Package org.apache.geronimo.deployment.plugin

Examples of org.apache.geronimo.deployment.plugin.TargetModuleIDImpl


            throw new UnsupportedOperationException("More than one deployer found");
        }

        try {
            for (int i = 0; i < modules.length; i++) {
                TargetModuleIDImpl module = (TargetModuleIDImpl) modules[i];

                URI configID = URI.create(module.getModuleID());
                kernel.stopConfiguration(configID);
               
                TargetImpl target = (TargetImpl) module.getTarget();
                ObjectName storeName = target.getObjectName();
                kernel.invoke(storeName, "uninstall", new Object[]{configID}, UNINSTALL_SIG);

                Object[] args = {moduleArchive, deploymentPlan};
                URI configId = (URI) kernel.invoke(deployer, "deploy", args, DEPLOY_SIG);
                module = new TargetModuleIDImpl(module.getTarget(), configId.toString());
                addModule(module);
            }
            complete("Completed");
        } catch (Exception e) {
            fail(e.getMessage());
View Full Code Here


                ObjectName storeName = target.getObjectName();
                List infos = kernel.listConfigurations(storeName);
                for (int j = 0; j < infos.size(); j++) {
                    ConfigurationInfo info = (ConfigurationInfo) infos.get(j);
                    if (filter.accept(info)) {
                        TargetModuleID moduleID = new TargetModuleIDImpl(target, info.getConfigID().toString());
                        result.add(moduleID);
                    }
                }
            }
            return result.size() == 0 ? null : (TargetModuleID[]) result.toArray(new TargetModuleID[result.size()]);
