Class ApplicationManager

  • All Implemented Interfaces:
    ApplicationManagerService

    public final class ApplicationManager
    extends Object
    implements ApplicationManagerService
    Manages all cApp deployment aspects. Carbon App deployment is done in two steps. A cApp is basically a p2 repo which contains artifacts as features. Step 1 : Find out the artifacts to be installed in this server and install their features through p2 Step 2 : After needed features are installed, complete the cApp deployment by sending the cApp through a chain of handlers This handler chain can contain different cApp artifact deployers. Those can be registered or unregistered using this ApplicationManager API.
    • Method Detail

      • init

        public void init()
      • getInstance

        public static ApplicationManager getInstance()
        ApplicationManager is singleton. This can be used to access the instance.
        Returns:
        - ApplicationManager instance
      • deployCarbonApp

        public void deployCarbonApp​(String archPath,
                                    org.apache.axis2.engine.AxisConfiguration axisConfig)
                             throws Exception
        Deploy a single app by iterating all handlers and sending apps through the handler chain..
        Specified by:
        deployCarbonApp in interface ApplicationManagerService
        Parameters:
        archPath - - carbon app archive path
        axisConfig - - AxisConfiguration of the current tenant
        Throws:
        Exception - - error on registry actions
      • buildAppArtifact

        public Artifact buildAppArtifact​(CarbonApplication parentApp,
                                         InputStream artifactXmlStream)
                                  throws org.wso2.carbon.CarbonException
        Builds the artifact from the given input steam and adds it as a dependency in the provided parent carbon application.
        Parameters:
        parentApp - - parent application
        artifactXmlStream - - xml input stream of the artifact.xml
        Returns:
        - Artifact instance if successfull. otherwise null..
        Throws:
        org.wso2.carbon.CarbonException - - error while building
      • undeployCarbonApp

        public void undeployCarbonApp​(CarbonApplication carbonApp,
                                      org.apache.axis2.engine.AxisConfiguration axisConfig)
        Undeploy the provided carbon App by sending it through the registered undeployment handler chain..
        Specified by:
        undeployCarbonApp in interface ApplicationManagerService
        Parameters:
        carbonApp - - CarbonApplication instance
        axisConfig - - AxisConfiguration of the current tenant
      • getFaultyCarbonApps

        public HashMap<String,​Exception> getFaultyCarbonApps​(String tenantId)
        Get the list of faulty CarbonApplications for the give tenant id. If the list is null, return an empty Arraylist
        Specified by:
        getFaultyCarbonApps in interface ApplicationManagerService
        Parameters:
        tenantId - - tenant id to find faulty cApps
        Returns:
        - list of tenant faulty cApps
      • addFaultyCarbonApp

        public void addFaultyCarbonApp​(String tenantId,
                                       String carbonApp,
                                       Exception error)
        Add a new faulty cApp for a particular tenant. If there are no faulty cApps currently, create a new ArrayList and add the new cApp.
        Parameters:
        tenantId -
        carbonApp -
      • removeFaultyCarbonApp

        public void removeFaultyCarbonApp​(String tenantId,
                                          String appFilePath)
        Remove a faulty cApp for a particular tenant
        Parameters:
        tenantId -
        appFilePath -
      • addCarbonApp

        public void addCarbonApp​(String tenantId,
                                 CarbonApplication carbonApp)
        Add a new cApp for a particular tenant. If there are no cApps currently, create a new ArrayList and add the new cApp.
        Parameters:
        tenantId - - tenant id of the cApp
        carbonApp - - CarbonApplication instance
      • removeCarbonApp

        public void removeCarbonApp​(String tenantId,
                                    CarbonApplication carbonApp)
        Remove a cApp for a particular tenant
        Parameters:
        tenantId - - tenant id of the cApp
        carbonApp - - CarbonApplication instance
      • buildDependencyTree

        public void buildDependencyTree​(Artifact rootArtifact,
                                        List<Artifact> allArtifacts)
        If the given artifact is a dependent artifact for the rootArtifact, include it as the actual dependency. The existing one is a dummy one. So remove it. Do this recursively for the dependent artifacts as well..
        Parameters:
        rootArtifact - - root to start search
        allArtifacts - - all artifacts found under current cApp
      • getPersistenceManager

        public CarbonAppPersistenceManager getPersistenceManager​(org.apache.axis2.engine.AxisConfiguration axisConfig)
        Retuns the persistence manger for the given axis config (tenant). First try to find it in the PM map. If it is not there, create a new one.
        Parameters:
        axisConfig - - AxisConfiguration of the current tenant
        Returns:
        - CarbonAppPersistenceManager for the current tenant
      • cleanupCarbonApps

        public void cleanupCarbonApps​(org.apache.axis2.engine.AxisConfiguration axisConfig)