Package org.apache.geronimo.kernel.repository

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


    }

    private static List toDependencyTypes(Collection artifacts) {
        List dependencies = new ArrayList();
        for (Iterator iterator = artifacts.iterator(); iterator.hasNext();) {
            Dependency dependency = (Dependency) iterator.next();
            ArtifactType artifactType = toDependencyType(dependency);
            dependencies.add(artifactType);
        }
        return dependencies;
    }
View Full Code Here


    private static LinkedHashSet toDependencies(DependencyType[] dependencyArray) {
        LinkedHashSet dependencies = new LinkedHashSet();
        for (int i = 0; i < dependencyArray.length; i++) {
            DependencyType artifactType = dependencyArray[i];
            Dependency dependency = toDependency(artifactType);
            dependencies.add(dependency);
        }
        return dependencies;
    }
View Full Code Here

    }

    private static Dependency toDependency(DependencyType dependencyType) {
        Artifact artifact = toArtifact(dependencyType, null);
        if (ImportType.CLASSES.equals(dependencyType.getImport())) {
            return new Dependency(artifact, org.apache.geronimo.kernel.repository.ImportType.CLASSES);
        } else if (ImportType.SERVICES.equals(dependencyType.getImport())) {
            return new Dependency(artifact, org.apache.geronimo.kernel.repository.ImportType.SERVICES);
        } else if (dependencyType.getImport() == null) {
            return new Dependency(artifact, org.apache.geronimo.kernel.repository.ImportType.ALL);
        } else {
            throw new IllegalArgumentException("Unknown import type: " + dependencyType.getImport());
        }
    }
View Full Code Here

        return false;
    }

    protected boolean matchesDefaultEnvironment(Environment environment) {
        for (Iterator iterator = defaultEnvironment.getDependencies().iterator(); iterator.hasNext();) {
            Dependency defaultDependency = (Dependency) iterator.next();
            boolean matches = false;
            for (Iterator iterator1 = environment.getDependencies().iterator(); iterator1.hasNext();) {
                Dependency actualDependency = (Dependency) iterator1.next();
                if (matches(defaultDependency, actualDependency)) {
                    matches = true;
                    break;
                }
            }
View Full Code Here

    }
    private void toDependencies(List<String> artifacts, List<DependencyType> result) {
        result.clear();
        for (String artifact : artifacts) {
            //TODO this is wrong.... need to encode import type as well
            result.add(PluginInstallerGBean.toDependencyType(new Dependency(Artifact.create(artifact), ImportType.ALL), true));
        }
    }
View Full Code Here

        Environment environment = configurationData.getEnvironment();

        LinkedHashSet<Artifact> parentIds = new LinkedHashSet<Artifact>();
        List<Dependency> dependencies = new ArrayList<Dependency>(environment.getDependencies());
        for (ListIterator<Dependency> iterator = dependencies.listIterator(); iterator.hasNext();) {
            Dependency dependency = iterator.next();
            Artifact resolvedArtifact = artifactResolver.resolveInClassLoader(dependency.getArtifact());
            if (isConfiguration(resolvedArtifact)) {
                parentIds.add(resolvedArtifact);

                // update the dependency list to contain the resolved artifact
                dependency = new Dependency(resolvedArtifact, dependency.getImportType());
                iterator.set(dependency);
            } else if (dependency.getImportType() == ImportType.SERVICES) {
                // Service depdendencies require that the depdencency be a configuration
                throw new InvalidConfigException("Dependency does not have services: " + resolvedArtifact);
            }
        }
View Full Code Here

   
    public void testTransformDependencies() throws Exception {
        startVerification();
       
        Environment environment = configurationData.getEnvironment();
        environment.addDependency(new Dependency(new Artifact("group", "artifactToRemove", "1.0", "jar"), ImportType.ALL));

        transformer.transformDependencies(configurationData);
       
        List<Dependency> newDependencies = environment.getDependencies();
        assertEquals(1, newDependencies.size());
        Dependency newDependency = newDependencies.get(0);
        assertEquals(new Artifact("group", "artifactToAdd", "1.0", "jar"), newDependency.getArtifact());
        assertSame(ImportType.SERVICES, newDependency.getImportType());
       
        assertSame(transformer, configurationData.getConfigurationDataTransformer());
    }
View Full Code Here

    }

    private static List<DependencyType> toDependencyTypes(Collection artifacts) {
        List<DependencyType> dependencies = new ArrayList<DependencyType>();
        for (Iterator iterator = artifacts.iterator(); iterator.hasNext();) {
            Dependency dependency = (Dependency) iterator.next();
            DependencyType artifactType = toDependencyType(dependency);
            dependencies.add(artifactType);
        }
        return dependencies;
    }
View Full Code Here

    private static LinkedHashSet<Dependency> toDependencies(DependencyType[] dependencyArray) {
        LinkedHashSet<Dependency> dependencies = new LinkedHashSet<Dependency>();
        for (int i = 0; i < dependencyArray.length; i++) {
            DependencyType artifactType = dependencyArray[i];
            Dependency dependency = toDependency(artifactType);
            dependencies.add(dependency);
        }
        return dependencies;
    }
View Full Code Here

    }

    private static Dependency toDependency(DependencyType dependencyType) {
        Artifact artifact = toArtifact(dependencyType, null);
        if (ImportType.CLASSES.equals(dependencyType.getImport())) {
            return new Dependency(artifact, org.apache.geronimo.kernel.repository.ImportType.CLASSES);
        } else if (ImportType.SERVICES.equals(dependencyType.getImport())) {
            return new Dependency(artifact, org.apache.geronimo.kernel.repository.ImportType.SERVICES);
        } else if (dependencyType.getImport() == null) {
            return new Dependency(artifact, org.apache.geronimo.kernel.repository.ImportType.ALL);
        } else {
            throw new IllegalArgumentException("Unknown import type: " + dependencyType.getImport());
        }
    }
View Full Code Here

TOP

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

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.