Package org.apache.geronimo.kernel.config

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


             
        String cookies = renderRequest.getProperty("cookie");
        boolean showDependencies = (cookies != null && cookies.indexOf(SHOW_DEPENDENCIES_COOKIE + "=true") > 0);
       
        List<ModuleDetails> moduleDetails = new ArrayList<ModuleDetails>();
        ConfigurationManager configManager = ConfigurationUtil.getConfigurationManager(kernel);
        List<ConfigurationInfo> infos = configManager.listConfigurations();
        for (ConfigurationInfo info : infos) {

            String moduleType = getInitParameter(CONFIG_INIT_PARAM);
            if (ConfigurationModuleType.WAR.getName().equalsIgnoreCase(moduleType)) {

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

                        WebModule webModule = (WebModule) PortletManager.getModule(renderRequest, info.getConfigID());
                        if (webModule != null) {
                            details.getContextPaths().add(webModule.getContextPath());
                        }

                        if (showDependencies) {
                            addDependencies(details, configObjName);
                        }
                        if (loaded) {
                            unloadModule(configManager, configObjName);
                        }
                    } catch (InvalidConfigException ice) {
                        // Should not occur
                        ice.printStackTrace();
                    }
                    moduleDetails.add(details);
                } 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()) {
View Full Code Here


    public Deployer(Collection builders, Collection stores, Collection watchers, Kernel kernel) {
        this(builders, stores, watchers, getArtifactResolver(kernel), kernel);
    }

    private static ArtifactResolver getArtifactResolver(Kernel kernel) {
        ConfigurationManager configurationManager = ConfigurationUtil.getConfigurationManager(kernel);
        return configurationManager.getArtifactResolver();
    }
View Full Code Here

        response.setRenderParameter("repository", repo);
        if(!isEmpty(user)) response.setRenderParameter("repo-user", user);
        if(!isEmpty(pass)) response.setRenderParameter("repo-pass", pass);
        try {
            //todo: hide this in PortletManager/ManagementHelper
            ConfigurationManager mgr = ConfigurationUtil.getConfigurationManager(KernelRegistry.getSingleKernel());
            Artifact artifact = Artifact.create(configId);
            mgr.loadConfiguration(artifact);
            mgr.startConfiguration(artifact);
            return LIST_MODE;
        } catch (Exception e) {
            log.error("Unable to start configuration "+configId, e);
            response.setRenderParameter("configId", configId);
            return getMode()+BEFORE_ACTION;
View Full Code Here

    }

    private boolean produceDownloadFile(Kernel kernel, Artifact configId, HttpServletResponse response, boolean reply) throws IOException {
        //todo: replace kernel mumbo jumbo with JSR-77 navigation
        // Step 1: check if it's in a configuration store
        ConfigurationManager mgr = ConfigurationUtil.getConfigurationManager(kernel);
        List stores = mgr.listStores();
        for (int i = 0; i < stores.size(); i++) {
            AbstractName name = (AbstractName) stores.get(i);
            //todo: this is bad!!!
            if(name.getName().get(NameFactory.J2EE_NAME).equals("Local")) {
                ConfigurationStore store = (ConfigurationStore) kernel.getProxyManager().createProxy(name, ConfigurationStore.class);
View Full Code Here

        // Step 3: wasn't found
        return false;
    }

    private void generateConfigFile(HttpServletRequest request, Kernel kernel, PrintWriter out) throws ParserConfigurationException, NoSuchStoreException, TransformerException {
        ConfigurationManager mgr = ConfigurationUtil.getConfigurationManager(kernel);
        PluginInstaller installer = getInstaller(kernel);
        DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
        factory.setNamespaceAware(true);
        DocumentBuilder builder = factory.newDocumentBuilder();
        Document doc = builder.newDocument();
        Element root = doc.createElementNS("http://geronimo.apache.org/xml/ns/plugins-1.1", "geronimo-plugin-list");
        doc.appendChild(root);
        List stores = mgr.listStores();
        for (int i = 0; i < stores.size(); i++) {
            AbstractName name = (AbstractName) stores.get(i);
            List configs = mgr.listConfigurations(name);
            for (int j = 0; j < configs.size(); j++) {
                ConfigurationInfo info = (ConfigurationInfo) configs.get(j);
                PluginMetadata data = installer.getPluginMetadata(info.getConfigID());
                Element config = doc.createElement("plugin");
                root.appendChild(config);
View Full Code Here

        }
        return (PluginInstaller) kernel.getProxyManager().createProxy((AbstractName) names.iterator().next(), PluginInstaller.class);
    }

    private void generateMavenFile(Kernel kernel, PrintWriter writer, String groupId, String artifactId, boolean reply) throws ParserConfigurationException, TransformerException {
        ConfigurationManager mgr = ConfigurationUtil.getConfigurationManager(kernel);
        Artifact[] artifacts = mgr.getArtifactResolver().queryArtifacts(new Artifact(groupId, artifactId, (Version)null, null));
        if(!reply) {
            return;
        }

        DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
View Full Code Here

        if(configId == null) {
            throw new ServletException("No configId specified for CAR download");
        }
        Artifact artifact = Artifact.create(configId);
        Kernel kernel = KernelRegistry.getSingleKernel();
        ConfigurationManager mgr = ConfigurationUtil.getConfigurationManager(kernel);
        ConfigurationStore store = mgr.getStoreForConfiguration(artifact);
        try {
            response.setContentType("application/zip");
            store.exportConfiguration(artifact, response.getOutputStream());
        } catch (NoSuchConfigException e) {
            throw new ServletException("No such configuration '"+configId+"'");
View Full Code Here

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

        ConfigurationManager configurationManager = this.configurationManager;
        if (configurationManager == null) {
            configurationManager = new SimpleConfigurationManager(configurationStores, artifactResolver, repositories);
        }
        try {
            // Create the output ear context
View Full Code Here

            if(!targetSet) {
                setTargetConfigStore();
            }

            // start the Configuration we're going to use for this deployment
            ConfigurationManager configurationManager = ConfigurationUtil.getConfigurationManager(kernel);
            try {
                for (Iterator iterator = deploymentConfigs.iterator(); iterator.hasNext();) {
                    String artifactName = (String) iterator.next();
                    Artifact configName = Artifact.create(artifactName);
                    if (!configurationManager.isLoaded(configName)) {
                        configurationManager.loadConfiguration(configName);
                        configurationManager.startConfiguration(configName);
                    }
                }
            } finally {
                ConfigurationUtil.releaseConfigurationManager(kernel, configurationManager);
            }
View Full Code Here

        kernel.boot();

        ConfigurationUtil.loadBootstrapConfiguration(kernel, in, this.getClass().getClassLoader());

        // load the rest of the configuration listed on the command line
        ConfigurationManager configurationManager = ConfigurationUtil.getConfigurationManager(kernel);
        try {
            for (Iterator i = configList.iterator(); i.hasNext();) {
                Artifact configID = (Artifact) i.next();
                configurationManager.loadConfiguration(configID);
                configurationManager.startConfiguration(configID);
                System.out.println("started gbean: " + configID);
            }
        } finally {
            ConfigurationUtil.releaseConfigurationManager(kernel, configurationManager);
        }
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.