Package org.apache.geronimo.kernel.repository

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


        InputStream in;
        LinkedList list = new LinkedList();
        list.addAll(Arrays.asList(repos));
        while (true) {
            if(list.isEmpty()) {
                throw new MissingDependencyException("Unable to download dependency "+artifact);
            }
            if(monitor != null) {
                monitor.setTotalBytes(-1); // Just to be sure
            }
            URL repository = (URL) list.removeFirst();
View Full Code Here


     * 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

    public void execute() throws MissingDependencyException, IOException {
        Artifact configId = new Artifact(groupId, artifactId, version, type);
        Repository sourceRepository = new Maven1Repository(sourceRepositoryFile);
        WriteableRepository targetRepository = new Maven2Repository(targetRepositoryFile);
        if (!sourceRepository.contains(configId)) {
            throw new MissingDependencyException("source repository at " + sourceRepositoryFile + " does not contain artifact " + configId);
        }
        if (!targetRepository.contains(configId)) {
            File sourceFile = sourceRepository.getLocation(configId);
            targetRepository.copyToRepository(sourceFile, configId, BaseConfigInstaller.LOG_COPY_START);
        }
View Full Code Here

            if (repository.contains(artifact)) {
                File file = repository.getLocation(artifact);
                return file;
            }
        }
        throw new MissingDependencyException("Unable to resolve dependency " + artifact);
    }
View Full Code Here

            return dependency;
        }

        // we need an artifact resolver at this point
        if (artifactResolver == null) {
            throw new MissingDependencyException("Artifact is not resolved and there no artifact resolver available: " + artifact);
        }

        // resolve the artifact
        artifact = artifactResolver.resolveInClassLoader(artifact, parents);
View Full Code Here

            if (repository.contains(artifact)) {
                File file = repository.getLocation(artifact);
                return file;
            }
        }
        throw new MissingDependencyException(artifact);
    }
View Full Code Here

        if (artifactResolver == null) {
            // if it is already resolved we are done
            if (artifact.isResolved()) {
                return dependency;
            }
            throw new MissingDependencyException("Artifact is not resolved and there no artifact resolver available: ", artifact, parentStack);
        }
       
        // resolve the artifact
        try {
            artifact = artifactResolver.resolveInClassLoader(artifact, parents);
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

                if (iter.hasNext()) {
                    buf.append(", ");
                }
            }
            buf.append(" to be installed");
            throw new MissingDependencyException(buf.toString(), null, (Artifact) null);
        }
    }
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

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.