Package org.apache.geronimo.kernel.repository

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


            List<PluginType> toInstall = new ArrayList<PluginType>();
            for (PluginType metadata : pluginsToInstall.getPlugin()) {
                try {
                    if (validatePlugins) {
                        if (!validatePlugin(metadata)) {
                            throw new MissingDependencyException("Already installed", toArtifact(metadata.getPluginArtifact().get(0).getModuleId()), (Stack<Artifact>)null);
                        }
                        verifyPrerequisites(metadata);
                    }

                    PluginArtifactType instance = metadata.getPluginArtifact().get(0);
View Full Code Here


     * @throws org.apache.geronimo.kernel.repository.MissingDependencyException
     *          if plugin requires a dependency that is not present
     */
    public boolean validatePlugin(PluginType plugin) throws MissingDependencyException {
        if (plugin.getPluginArtifact().size() != 1) {
            throw new MissingDependencyException("A plugin configuration must include one plugin artifact, not " + plugin.getPluginArtifact().size(), null, (Stack<Artifact>) null);
        }
        PluginArtifactType metadata = plugin.getPluginArtifact().get(0);
        // 1. Check that it's not already installed
        if (metadata.getModuleId() != null) { // that is, it's a real configuration not a plugin list
            Artifact artifact = toArtifact(metadata.getModuleId());
           
            //plugin groups don't get registered with configManager
            if (plugin.isPluginGroup() != null && plugin.isPluginGroup()) {
                if (installedArtifacts.contains(artifact)) {
                    log.debug("Configuration {} is already installed", artifact);
                    return false;
                }
            } else {
                if (configManager.isInstalled(artifact)) {
                    boolean upgrade = false;
                    for (ArtifactType obsolete : metadata.getObsoletes()) {
                        Artifact test = toArtifact(obsolete);
                        if (test.matches(artifact)) {
                            upgrade = true;
                            break;
                        }
                    }
                    if (!upgrade && installedArtifacts.contains(artifact)) {
                        log.debug("Configuration {} is already installed", artifact);
                        return false;
                    }
                }
            }
        }

        // 2. Check that we meet the Geronimo, JVM versions
        if (metadata.getGeronimoVersion().size() > 0 && !checkGeronimoVersions(metadata.getGeronimoVersion())) {
            log.debug("Plugin " + toArtifact(metadata.getModuleId()) + " is not installable on Geronimo " + serverInfo.getVersion());
            throw new MissingDependencyException(
                    "Plugin is not installable on Geronimo " + serverInfo.getVersion(), toArtifact(metadata.getModuleId()), (Stack<Artifact>) null);
        }
        if (metadata.getJvmVersion().size() > 0 && !checkJVMVersions(metadata.getJvmVersion())) {
            log.debug("Plugin " + toArtifact(metadata.getModuleId()) + " is not installable on JVM " + System.getProperty("java.version"));
            throw new MissingDependencyException(
                    "Plugin is not installable on JVM " + System.getProperty("java.version"), toArtifact(metadata.getModuleId()), (Stack<Artifact>) null);
        }
        return true;
    }
View Full Code Here

                if (iter.hasNext()) {
                    buf.append(", ");
                }
            }
            buf.append(" to be installed");
            throw new MissingDependencyException(buf.toString(), null, (Artifact) null);
        }
    }
View Full Code Here

                    log.error("Unable to read plugin metadata: {}", e.getMessage());
                    throw (IOException) new IOException("Unable to read plugin metadata: " + e.getMessage()).initCause(e);
                }
                if (pluginData != null) { // it's a plugin, not a plain JAR
                    if (!validatePlugin(pluginData)) {
                        monitor.getResults().addSkippedConfigID(new MissingDependencyException("already installed", configID, (Stack<Artifact>)null));
                        return;
                    }
                    instance = pluginData.getPluginArtifact().get(0);
                }
                monitor.getResults().setCurrentMessage("Copying " + result.getArtifact() + " to the repository");
View Full Code Here

     * @throws org.apache.geronimo.kernel.repository.MissingDependencyException
     *          if plugin requires a dependency that is not present
     */
    public void validatePlugin(PluginType plugin) throws MissingDependencyException {
        if (plugin.getPluginArtifact().size() != 1) {
            throw new MissingDependencyException("A plugin configuration must include one plugin artifact, not " + plugin.getPluginArtifact().size(), null, (Stack<Artifact>) null);
        }
        PluginArtifactType metadata = plugin.getPluginArtifact().get(0);
        // 1. Check that it's not already installed
        if (metadata.getModuleId() != null) { // that is, it's a real configuration not a plugin list
            Artifact artifact = toArtifact(metadata.getModuleId());
            if (configManager.isInstalled(artifact)) {
                boolean upgrade = false;
                for (ArtifactType obsolete : metadata.getObsoletes()) {
                    Artifact test = toArtifact(obsolete);
                    if (test.matches(artifact)) {
                        upgrade = true;
                        break;
                    }
                }
                if (!upgrade) {
                    log.debug("Configuration " + artifact + " is already installed.");
                    throw new MissingDependencyException(
                            "Configuration " + artifact + " is already installed.", toArtifact(metadata.getModuleId()), (Stack<Artifact>) null);
                }
            }
        }

        // 2. Check that we meet the Geronimo, JVM versions
        if (metadata.getGeronimoVersion().size() > 0 && !checkGeronimoVersions(metadata.getGeronimoVersion())) {
            log.debug("Plugin " + toArtifact(metadata.getModuleId()) + " is not installable on Geronimo " + serverInfo.getVersion());
            throw new MissingDependencyException(
                    "Plugin is not installable on Geronimo " + serverInfo.getVersion(), toArtifact(metadata.getModuleId()), (Stack<Artifact>) null);
        }
        if (metadata.getJvmVersion().size() > 0 && !checkJVMVersions(metadata.getJvmVersion())) {
            log.debug("Plugin " + toArtifact(metadata.getModuleId()) + " is not installable on JVM " + System.getProperty("java.version"));
            throw new MissingDependencyException(
                    "Plugin is not installable on JVM " + System.getProperty("java.version"), toArtifact(metadata.getModuleId()), (Stack<Artifact>) null);
        }
    }
