Package org.apache.ivy.core.module.descriptor

Examples of org.apache.ivy.core.module.descriptor.DefaultArtifact


        ResolvedModuleRevision rmr = resolver.getDependency(new DefaultDependencyDescriptor(mrid,
                false), _data);
        assertNotNull(rmr);
        assertEquals(mrid, rmr.getId());

        DefaultArtifact artifact = new DefaultArtifact(mrid, rmr.getPublicationDate(),
                "commons-fileupload", "jar", "jar");
        DownloadReport report = resolver.download(new Artifact[] {artifact}, downloadOptions());
        assertNotNull(report);

        assertEquals(1, report.getArtifactsReports().length);
View Full Code Here


                "nanning-trace", "jar", "jar"), ExactPatternMatcher.INSTANCE, null));
        ResolvedModuleRevision rmr = resolver.getDependency(dd, _data);
        assertNotNull(rmr);
        assertEquals(mrid, rmr.getId());

        DefaultArtifact profiler = new DefaultArtifact(mrid, rmr.getPublicationDate(),
                "nanning-profiler", "jar", "jar");
        DefaultArtifact trace = new DefaultArtifact(mrid, rmr.getPublicationDate(),
                "nanning-trace", "jar", "jar");
        DownloadReport report = resolver.download(new Artifact[] {profiler, trace},
            downloadOptions());
        assertNotNull(report);
View Full Code Here

            null, moduleRevision.getQualifiedExtraAttributes(), null);
    }

    public static String substitute(String pattern, ModuleRevisionId moduleRevision,
            String artifact, String type, String ext) {
        return substitute(pattern, moduleRevision, new DefaultArtifact(moduleRevision, null,
                artifact, type, ext));
    }
View Full Code Here

        // Called by substituteTokens only if the original artifact name is needed
        public String toString() {
            if (origin == null) {
                ModuleRevisionId revId = ModuleRevisionId.newInstance(org, moduleName, branch,
                    revision, extraModuleAttributes);
                Artifact artifact = new DefaultArtifact(revId, null, artifactName, artifactType,
                        artifactExt, extraArtifactAttributes);

                // TODO cache: see how we could know which actual cache manager to use, since this
                // will fail when using a resolver in a chain with a specific cache manager
                RepositoryCacheManager cacheManager = IvyContext.getContext().getSettings()
View Full Code Here

        ModuleRevisionId mrid = ModuleRevisionId.newInstance("org1", "mod1.1", "1.0");
        ResolvedModuleRevision rmr = resolver.getDependency(new DefaultDependencyDescriptor(mrid,
                false), _data);
        assertNotNull(rmr);

        DefaultArtifact artifact = new DefaultArtifact(mrid, rmr.getPublicationDate(), "mod1.1",
                "jar", "jar");
        DownloadReport report = resolver.download(new Artifact[] {artifact}, downloadOptions());
        assertNotNull(report);

        assertEquals(1, report.getArtifactsReports().length);
View Full Code Here

                    }
                    String status = attributes.getValue("status");
                    String artifactName = attributes.getValue("name");
                    String type = attributes.getValue("type");
                    String ext = attributes.getValue("ext");
                    Artifact artifact = new DefaultArtifact(mrid, pubdate, artifactName, type, ext,
                            ExtendableItemHelper.getExtraAttributes(attributes, "extra-"));
                    ArtifactDownloadReport aReport = new ArtifactDownloadReport(artifact);
                    aReport.setDownloadStatus(DownloadStatus.fromString(status));
                    aReport.setDownloadDetails(attributes.getValue("details"));
                    aReport.setSize(Long.parseLong(attributes.getValue("size")));
View Full Code Here

            throw new IllegalStateException("Unknown packing type '" + packings[0]
                    + "' in the packing chain: " + packaging);
        }
        ext = packing.getUnpackedExtension(ext);

        DefaultArtifact unpacked = new DefaultArtifact(artifact.getModuleRevisionId(),
                artifact.getPublicationDate(), artifact.getName(),
                artifact.getType() + "_unpacked", ext);

        return unpacked;
    }
