Examples of ModuleDescriptorParser


Examples of org.apache.ivy.plugins.parser.ModuleDescriptorParser

    private void cacheModuleDescriptor(ModuleDescriptor systemMd, ModuleRevisionId systemMrid,
            ResolvedResource ivyRef, ResolvedModuleRevision rmr) {
        RepositoryCacheManager cacheManager = getRepositoryCacheManager();
       
        final ModuleDescriptorParser parser = systemMd.getParser();
       
        // the metadata artifact which was used to cache the original metadata file
        Artifact requestedMetadataArtifact =
            ivyRef == null
            ? systemMd.getMetadataArtifact()
            : parser.getMetadataArtifact(
                ModuleRevisionId.newInstance(systemMrid, ivyRef.getRevision()),
                ivyRef.getResource());
       
        cacheManager.originalToCachedModuleDescriptor(this, ivyRef, requestedMetadataArtifact,
                rmr, new ModuleDescriptorWriter() {
            public void write(ResolvedResource originalMdResource, ModuleDescriptor md,
                    File src, File dest)
                    throws IOException, ParseException {
                if (originalMdResource == null) {
                    // a basic ivy file is written containing default data
                    XmlModuleDescriptorWriter.write(md, dest);
                } else {
                    // copy and update ivy file from source to cache
                    parser.toIvyFile(
                        new FileInputStream(src),
                        originalMdResource.getResource(), dest,
                        md);
                    long repLastModified = originalMdResource.getLastModified();
                    if (repLastModified > 0) {
View Full Code Here

Examples of org.apache.ivy.plugins.parser.ModuleDescriptorParser

        DependencyDescriptor nsDd = dd;
        dd = toSystem(nsDd);
       
        ModuleRevisionId mrid = dd.getDependencyRevisionId();
        ModuleDescriptorParser parser = ModuleDescriptorParserRegistry
                .getInstance().getParser(mdRef.getResource());
        if (parser == null) {
            Message.warn("no module descriptor parser available for " + mdRef.getResource());
            return null;
        }
        Message.verbose("\t" + getName() + ": found md file for " + mrid);
        Message.verbose("\t\t=> " + mdRef);
        Message.debug("\tparser = " + parser);

        ModuleRevisionId resolvedMrid = mrid;

        // first check if this dependency has not yet been resolved
        if (getSettings().getVersionMatcher().isDynamic(mrid)) {
            resolvedMrid = ModuleRevisionId.newInstance(mrid, mdRef.getRevision());
            IvyNode node = data.getNode(resolvedMrid);
            if (node != null && node.getModuleRevision() != null) {
                // this revision has already be resolved : return it
                if (node.getDescriptor() != null && node.getDescriptor().isDefault()) {
                    Message.verbose("\t" + getName() + ": found already resolved revision: "
                            + resolvedMrid
                            + ": but it's a default one, maybe we can find a better one");
                } else {
                    Message.verbose("\t" + getName() + ": revision already resolved: "
                            + resolvedMrid);
                    node.getModuleRevision().getReport().setSearched(true);
                    return node.getModuleRevision();
                }
            }
        }

        Artifact moduleArtifact = parser.getMetadataArtifact(resolvedMrid, mdRef.getResource());
        return getRepositoryCacheManager().cacheModuleDescriptor(
            this, mdRef, dd, moduleArtifact, downloader,
            getCacheOptions(data));
    }
View Full Code Here

Examples of org.apache.ivy.plugins.parser.ModuleDescriptorParser

    private void cacheModuleDescriptor(ModuleDescriptor systemMd, ModuleRevisionId systemMrid,
            ResolvedResource ivyRef, ResolvedModuleRevision rmr) {
        RepositoryCacheManager cacheManager = getRepositoryCacheManager();
       
        final ModuleDescriptorParser parser = systemMd.getParser();
       
        // the metadata artifact which was used to cache the original metadata file
        Artifact requestedMetadataArtifact =
            ivyRef == null
            ? systemMd.getMetadataArtifact()
            : parser.getMetadataArtifact(
                ModuleRevisionId.newInstance(systemMrid, ivyRef.getRevision()),
                ivyRef.getResource());
       
        cacheManager.originalToCachedModuleDescriptor(this, ivyRef, requestedMetadataArtifact,
                rmr, new ModuleDescriptorWriter() {
            public void write(ResolvedResource originalMdResource, ModuleDescriptor md,
                    File src, File dest)
                    throws IOException, ParseException {
                if (originalMdResource == null) {
                    // a basic ivy file is written containing default data
                    XmlModuleDescriptorWriter.write(md, dest);
                } else {
                    // copy and update ivy file from source to cache
                    parser.toIvyFile(
                        new FileInputStream(src),
                        originalMdResource.getResource(), dest,
                        md);
                    long repLastModified = originalMdResource.getLastModified();
                    if (repLastModified > 0) {
View Full Code Here

Examples of org.apache.ivy.plugins.parser.ModuleDescriptorParser

        DependencyDescriptor nsDd = dd;
        dd = toSystem(nsDd);
       
        ModuleRevisionId mrid = dd.getDependencyRevisionId();
        ModuleDescriptorParser parser = ModuleDescriptorParserRegistry
                .getInstance().getParser(mdRef.getResource());
        if (parser == null) {
            Message.warn("no module descriptor parser available for " + mdRef.getResource());
            return null;
        }
        Message.verbose("\t" + getName() + ": found md file for " + mrid);
        Message.verbose("\t\t=> " + mdRef);
        Message.debug("\tparser = " + parser);

        ModuleRevisionId resolvedMrid = mrid;

        // first check if this dependency has not yet been resolved
        if (getSettings().getVersionMatcher().isDynamic(mrid)) {
            resolvedMrid = ModuleRevisionId.newInstance(mrid, mdRef.getRevision());
            IvyNode node = data.getNode(resolvedMrid);
            if (node != null && node.getModuleRevision() != null) {
                // this revision has already be resolved : return it
                if (node.getDescriptor() != null && node.getDescriptor().isDefault()) {
                    Message.verbose("\t" + getName() + ": found already resolved revision: "
                            + resolvedMrid
                            + ": but it's a default one, maybe we can find a better one");
                } else {
                    Message.verbose("\t" + getName() + ": revision already resolved: "
                            + resolvedMrid);
                    node.getModuleRevision().getReport().setSearched(true);
                    return node.getModuleRevision();
                }
            }
        }

        Artifact moduleArtifact = parser.getMetadataArtifact(resolvedMrid, mdRef.getResource());
        return getRepositoryCacheManager().cacheModuleDescriptor(
            this, mdRef, dd, moduleArtifact, downloader,
            getCacheOptions(data));
    }
View Full Code Here

Examples of org.apache.ivy.plugins.parser.ModuleDescriptorParser

        }

        ParserSettings pSettings = new CacheParserSettings(settings, paths);

        URL ivyFileURL = ivyFile.toURI().toURL();
        ModuleDescriptorParser parser = ModuleDescriptorParserRegistry.getInstance().getParser(
                new URLResource(ivyFileURL));
        return parser.parseDescriptor(pSettings, ivyFileURL, false);
    }
View Full Code Here

Examples of org.apache.ivy.plugins.parser.ModuleDescriptorParser

        }

    }

    protected EasyAntModuleDescriptorParser getEasyAntModuleDescriptorParser(File file) throws BuildException {
        ModuleDescriptorParser mdp = null;
        EasyAntModuleDescriptorParser parser = null;
        try {
            mdp = ModuleDescriptorParserRegistry.getInstance().getParser(new URLResource(file.toURI().toURL()));
        } catch (MalformedURLException e) {
            throw new BuildException("Impossible to find a parser for " + file.getName());
        }
        // If valid easyant parser is defined use it
        if (mdp != null && mdp.getClass().isInstance(EasyAntModuleDescriptorParser.class)) {
            return (EasyAntModuleDescriptorParser) mdp;
        } else {
            // if the user has customized the loadmodule task
            if (easyAntMDParserClassName != null) {
View Full Code Here

Examples of org.apache.ivy.plugins.parser.ModuleDescriptorParser

            File ivyFile = getIvyFileInCache(mrid);
            if (ivyFile.exists()) {
                // found in cache !
                try {
                    ModuleDescriptorParser parser = ModuleDescriptorParserRegistry.getInstance().getParser(
                            new URLResource(ivyFile.toURI().toURL()));
                    ModuleDescriptor depMD = getMdFromCache(parser, options, ivyFile);
                    String resolverName = getSavedResolverName(depMD);
                    String artResolverName = getSavedArtResolverName(depMD);
                    DependencyResolver resolver = settings.getResolver(resolverName);
View Full Code Here

Examples of org.apache.ivy.plugins.parser.ModuleDescriptorParser

                        + report.getDownloadDetails() + " (" + report.getDownloadTimeMillis() + "ms)");
                return null;
            }

            try {
                ModuleDescriptorParser parser = ModuleDescriptorParserRegistry.getInstance().getParser(
                        mdRef.getResource());
                ParserSettings parserSettings = settings;
                if (resolver instanceof AbstractResolver) {
                    parserSettings = ((AbstractResolver) resolver).getParserSettings();
                }
                ModuleDescriptor md = getStaledMd(parser, options, report.getLocalFile(), parserSettings);
                if (md == null) {
                    throw new IllegalStateException("module descriptor parser returned a null module descriptor, "
                            + "which is not allowed. " + "parser=" + parser + "; parser class="
                            + parser.getClass().getName() + "; module descriptor resource=" + mdRef.getResource());
                }
                Message.debug("\t" + getName() + ": parsed downloaded md file for " + mrid + "; parsed="
                        + md.getModuleRevisionId());

                // check if we should delete old artifacts
View Full Code Here

Examples of org.apache.ivy.plugins.parser.ModuleDescriptorParser

            url = file.toURI().toURL();
        } catch (MalformedURLException e) {
            throw new BuildException("[easyant bug] a file has not a proper url", e);
        }
        URLResource res = new URLResource(url);
        ModuleDescriptorParser mdparser = ModuleDescriptorParserRegistry.getInstance().getParser(res);
        ModuleDescriptor md;
        ivy.pushContext();
        try {
            md = mdparser.parseDescriptor(ivy.getSettings(), url, true);
        } catch (ParseException e) {
            throw new BuildException("The file " + file + " is not a correct ivy file (" + e.getMessage() + ")", e);
        } catch (IOException e) {
            throw new BuildException("The file " + file + " could not be read (" + e.getMessage() + ")", e);
        }
View Full Code Here

Examples of org.apache.ivy.plugins.parser.ModuleDescriptorParser

                Message.verbose("Parent module doesn't exist on the filesystem: " + file.getAbsolutePath());
                return null;
            }

            FileResource res = new FileResource(null, file);
            ModuleDescriptorParser parser = ModuleDescriptorParserRegistry.getInstance().getParser(res);
            return parser.parseDescriptor(getSettings(), file.toURI().toURL(), res, isValidate());
        }
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.