Package org.rioproject.resolver

Examples of org.rioproject.resolver.Artifact


        Assert.assertTrue(a.getVersion().equals("2.0"));
    }

    @Test
    public void createGoodArtifactWithType() {
        Artifact a = new Artifact("org.foo:bar:oar:2.0");
        Assert.assertTrue(a.getGroupId().equals("org.foo"));
        Assert.assertTrue(a.getArtifactId().equals("bar"));
        Assert.assertTrue(a.getVersion().equals("2.0"));
        Assert.assertTrue(a.getType().equals("oar"));
    }
View Full Code Here


        Assert.assertTrue(a.getType().equals("oar"));
    }

    @Test
    public void createGoodArtifactWithClassifier() {
        Artifact a = new Artifact("org.foo:bar:jar:dl:2.0");
        Assert.assertTrue(a.getGroupId().equals("org.foo"));
        Assert.assertTrue(a.getArtifactId().equals("bar"));
        Assert.assertTrue(a.getVersion().equals("2.0"));
        Assert.assertTrue(a.getType().equals("jar"));
        Assert.assertTrue(a.getClassifier().equals("dl"));
    }
View Full Code Here

                remoteRepositories = transformRemoteRepository(request.getRepositories());
            }
            try {
                ResolutionResult result;
                if(remoteRepositories!=null) {
                    Artifact a = new Artifact(request.getArtifact());
                    result = service.resolve(a.getGroupId(),
                                             a.getArtifactId(),
                                             a.getType(),
                                             a.getClassifier(),
                                             a.getVersion(),
                                             remoteRepositories);
                } else {
                    DefaultArtifact a = new DefaultArtifact(request.getArtifact());
                    result = service.resolve(a.getGroupId(),
                                             a.getArtifactId(),
                                             a.getExtension(),
                                             a.getClassifier(),
                                             a.getVersion());
                }
                classPath = produceClassPathFromResolutionResult(result);
            } catch (RepositoryException e) {
                throw new ResolverException(e.getLocalizedMessage());
            } catch (SettingsBuildingException e) {
View Full Code Here

                final String chosen = chooser.getName();
                if (chosen == null)
                    return;
                boolean isArtifact = false;
                try {
                    new Artifact(chosen);
                    isArtifact = true;
                    lastArtifact = chosen;
                } catch (Exception e) {
                    /* don't need to print stack trace here */
                }
View Full Code Here

            if (action.getActionCommand().equals("Deploy")) {
                boolean canApprove = true;
                if(artifactHasBeenProvided()) {
                    String a = artifactField.getText();
                    try {
                        new Artifact(a);
                    } catch(Exception e) {
                        canApprove = false;
                        StringBuilder sb = new StringBuilder();
                        sb.append("<html><body>The artifact <font color=red>")
                        .append(a).append("</font> is not valid. The artifact <br>must be in the form of " +
View Full Code Here

        if(Artifact.isArtifact(args[0])) {
            logger.debug("Loading configuration {} as an artifact", args[0]);
            URL configLocation = null;
            try {
                Resolver resolver = ResolverHelper.getResolver();
                Artifact artifact = new Artifact(args[0]);
                configLocation = resolver.getLocation(artifact.getGAV(),
                                                      artifact.getType(),
                                                      service.getRemoteRepositories());
                return new String[]{new File(configLocation.toURI()).getPath()};
            } catch(ResolverException e) {
                throw new IOException("Could not resolve "+args[0], e);
            } catch (URISyntaxException e) {
View Full Code Here

    }

    private String getVersionFromArtifact(final String a) {
        String version = null;
        try {
            Artifact artifact = new Artifact(a);
            version =  artifact.getVersion();
        } catch(IllegalArgumentException e) {
            logger.warn("Unable to determine artifact version for {}", a);
        }
        return version;
    }
View Full Code Here

        if(path==null)
            throw new MalformedURLException("url has null path");

        ArtifactURLConfiguration configuration = new ArtifactURLConfiguration(path);
        String artifact = configuration.getArtifact();
        Artifact a;
        try {
            a = new Artifact(artifact);
        } catch(IllegalArgumentException e) {
            throw new MalformedURLException(e.getLocalizedMessage());
        }

        URL u;
        try {
            u = cache.get(a);
            if(u==null) {
                u = resolver.getLocation(artifact, a.getType(), configuration.getRepositories());
                cache.put(a, u);
                if(logger.isDebugEnabled())
                    logger.debug("Location of {} is {}", a, u==null?"<NULL>":u.toExternalForm());
            }
        } catch (ResolverException e) {
View Full Code Here

* Test creating an Artifact
*/
public class ArtifactCreationTest {
    @Test(expected = IllegalArgumentException.class)
    public void createBadArtifact() {
        new Artifact("http://foo:9000/foo.oar");
    }
View Full Code Here

        new Artifact("http://foo:9000/foo.oar");
    }

    @Test(expected = IllegalArgumentException.class)
    public void createBadArtifact2() {
        new Artifact("org/foo.foo:bar:2.0");
    }
View Full Code Here

TOP

Related Classes of org.rioproject.resolver.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.