Examples of XMLReportParser


Examples of org.apache.ivy.plugins.report.XmlReportParser

                ResolveOptions.getDefaultResolveId(md), confs[i]);
            parsingOk = false;
            if (report.exists()) {
                // found a report, try to parse it.
                try {
                    XmlReportParser parser = new XmlReportParser();
                    parser.parse(report);
                    all.addAll(Arrays.asList(parser.getArtifactReports()));
                    parsingOk = true;
                    findAllArtifactOnRefresh(parser);
                } catch (ParseException e) {
                    Message.info("\n\nIVYDE: Error while parsing the report " + report
                            + ". Falling back by doing a resolve again.");
View Full Code Here

Examples of org.apache.ivy.plugins.report.XmlReportParser

            List<ModuleDescriptor> dependencies = new ArrayList<ModuleDescriptor>();

            // first, let's resolve the ant scripts, just the scripts, not their possible jar dependencies, thus only
            // the configuration "default"

            XmlReportParser xmlreport = null;
            if (!refresh) {
                // first try to relad the resolve from the last report
                xmlreport = getResolveReport(ivy, md.getModuleRevisionId().getModuleId(), "default", ivyfile);
            }
            if (xmlreport != null) {
                // collect the ant scripts
                artifacts = xmlreport.getArtifactReports();

                // collect the descriptor associated with each ant script
                ModuleRevisionId[] depIds = xmlreport.getDependencyRevisionIds();
                for (int i = 0; i < depIds.length; i++) {
                    File depIvyFile = xmlreport.getMetadataArtifactReport(depIds[i]).getLocalFile();
                    dependencies.add(getMd(ivy, depIvyFile));
                }
            } else {
                // do a full resolve

                // if in a retrieved setup, clean the repo and repopulate it
                maybeClearLocalRepo();
                maybeRetrieve(md, "default");

                // launch the actual resolve
                ResolveReport resolveReport = resolve(ivy, md, "default");
                ConfigurationResolveReport confReport = resolveReport.getConfigurationReport("default");

                // collect the ant scripts
                artifacts = confReport.getAllArtifactsReports();

                // collect the descriptor associated with each ant script
                Set<ModuleRevisionId> mrids = confReport.getModuleRevisionIds();
                for (ModuleRevisionId mrid : mrids) {
                    dependencies.add(confReport.getDependency(mrid).getDescriptor());
                }
            }

            int nbPaths = 1;

            // save the collection of ant scripts as a path
            Path antScriptsPath = makePath("easyant.antscripts", sortArtifacts(ivy, artifacts, dependencies));

            // now, for each ant script descriptor, search for an ivy configuration which is used by the ant script
            // itself

            for (ModuleDescriptor depmd : dependencies) {
                log("Searching for external conf for " + depmd.getModuleRevisionId(), Project.MSG_VERBOSE);
                String[] confs = depmd.getConfigurationsNames();
                log("configurations for " + depmd.getModuleRevisionId() + " : " + Arrays.toString(confs),
                        Project.MSG_DEBUG);

                // some trick here: launching a resolve on a module won't resolve the artifacts of the module itself but
                // only of its dependencies. So we'll create a mock one which will depend on the real one
                String mockOrg = "_easyant_mocks_";
                String mockName = depmd.getModuleRevisionId().getOrganisation() + "__"
                        + depmd.getModuleRevisionId().getName();
                ModuleRevisionId mockmrid = ModuleRevisionId.newInstance(mockOrg, mockName, depmd.getModuleRevisionId()
                        .getBranch(), depmd.getRevision(), depmd.getExtraAttributes());
                DefaultModuleDescriptor mock = new DefaultModuleDescriptor(mockmrid, depmd.getStatus(),
                        depmd.getPublicationDate(), depmd.isDefault());
                DefaultDependencyDescriptor mockdd = new DefaultDependencyDescriptor(depmd.getModuleRevisionId(), false);
                for (String conf : confs) {
                    mock.addConfiguration(new Configuration(conf));
                    mockdd.addDependencyConfiguration(conf, conf);
                }
                mock.addDependency(mockdd);

                for (String conf : confs) {
                    if (conf.equals("default")) {
                        continue;
                    }

                    nbPaths++;
                    log("Found configuration " + conf, Project.MSG_VERBOSE);

                    // same process than for the ant script:
                    // * trust the last resolve report
                    // * or launch a full resolve
                    // A full resolve might trigger a retrieve to populate the local repo

                    XmlReportParser xmldepreport = null;
                    if (!refresh) {
                        xmldepreport = getResolveReport(ivy, mock.getModuleRevisionId().getModuleId(), conf, null);
                    }
                    if (xmldepreport != null) {
                        artifacts = xmldepreport.getArtifactReports();
                    } else {
                        maybeRetrieve(mock, conf);
                        ResolveReport resolveReport = resolve(ivy, mock, conf);
                        ConfigurationResolveReport confReport = resolveReport.getConfigurationReport(conf);
                        artifacts = confReport.getAllArtifactsReports();
View Full Code Here

Examples of org.apache.ivy.plugins.report.XmlReportParser

            return null;
        }
        // found a report, try to parse it.
        try {
            log("Reading resolve report " + report, Project.MSG_DEBUG);
            XmlReportParser reportparser = new XmlReportParser();
            reportparser.parse(report);
            if (reportparser.hasError()) {
                return null;
            }
            log("Loading last resolve report for " + mid + "[" + conf + "]", Project.MSG_VERBOSE);
            return reportparser;
        } catch (ParseException e) {
View Full Code Here

Examples of org.apache.ivy.plugins.report.XmlReportParser

        // 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) {
                ModuleRevisionId[] mrids = parser.getRealDependencyRevisionIds();
                for (int j = 0; j < mrids.length; j++) {
                    artifacts.add(parser.getMetadataArtifactReport(mrids[j]));
                }
            }
            for (Iterator iter = artifacts.iterator(); iter.hasNext();) {
                ArtifactDownloadReport artifact = (ArtifactDownloadReport) iter.next();
                String destPattern = "ivy".equals(artifact.getType()) ? destIvyPattern
View Full Code Here

Examples of org.apache.ivy.plugins.report.XmlReportParser

   
    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(
                    "Error occurred while parsing reportfile '"
                    + reportFile.getAbsolutePath() + "'", e);
            }
           
            // get the resolve module
            mRevId = parser.getResolvedModule();
        }
       
        return IvyPatternHelper.substitute(
            outputpattern, mRevId.getOrganisation(), mRevId.getName(),
            mRevId.getRevision(), "", "", ext, conf, mRevId.getAttributes(), null);
View Full Code Here

Examples of org.apache.ivy.plugins.report.XmlReportParser

        File[] files = getCache().getConfigurationResolveReportsInCache(resolveId);
        if (files.length == 0) {
            throw new IllegalStateException("No previous resolve found for id '" + resolveId
                    + "' Please resolve dependencies before delivering.");
        }
        XmlReportParser parser = new XmlReportParser();
        parser.parse(files[0]);
        ModuleRevisionId mrid = parser.getResolvedModule();
        deliver(mrid, revision, destIvyPattern, options);
    }
View Full Code Here

Examples of org.apache.ivy.plugins.report.XmlReportParser

                String resolveId = getResolveId();
                if (resolveId == null) {
                    resolveId = ResolveOptions
                            .getDefaultResolveId(getResolvedModuleId());
                }
                XmlReportParser parser = new XmlReportParser();
                for (int i = 0; i < confs.length; i++) {
                    File report = cacheMgr
                            .getConfigurationResolveReportInCache(resolveId,
                                    confs[i]);
                    parser.parse(report);

                    Artifact[] artifacts = parser.getArtifacts();
                    for (int j = 0; j < artifacts.length; j++) {
                        Artifact artifact = artifacts[j];
                        ModuleRevisionId mrid = artifact.getModuleRevisionId();
                        if (mrid.getOrganisation().equals(
                                getOrganisationToFind())) {
View Full Code Here

Examples of org.apache.ivy.plugins.report.XmlReportParser

        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());
                HashSet previousDepSet = new HashSet(previousDeps);
                hasChanged = Boolean.valueOf(!previousDepSet.equals(getModuleRevisionIds()));
            } catch (Exception e) {
                Message.warn("Error while parsing configuration resolve report "
                        + previousReportFile.getAbsolutePath());
View Full Code Here

Examples of org.apache.ivy.plugins.report.XmlReportParser

        try {
            String pathSeparator = System.getProperty("path.separator");
            StringBuffer buf = new StringBuffer();
            Collection all = new LinkedHashSet();
            ResolutionCacheManager cacheMgr = ivy.getResolutionCacheManager();
            XmlReportParser parser = new XmlReportParser();
            for (int i = 0; i < confs.length; i++) {
                String resolveId = ResolveOptions.getDefaultResolveId(md);
                File report = cacheMgr.getConfigurationResolveReportInCache(resolveId, confs[i]);
                parser.parse(report);

                all.addAll(Arrays.asList(parser.getArtifactReports()));
            }
            for (Iterator iter = all.iterator(); iter.hasNext();) {
                ArtifactDownloadReport artifact = (ArtifactDownloadReport) iter.next();
                if (artifact.getLocalFile() != null) {
                    buf.append(artifact.getLocalFile().getCanonicalPath());
View Full Code Here

Examples of org.apache.ivy.plugins.report.XmlReportParser

        }
       
        try {
            Collection all = new LinkedHashSet();
            ResolutionCacheManager cacheMgr = ivy.getResolutionCacheManager();
            XmlReportParser parser = new XmlReportParser();
            for (int i = 0; i < confs.length; i++) {
                String resolveId = ResolveOptions.getDefaultResolveId(md);
                File report = cacheMgr.getConfigurationResolveReportInCache(resolveId, confs[i]);
                parser.parse(report);

                all.addAll(Arrays.asList(parser.getArtifactReports()));
            }
            for (Iterator iter = all.iterator(); iter.hasNext();) {
                ArtifactDownloadReport artifact = (ArtifactDownloadReport) iter.next();

                if (artifact.getLocalFile() != null) {
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.