Examples of ArtifactOrigin


Examples of org.apache.ivy.core.cache.ArtifactOrigin

                String[] confs = rmr.getDescriptor().getConfigurationsNames();
                for (int i = 0; i < confs.length; i++) {
                    Artifact[] arts = rmr.getDescriptor().getArtifacts(confs[i]);
                    for (int j = 0; j < arts.length; j++) {
                        Artifact transformedArtifact = toSystem(arts[j]);
                        ArtifactOrigin origin = data.getCacheManager().getSavedArtifactOrigin(transformedArtifact);
            File artFile = data.getCacheManager().getArchiveFileInCache(transformedArtifact, origin, false);
                        if (artFile.exists()) {
                            Message.debug("deleting "+artFile);
                            artFile.delete();
                        }
View Full Code Here

Examples of org.apache.ivy.core.cache.ArtifactOrigin

          final ArtifactDownloadReport adr = new ArtifactDownloadReport(artifacts[i]);
          dr.addArtifactReport(adr);
          if (eventManager != null) {
            eventManager.fireIvyEvent(new NeedArtifactEvent(this, artifacts[i]));
          }
          ArtifactOrigin origin = cacheManager.getSavedArtifactOrigin(artifacts[i]);
          // if we can use origin file, we just ask ivy for the file in cache, and it will return
          // the original one if possible. If we are not in useOrigin mode, we use the getArchivePath
          // method which always return a path in the actual cache
          File archiveFile = cacheManager.getArchiveFileInCache(artifacts[i], origin, options.isUseOrigin());

          if (archiveFile.exists()) {
            Message.verbose("\t[NOT REQUIRED] "+artifacts[i]);
            adr.setDownloadStatus(DownloadStatus.NO)
            adr.setSize(archiveFile.length());
            adr.setArtifactOrigin(origin);
          } else {
            Artifact artifact = fromSystem(artifacts[i]);
            if (!artifact.equals(artifacts[i])) {
              Message.verbose("\t"+getName()+"looking for artifact "+artifact+ " (is "+artifacts[i]+" in system namespace)");
            }
            long start = System.currentTimeMillis();
            try {
              ResolvedResource artifactRef = getArtifactRef(artifact, null);
              if (artifactRef != null) {
                origin = new ArtifactOrigin(artifactRef.getResource().isLocal(), artifactRef.getResource().getName());
                if (useOrigin && artifactRef.getResource().isLocal()) {
                  Message.verbose("\t[NOT REQUIRED] "+artifacts[i]);
                  cacheManager.saveArtifactOrigin(artifacts[i], origin);
                  archiveFile = cacheManager.getArchiveFileInCache(artifacts[i], origin);
                  adr.setDownloadStatus(DownloadStatus.NO)
View Full Code Here

Examples of org.apache.ivy.core.cache.ArtifactOrigin

        _report = report;
        addAttribute("resolver", _resolver.getName());
        addAttribute("status", _report.getDownloadStatus().toString());
        addAttribute("size", String.valueOf(_report.getSize()));
        addAttribute("file", dest.getAbsolutePath());
        ArtifactOrigin origin = report.getArtifactOrigin();
        if (origin != null) {
          addAttribute("origin", _report.getArtifactOrigin().getLocation());
          addAttribute("local", String.valueOf(_report.getArtifactOrigin().isLocal()));
        } else {
            addAttribute("origin", "");
View Full Code Here

Examples of org.apache.ivy.core.cache.ArtifactOrigin

        artifactAttrs.addAttribute(null, "type", "type", "CDATA", artifact.getType());
        saxHandler.startElement(null, "artifact", "artifact", artifactAttrs);
    }

    private void writeOriginLocationIfPresent(CacheManager cache, TransformerHandler saxHandler, Artifact artifact) throws IOException, SAXException {
      ArtifactOrigin origin = cache.getSavedArtifactOrigin(artifact);
      if (origin != null) {
        String originName = origin.getLocation();
        boolean isOriginLocal = origin.isLocal();

        String originLocation;
            AttributesImpl originLocationAttrs = new AttributesImpl();
            if (isOriginLocal) {
                originLocationAttrs.addAttribute(null, "is-local", "is-local", "CDATA", "true");
View Full Code Here

Examples of org.apache.ivy.core.cache.ArtifactOrigin

            saxHandler.endElement(null, "origin-location", "origin-location");
        }
    }

    private void writeCacheLocation(CacheManager cache, TransformerHandler saxHandler, Artifact artifact) throws SAXException {
      ArtifactOrigin origin = cache.getSavedArtifactOrigin(artifact);
        File archiveInCacheFile = cache.getArchiveFileInCache(artifact, origin, false);
        StringBuffer archiveInCachePathWithSlashes = new StringBuffer(1000);
        replaceFileSeparatorWithSlash(archiveInCacheFile, archiveInCachePathWithSlashes);

        saxHandler.startElement(null, "cache-location", "cache-location", new AttributesImpl());
View Full Code Here

Examples of org.apache.ivy.core.cache.ArtifactOrigin

            DependencyResolver resolver = parserSettings.getResolver(mrid);
           
            if (resolver != null) {
                DefaultArtifact artifact = new DefaultArtifact(
                                    mrid, new Date(), artifactId, "jar", "jar");
                ArtifactOrigin artifactOrigin = resolver.locate(artifact);
               
                if (!ArtifactOrigin.isUnknown(artifactOrigin)) {
                    mainArtifact = artifact;
                    ivyModuleDescriptor.addArtifact("master", mainArtifact);
                }
View Full Code Here

Examples of org.apache.ivy.core.cache.ArtifactOrigin

        String expectedLocation = new File("test/repositories/1/org1/mod1.2/jars/mod1.2-2.0.jar")
                .getAbsolutePath();

        // verify the origin in the report
        ArtifactOrigin reportOrigin = dReports[0].getArtifactOrigin();
        assertNotNull(reportOrigin);
        assertEquals("isLocal for artifact not correct", true, reportOrigin.isLocal());
        assertEquals("location for artifact not correct", expectedLocation, reportOrigin
                .getLocation());

        // verify the saved origin on disk
        ArtifactOrigin ivyOrigin = getSavedArtifactOrigin(artifact);
        assertNotNull(ivyOrigin);
        assertEquals("isLocal for artifact not correct", true, ivyOrigin.isLocal());
        assertEquals("location for artifact not correct", expectedLocation, ivyOrigin.getLocation());

        // now resolve the same artifact again and verify the origin of the (not-downloaded)
        // artifact
        report = ivy.resolve(new File("test/repositories/1/org1/mod1.1/ivys/ivy-1.0.xml").toURL(),
            getResolveOptions(new String[] {"default"}));
View Full Code Here

Examples of org.apache.ivy.core.cache.ArtifactOrigin

        assertNotNull(artifact);

        String expectedLocation = new File("test/repositories/1/org1/mod1.2/jars/mod1.2-2.0.jar")
                .getAbsolutePath();

        ArtifactOrigin origin = getSavedArtifactOrigin(artifact);
        File artInCache = new File(cache, getArchivePathInCache(artifact, origin));
        assertFalse("should not download artifact in useOrigin mode.", artInCache.exists());
        assertEquals("location for artifact not correct.", expectedLocation,
                getArchiveFileInCache(artifact).getAbsolutePath());
    }
View Full Code Here

Examples of org.apache.ivy.core.cache.ArtifactOrigin

        String expectedLocation = new File("test/repositories/1/org1/mod1.2/jars/mod1.2-2.0.jar")
                .getAbsolutePath();

        // verify the origin in the report
        ArtifactOrigin reportOrigin = dReports[0].getArtifactOrigin();
        assertNotNull(reportOrigin);
        assertEquals("isLocal for artifact not correct", true, reportOrigin.isLocal());
        assertEquals("location for artifact not correct", expectedLocation, reportOrigin
                .getLocation());

        // verify the saved origin on disk
        ArtifactOrigin ivyOrigin = getSavedArtifactOrigin(artifact);
        assertNotNull(ivyOrigin);
        assertEquals("isLocal for artifact not correct", true, ivyOrigin.isLocal());
        assertEquals("location for artifact not correct", expectedLocation, ivyOrigin.getLocation());

        // now resolve the same artifact again and verify the origin of the (not-downloaded)
        // artifact
        report = ivy.resolve(new File("test/repositories/1/org1/mod1.1/ivys/ivy-1.0.xml").toURL(),
            getResolveOptions(new String[] {"default"}));
View Full Code Here

Examples of org.apache.ivy.core.cache.ArtifactOrigin

        assertNotNull(artifact);

        String expectedLocation = new File("test/repositories/1/org1/mod1.2/jars/mod1.2-2.0.jar")
                .getAbsolutePath();

        ArtifactOrigin origin = getSavedArtifactOrigin(artifact);
        File artInCache = new File(cache, getArchivePathInCache(artifact, origin));
        assertFalse("should not download artifact in useOrigin mode.", artInCache.exists());
        assertEquals("location for artifact not correct.", expectedLocation,
                getArchiveFileInCache(artifact).getAbsolutePath());
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.