Examples of ConfigurationManager


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

    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

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

        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

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

        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

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

        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

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

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

        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

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

    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

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

     * @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

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

        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

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

            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
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.