Package org.apache.geronimo.kernel.config

Examples of org.apache.geronimo.kernel.config.Configuration


                } else if (info.getType().getValue() == ConfigurationModuleType.EAR.getValue()) {
                    try {
                        AbstractName configObjName = Configuration.getConfigurationAbstractName(info.getConfigID());
                        boolean loaded = loadModule(configManager, configObjName);

                        Configuration config = configManager.getConfiguration(info.getConfigID());
                        if(config != null){
                            for (Configuration child : config.getChildren()) {
                                if (child.getModuleType().getValue() == ConfigurationModuleType.WAR.getValue()) {
                                    ModuleDetails childDetails = new ModuleDetails(info.getConfigID(), child.getModuleType(), info.getState());
                                    childDetails.setComponentName(child.getId().toString());
                                    WebModule webModule = getWebModule(config, child);
                                    if (webModule != null) {
                                        childDetails.getContextPaths().add(webModule.getContextPath());
                                    }
                                    if (showDependencies) {
                                        addDependencies(childDetails, configObjName);
                                    }
                                    moduleDetails.add(childDetails);
                                }
                            }
                        }

                        if (loaded) {
                            unloadModule(configManager, configObjName);
                        }
                    } catch (InvalidConfigException ice) {
                        // Should not occur
                        ice.printStackTrace();
                    }
                }

            } else if (shouldListConfig(info.getType())) {
                ModuleDetails details = new ModuleDetails(info.getConfigID(), info.getType(), info.getState());
                try {
                    AbstractName configObjName = Configuration.getConfigurationAbstractName(info.getConfigID());
                    boolean loaded = loadModule(configManager, configObjName);

                    if (info.getType().getValue() == ConfigurationModuleType.EAR.getValue()) {
                        Configuration config = configManager.getConfiguration(info.getConfigID());
                        if(config != null){
                            Iterator childs = config.getChildren().iterator();
                            while (childs.hasNext()) {
                                Configuration child = (Configuration) childs.next();
                                if (child.getModuleType().getValue() == ConfigurationModuleType.WAR.getValue()) {
                                    WebModule webModule = getWebModule(config, child);
                                    if (webModule != null) {
                                        details.getContextPaths().add(webModule.getContextPath());
                                    }
                                }
View Full Code Here


    public boolean isConfiguration(Artifact artifact) {
        return configurationManager.isConfiguration(artifact) || super.isConfiguration(artifact);
    }

    public synchronized Configuration getConfiguration(Artifact configurationId) {
        Configuration configuration = configurationManager.getConfiguration(configurationId);
        if (configuration == null) {
            configuration = super.getConfiguration(configurationId);
        }
        return configuration;
    }
View Full Code Here

    }

    protected void addNewConfigurationToModel(Configuration configuration) throws NoSuchConfigException {
        LinkedHashSet loadParents = getLoadParents(configuration);
        for (Iterator iterator = loadParents.iterator(); iterator.hasNext();) {
            Configuration loadParent= (Configuration) iterator.next();
            if (!configurationModel.containsConfiguration(loadParent.getId())) {
                configurationModel.addConfiguation(loadParent.getId(), Collections.EMPTY_SET, Collections.EMPTY_SET);
                configurationModel.load(loadParent.getId());
            }
        }
        LinkedHashSet startParents = getStartParents(configuration);
        for (Iterator iterator = startParents.iterator(); iterator.hasNext();) {
            Configuration startParent = (Configuration) iterator.next();
            if (!configurationModel.containsConfiguration(startParent.getId())) {
                configurationModel.addConfiguation(startParent.getId(), Collections.EMPTY_SET, Collections.EMPTY_SET);
                configurationModel.load(startParent.getId());
            }
        }
        super.addNewConfigurationToModel(configuration);
    }
View Full Code Here

    ComponentContextBuilder builder = new ComponentContextBuilder();

    protected void setUp() throws Exception {
        super.setUp();
        Artifact id = new Artifact("test", "test", "", "car");
        configuration = new Configuration(Collections.EMPTY_LIST,
                new ConfigurationData(id, naming),
                new ConfigurationResolver(id, null),
                null);
        baseName = naming.createRootName(configuration.getId(), "testRoot", NameFactory.RESOURCE_ADAPTER_MODULE);
    }
View Full Code Here

    }

    public long getDeploymentTime(File file, String configId) {
        try {
            Artifact art = configManager.getArtifactResolver().resolveInClassLoader(Artifact.create(configId));
            Configuration config = configManager.getConfiguration(art);
            return config.getCreated();
        } catch (MissingDependencyException e) {
            log.error("Unknown configuration "+configId);
            return -1;
        }
    }
View Full Code Here

                                            GerServiceRefType[] gerServiceRefs,
                                            GerGbeanRefType[] gerGbeanRefs,
                                            ClassLoader cl) throws DeploymentException {
        ComponentContextBuilder builder = new ComponentContextBuilder();
        RefContext refContext = earContext.getRefContext();
        Configuration earConfiguration = earContext.getConfiguration();

        if (userTransaction != null) {
            builder.addUserTransaction(userTransaction);
        }

        AbstractNameQuery corbaGBean = earContext.getCORBAGBeanObjectName();
        if (corbaGBean != null) {
            builder.addORB(earConfiguration.getId(), corbaGBean);
            builder.addHandleDelegateReference(earConfiguration.getId(), corbaGBean);
        }

        URI moduleURI = module.getModuleURI();

        addEnvEntries(envEntries, builder, cl);
View Full Code Here

            AbstractNameQuery abstractNameQuery = buildAbstractNameQuery(patternType, null, null, interfaceTypes);
            queries.add(abstractNameQuery);
        }

        GBeanData gBeanData;
        Configuration configuration = earContext.getConfiguration();
        try {
            gBeanData = configuration.findGBeanData(queries);
        } catch (GBeanNotFoundException e) {
            throw new DeploymentException("Could not resolve reference at deploy time for queries " + queries, e);
        }

        if (interfaceTypes.isEmpty()) {
            interfaceTypes.add(gBeanData.getGBeanInfo().getClassName());
        }
        Class gBeanType;
        try {
            gBeanType = ClassLoading.loadClass(gBeanData.getGBeanInfo().getClassName(), cl);
        } catch (ClassNotFoundException e) {
            throw new DeploymentException("Cannot load GBean class", e);
        }

        String refName = gerGbeanRef.getRefName();

        builder.bind(refName, new GBeanReference(configuration.getId(), queries, gBeanType));
    }
View Full Code Here

            throw new UnsupportedOperationException();
        }

        public Configuration getConfiguration(Artifact configurationId) {
            try {
                return new Configuration(Collections.EMPTY_SET, loadedConfigurationData, new ConfigurationResolver(configurationId, dir), null);
            } catch (Exception e) {
                throw new RuntimeException(e);
            }
        }
