Package org.apache.geronimo.kernel.config

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


    public void execute() throws Exception {
        Kernel kernel = createKernel(repository);

        // start the Configuration we're going to use for this deployment
        ConfigurationManager configurationManager = ConfigurationUtil.getConfigurationManager(kernel);
        try {
            if (!configurationManager.isLoaded(deploymentConfig)) {
                List configs = configurationManager.loadRecursive(deploymentConfig);
                for (int i = 0; i < configs.size(); i++) {
                    ObjectName configName = (ObjectName) configs.get(i);
                    kernel.startRecursiveGBean(configName);
                }
            }
View Full Code Here


        kernel.loadGBean(configuration, this.getClass().getClassLoader());
        kernel.setAttribute(configName, "baseURL", systemURL);
        kernel.startRecursiveGBean(configName);

        // load the rest of the configuration listed on the command line
        ConfigurationManager configurationManager = ConfigurationUtil.getConfigurationManager(kernel);
        try {
            for (Iterator i = configList.iterator(); i.hasNext();) {
                URI configID = (URI) i.next();
                List list = configurationManager.loadRecursive(configID);
                for (Iterator iterator = list.iterator(); iterator.hasNext();) {
                    ObjectName name = (ObjectName) iterator.next();
                    kernel.startRecursiveGBean(name);
                    System.out.println("started gbean: " + name);
                }
View Full Code Here

    public void processAction(ActionRequest actionRequest,
            ActionResponse actionResponse) throws PortletException, IOException {
        String action = actionRequest.getParameter("action");
        actionResponse.setRenderParameter("message", ""); // set to blank first
        try {
            ConfigurationManager configurationManager = ConfigurationUtil
                    .getConfigurationManager(kernel);
            ObjectName configName = null;
            String config = getConfigID(actionRequest);
            if (configurationManager.isLoaded(URI.create(config)))
                configName = JMXUtil
                        .getObjectName(ObjectNameConstants.CONFIG_GBEAN_PREFIX
                                + "\"" + getConfigID(actionRequest) + "\"");
            else
                configName = configurationManager.load(URI.create(config));

            if (START_ACTION.equals(action)) {
                kernel.startRecursiveGBean(configName);
                //kernel.startConfiguration(getConfigID(actionRequest));
                messageStatus = "Started application<br /><br />";
View Full Code Here

     * @throws PortletException
     * @throws Exception
     */
    private void uninstallConfig(ActionRequest actionRequest)
            throws PortletException, Exception {
        ConfigurationManager configManager = ConfigurationUtil
                .getConfigurationManager(kernel);
        List configStores = configManager.listStores();
        int size = configStores.size();
        String configID = getConfigID(actionRequest);
        for (int i = 0; i < size; i++) {
            ObjectName configStore = (ObjectName) configStores.get(i);
            Boolean result = (Boolean) kernel.invoke(configStore,
                    CONTAINSCONFIG_METHOD,
                    new Object[] { URI.create(configID) }, CONTAINSCONFIG_SIG);
            if (result.booleanValue() == true) {
                // stop config if running
                if (configManager.isLoaded(URI.create(configID))) {
                    //int state = kernel.getConfigurationState(configID);
                    int state = kernel
                            .getGBeanState(JMXUtil
                                    .getObjectName(ObjectNameConstants.CONFIG_GBEAN_PREFIX
                                            + "\"" + configID + "\""));
View Full Code Here

        if (WindowState.MINIMIZED.equals(renderRequest.getWindowState())) {
            return;
        }

        List configInfo = new ArrayList();
        ConfigurationManager configManager = ConfigurationUtil
                .getConfigurationManager(kernel);
        List stores = configManager.listStores();
        for (Iterator i = stores.iterator(); i.hasNext();) {
            ObjectName storeName = (ObjectName) i.next();
            try {
                List infos = configManager.listConfigurations(storeName);
                for (Iterator j = infos.iterator(); j.hasNext();) {
                    ConfigurationInfo info = (ConfigurationInfo) j.next();
                    if (shouldListConfig(info)) {
                        // TODO: Check if this is the right solution
                        // Disregard JMS Queues and Topics &&
View Full Code Here

            int size = list.size();
            for (int i = 0; i < size; i++) {
                String config = (String) list.get(i);
                //URI configID = new URI(config);
                //kernel.startConfiguration(configID);
                ConfigurationManager configurationManager = ConfigurationUtil
                        .getConfigurationManager(kernel);
                ObjectName configName = configurationManager.load(URI
                        .create(config));

                kernel.startRecursiveGBean(configName);
            }
        } catch (DeploymentException e) {
View Full Code Here

            GBeanData configurationManagerData = new GBeanData(configurationManagerName, ConfigurationManagerImpl.GBEAN_INFO);
            configurationManagerData.setReferencePatterns("Stores", Collections.singleton(store.getName()));
            kernel.loadGBean(configurationManagerData, getClass().getClassLoader());
            kernel.startGBean(configurationManagerName);
            ConfigurationManager configurationManager = (ConfigurationManager) kernel.getProxyManager().createProxy(configurationManagerName, ConfigurationManager.class);

            ObjectName baseConfigName = configurationManager.load(defaultParentId[0]);
            kernel.startGBean(baseConfigName);

            ObjectName serverInfoObjectName = ObjectName.getInstance(j2eeContext.getJ2eeDomainName() + ":name=ServerInfo");
            GBeanData serverInfoGBean = new GBeanData(serverInfoObjectName, BasicServerInfo.GBEAN_INFO);
            serverInfoGBean.setAttribute("baseDirectory", ".");
View Full Code Here

        return parentCL;
    }

    private void loadAncestors(Kernel kernel, List parentId, List loadedAncestors) throws DeploymentException {
        if (kernel != null && parentId != null) {
            ConfigurationManager configurationManager = ConfigurationUtil.getConfigurationManager(kernel);

            try {
                for (Iterator iterator = parentId.iterator(); iterator.hasNext();) {
                    URI uri = (URI) iterator.next();
                    loadedAncestors.addAll(configurationManager.loadRecursive(uri));
                }
            } catch (Exception e) {
                throw new DeploymentException("Unable to load parents", e);
            } finally {
                ConfigurationUtil.releaseConfigurationManager(kernel, configurationManager);
View Full Code Here

        List parentId = configurationData.getParentId();
        if (kernel == null || parentId == null || parentId.isEmpty()) {
            throw new DeploymentException("neither domain and server nor any way to determine them was provided for configuration " + configurationData.getId());
        }
        URI parent = (URI) parentId.get(0);
        ConfigurationManager configurationManager = ConfigurationUtil.getConfigurationManager(kernel);

        try {
            boolean loaded = false;
            if (!configurationManager.isLoaded(parent)) {
                configurationManager.load(parent);
                loaded = true;
            }
            try {
                ObjectName parentName = Configuration.getConfigurationObjectName(parent);
                configurationData.setDomain((String) kernel.getAttribute(parentName, "domain"));
                configurationData.setServer((String) kernel.getAttribute(parentName, "server"));
            } catch (Exception e) {
                throw new DeploymentException("Unable to copy domain and server from parent configuration", e);
            } finally {
                if (loaded) {
                    //we need to unload again so the loadedAncestors list will be in the correct order to start configs.
                    configurationManager.unload(parent);
                }
            }
        } catch (Exception e) {
            throw new DeploymentException("Unable to load first parent of configuration " + configurationData.getId(), e);
        } finally {
View Full Code Here

            monitor.foundConfigurations((URI[]) configs.toArray(new URI[configs.size()]));

            // load the rest of the configurations
            try {
                ConfigurationManager configurationManager = ConfigurationUtil.getConfigurationManager(kernel);
                try {
                    for (Iterator i = configs.iterator(); i.hasNext();) {
                        URI configID = (URI) i.next();
                        monitor.configurationLoading(configID);
                        List list = configurationManager.loadRecursive(configID);
                        monitor.configurationLoaded(configID);
                        monitor.configurationStarting(configID);
                        for (Iterator iterator = list.iterator(); iterator.hasNext();) {
                            ObjectName name = (ObjectName) iterator.next();
                             kernel.startRecursiveGBean(name);
View Full Code Here

TOP

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

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.