Package org.apache.geronimo.kernel.repository

Examples of org.apache.geronimo.kernel.repository.Artifact


        TargetImpl impl = (TargetImpl) target;
        AbstractName storeName = impl.getAbstractName();
        Boolean inPlaceConfiguration = (Boolean) kernel.invoke(storeName, IS_IN_PLACE_CONFIGURATION_METH, new Object[]{previous}, IS_IN_PLACE_CONFIGURATION_SIG);
        commandContext.setInPlace(inPlaceConfiguration.booleanValue());
        doDeploy(target, false);
        Artifact configID = Artifact.create(getResultTargetModuleIDs()[0].getModuleID());
        LifecycleResults results = manager.reloadConfiguration(previous, configID.getVersion());

        // Activate it
        //todo: make this asynchronous
        boolean newStarted = false;
        for (Iterator it = results.getStopped().iterator(); it.hasNext();) {
            Artifact name = (Artifact) it.next();
            updateStatus("Stopped "+name);
        }
        for (Iterator it = results.getUnloaded().iterator(); it.hasNext();) {
            Artifact name = (Artifact) it.next();
            updateStatus("Unloaded "+name);
        }
        for (Iterator it = results.getLoaded().iterator(); it.hasNext();) {
            Artifact name = (Artifact) it.next();
            updateStatus("Loaded "+name);
        }
        for (Iterator it = results.getStarted().iterator(); it.hasNext();) {
            Artifact name = (Artifact) it.next();
            updateStatus("Started "+name);
            if(configID.matches(name)) {
                newStarted = true;
            }
        }
        for (Iterator it = results.getFailed().keySet().iterator(); it.hasNext();) {
            Artifact name = (Artifact) it.next();
            updateStatus("Failed on "+name+": "+results.getFailedCause(name).getMessage());
            doFail((Exception)results.getFailedCause(name));
        }
        if(results.getFailed().size() == 0 && !newStarted) {
            updateStatus("Note: new module was not started (probably because old module was not running).");
View Full Code Here


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

                    // Check to see whether the module is already started
                    Artifact moduleID = Artifact.create(module.getModuleID());
                    if (configurationManager.isRunning(moduleID)) {
                        updateStatus("Module " + moduleID + " is already running");
                        Thread.sleep(100);
                        continue;
                    }

                    // Load
                    if(!configurationManager.isLoaded(moduleID)) {
                        configurationManager.loadConfiguration(moduleID);
                    }

                    // Start
                    org.apache.geronimo.kernel.config.LifecycleResults lcresult = configurationManager.startConfiguration(moduleID);

                    // Determine the child modules of the configuration
                    //TODO might be a hack
                    List kids = loadChildren(kernel, moduleID.toString());

                    // Build a response obect containg the started configuration and a list of it's contained modules
                    TargetModuleIDImpl id = new TargetModuleIDImpl(modules[i].getTarget(), module.getModuleID(),
                            (String[]) kids.toArray(new String[kids.size()]));
                    if (isWebApp(kernel, moduleID.toString())) {
                        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);
                    java.util.Iterator iterator = lcresult.getStarted().iterator();
                    while (iterator.hasNext()) {
                        Artifact config = (Artifact)iterator.next();
                        if (!config.toString().equals(id.getModuleID())) {
                            //TODO might be a hack
                            List kidsChild = loadChildren(kernel, config.toString());

                            // Build a response obect containg the started configuration and a list of it's contained modules
                            TargetModuleIDImpl idChild = new TargetModuleIDImpl(null, config.toString(),
                                    (String[]) kidsChild.toArray(new String[kidsChild.size()]));
                            if (isWebApp(kernel, config.toString())) {
                                idChild.setType(ModuleType.WAR);
                            }
                            if (idChild.getChildTargetModuleID() != null) {
                                for (int k = 0; k < idChild.getChildTargetModuleID().length; k++) {
                                    TargetModuleIDImpl child = (TargetModuleIDImpl) idChild.getChildTargetModuleID()[k];
View Full Code Here

    private static Map<Artifact, Artifact> propertiesToArtifactMap(Properties properties) {
        Map<Artifact, Artifact> explicitResolution = new HashMap<Artifact, Artifact>();
        for (Map.Entry<Object, Object> entry : properties.entrySet()) {
            String key = (String) entry.getKey();
            String resolvedString = (String) entry.getValue();
            Artifact source = Artifact.createPartial(key);
            Artifact resolved = Artifact.create(resolvedString);
            explicitResolution.put(source, resolved);
        }
        return explicitResolution;
    }
View Full Code Here

        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;
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();
        DocumentBuilder builder = factory.newDocumentBuilder();
        Document doc = builder.newDocument();
        Element root = doc.createElement("metadata");
        doc.appendChild(root);
        createText(doc, root, "groupId", groupId);
        createText(doc, root, "artifactId", artifactId);
        if(artifacts.length > 0) {
            createText(doc, root, "version", artifacts[0].getVersion().toString());
        }
        Element versioning = doc.createElement("versioning");
        root.appendChild(versioning);
        Element versions = doc.createElement("versions");
        versioning.appendChild(versions);
        for (int i = 0; i < artifacts.length; i++) {
            Artifact artifact = artifacts[i];
            createText(doc, versions, "version", artifact.getVersion().toString());
        }
        TransformerFactory xfactory = XmlUtil.newTransformerFactory();
        Transformer xform = xfactory.newTransformer();
        xform.setOutputProperty(OutputKeys.INDENT, "yes");
        xform.transform(new DOMSource(doc), new StreamResult(writer));
View Full Code Here

                for (int i = 0; i < dependencies.length; i++) {
                    dependencies[i] = new org.apache.geronimo.deployment.service.jsr88.Artifact();
                }
                environment.setDependencies(dependencies);
                for (int i = 0; i < dependencies.length; i++) {
                    Artifact tmp = Artifact.create(jars[i]);
                    dependencies[i].setGroupId(tmp.getGroupId());
                    dependencies[i].setArtifactId(tmp.getArtifactId());
                    dependencies[i].setVersion(tmp.getVersion().toString());
                    dependencies[i].setType(tmp.getType());
                }

                ResourceAdapter adapter = connector.getResourceAdapter()[0];
                ConnectionDefinition definition = new ConnectionDefinition();
                adapter.setConnectionDefinition(new ConnectionDefinition[]{definition});
View Full Code Here

                return null;
            }
            ListableRepository[] repos = PortletManager.getCurrentServer(request).getRepositories();

            for (String jar : jars) {
                Artifact artifact = Artifact.create(
                        jar);
                for (ListableRepository repo : repos) {
                    File url = repo.getLocation(artifact);
                    if (url != null) {
                        list.add(url.toURL());
View Full Code Here

    Map componentContext = new HashMap();

    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,
            configurationManager,
            (Collection) null,
            null,
View Full Code Here

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

            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.
View Full Code Here

TOP

Related Classes of org.apache.geronimo.kernel.repository.Artifact

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.