Package org.apache.ivy.core.cache

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


        return style;
    }
   
    private String getOutputPattern(String conf, String ext) {
        if (mRevId == null) {
            ResolutionCacheManager cacheMgr = getIvyInstance().getResolutionCacheManager();
           
            XmlReportParser parser = new XmlReportParser();
            File reportFile = cacheMgr.getConfigurationResolveReportInCache (resolveId, conf);
           
            try {
                parser.parse(reportFile);
            } catch (ParseException e) {
                throw new BuildException(
View Full Code Here


            outputpattern, mRevId.getOrganisation(), mRevId.getName(),
            mRevId.getRevision(), "", "", ext, conf, mRevId.getAttributes(), null);
    }

    private void genStyled(String[] confs, File style, String ext) throws IOException {
        ResolutionCacheManager cacheMgr = getIvyInstance().getResolutionCacheManager();

        // process the report with xslt to generate dot file
        File out;
        if (todir != null) {
            out = todir;
        } else {
            out = getProject().getBaseDir();
        }
       
        InputStream xsltStream = null;
        try {
            // create stream to stylesheet
            xsltStream = new BufferedInputStream(new FileInputStream(style));
            Source xsltSource = new StreamSource(xsltStream, JAXPUtils.getSystemId(style));
           
            // create transformer
            TransformerFactory tFactory = TransformerFactory.newInstance();
            Transformer transformer = tFactory.newTransformer(xsltSource);
           
            // add standard parameters
            transformer.setParameter("confs", conf);
            transformer.setParameter("extension", xslext);
           
            // add the provided XSLT parameters
            for (Iterator it = params.iterator(); it.hasNext();) {
                XSLTProcess.Param param = (XSLTProcess.Param) it.next();
                transformer.setParameter(param.getName(), param.getExpression());
            }
           
            // create the report
            for (int i = 0; i < confs.length; i++) {
                File reportFile =
                    cacheMgr.getConfigurationResolveReportInCache (resolveId, confs[i]);
                File outFile =
                    new File(out, getOutputPattern(confs[i], ext));
               
                log("Processing " + reportFile + " to " + outFile);
               
View Full Code Here

    }

    private File getStylePath(String styleResourceName) throws IOException {
        // style should be a file (and not an url)
        // so we have to copy it from classpath to cache
        ResolutionCacheManager cacheMgr = getIvyInstance().getResolutionCacheManager();
        File style = new File(cacheMgr.getResolutionCacheRoot(), styleResourceName);
        FileUtil.copy(XmlReportOutputter.class.getResourceAsStream(styleResourceName), style, null);
        return style;
    }
View Full Code Here

            }
           
            HashSet rconfsSet = new HashSet(Arrays.asList(rconfs));
           
            // for each resolved configuration, check if the report still exists
            ResolutionCacheManager cache = getSettings().getResolutionCacheManager();
            for (Iterator it = rconfsSet.iterator(); it.hasNext();) {
                String resolvedConf = (String) it.next();
                String resolveId = getResolveId();
                if (resolveId == null) {
                    resolveId = ResolveOptions.getDefaultResolveId(reference);
                }
                File report = cache.getConfigurationResolveReportInCache(resolveId, resolvedConf);
                if (!report.exists()) {
                    // the report doesn't exist any longer, we have to recreate it...
                    it.remove();
                }
            }
View Full Code Here

        if (options.getResolveId() == null) {
            options.setResolveId(ResolveOptions.getDefaultResolveId(moduleId));
        }

        ResolutionCacheManager cacheManager = getCache();
        String[] confs = getConfs(mrid, options);
        String destIvyPattern = IvyPatternHelper.substituteVariables(options.getDestIvyPattern(),
            settings.getVariables());

        // find what we must retrieve where

        // ArtifactDownloadReport source -> Set (String copyDestAbsolutePath)
        final Map artifactsToCopy = new HashMap();
        // String copyDestAbsolutePath -> Set (ArtifactRevisionId source)
        final Map conflictsMap = new HashMap();
        // String copyDestAbsolutePath -> Set (ArtifactDownloadReport source)
        final Map conflictsReportsMap = new HashMap();
        // String copyDestAbsolutePath -> Set (String conf)
        final Map conflictsConfMap = new HashMap();
       
        XmlReportParser parser = new XmlReportParser();
        for (int i = 0; i < confs.length; i++) {
            final String conf = confs[i];

            File report = cacheManager.getConfigurationResolveReportInCache(options.getResolveId(),
                conf);
            parser.parse(report);

            Collection artifacts = new ArrayList(Arrays.asList(parser.getArtifactReports()));
            if (destIvyPattern != null) {
View Full Code Here

            if (options.getCheckIfChanged()) {
                report.checkIfChanged();
            }

            // produce resolved ivy file and ivy properties in cache
            ResolutionCacheManager cacheManager = settings.getResolutionCacheManager();
            File ivyFileInCache = cacheManager.getResolvedIvyFileInCache(md
                    .getResolvedModuleRevisionId());
            md.toIvyFile(ivyFileInCache);

            // we store the resolved dependencies revisions and statuses per asked dependency
            // revision id,
            // for direct dependencies only.
            // this is used by the deliver task to resolve dynamic revisions to static ones
            File ivyPropertiesInCache = cacheManager.getResolvedIvyPropertiesInCache(
                        md.getResolvedModuleRevisionId());
            Properties props = new Properties();
            if (dependencies.length > 0) {
                Map forcedRevisions = new HashMap();
                for (int i = 0; i < dependencies.length; i++) {
View Full Code Here

     * This function might be 'heavy' because it may have to parse the previous
     * report.
     * @return
     */
    public void checkIfChanged() {
        ResolutionCacheManager cache = resolveEngine.getSettings().getResolutionCacheManager();
        String resolveId = options.getResolveId();
        File previousReportFile = cache.getConfigurationResolveReportInCache(resolveId, conf);
        if (previousReportFile.exists()) {
            try {
                XmlReportParser parser = new XmlReportParser();
                parser.parse(previousReportFile);
                List previousDeps = Arrays.asList(parser.getDependencyRevisionIds());
View Full Code Here

            if (!ivyFile.exists()) {
                throw new IllegalArgumentException("ivy file to publish not found for " + mrid
                        + ": call deliver before (" + ivyFile + ")");
            }
        } else {
            ResolutionCacheManager cacheManager = settings.getResolutionCacheManager();
            ivyFile = cacheManager.getResolvedIvyFileInCache(mrid);
            if (!ivyFile.exists()) {
                throw new IllegalStateException("ivy file not found in cache for " + mrid
                        + ": please resolve dependencies before publishing (" + ivyFile + ")");
            }
        }
View Full Code Here

            if (parent == null) {
                throw new ParseException("Unable to parse included ivy file for "
                        + parentOrganisation + "#" + parentModule + ";" + parentRevision, 0);
            }

            ResolutionCacheManager cacheManager = settings.getResolutionCacheManager();

            File ivyFileInCache = cacheManager.getResolvedIvyFileInCache(parent
                    .getResolvedModuleRevisionId());
            //Generate the parent cache file if necessary
            if (parent.getResource() != null
                    && !parent.getResource().getName().equals(ivyFileInCache.toURI().toString())) {
                try {
View Full Code Here

                }
            } catch (ParseException e) {
                throw new IllegalStateException("bad ivy file for " + mrid + ": " + ivyFile + ": " + e);
            }
        } else {
            ResolutionCacheManager cacheManager = settings.getResolutionCacheManager();
            try {
                md = cacheManager.getResolvedModuleDescriptor(mrid);
            } catch (ParseException e) {
                throw new IllegalStateException("bad ivy file in cache for " + mrid + ": " + e);
            }
            md.setResolvedModuleRevisionId(pubmrid);
        }
View Full Code Here

TOP

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

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.