View Full Code Here

                    ArtifactRevisionId originArtifactId = ArtifactRevisionId.newInstance(
                        artifact.getModuleRevisionId(), origName, origType, origExt);
                    // second check: verify the hashcode of the cached artifact
                    if (m.group(4).equals("" + originArtifactId.hashCode())) {
                        try {
                            artifact = new DefaultArtifact(originArtifactId,
                                    artifact.getPublicationDate(), new URL(location), true);
                        } catch (MalformedURLException e) {
                            Message.debug(e);
                        }
                    }
                }
            } else {
                // Fallback if cached with old version:

                // if the origin artifact has another extension (e.g. .pom) then make a synthetic
                // origin artifact for it
                if (!location.endsWith("." + artifact.getExt())) {
                    // try to find other cached artifact info with same location. This must be the
                    // origin. We must parse the key as we do not know for sure what the original
                    // artifact is named.
                    Iterator it = cdf.entrySet().iterator();
                    String ownLocationKey = getLocationKey(artifact);
                    while (it.hasNext()) {
                        Map.Entry entry = (Map.Entry) it.next();
                        if (entry.getValue().equals(location)
                                && !ownLocationKey.equals(entry.getKey())) {
                            // found a match, key is
                            // artifact:[name]#[type]#[ext]#[hashcode].location
                            java.util.regex.Matcher m = ARTIFACT_KEY_PATTERN.matcher((String) entry
                                    .getKey());
                            if (m.matches()) {
                                String origName = m.group(1);
                                String origType = m.group(2);
                                String origExt = m.group(3);

                                // first check: the type should end in .original
                                if (!origType.endsWith(".original")) {
                                    continue;
                                }

                                ArtifactRevisionId originArtifactId = ArtifactRevisionId
                                        .newInstance(artifact.getModuleRevisionId(), origName,
                                            origType, origExt);
                                // second check: verify the hashcode of the cached artifact
                                if (m.group(4).equals("" + originArtifactId.hashCode())) {
                                    try {
                                        artifact = new DefaultArtifact(originArtifactId,
                                                artifact.getPublicationDate(), new URL(location),
                                                true);
                                    } catch (MalformedURLException e) {
                                        Message.debug(e);
                                    }
View Full Code Here

        settings.addResolver(chain);

        MockMessageLogger mockLogger = new MockMessageLogger();
        IvyContext.getContext().getIvy().getLoggerEngine().setDefaultLogger(mockLogger);
        DownloadReport report = chain.download(
            new Artifact[] {new DefaultArtifact(ModuleRevisionId.parse("org1#mod1.1;1.0"),
                    new Date(), "mod1.1", "jar", "jar")}, new DownloadOptions());
        assertNotNull(report);
        assertEquals(1, report.getArtifactsReports().length);
        assertEquals(DownloadStatus.SUCCESSFUL, report.getArtifactsReports()[0].getDownloadStatus());
        mockLogger.assertLogDoesntContain("[FAILED     ] org1#mod1.1;1.0!mod1.1.jar");
View Full Code Here

                        IvyDEMessage.verbose("\t\tmatched (version are ignored)");
                    } else {
                        IvyDEMessage.verbose("\t\tversion matched");
                    }

                    Artifact af = new DefaultArtifact(md.getModuleRevisionId(),
                            md.getPublicationDate(), p.getFullPath().toString(),
                            ECLIPSE_PROJECT_TYPE, ECLIPSE_PROJECT_EXTENSION);

                    DependencyArtifactDescriptor[] dArtifacts = dd.getAllDependencyArtifacts();
                    if (dArtifacts != null) {
View Full Code Here

TOP

Related Classes of org.apache.ivy.core.module.descriptor.DefaultArtifact

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.