Package org.apache.geronimo.kernel.config

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


            monitor.foundModules(configs.toArray(new Artifact[configs.size()]));

            // load the rest of the configurations
            try {
                ConfigurationManager configurationManager = ConfigurationUtil.getConfigurationManager(kernel);
                try {
                    for (Artifact configID : configs) {
                        monitor.moduleLoading(configID);
                        configurationManager.loadConfiguration(configID, lifecycleMonitor);
                        monitor.moduleLoaded(configID);
                        monitor.moduleStarting(configID);
                        configurationManager.startConfiguration(configID, lifecycleMonitor);
                        monitor.moduleStarted(configID);
                    }
                    // the server has finished loading the persistent configuration so inform the gbean
                    AbstractNameQuery startedQuery = new AbstractNameQuery(ServerStatus.class.getName());
                    Set statusBeans = kernel.listGBeans(startedQuery);
View Full Code Here


        if(!isEmpty(user)) response.setRenderParameter("repo-user", user);
        if(!isEmpty(pass)) response.setRenderParameter("repo-pass", pass);
        try {
            //todo: hide this in PortletManager/ManagementHelper
            for(int i=0; i<configId.length; i++) {
                ConfigurationManager mgr = ConfigurationUtil.getConfigurationManager(KernelRegistry.getSingleKernel());
                Artifact artifact = Artifact.create(configId[i]);
                mgr.loadConfiguration(artifact);
                mgr.startConfiguration(artifact);
            }
            return INDEX_MODE;
            //return LIST_MODE;
        } catch (Exception e) {
            log.error("Unable to start configuration "+configId, e);
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);
        if(mgr.isConfiguration(configId)) {
            ConfigurationStore store = mgr.getStoreForConfiguration(configId);
            response.setContentType("application/zip");
            if(!reply) {
                return true;
            }
            try {
View Full Code Here

    }

    private void generateConfigFile(HttpServletRequest request, Kernel kernel, PrintWriter out) throws NoSuchStoreException, JAXBException, XMLStreamException {
        String repo = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+request.getContextPath()+request.getServletPath();
        if(!repo.endsWith("/")) repo += "/";
        ConfigurationManager mgr = ConfigurationUtil.getConfigurationManager(kernel);
        PluginInstaller installer = getInstaller(kernel);
        PluginListType pluginList = installer.createPluginListForRepositories(repo);
        PluginXmlUtil.writePluginList(pluginList, out);
    }
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 = XmlUtil.newDocumentBuilderFactory();
View Full Code Here

    protected void setUp() throws Exception {
        super.setUp();
        Artifact id = new Artifact("test", "test", "", "car");
        module  = new ConnectorModule(false, new AbstractName(id, Collections.singletonMap("name", "test")), null, null, "foo", null, null, null, null);
        ConfigurationManager configurationManager = new MockConfigurationManager();
        EARContext earContext = new EARContext(new File("foo"),
            null,
            new Environment(new Artifact("foo", "bar", "1.0", "car")),
            ConfigurationModuleType.EAR,
            naming,
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);
            String config = getConfigID(actionRequest);
            Artifact configId = Artifact.create(config);

            if (START_ACTION.equals(action)) {
                if(!configurationManager.isLoaded(configId)) {
                    configurationManager.loadConfiguration(configId);
                }
                if(!configurationManager.isRunning(configId)) {
                    org.apache.geronimo.kernel.config.LifecycleResults lcresult = configurationManager.startConfiguration(configId);
                    message(actionResponse, lcresult, "Started application<br /><br />");
                }
            } else if (STOP_ACTION.equals(action)) {
                if(configurationManager.isRunning(configId)) {
                    configurationManager.stopConfiguration(configId);
                }
                if(configurationManager.isLoaded(configId)) {
                    LifecycleResults lcresult = configurationManager.unloadConfiguration(configId);
                    message(actionResponse, lcresult, "Stopped application<br /><br />");
                }
            } else if (UNINSTALL_ACTION.equals(action)) {
                configurationManager.uninstallConfiguration(configId);
                message(actionResponse, null, "Uninstalled application<br /><br />"+configId+"<br /><br />");
            } else if (RESTART_ACTION.equals(action)) {
                LifecycleResults lcresult = configurationManager.restartConfiguration(configId);
                message(actionResponse, lcresult, "Restarted application<br /><br />");
            } else {
                message(actionResponse, null, "Invalid value for changeState: " + action + "<br /><br />");
                throw new PortletException("Invalid value for changeState: " + action);
            }
View Full Code Here

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

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

                        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());
                        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());
                                }
                                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());
                        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);
View Full Code Here

        this.modules = modules;
    }

    public void run() {
        try {
            ConfigurationManager configurationManager = ConfigurationUtil.getConfigurationManager(kernel);
            try {
                for (int i = 0; i < modules.length; i++) {
                    TargetModuleIDImpl module = (TargetModuleIDImpl) modules[i];

                    Artifact moduleID = Artifact.create(module.getModuleID());
                    try {
                      if(!configurationManager.isOnline()) {
                        //If an offline undeploy, need to load the configuration first, so that stopConfiguration()
                        //can resolve the configuration and successfully set load=false in attribute manager, otherwise
                        //starting the server will fail attempting to start an config that does not exist.
                        configurationManager.loadConfiguration(moduleID);
                      }
                     
                        configurationManager.stopConfiguration(moduleID);


                        configurationManager.unloadConfiguration(moduleID);
                        updateStatus("Module " + moduleID + " unloaded.");
                    } catch (InternalKernelException e) {
                        // this is cause by the kernel being already shutdown
                    } catch (NoSuchConfigException e) {
                        // module was already unloaded - just continue
                    }

                    try {
                        configurationManager.uninstallConfiguration(moduleID);
                        updateStatus("Module " + moduleID + " uninstalled.");
                        addModule(module);
                    } catch (NoSuchConfigException e) {
                        // module was already undeployed - just continue
                    }
View Full Code Here

        this.modules = modules;
    }

    public void run() {
        try {
            ConfigurationManager configurationManager = ConfigurationUtil.getConfigurationManager(kernel);
            int alreadyStopped = 0;

            try {
                for (int i = 0; i < modules.length; i++) {
                    TargetModuleID module = modules[i];
                    Artifact moduleID = Artifact.create(module.getModuleID());
                    org.apache.geronimo.kernel.config.LifecycleResults lcresult = null;

                    if (configurationManager.isRunning(moduleID)) {
                        lcresult = configurationManager.stopConfiguration(moduleID);
                        addModule(module);
                    } else {
                        updateStatus("Module " + moduleID + " is already stopped");
                        alreadyStopped++;
                    }

                    if (configurationManager.isLoaded(moduleID)) {
                        configurationManager.unloadConfiguration(moduleID);
                    }

                    if (lcresult != null) {
                        java.util.Iterator iterator = lcresult.getStopped().iterator();
                        while (iterator.hasNext()) {
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.