Package org.apache.geronimo.kernel.repository

Examples of org.apache.geronimo.kernel.repository.Environment


            geronimoEjbJarType = XmlUtil.createDefaultPlan(path, ejbModule.getEjbJar());
            ejbModule.getAltDDs().put("geronimo-openejb.xml", geronimoEjbJarType);
        }

        // create the geronimo environment object
        Environment environment = XmlUtil.buildEnvironment(geronimoEjbJarType.getEnvironment(), defaultEnvironment);
        if (earEnvironment != null) {
            EnvironmentBuilder.mergeEnvironments(earEnvironment, environment);
            environment = earEnvironment;
            if (!environment.getConfigId().isResolved()) {
                throw new IllegalStateException("EJB module ID should be fully resolved (not " + environment.getConfigId() + ")");
            }
        } else {
            idBuilder.resolve(environment, new File(moduleFile.getName()).getName(), "jar");
        }


        AbstractName moduleName;
        if (earName == null) {
            earName = naming.createRootName(environment.getConfigId(), NameFactory.NULL, NameFactory.J2EE_APPLICATION);
            moduleName = naming.createChildName(earName, environment.getConfigId().toString(), NameFactory.EJB_MODULE);
            ejbModule.setModuleId(environment.getConfigId().getArtifactId());
        } else {
            moduleName = naming.createChildName(earName, targetPath, NameFactory.EJB_MODULE);
            ejbModule.setModuleId(targetPath);
        }
View Full Code Here


        installModule(module, earContext);
        EARContext moduleContext;
        if (module.isStandAlone()) {
            moduleContext = earContext;
        } else {
            Environment environment = earContext.getConfiguration().getEnvironment();
            File configurationDir = new File(earContext.getBaseDir(), module.getTargetPath());
//            configurationDir.mkdirs();

            // construct the ejb app deployment context... this is the same class used by the ear context
            try {
View Full Code Here

        }

        contextRoot = contextRoot.trim();

        EnvironmentType environmentType = tomcatWebApp.getEnvironment();
        Environment environment = EnvironmentBuilder.buildEnvironment(environmentType, defaultEnvironment);

        // Note: logic elsewhere depends on the default artifact ID being the file name less extension (ConfigIDExtractor)
        String warName = "";
        File temp = new File(moduleFile.getName());
        if (temp.isFile()) {
            warName = temp.getName();
            if (warName.lastIndexOf('.') > -1) {
                warName = warName.substring(0, warName.lastIndexOf('.'));
            }
        } else {
            try {
                warName = temp.getCanonicalFile().getName();
                if (warName.equals("")) {
                    // Root directory
                    warName = "$root-dir$";
                }
            } catch (IOException e) {
            }
        }
        idBuilder.resolve(environment, warName, "war");

        AbstractName moduleName;
        if (earName == null) {
            earName = naming.createRootName(environment.getConfigId(), NameFactory.NULL, NameFactory.J2EE_APPLICATION);
            moduleName = naming.createChildName(earName, environment.getConfigId().toString(), NameFactory.WEB_MODULE);
        } else {
            moduleName = naming.createChildName(earName, targetPath, NameFactory.WEB_MODULE);
        }

        // Create the AnnotatedApp interface for the WebModule
View Full Code Here

            throw new DeploymentException("Error parsing geronimo-openejb.xml", e);
        }
    }

    public static Environment buildEnvironment(EnvironmentType environmentType, Environment defaultEnvironment) {
        Environment environment = new Environment();
        if (environmentType != null) {
            if (environmentType.getModuleId() != null) {
                environment.setConfigId(toArtifact(environmentType.getModuleId(), null));
            }

            if (environmentType.getDependencies() != null) {
                for (DependencyType dependencyType : environmentType.getDependencies().getDependency()) {
                    Dependency dependency = toDependency(dependencyType);
                    environment.addDependency(dependency);
                }
            }
            environment.setInverseClassLoading(environmentType.isInverseClassloading());
            environment.setSuppressDefaultEnvironment(environmentType.isSuppressDefaultEnvironment());
            if (environmentType.getHiddenClasses() != null) {
                environment.setHiddenClasses(environmentType.getHiddenClasses().getFilter());
            }
            if (environmentType.getNonOverridableClasses() != null) {
                environment.setNonOverrideableClasses(environmentType.getNonOverridableClasses().getFilter());
            }
        }
        if (!environment.isSuppressDefaultEnvironment()) {
            EnvironmentBuilder.mergeEnvironments(environment, defaultEnvironment);
        }

        return environment;
    }