View Full Code Here

                for (Object info1 : infos) {
                    ConfigurationInfo info = (ConfigurationInfo) info1;
                    if (filter.accept(info)) {
                        String name = info.getConfigID().toString();
                        List list = CommandSupport.loadChildren(kernel, name);
                        TargetModuleIDImpl moduleID = new TargetModuleIDImpl(target, name, (String[]) list.toArray(new String[list.size()]));
                        moduleID.setType(CommandSupport.convertModuleType(info.getType()));
                        if (moduleID.getChildTargetModuleID() != null) {
                            for (int k = 0; k < moduleID.getChildTargetModuleID().length; k++) {
                                TargetModuleIDImpl child = (TargetModuleIDImpl) moduleID.getChildTargetModuleID()[k];
                                if (CommandSupport.isWebApp(kernel, child.getModuleID())) {
                                    child.setType(ModuleType.WAR);
                                }
                            }
                        }
                        result.add(moduleID);
                    }
View Full Code Here

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

                    URI moduleID = URI.create(module.getModuleID());
                    try {
                        try {
                            configurationManager.stop(moduleID);
                        } catch (InvalidConfigException e) {
                            if(e.getCause() instanceof GBeanNotFoundException) {
                                GBeanNotFoundException gnf = (GBeanNotFoundException) e.getCause();
                                if(clean(gnf.getGBeanName().getKeyProperty("name")).equals(moduleID.toString())) {
                                    // the module is not running
                                } else {
                                    throw gnf;
                                }
                            }
                        }
                        configurationManager.unload(moduleID);
                        updateStatus("Module "+moduleID+" unloaded.");
                    } catch (InternalKernelException e) {
                        // this is cause by the kernel being already shutdown
                    } catch (NoSuchConfigException e) {
                        // module was already undeployed - just continue
                    }

                    try {
                        TargetImpl target = (TargetImpl) module.getTarget();
                        ObjectName storeName = target.getObjectName();
                        URI configID = URI.create(module.getModuleID());
                        kernel.invoke(storeName, "uninstall", new Object[]{configID}, UNINSTALL_SIG);
                        updateStatus("Module "+moduleID+" uninstalled.");
                        addModule(module);
                    } catch (NoSuchConfigException e) {
                        // module was already undeployed - just continue
View Full Code Here

            }

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

                    URI configID = URI.create(module.getModuleID());
                    ObjectName configName = Configuration.getConfigurationObjectName(configID);
                    try {
                        kernel.stopGBean(configName);
                        updateStatus("Stopped "+configID);
                    } catch (GBeanNotFoundException e) {
                        if(e.getGBeanName().equals(configName)) {
                            // The module isn't running -- that's OK
                        } else throw e;
                    }
                    try {
                        configurationManager.unload(configID);
                        updateStatus("Unloaded "+configID);
                    } catch(InternalKernelException e) {
                        Exception cause = (Exception)e.getCause();
                        if(cause instanceof NoSuchConfigException) {
                            // The modules isn't loaded -- that's OK
                        } else {
                            throw cause;
                        }
                    } catch (NoSuchConfigException e) {
                        // The modules isn't loaded -- that's OK
                    }

                    TargetImpl target = (TargetImpl) module.getTarget();
                    ObjectName storeName = target.getObjectName();
                    kernel.invoke(storeName, "uninstall", new Object[]{configID}, UNINSTALL_SIG);
                    updateStatus("Uninstalled "+configID);

                    doDeploy(module.getTarget(), false);
                    updateStatus("Deployed "+configID);

                    List list = configurationManager.loadRecursive(configID);
                    for (int j = 0; j < list.size(); j++) {
                        URI name = (URI) list.get(j);
View Full Code Here

        String[] childIDs = new String[objectNames.size()-1];
        for (int j=0; j < childIDs.length; j++) {
            childIDs[j] = (String)objectNames.get(j+1);
        }

        TargetModuleIDImpl moduleID = new TargetModuleIDImpl(target, parentName.toString(), childIDs);
        if(isWebApp(kernel, parentName.toString())) {
            moduleID.setType(ModuleType.WAR);
        }
        if(moduleID.getChildTargetModuleID() != null) {
            for (int i = 0; i < moduleID.getChildTargetModuleID().length; i++) {
                TargetModuleIDImpl id = (TargetModuleIDImpl) moduleID.getChildTargetModuleID()[i];
                if(isWebApp(kernel, id.getModuleID())) {
                    id.setType(ModuleType.WAR);
                }
            }
        }
        addModule(moduleID);
        if(finished) {
View Full Code Here

                for (int j = 0; j < infos.size(); j++) {
                    ConfigurationInfo info = (ConfigurationInfo) infos.get(j);
                    if (filter.accept(info)) {
                        String name = info.getConfigID().toString();
                        List list = CommandSupport.loadChildren(kernel, name);
                        TargetModuleIDImpl moduleID = new TargetModuleIDImpl(target, name, (String[]) list.toArray(new String[list.size()]));
                        moduleID.setType(CommandSupport.convertModuleType(info.getType()));
                        if(moduleID.getChildTargetModuleID() != null) {
                            for (int k = 0; k < moduleID.getChildTargetModuleID().length; k++) {
                                TargetModuleIDImpl child = (TargetModuleIDImpl) moduleID.getChildTargetModuleID()[k];
                                if(CommandSupport.isWebApp(kernel, child.getModuleID())) {
                                    child.setType(ModuleType.WAR);
                                }
                            }
                        }
                        result.add(moduleID);
                    }
View Full Code Here

                        URI name = (URI) list.get(j);
                        configurationManager.loadGBeans(name);
                        configurationManager.start(name);
                        String configName = name.toString();
                        List kids = loadChildren(kernel, configName);
                        TargetModuleIDImpl id = new TargetModuleIDImpl(modules[i].getTarget(), configName,
                                (String[]) kids.toArray(new String[kids.size()]));
                        if(isWebApp(kernel, configName)) {
                            id.setType(ModuleType.WAR);
                        }
                        if(id.getChildTargetModuleID() != null) {
                            for (int k = 0; k < id.getChildTargetModuleID().length; k++) {
                                TargetModuleIDImpl child = (TargetModuleIDImpl) id.getChildTargetModuleID()[k];
                                if(isWebApp(kernel, child.getModuleID())) {
                                    child.setType(ModuleType.WAR);
                                }
                            }
                        }
                        addModule(id);
                    }
View Full Code Here

        } catch (Exception e) {
            e.printStackTrace();
            containers = Collections.EMPTY_MAP;
        }
        for (int i = 0; i < moduleIDs.size(); i++) {
            TargetModuleIDImpl id = (TargetModuleIDImpl) moduleIDs.get(i);
            if(id.getType() != null && id.getType().getValue() == ModuleType.WAR.getValue()) {
                if(webApps == null) {
                    webApps = kernel.listGBeans(new GBeanQuery(null, "org.apache.geronimo.management.geronimo.WebModule"));
                }
                for (Iterator it = webApps.iterator(); it.hasNext();) {
                    ObjectName name = (ObjectName) it.next();
                    if(name.getKeyProperty("name").equals(id.getModuleID())) {
                        try {
                            String container = (String) kernel.getAttribute(name, "containerName");
                            String context = (String) kernel.getAttribute(name, "contextPath");
                            id.setWebURL(containers.get(container)+context);
                        } catch (Exception e) {
                            e.printStackTrace();
                        }
                    }
                }
            }
            if(id.getChildTargetModuleID() != null) {
                addWebURLs(kernel, Arrays.asList(id.getChildTargetModuleID()));
            }
        }
    }
View Full Code Here

            }

            ConfigurationManager configurationManager = ConfigurationUtil.getConfigurationManager(kernel);
            try {
                for (int i = 0; i < modules.length; i++) {
                    TargetModuleIDImpl module = (TargetModuleIDImpl) modules[i];
                    Artifact artifact = Artifact.create(module.getModuleID());
                    if(configID != null && configID.isResolved()) {
                        if(configID.getGroupId().equals(artifact.getGroupId()) &&
                                configID.getArtifactId().equals(artifact.getArtifactId()) &&
                                configID.getVersion().equals(artifact.getVersion())) {
                            redeploySameConfiguration(configurationManager, artifact, module.getTarget());
                        } else {
                            redeployUpdatedConfiguration(configurationManager, artifact, module.getTarget());
                        }
                    } else {
                        redeployUpdatedConfiguration(configurationManager, artifact, module.getTarget());
                    }
                }
            } finally {
                ConfigurationUtil.releaseConfigurationManager(kernel, configurationManager);
            }
View Full Code Here

TOP

Related Classes of org.apache.geronimo.deployment.plugin.TargetModuleIDImpl

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.