View Full Code Here

            List<PluginType> toInstall = new ArrayList<PluginType>();
            for (PluginType metadata : pluginsToInstall.getPlugin()) {
                try {
                    if (validatePlugins) {
                        if (!validatePlugin(metadata)) {
                            throw new MissingDependencyException("Already installed", toArtifact(metadata.getPluginArtifact().get(0).getModuleId()), (Stack<Artifact>) null);
                        }
                        verifyPrerequisites(metadata);
                    }

                    PluginArtifactType instance = metadata.getPluginArtifact().get(0);
View Full Code Here

     * @throws org.apache.geronimo.kernel.repository.MissingDependencyException
     *          if plugin requires a dependency that is not present
     */
    public boolean validatePlugin(PluginType plugin) throws MissingDependencyException {
        if (plugin.getPluginArtifact().size() != 1) {
            throw new MissingDependencyException("A plugin configuration must include one plugin artifact, not " + plugin.getPluginArtifact().size(), null, (Stack<Artifact>) null);
        }
        PluginArtifactType metadata = plugin.getPluginArtifact().get(0);
        // 1. Check that it's not already installed
        if (metadata.getModuleId() != null) { // that is, it's a real configuration not a plugin list
            Artifact artifact = toArtifact(metadata.getModuleId());

            //plugin groups don't get registered with configManager
            if (plugin.isPluginGroup() != null && plugin.isPluginGroup()) {
                if (installedArtifacts.contains(artifact)) {
                    log.debug("Configuration {} is already installed", artifact);
                    return false;
                }
            } else {
                if (configManager.isInstalled(artifact)) {
                    boolean upgrade = false;
                    for (ArtifactType obsolete : metadata.getObsoletes()) {
                        Artifact test = toArtifact(obsolete);
                        if (test.matches(artifact)) {
                            upgrade = true;
                            break;
                        }
                    }
                    if (!upgrade && installedArtifacts.contains(artifact)) {
                        log.debug("Configuration {} is already installed", artifact);
                        return false;
                    }
                }
            }
        }

        // 2. Check that we meet the Geronimo, JVM versions
        if (metadata.getGeronimoVersion().size() > 0 && !checkGeronimoVersions(metadata.getGeronimoVersion())) {
            log.debug("Plugin " + toArtifact(metadata.getModuleId()) + " is not installable on Geronimo " + serverInfo.getVersion());
            throw new MissingDependencyException(
                    "Plugin is not installable on Geronimo " + serverInfo.getVersion(), toArtifact(metadata.getModuleId()), (Stack<Artifact>) null);
        }
        if (metadata.getJvmVersion().size() > 0 && !checkJVMVersions(metadata.getJvmVersion())) {
            log.debug("Plugin " + toArtifact(metadata.getModuleId()) + " is not installable on JVM " + System.getProperty("java.version"));
            throw new MissingDependencyException(
                    "Plugin is not installable on JVM " + System.getProperty("java.version"), toArtifact(metadata.getModuleId()), (Stack<Artifact>) null);
        }
        return true;
    }
View Full Code Here

                    if (dependency.getImportType() == ImportType.ALL || dependency.getImportType() == ImportType.CLASSES) {
                        classParents.add(parent);
                    }
                } else {
                    if (dependency.getImportType() == ImportType.SERVICES) {
                        throw new MissingDependencyException("Not a configuration but import type services only", parent, id);
                    }
                }
            } catch (MissingDependencyException e) {
                throw (MissingDependencyException)new MissingDependencyException("Attempting to resolve environment: " + environment, dependency.getArtifact(), id).initCause(e);
            }
        }
        return new DependencyNode(id, classParents, serviceParents);
    }
View Full Code Here

                if (iter.hasNext()) {
                    buf.append(", ");
                }
            }
            buf.append(" to be installed");
            throw new MissingDependencyException(buf.toString(), null, (Artifact) null);
        }
    }
View Full Code Here

                    log.error("Unable to read plugin metadata: {}", e.getMessage());
                    throw (IOException) new IOException("Unable to read plugin metadata: " + e.getMessage()).initCause(e);
                }
                if (pluginData != null) { // it's a plugin, not a plain JAR
                    if (!validatePlugin(pluginData)) {
                        monitor.getResults().addSkippedConfigID(new MissingDependencyException("already installed", configID, (Stack<Artifact>) null));
                        return;
                    }
                    instance = pluginData.getPluginArtifact().get(0);
                }
                monitor.getResults().setCurrentMessage("Copying " + result.getArtifact() + " to the repository");
View Full Code Here

TOP

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

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.