View Full Code Here

        // parse vendor dd
        GerApplicationClientType gerAppClient = getGeronimoAppClient(plan, moduleFile, standAlone, targetPath, appClient, earEnvironment);


        EnvironmentType clientEnvironmentType = gerAppClient.getClientEnvironment();
        Environment clientEnvironment = EnvironmentBuilder.buildEnvironment(clientEnvironmentType, defaultClientEnvironment);
        if (standAlone) {
            String name = new File(moduleFile.getName()).getName();
            idBuilder.resolve(clientEnvironment, name + "_" + name, "jar");
        } else {
            Artifact earConfigId = earEnvironment.getConfigId();
            idBuilder.resolve(clientEnvironment, earConfigId.getArtifactId() + "_" + targetPath, "jar");
        }
        EnvironmentType serverEnvironmentType = gerAppClient.getServerEnvironment();
        Environment serverEnvironment = EnvironmentBuilder.buildEnvironment(serverEnvironmentType, defaultServerEnvironment);
        if (!standAlone) {
            EnvironmentBuilder.mergeEnvironments(earEnvironment, serverEnvironment);
            serverEnvironment = earEnvironment;
            if (!serverEnvironment.getConfigId().isResolved()) {
                throw new IllegalStateException("Server environment module ID should be fully resolved (not " + serverEnvironment.getConfigId() + ")");
            }
        } else {
            idBuilder.resolve(serverEnvironment, new File(moduleFile.getName()).getName(), "jar");
        }

        if (earName == null) {
            earName = naming.createRootName(serverEnvironment.getConfigId(), NameFactory.NULL, NameFactory.J2EE_APPLICATION);
        }

        //always use the artifactId of the app client as the name component of the module name (on the server).
        AbstractName  moduleName = naming.createChildName(earName, clientEnvironment.getConfigId().toString(), NameFactory.APP_CLIENT_MODULE);
        AbstractName clientBaseName = naming.createRootName(clientEnvironment.getConfigId(), clientEnvironment.getConfigId().toString(), NameFactory.J2EE_APPLICATION);
View Full Code Here

            throw new DeploymentException("Unable to copy app client module jar into configuration: " + moduleFile.getName());
        }
        AppClientModule appClientModule = (AppClientModule) module;
        appClientModule.setEarFile(earFile);
        //create the ear context for the app client.
        Environment clientEnvironment = appClientModule.getClientEnvironment();
//        if (!appClientModule.isStandAlone() || clientEnvironment.getConfigId() == null) {
//            Artifact earConfigId = earContext.getConfigID();
//            Artifact configId = new Artifact(earConfigId.getGroupId(), earConfigId.getArtifactId() + "_" + module.getTargetPath(), earConfigId.getVersion(), "car");
//            clientEnvironment.setConfigId(configId);
//        }

        File appClientDir;
        try {
            appClientDir = targetConfigurationStore.createNewConfigurationDir(clientEnvironment.getConfigId());
        } catch (ConfigurationAlreadyExistsException e) {
            throw new DeploymentException(e);
        }

        // construct the app client deployment context... this is the same class used by the ear context
View Full Code Here

        }
        return jaxrpcBuilder;
    }

    private void mergeEnvironment(Environment environment, ServiceRefBuilder builder) {
        Environment env = builder.getEnvironment();
        if (env != null) {
            EnvironmentBuilder.mergeEnvironments(environment, env);
        }
    }
View Full Code Here

    public void installModule(JarFile earFile, EARContext earContext, Module module, Collection configurationStores, ConfigurationStore targetConfigurationStore, Collection repositories) throws DeploymentException {
        EARContext moduleContext;
        if (module.isStandAlone()) {
            moduleContext = earContext;
        } else {
            Environment environment = module.getEnvironment();
            Artifact earConfigId = earContext.getConfigID();
            Artifact configId = new Artifact(earConfigId.getGroupId(), earConfigId.getArtifactId() + "_" + module.getTargetPath(), earConfigId.getVersion(), "car");
            environment.setConfigId(configId);
            environment.addDependency(earConfigId, ImportType.ALL);
            File configurationDir = new File(earContext.getBaseDir(), module.getTargetPath());
            configurationDir.mkdirs();

            // construct the web app deployment context... this is the same class used by the ear context
            try {
View Full Code Here

    public void installModule(JarFile earFile, EARContext earContext, Module module, Collection configurationStores, ConfigurationStore targetConfigurationStore, Collection repositories) throws DeploymentException {
        EARContext moduleContext;
        if (module.isStandAlone()) {
            moduleContext = earContext;
        } else {
            Environment environment = module.getEnvironment();
            Artifact earConfigId = earContext.getConfigID();
            Artifact configId = new Artifact(earConfigId.getGroupId(), earConfigId.getArtifactId() + "_" + module.getTargetPath(), earConfigId.getVersion(), "car");
            environment.setConfigId(configId);
            environment.addDependency(earConfigId, ImportType.ALL);
            File configurationDir = new File(earContext.getBaseDir(), module.getTargetPath());
            configurationDir.mkdirs();

            // construct the web app deployment context... this is the same class used by the ear context
            try {
View Full Code Here

            configurationDir = targetConfigurationStore.createNewConfigurationDir(configId);
        } catch (ConfigurationAlreadyExistsException e) {
            throw new DeploymentException(e);
        }

        Environment environment = new Environment();
        environment.setConfigId(configId);
        EnvironmentBuilder.mergeEnvironments(environment, defaultEnvironment);

        DeploymentPlanWrapper wrapper = (DeploymentPlanWrapper) plan;
        if (wrapper.getGeronimoPlan() != null) {
                 
          if (wrapper.getGeronimoPlan().getJbi() != null) {
            EnvironmentType environmentType = wrapper.getGeronimoPlan().getJbi().getEnvironment();
            if (environmentType != null) {
              log.debug("Environment found in Geronimo Plan for Servicemix " + environmentType);
              Environment geronimoPlanEnvironment = EnvironmentBuilder.buildEnvironment(environmentType);
              EnvironmentBuilder.mergeEnvironments(environment, geronimoPlanEnvironment);
            } else {
              log.debug("no additional environment entry found in deployment plan for JBI component");
            }
          }
View Full Code Here

TOP

Related Classes of org.apache.geronimo.kernel.repository.Environment

Copyright © 2018 www.massapicom. 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.