View Full Code Here

            Artifact configurationId = configurationData.getId();

            // load the configuration
            configurationManager.loadConfiguration(configurationData);
            Configuration configuration = configurationManager.getConfiguration(configurationId);
            configurationManager.startConfiguration(configurationId);
            Set gb = configuration.getGBeans().keySet();
            for (Iterator iterator = gb.iterator(); iterator.hasNext();) {
                AbstractName name = (AbstractName) iterator.next();
                if (State.RUNNING_INDEX != kernel.getGBeanState(name)) {
                    System.out.println("Not running: " + name);
                }
View Full Code Here

        earContext.close();
        module.close();

        Artifact configurationId = configurationData.getId();
        configurationManager.loadConfiguration(configurationData);
        Configuration configuration = configurationManager.getConfiguration(configurationId);
        configurationManager.startConfiguration(configurationId);

        assertEquals(State.RUNNING_INDEX, kernel.getGBeanState(moduleName));
        Set names = configuration.findGBeans(new AbstractNameQuery(moduleName.getArtifact(), Collections.EMPTY_MAP));
        System.out.println("names: " + names);
        for (Iterator iterator = names.iterator(); iterator.hasNext();) {
            AbstractName objectName = (AbstractName) iterator.next();
            assertEquals(State.RUNNING_INDEX, kernel.getGBeanState(objectName));
        }
View Full Code Here

TOP

Related Classes of org.apache.geronimo.kernel.config.Configuration

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.