Examples of EditableConfigurationManager


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

        AbstractNameQuery query = new AbstractNameQuery(ServerInfo.class.getName());
        Set set = kernel.listGBeans(query);
        AbstractName serverInfo = (AbstractName)set.iterator().next();
        gbeanData.setReferencePattern("ServerInfo", serverInfo);

        EditableConfigurationManager mgr = ConfigurationUtil.getEditableConfigurationManager(kernel);
        if (mgr != null) {
            try {
                mgr.addGBeanToConfiguration(containerName.getArtifact(), gbeanData, false);
            } catch (InvalidConfigException e) {
                log.error("Unable to add GBean", e);
                return null;
            } finally {
                ConfigurationUtil.releaseConfigurationManager(kernel, mgr);
View Full Code Here

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

        } catch (URISyntaxException e) {
            throw new IllegalStateException("Can't resolve keystore path: "+e.getMessage(), e);
        }
        data.setReferencePattern("ServerInfo", kernel.getAbstractNameFor(serverInfo));
        data.setAttribute("keystoreName", name);
        EditableConfigurationManager mgr = ConfigurationUtil.getEditableConfigurationManager(kernel);
        if(mgr != null) {
            try {
                mgr.addGBeanToConfiguration(myName.getArtifact(), data, true);
                return (KeystoreInstance) kernel.getProxyManager().createProxy(aName, KeystoreInstance.class);
            } catch (InvalidConfigException e) {
                log.error("Should never happen", e);
                throw new IllegalStateException("Unable to add Keystore GBean ("+e.getMessage()+")", e);
            } finally {
View Full Code Here

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

                }
            }
            if (!found) {
                throw new GBeanNotFoundException(connectorName);
            }
            EditableConfigurationManager mgr = ConfigurationUtil.getEditableConfigurationManager(kernel);
            if (mgr != null) {
                try {
                    mgr.removeGBeanFromConfiguration(connectorName.getArtifact(), connectorName);
                } catch (InvalidConfigException e) {
                    log.error("Unable to add GBean", e);
                } finally {
                    ConfigurationUtil.releaseConfigurationManager(kernel, mgr);
                }
View Full Code Here

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

        if (connectorType.equals(HTTPS_NIO) || connectorType.equals(HTTPS_BIO)) {
            AbstractNameQuery query = new AbstractNameQuery(KeystoreManager.class.getName());
            gbeanData.setReferencePattern("KeystoreManager", query);
        }
       
        EditableConfigurationManager mgr = ConfigurationUtil.getEditableConfigurationManager(kernel);
        if (mgr != null) {
            try {
                mgr.addGBeanToConfiguration(containerName.getArtifact(), gbeanData, false);
            } catch (InvalidConfigException e) {
                log.error("Unable to add GBean", e);
                return null;
            } finally {
                ConfigurationUtil.releaseConfigurationManager(kernel, mgr);
View Full Code Here

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

     * @param configID  The configuration to add the GBean to.
     * @param gbean     The data representing the GBean to add.
     * @param start     If true, the GBean should be started as part of this call.
     */
    public void addGBeanToConfiguration(Artifact configID, GBeanData gbean, boolean start) {
        EditableConfigurationManager mgr = ConfigurationUtil.getEditableConfigurationManager(kernel);
        try {
            mgr.addGBeanToConfiguration(configID, gbean, start);
        } catch (InvalidConfigException e) {
            throw new RuntimeException("Bad configID. configID = "+configID, e);
        } finally {
            ConfigurationUtil.releaseConfigurationManager(kernel, mgr);
        }
View Full Code Here

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

                }
            }
            if (!found) {
                throw new GBeanNotFoundException(connectorName);
            }
            EditableConfigurationManager mgr = ConfigurationUtil.getEditableConfigurationManager(kernel);
            if(mgr != null) {
                try {
                    mgr.removeGBeanFromConfiguration(connectorName.getArtifact(), connectorName);
                } catch (InvalidConfigException e) {
                    log.error("Unable to add GBean", e);
                } finally {
                    ConfigurationUtil.releaseConfigurationManager(kernel, mgr);
                }
View Full Code Here

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

        AbstractNameQuery query = new AbstractNameQuery(ServerInfo.class.getName());
        Set set = kernel.listGBeans(query);
        AbstractName serverInfo = (AbstractName)set.iterator().next();
        gbeanData.setReferencePattern("ServerInfo", serverInfo);

        EditableConfigurationManager mgr = ConfigurationUtil.getEditableConfigurationManager(kernel);
        if (mgr != null) {
            try {
                mgr.addGBeanToConfiguration(containerName.getArtifact(), gbeanData, false);
            } catch (InvalidConfigException e) {
                log.error("Unable to add GBean", e);
                return null;
            } finally {
                ConfigurationUtil.releaseConfigurationManager(kernel, mgr);
View Full Code Here

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

        //todo: if SSL is supported, need to add more properties or use a different GBean?
        connector.setAttribute("protocol", protocol);
        connector.setAttribute("host", host);
        connector.setAttribute("port", new Integer(port));
        connector.setReferencePattern("brokerService", brokerAbstractName);
        EditableConfigurationManager mgr = ConfigurationUtil.getEditableConfigurationManager(kernel);
        if(mgr != null) {
            try {
                mgr.addGBeanToConfiguration(brokerAbstractName.getArtifact(), connector, false);
                return (JMSConnector) kernel.getProxyManager().createProxy(name, ActiveMQConnector.class.getClassLoader());
            } catch (InvalidConfigException e) {
                log.error("Unable to add GBean", e);
                return null;
            } finally {
View Full Code Here

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

                }
            }
            if (!found) {
                throw new GBeanNotFoundException(connectorName);
            }
            EditableConfigurationManager mgr = ConfigurationUtil.getEditableConfigurationManager(kernel);
            if (mgr != null) {
                try {
                    mgr.removeGBeanFromConfiguration(connectorName.getArtifact(), connectorName);
                } catch (InvalidConfigException e) {
                    log.error("Unable to add GBean", e);
                } finally {
                    ConfigurationUtil.releaseConfigurationManager(kernel, mgr);
                }
View Full Code Here

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

        configurationManagerData.setReferencePattern("ArtifactManager", artifactManagerData.getAbstractName());
        configurationManagerData.setReferencePattern("ArtifactResolver", artifactResolverData.getAbstractName());

        ConfigurationUtil.loadBootstrapConfiguration(kernel, bootstrap, getClass().getClassLoader());

        EditableConfigurationManager configurationManager = ConfigurationUtil.getEditableConfigurationManager(kernel);

        ConfigurationData configurationData = new ConfigurationData(new Artifact("test", "test", "", "car"), kernel.getNaming());
        configurationData.addGBean("GlobalContext", GlobalContextGBean.GBEAN_INFO);

        contextEnv = new Hashtable();
        contextEnv.put(Context.INITIAL_CONTEXT_FACTORY, GlobalContextManager.class.getName());

        // dataSources
        GBeanData ds1GBean = configurationData.addGBean("ds1", MockDataSource.GBEAN_INFO);
        ds1Name = ds1GBean.getAbstractName();

        GBeanData ds2GBean = configurationData.addGBean("ds2", MockDataSource.GBEAN_INFO);
        ds2Name = ds2GBean.getAbstractName();

        // bindings
        GBeanData writableGBean = configurationData.addGBean("writable", WritableContextGBean.GBEAN_INFO);
        AbstractName writableName = writableGBean.getAbstractName();
        writableGBean.setAttribute("nameInNamespace", "writable");

        GBeanData dsBinding = configurationData.addGBean("dsBinding", GBeanBinding.GBEAN_INFO);
        dsBinding.setReferencePattern("Context", writableName);
        dsBinding.setAttribute("name", "ds");
        dsBinding.setAttribute("abstractNameQuery", new AbstractNameQuery(null, Collections.EMPTY_MAP, DataSource.class.getName()));

        GBeanData ds1Binding = configurationData.addGBean("ds1Binding", GBeanBinding.GBEAN_INFO);
        ds1Binding.setReferencePattern("Context", writableName);
        ds1Binding.setAttribute("name", "ds1");
        ds1Binding.setAttribute("abstractNameQuery", new AbstractNameQuery(null,
                Collections.singletonMap("name", "ds1"),
                DataSource.class.getName()));

        GBeanData ds2Binding = configurationData.addGBean("ds2Binding", GBeanBinding.GBEAN_INFO);
        ds2Binding.setReferencePattern("Context", writableName);
        ds2Binding.setAttribute("name", "ds2");
        ds2Binding.setAttribute("abstractNameQuery", new AbstractNameQuery(null,
                Collections.singletonMap("name", "ds2"),
                DataSource.class.getName()));

        configurationManager.loadConfiguration(configurationData);
        configurationManager.startConfiguration(configurationData.getId());

        DataSource ds1 = (DataSource) kernel.getGBean(ds1Name);
        DataSource ds2 = (DataSource) kernel.getGBean(ds2Name);

        // global bindings
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.