Package org.apache.tuscany.spi.services.artifact

Examples of org.apache.tuscany.spi.services.artifact.Artifact


        URLClassLoader urlc = new URLClassLoader(new URL[] {warUrl});
       
        URL repoUrl = urlc.getResource("WEB-INF/tuscany/");
        WarRepositoryHelper warRepositoryHelper = new WarRepositoryHelper(repoUrl);
       
        Artifact artifact = new Artifact();
        artifact.setGroup("commons-httpclient");
        artifact.setName("commons-httpclient");
        artifact.setVersion("3.0");
       
        warRepositoryHelper.resolveTransitively(artifact);
        assertEquals(4, artifact.getUrls().size());
       
    }
View Full Code Here


            public boolean isOnline() {
                return false;
            }
        });
        Artifact artifact = new Artifact();
        artifact.setGroup("junit");
        artifact.setName("junit");
        artifact.setVersion("3.8.1");
        artifact.setType("jar");

        repository.resolve(artifact);

        Set<URL> urls = artifact.getUrls();
       
        System.err.println(urls);

        assertEquals(1, urls.size());
View Full Code Here

            public boolean matches(Object object) {
                if (!(object instanceof Artifact)) {
                    return false;
                }

                Artifact artifact = (Artifact) object;
                boolean match = group.equals(artifact.getGroup()) &&
                    name.equals(artifact.getName()) &&
                    version.equals(artifact.getVersion()) &&
                    "jar".equals(artifact.getType());
                if (match) {
                    artifact.setUrl(url);
                }
                return match;
            }

            public void appendTo(StringBuffer stringBuffer) {
View Full Code Here

    public Dependency load(CompositeComponent parent,
                           XMLStreamReader reader,
                           DeploymentContext deploymentContext)
        throws XMLStreamException, LoaderException {

        Artifact artifact = new Artifact();
        while (reader.nextTag() == XMLStreamConstants.START_ELEMENT) {
            QName name = reader.getName();
            String text = reader.getElementText();
            if (GROUP.equals(name)) {
                artifact.setGroup(text);
            } else if (NAME.equals(name)) {
                artifact.setName(text);
            } else if (VERSION.equals(name)) {
                artifact.setVersion(text);
            } else if (CLASSIFIER.equals(name)) {
                artifact.setClassifier(text);
            } else if (TYPE.equals(name)) {
                artifact.setType(text);
            }
        }
        Dependency dependency = new Dependency();
        dependency.setArtifact(artifact);
        return dependency;
View Full Code Here

            try {
                if(artName.equals(rootArtifact.getName())) {
                    rootArtifact.setUrl(new URL(reporsitoryUrl, dep));
                } else {     
                    Artifact depArtifact = new Artifact();
                    depArtifact.setGroup(tokens[0]);
                    depArtifact.setName(tokens[1]);
                    depArtifact.setVersion(tokens[2]);
                    depArtifact.setUrl(new URL(reporsitoryUrl, dep));
                    rootArtifact.addDependency(depArtifact);
                   
                }
            } catch (MalformedURLException ex) {
                throw new TuscanyDependencyException(ex);
View Full Code Here

            } catch (MalformedURLException e) {
                throw new AssertionError("Could not convert URL to a jar: url");
            }
            impl.setClassLoader(new CompositeClassLoader(new URL[]{jarUrl}, deploymentContext.getClassLoader()));
        } else if (artifactRepository != null && group != null && version != null) {
            Artifact artifact = new Artifact();
            artifact.setGroup(group);
            artifact.setName(name);
            artifact.setVersion(version);
            artifact.setType("jar");
            artifactRepository.resolve(artifact);
            if (artifact.getUrl() == null) {
                MissingResourceException mre = new MissingResourceException(artifact.toString());
                mre.setIdentifier(name);
                throw mre;
            }
            try {
                impl.setScdlLocation(new URL("jar:" + artifact.getUrl() + "!/META-INF/sca/default.scdl"));
            } catch (MalformedURLException e) {
                throw new AssertionError(e);
            }
            Set<URL> artifactURLs = artifact.getUrls();
            URL[] urls = new URL[artifactURLs.size()];
            int i = 0;
            for (URL artifactURL : artifactURLs) {
                urls[i++] = artifactURL;
            }
View Full Code Here

                    metadataSource);

            // Add the artifacts to the deployment unit
            for (Object obj : result.getArtifacts()) {
                org.apache.maven.artifact.Artifact depArtifact = (org.apache.maven.artifact.Artifact) obj;
                Artifact artifact = new Artifact();
                artifact.setName(mavenRootArtifact.getArtifactId());
                artifact.setGroup(mavenRootArtifact.getGroupId());
                artifact.setType(mavenRootArtifact.getType());
                artifact.setClassifier(mavenRootArtifact.getClassifier());
                artifact.setUrl(depArtifact.getFile().toURL());
                rootArtifact.addDependency(artifact);
            }

        } catch (ArtifactMetadataRetrievalException ex) {
            return false;
View Full Code Here

                    } else if (o instanceof ComponentDefinition<?>) {
                        composite.add((ComponentDefinition<? extends Implementation<?>>) o);
                    } else if (o instanceof Include) {
                        composite.add((Include) o);
                    } else if (o instanceof Dependency) {
                        Artifact artifact = ((Dependency) o).getArtifact();
                        if (artifactRepository != null) {
                            // default to jar type if not specified
                            if (artifact.getType() == null) {
                                artifact.setType("jar");
                            }
                            artifactRepository.resolve(artifact);
                        }
                        if (artifact.getUrl() != null) {
                            ClassLoader classLoader = deploymentContext.getClassLoader();
                            if (classLoader instanceof CompositeClassLoader) {
                                CompositeClassLoader ccl = (CompositeClassLoader)classLoader;
                                for (URL dep : artifact.getUrls()) {
                                    ccl.addURL(dep);
                                }
                            }
                        }
                    } else {
View Full Code Here

    protected void setUp() throws Exception {
        super.setUp();
        repo = new LocalMavenRepository(".m2/repository");

        artifact = new Artifact();
        artifact.setGroup("junit");
        artifact.setName("junit");
        artifact.setVersion(VERSION);
        artifact.setType("jar");
        path = "junit/junit/" + VERSION + "/junit-" + VERSION + ".jar";
View Full Code Here

TOP

Related Classes of org.apache.tuscany.spi.services.artifact.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.