Examples of DefaultModuleDescriptor


Examples of org.apache.ivy.core.module.descriptor.DefaultModuleDescriptor

            final boolean isdefault) {
        final MockResolver r = new MockResolver();
        r.setName(name);
        r.setSettings(settings);
        if (findRevision) {
            DefaultModuleDescriptor md = new DefaultModuleDescriptor(mrid, "integration",
                    publicationDate, isdefault);
            r.rmr = new ResolvedModuleRevision(r, r, md, new MetadataArtifactDownloadReport(
                    md.getMetadataArtifact()));
        }
        return r;
    }
View Full Code Here

Examples of org.apache.ivy.core.module.descriptor.DefaultModuleDescriptor

        String rev = (String) md.getExtraInfo().get(
            BundleInfoAdapter.EXTRA_INFO_EXPORT_PREFIX + name);
        ModuleRevisionId capabilityRev = ModuleRevisionId.newInstance(org, name, rev,
            Collections.singletonMap(CAPABILITY_EXTRA_ATTR, md.getModuleRevisionId().toString()));

        DefaultModuleDescriptor capabilityMd = new DefaultModuleDescriptor(capabilityRev,
                getSettings().getStatusManager().getDefaultStatus(), new Date());

        String useConf = BundleInfoAdapter.CONF_USE_PREFIX + dd.getDependencyRevisionId().getName();

        capabilityMd.addConfiguration(BundleInfoAdapter.CONF_DEFAULT);
        capabilityMd.addConfiguration(BundleInfoAdapter.CONF_OPTIONAL);
        capabilityMd.addConfiguration(BundleInfoAdapter.CONF_TRANSITIVE_OPTIONAL);
        capabilityMd.addConfiguration(new Configuration(useConf));

        DefaultDependencyDescriptor capabilityDD = new DefaultDependencyDescriptor(
                md.getModuleRevisionId(), false);
        capabilityDD.addDependencyConfiguration(BundleInfoAdapter.CONF_NAME_DEFAULT,
            BundleInfoAdapter.CONF_NAME_DEFAULT);
        capabilityDD.addDependencyConfiguration(BundleInfoAdapter.CONF_NAME_OPTIONAL,
            BundleInfoAdapter.CONF_NAME_OPTIONAL);
        capabilityDD.addDependencyConfiguration(BundleInfoAdapter.CONF_NAME_TRANSITIVE_OPTIONAL,
            BundleInfoAdapter.CONF_NAME_TRANSITIVE_OPTIONAL);
        capabilityDD.addDependencyConfiguration(useConf, useConf);
        capabilityMd.addDependency(capabilityDD);

        MetadataArtifactDownloadReport report = new MetadataArtifactDownloadReport(null);
        report.setDownloadStatus(DownloadStatus.NO);
        report.setSearched(true);
        ResolvedModuleRevision rmr = new ResolvedModuleRevision(this, this, capabilityMd, report);
        return new MDResolvedResource(null, capabilityMd.getRevision(), rmr);
    }
View Full Code Here

Examples of org.apache.ivy.core.module.descriptor.DefaultModuleDescriptor

        Pattern oneDependencyPattern = Pattern.compile("(" + mridPattern.pattern() + ")\\s*->\\s*("
                + mridPattern.pattern() + ")");
        m = oneDependencyPattern.matcher(microIvy);
        if (m.matches()) {
            DefaultModuleDescriptor md = DefaultModuleDescriptor.newBasicInstance(
                ModuleRevisionId.parse(m.group(1)), new Date());
            md.addDependency(new DefaultDependencyDescriptor(ModuleRevisionId.parse(m.group(2)),
                    false));
            return md;
        }

        String p = "(" + mridPattern.pattern() + ")\\s*->\\s*\\{\\s*((?:" + mridPattern.pattern()
                + ",?\\s+)*" + mridPattern.pattern() + ")?\\s*\\}";
        Pattern multipleDependenciesPattern = Pattern.compile(p);
        m = multipleDependenciesPattern.matcher(microIvy);
        if (m.matches()) {
            DefaultModuleDescriptor md = DefaultModuleDescriptor.newBasicInstance(
                ModuleRevisionId.parse(m.group(1)), new Date());
            String mrids = m.group(2);
            if (mrids != null) {
                Collection depMrids = parseMrids(mrids);
                for (Iterator iter = depMrids.iterator(); iter.hasNext();) {
                    ModuleRevisionId dep = (ModuleRevisionId) iter.next();
                    md.addDependency(new DefaultDependencyDescriptor(dep, false));
                }
            }
            return md;
        }
        throw new IllegalArgumentException("invalid micro ivy format: " + microIvy);
