Package org.apache.ivy.core.cache

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


  }

 
  public CacheManager getCacheManager(File cache) {
    //TODO : reuse instance
    CacheManager cacheManager = new CacheManager(_settings, cache);
    return cacheManager;
  }
View Full Code Here


      _settings = new IvySettings();
        _engine = new ResolveEngine(_settings, new EventManager(), new SortEngine(_settings));
        _cache = new File("build/cache");
        _data = new ResolveData(_engine, new ResolveOptions().setCache(CacheManager.getInstance(_settings, _cache)));
        _cache.mkdirs();
        _cacheManager = new CacheManager(_settings, _cache);
        _settings.setDefaultCache(_cache);
    }
View Full Code Here

        assertEquals(pubdate, rmr.getPublicationDate());
       
       
        // test to ask to download
        DefaultArtifact artifact = new DefaultArtifact(mrid, pubdate, "mod1.1", "jar", "jar");
        DownloadReport report = resolver.download(new Artifact[] {artifact}, new DownloadOptions(_settings, new CacheManager(_settings, _cache), null, true));
        assertNotNull(report);
       
        assertEquals(1, report.getArtifactsReports().length);
       
        ArtifactDownloadReport ar = report.getArtifactReport(artifact);
View Full Code Here

       
        // verify that the module in the default cache doesn't exist
        assertEquals("Default cache is not empty", _cache.list().length, 0);
       
        // verify the artifact does exist in the non-default cache.
        CacheManager nonDefaultManager = _ivy.getCacheManager(cache2);
          assertTrue(TestHelper.getArchiveFileInCache(nonDefaultManager, "org1", "mod1.1", "1.0", "mod1.1", "jar", "jar").exists());
          assertTrue(nonDefaultManager.getResolvedIvyFileInCache(resolvedModule).exists());
          assertTrue(nonDefaultManager.getResolvedIvyPropertiesInCache(resolvedModule).exists());
          assertNotNull(nonDefaultManager.getSavedArtifactOrigin((Artifact) report.getArtifacts().get(0)));
      } finally {
        // delete the non-default cache
            Delete del = new Delete();
            del.setProject(new Project());
            del.setDir(new File("build/cache2"));
View Full Code Here

          }
        }
        try {
            Path path = new Path(getProject());
            getProject().addReference(_pathid, path);
          CacheManager cache = getCacheManager();
            for (Iterator iter = getArtifacts().iterator(); iter.hasNext();) {
              Artifact a = (Artifact) iter.next();
              path.createPathElement().setLocation(cache.getArchiveFileInCache(a, cache.getSavedArtifactOrigin(a), isUseOrigin()));
            }
        } catch (Exception ex) {
            throw new BuildException("impossible to build ivy path: "+ex, ex);
        }
       
View Full Code Here

      _md = md;
      _conf = conf;
      _date = date;

    // parse previous deps from previous report file if any
      CacheManager cache = options.getCache();
      String resolveId = options.getResolveId();
        File previousReportFile = cache.getConfigurationResolveReportInCache(resolveId, conf);
    if (previousReportFile.exists()) {
      try {
        XmlReportParser parser = new XmlReportParser();
        parser.parse(previousReportFile);
        _previousDeps = Arrays.asList(parser.getDependencyRevisionIds());
View Full Code Here

            List paths = getArtifacts();
            if (paths.isEmpty()) {
                NameEntry ne = fileset.createExclude();
                ne.setName("**/*");
            } else {
              CacheManager cache = getCacheManager();
                for (Iterator iter = paths.iterator(); iter.hasNext();) {
                  Artifact a = (Artifact)iter.next();
                    NameEntry ne = fileset.createInclude();
                    ne.setName(cache.getArchivePathInCache(a, cache.getSavedArtifactOrigin(a)));
                }
            }
        } catch (Exception ex) {
            throw new BuildException("impossible to build ivy cache fileset: "+ex, ex);
        }       
View Full Code Here

    /**
     * Default implementation actually download the artifact
     * Subclasses should overwrite this to avoid the download
     */
    public boolean exists(Artifact artifact) {
        DownloadReport dr = download(new Artifact[] {artifact}, new DownloadOptions(getSettings(), new CacheManager(getSettings(), getSettings().getDefaultCache()), null, true));
        ArtifactDownloadReport adr = dr.getArtifactReport(artifact);
        return adr.getDownloadStatus() != DownloadStatus.FAILED;
    }
View Full Code Here

  private CacheManager _cacheManager;
  private EventManager _eventManager = null; // can be null
  private boolean _useOrigin = false;

  public DownloadOptions(IvySettings settings, File cache) {
    this(settings, new CacheManager(settings, cache));
  }
View Full Code Here

            throw new BuildException("impossible to generate report: "+e, e);
        }
    }
   
    private void genxml(File cache, String organisation, String module, String[] confs) throws IOException {
      CacheManager cacheMgr = getIvyInstance().getCacheManager(_cache);
      for (int i = 0; i < confs.length; i++) {
          File xml = cacheMgr.getConfigurationResolveReportInCache(_resolveId, confs[i]);

            File out;
            if (_todir != null) {
              out = new File(_todir, IvyPatternHelper.substitute(_outputpattern, organisation, module, "", "", "", "xml", confs[i]));
            } else {
View Full Code Here

TOP

Related Classes of org.apache.ivy.core.cache.CacheManager

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.