Package org.apache.geronimo.kernel.repository

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


     * Searches for an artifact in the listed repositories, where the artifact
     * may have wildcards in the ID.
     */
    private static Artifact findArtifact(Artifact query, URL[] repos, String username, String password, ResultsFileWriteMonitor monitor) throws MissingDependencyException {
        if(query.getGroupId() == null || query.getArtifactId() == null || query.getType() == null) {
            throw new MissingDependencyException("No support yet for dependencies missing more than a version: "+query);
        }
        List list = new ArrayList();
        for (int i = 0; i < repos.length; i++) {
            list.add(repos[i]);
        }
        Artifact result = null;
        for (int i = 0; i < list.size(); i++) {
            URL url = (URL) list.get(i);
            try {
                result = findArtifact(query, url, username, password, monitor);
            } catch (Exception e) {
                log.warn("Unable to read from "+url, e);
            }
            if(result != null) {
                return result;
            }
        }
        throw new MissingDependencyException("No repository has a valid artifact for "+query);
    }
View Full Code Here


                    url = repository.getURL(uri);
                    break;
                }
            }
            if (url == null) {
                throw new MissingDependencyException("Unable to resolve dependency " + uri);
            }
            urls[idx++] = url;
        }
        for (Iterator i = classPath.iterator(); i.hasNext();) {
            URI uri = (URI) i.next();
View Full Code Here

                    url = repository.getURL(uri);
                    break;
                }
            }
            if (url == null) {
                throw new MissingDependencyException("Unable to resolve dependency " + uri);
            }
            urls[idx++] = url;
        }
        for (Iterator i = classPath.iterator(); i.hasNext();) {
            URI uri = (URI) i.next();
View Full Code Here

                    url = repository.getURL(uri);
                    break;
                }
            }
            if (url == null) {
                throw new MissingDependencyException("Unable to resolve dependency " + uri);
            }
            urls[idx++] = url;
        }
        for (Iterator i = classPath.iterator(); i.hasNext();) {
            URI uri = (URI) i.next();
View Full Code Here

    }

    private static URI getDependencyURI(DependencyType dep, Repository repository) throws DeploymentException {
        URI uri = getDependencyURI(dep);
        if (!repository.hasURI(uri)) {
            throw new DeploymentException(new MissingDependencyException("uri " + uri + " not found in repository"));
        }
        return uri;
    }
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 (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

            if (repository.contains(artifact)) {
                File file = repository.getLocation(artifact);
                return file;
            }
        }
        throw new MissingDependencyException(artifact);
    }
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.