View Full Code Here

Examples of org.apache.ivy.core.module.descriptor.DefaultModuleDescriptor

            int deps = minDependencies + r.nextInt(varDeps + 1);
            int versions = minVersions + r.nextInt(varVersions + 1);

            int prevCurDep = curDep;
            for (int ver = 0; ver < versions; ver++) {
                DefaultModuleDescriptor md = new DefaultModuleDescriptor(
                        ModuleRevisionId.newInstance("apache", "mod" + nb, "1." + ver),
                        "integration", new Date());

                curDep = prevCurDep;
                for (int i = 0; i < deps && curDep < nbModules; i++) {
                    int d;
                    if (i % 2 == 1) {
                        d = nb + i;
                        if (d >= prevCurDep) {
                            d = curDep;
                            curDep++;
                        }
                    } else {
                        d = curDep;
                        curDep++;
                    }
                    DefaultDependencyDescriptor dd = new DefaultDependencyDescriptor(
                            md,
                            ModuleRevisionId.newInstance("apache", "mod" + d, "latest.integration"),
                            false, false, true);
                    dd.addDependencyConfiguration("default", "default");
                    md.addDependency(dd);
                }
                XmlModuleDescriptorWriter.write(md, new File("build/test/perf/mod" + nb + "/ivy-1."
                        + ver + ".xml"));
                FileUtil.copy(new File("test/repositories/1/org1/mod1.1/jars/mod1.1-1.0.jar"),
                    new File("build/test/perf/mod" + nb + "/mod" + nb + "-1." + ver + ".jar"), null);
View Full Code Here

Examples of org.apache.ivy.core.module.descriptor.DefaultModuleDescriptor

    public void testAtomicity() throws Exception {
        IvySettings settings = new IvySettings();
        final PublishEngine engine = new PublishEngine(settings, new EventManager());
        final int[] counter = new int[] {0};

        final DefaultModuleDescriptor md = DefaultModuleDescriptor
                .newDefaultInstance(ModuleRevisionId.parse("#A;1.0"));
        final FileSystemResolver resolver = new FileSystemResolver() {
            public void publish(Artifact artifact, File src, boolean overwrite) throws IOException {
                super.publish(artifact, src, overwrite);
                synchronized (PublishEngineTest.this) {
View Full Code Here

Examples of org.apache.ivy.core.module.descriptor.DefaultModuleDescriptor

        }
        return false;
    }

    public ModuleDescriptor toFixedModuleDescriptor(IvySettings settings, List<ModuleId> midToKeep) {
        DefaultModuleDescriptor fixedmd = new DefaultModuleDescriptor(md.getModuleRevisionId(),
                md.getStatus(), new Date());

        // copy configurations
        List<String> resolvedConfs = Arrays.asList(getConfigurations());
        for (String conf : resolvedConfs) {
            fixedmd.addConfiguration(new Configuration(conf));
        }

        if (midToKeep != null && !midToKeep.isEmpty()) {
            // add dependency we want to keep from the original module descriptor
            DependencyDescriptor[] deps = md.getDependencies();
            for (int i = 0; i < deps.length; i++) {
                if (midToKeep.contains(deps[i].getDependencyId())) {
                    DefaultDependencyDescriptor dep = new DefaultDependencyDescriptor(fixedmd,
                            deps[i].getDependencyRevisionId(), true, false, false);
                    List<String> confs = Arrays.asList(deps[i].getModuleConfigurations());
                    if (confs.size() == 1 && confs.get(0).equals("*")) {
                        confs = resolvedConfs;
                    }
                    for (String conf : confs) {
                        String[] extendedConfs = getExtendingConfs(conf);
                        String[] depConfs = deps[i].getDependencyConfigurations(conf);
                        for (String extendedConf : extendedConfs) {
                            if (resolvedConfs.contains(extendedConf)) {
                                for (String depConf : depConfs) {
                                    dep.addDependencyConfiguration(extendedConf, depConf);
                                }
                            }
                        }
                    }
                    fixedmd.addDependency(dep);
                }
            }
        }

        // add resolved dependencies
        for (int i = 0; i < dependencies.size(); i++) {
            IvyNode node = (IvyNode) dependencies.get(i);
            if (midToKeep != null && midToKeep.contains(node.getModuleId())) {
                continue;
            }
            String[] rootConfs = node.getRootModuleConfigurations();
            for (int j = 0; j < rootConfs.length; j++) {
                if (node.isEvicted(rootConfs[j])) {
                    continue;
                }
                if (node.getAllArtifacts().length == 0) {
                    // no artifact: it was probably useful transitively, hence it is useless here
                    break;
                }
                DefaultDependencyDescriptor dep = new DefaultDependencyDescriptor(fixedmd,
                        node.getResolvedId(), true, false, false);
                String[] targetConfs = node.getConfigurations(rootConfs[j]);
                for (int k = 0; k < targetConfs.length; k++) {
                    dep.addDependencyConfiguration(rootConfs[j], targetConfs[k]);
                }
                fixedmd.addDependency(dep);
            }
        }

        return fixedmd;
    }
View Full Code Here

Examples of org.apache.ivy.core.module.descriptor.DefaultModuleDescriptor

    public void toIvyFile(InputStream is, Resource res, File destFile, ModuleDescriptor md)
            throws IOException, ParseException {
        try {
            Namespace ns = null;
            if (md instanceof DefaultModuleDescriptor) {
                DefaultModuleDescriptor dmd = (DefaultModuleDescriptor) md;
                ns = dmd.getNamespace();
            }
            XmlModuleDescriptorUpdater.update(
                is,
                res,
                destFile,
View Full Code Here

Examples of org.apache.ivy.core.module.descriptor.DefaultModuleDescriptor

                    if (isCheckconsistency()) {
                        checkDescriptorConsistency(systemMrid, systemMd, ivyRef);
                        checkDescriptorConsistency(nsMrid, nsMd, ivyRef);
                    } else {
                        if (systemMd instanceof DefaultModuleDescriptor) {
                            DefaultModuleDescriptor defaultMd = (DefaultModuleDescriptor) systemMd;
                            ModuleRevisionId revision = getRevision(ivyRef, systemMrid, systemMd);
                            defaultMd.setModuleRevisionId(revision);
                            defaultMd.setResolvedModuleRevisionId(revision);
                        } else {
                            Message.warn("consistency disabled with instance of non DefaultModuleDescriptor..."
                                    + " module info can't be updated, so consistency check will be done");
                            checkDescriptorConsistency(nsMrid, nsMd, ivyRef);
                            checkDescriptorConsistency(systemMrid, systemMd, ivyRef);
View Full Code Here

Examples of org.apache.ivy.core.module.descriptor.DefaultModuleDescriptor

    private void checkNotConvertedExclusionRule(ModuleDescriptor systemMd, ResolvedResource ivyRef,
            ResolveData data) {
        if (!getNamespace().equals(Namespace.SYSTEM_NAMESPACE) && !systemMd.isDefault()
                && data.getSettings().logNotConvertedExclusionRule()
                && systemMd instanceof DefaultModuleDescriptor) {
            DefaultModuleDescriptor dmd = (DefaultModuleDescriptor) systemMd;
            if (dmd.isNamespaceUseful()) {
                Message.warn("the module descriptor " + ivyRef.getResource()
                        + " has information which can't be converted into "
                        + "the system namespace. "
                        + "It will require the availability of the namespace '"
                        + getNamespace().getName() + "' to be fully usable.");
View Full Code Here

Examples of org.apache.ivy.core.module.descriptor.DefaultModuleDescriptor

    }

    protected ResourceMDParser getDefaultRMDParser(final ModuleId mid) {
        return new ResourceMDParser() {
            public MDResolvedResource parse(Resource resource, String rev) {
                DefaultModuleDescriptor md = DefaultModuleDescriptor
                        .newDefaultInstance(new ModuleRevisionId(mid, rev));
                MetadataArtifactDownloadReport madr = new MetadataArtifactDownloadReport(
                        md.getMetadataArtifact());
                madr.setDownloadStatus(DownloadStatus.NO);
                madr.setSearched(true);
                return new MDResolvedResource(resource, rev, new ResolvedModuleRevision(
                        BasicResolver.this, BasicResolver.this, md, madr, isForce()));
            }
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.