Package org.apache.geronimo.kernel.repository

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


            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);
        }

        AbstractName clientBaseName = earContext.getNaming().createRootName(clientEnvironment.getConfigId(), clientEnvironment.getConfigId().toString(), NameFactory.J2EE_APPLICATION);
        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


        } catch (XmlException e) {
            throw new DeploymentException(e);
        }

        EnvironmentType environmentType = gerConnector.getEnvironment();
        Environment environment = EnvironmentBuilder.buildEnvironment(environmentType, defaultEnvironment);
        if (earEnvironment != null) {
            EnvironmentBuilder.mergeEnvironments(earEnvironment, environment);
            environment = earEnvironment;
            if(!environment.getConfigId().isResolved()) {
                throw new IllegalStateException("Connector module ID should be fully resolved (not "+environment.getConfigId()+")");
            }
        } else {
            idBuilder.resolve(environment, new File(moduleFile.getName()).getName(), "rar");
        }

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

        boolean standAlone = earEnvironment == null;
View Full Code Here

public class EnvironmentBuilder extends PropertyEditorSupport implements XmlAttributeBuilder {
    private final static QName QNAME = EnvironmentDocument.type.getDocumentElementName();
    private final static String NAMESPACE = QNAME.getNamespaceURI();

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

            if (environmentType.isSetDependencies()) {
                DependencyType[] dependencyArray = environmentType.getDependencies().getDependencyArray();
                LinkedHashSet dependencies = toDependencies(dependencyArray);
                environment.setDependencies(dependencies);
            }
            environment.setInverseClassLoading(environmentType.isSetInverseClassloading());
            environment.setSuppressDefaultEnvironment(environmentType.isSetSuppressDefaultEnvironment());
            environment.setHiddenClasses(toFilters(environmentType.getHiddenClasses()));
            environment.setNonOverrideableClasses(toFilters(environmentType.getNonOverridableClasses()));
        }

        return environment;
    }
View Full Code Here

            environment.addNonOverrideableClasses(additionalEnvironment.getNonOverrideableClasses());
        }
    }

    public static Environment buildEnvironment(EnvironmentType environmentType, Environment defaultEnvironment) {
        Environment environment = buildEnvironment(environmentType);
        if (!environment.isSuppressDefaultEnvironment()) {
            mergeEnvironments(environment, defaultEnvironment);
        }
        return environment;
    }
View Full Code Here

        return buildEnvironment(environmentType);
    }

    public String getAsText() {
        Environment environment = (Environment) getValue();
        EnvironmentType environmentType = buildEnvironmentType(environment);
        XmlOptions xmlOptions = new XmlOptions();
        xmlOptions.setSaveSyntheticDocumentElement(QNAME);
        xmlOptions.setSavePrettyPrint();
        return environmentType.xmlText(xmlOptions);
View Full Code Here

    public void setAsText(String text) {
        try {
            EnvironmentDocument environmentDocument = EnvironmentDocument.Factory.parse(text);
            EnvironmentType environmentType = environmentDocument.getEnvironment();
            Environment environment = (Environment) getValue(environmentType, null, null);
            setValue(environment);

        } catch (XmlException e) {
            throw new PropertyEditorException(e);
        } catch (DeploymentException e) {
View Full Code Here

  public void testWriteReadInPlaceLocation() throws Exception {
    ConfigurationData configurationData = new ConfigurationData(null,
        null,
        Collections.EMPTY_LIST,
        Collections.EMPTY_MAP,
        new Environment(new Artifact("groupId", "artifactId", "version", "type")),
        configDir,
        inPlaceConfig,
        new Jsr77Naming());
   
        inPlaceConfUtil.writeInPlaceLocation(configurationData, configDir);
View Full Code Here

       
        ConfigurationData configurationData = new ConfigurationData(null,
                null,
                Collections.EMPTY_LIST,
                Collections.EMPTY_MAP,
                new Environment(new Artifact("groupId", "artifactId", "version", "type")),
                configDir,
                inPlaceConfig,
                new Jsr77Naming());
       
        inPlaceConfUtil.writeInPlaceLocation(configurationData, configDir);
View Full Code Here

        configurationManager = ConfigurationUtil.getEditableConfigurationManager(kernel);
//        configurationManager.getConfiguration(bootstrap.getId());
        ConfigurationStore configStore = (ConfigurationStore) kernel.getGBean(configStoreName);
        configStore.install(bootstrap);

        defaultEnvironment = new Environment();
        defaultEnvironment.addDependency(bootstrap.getId(), ImportType.ALL);

    }
View Full Code Here

    }

    public Artifact getConfigurationID(Object plan, JarFile module, ModuleIDBuilder idBuilder) throws IOException, DeploymentException {
        ModuleType configType = (ModuleType) plan;
        EnvironmentType environmentType = configType.getEnvironment();
        Environment environment = EnvironmentBuilder.buildEnvironment(environmentType, defaultEnvironment);
        idBuilder.resolve(environment, module == null ? "" : new File(module.getName()).getName(), "car");
        if(!environment.getConfigId().isResolved()) {
            throw new IllegalStateException("Service Module ID is not fully populated ("+environment.getConfigId()+")");
        }
        return environment.getConfigId();
    }
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.