Examples of ApplicationManager


Examples of org.wso2.carbon.application.deployer.internal.ApplicationManager

                return;
            }

            Collection allApps = (Collection) configRegistry.get(AppDeployerConstants.APPLICATIONS);
            String[] appPaths = allApps.getChildren();
            ApplicationManager appManager = ApplicationManager.getInstance();
            String tenantId = AppDeployerUtils.getTenantIdString(axisConfig);

            for (String currentAppPath : appPaths) {
                CarbonApplication carbonApp = new CarbonApplication();

                //get application collection
                Collection currentAppCollection = (Collection) configRegistry.get(currentAppPath);
                carbonApp.setAppName(currentAppCollection.getProperty(AppDeployerConstants.NAME));
                carbonApp.setAppFilePath(currentAppCollection.
                        getProperty(AppDeployerConstants.APP_FILE_PATH));

                //read the artifacts.xml and construct the ApplicationConfiguration
                String artifactsXmlPath = currentAppPath + AppDeployerConstants.APP_ARTIFACTS_XML;
                if (configRegistry.resourceExists(artifactsXmlPath)) {
                    Resource artifactXmlResource = configRegistry.get(artifactsXmlPath);
                    InputStream artifactsXmlStream = artifactXmlResource.getContentStream();
                    if (artifactsXmlStream != null) {
                        ApplicationConfiguration appConfig =
                                new ApplicationConfiguration(this, artifactsXmlStream);
                        carbonApp.setAppConfig(appConfig);
                    }
                }

                String dependencyPath = currentAppPath + AppDeployerConstants.APP_DEPENDENCIES;
                // list to keep all artifacts
                List<Artifact> allArtifacts = new ArrayList<Artifact>();
                if (configRegistry.resourceExists(dependencyPath)) {
                    Collection dependencies = (Collection) configRegistry.get(dependencyPath);

                    for (String depPath : dependencies.getChildren()) {
                        Resource artifactResource = configRegistry.get(depPath +
                                AppDeployerConstants.ARTIFACT_XML);
                        InputStream xmlStream = artifactResource.getContentStream();
                        Artifact artifact = null;
                        if (xmlStream != null) {
                            artifact = appManager.buildAppArtifact(carbonApp, xmlStream);
                        }
                        if (artifact != null) {
                            Collection artCollection = (Collection) configRegistry.get(depPath);
                            artifact.setRuntimeObjectName(artCollection
                                    .getProperty(AppDeployerConstants.RUNTIME_OBJECT_NAME));
                            allArtifacts.add(artifact);
                        }
                    }
                }
                Artifact appArtifact = carbonApp.getAppConfig().getApplicationArtifact();
                appManager.buildDependencyTree(appArtifact, allArtifacts);
                appManager.addCarbonApp(tenantId, carbonApp);
            }
        } catch (RegistryException e) {
            String msg = "Unable to load Applications. Registry transactions failed.";
            log.error(msg, e);
            throw new Exception(msg, e);
View Full Code Here

Examples of org.wso2.carbon.application.deployer.internal.ApplicationManager

                                                String runtimeObjectName,
                                                int tenantId) {
        if (fileName == null || artifactType == null || tenantId == -1) {
            return;
        }
        ApplicationManager appManager = ApplicationManager.getInstance();
        Artifact appArtifact;
        for (CarbonApplication carbonApp : appManager.getCarbonApps(String.valueOf(tenantId))) {
            appArtifact = carbonApp.getAppConfig().getApplicationArtifact();
            for (Artifact.Dependency dep : appArtifact.getDependencies()) {
                if (dep.getArtifact() != null) {
                    Artifact depArtifact = dep.getArtifact();
                    for (CappFile file : depArtifact.getFiles()) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.