Java Code Examples for org.apache.ivy.core.module.id.ModuleRevisionId#getOrganisation()

The following examples show how to use org.apache.ivy.core.module.id.ModuleRevisionId#getOrganisation() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractOSGiResolver.java    From ant-ivy with Apache License 2.0 5 votes vote down vote up
public ResolvedResource findIvyFileRef(DependencyDescriptor dd, ResolveData data) {
    ModuleRevisionId mrid = dd.getDependencyRevisionId();

    String osgiType = mrid.getOrganisation();
    if (osgiType == null) {
        throw new RuntimeException("Unsupported OSGi module Id: " + mrid.getModuleId());
    }
    String id = mrid.getName();
    Collection<ModuleDescriptor> mds = ModuleDescriptorWrapper.unwrap(getRepoDescriptor()
            .findModules(osgiType, id));
    if (mds == null || mds.isEmpty()) {
        Message.verbose("\t " + id + " not found.");
        return null;
    }

    ResolvedResource[] ret;
    if (BundleInfo.BUNDLE_TYPE.equals(osgiType)) {
        ret = findBundle(dd, data, mds);
    } else {
        ret = findCapability(dd, data, mds);
    }

    ResolvedResource found = findResource(ret, getDefaultRMDParser(dd.getDependencyId()), mrid,
        data.getDate());
    if (found == null) {
        Message.debug("\t" + getName() + ": no resource found for " + mrid);
    }
    return found;
}
 
Example 2
Source File: AbstractOSGiResolver.java    From ant-ivy with Apache License 2.0 5 votes vote down vote up
@Override
protected void checkModuleDescriptorRevision(ModuleDescriptor systemMd,
        ModuleRevisionId systemMrid) {
    String osgiType = systemMrid.getOrganisation();
    // only check revision if we're searching for a bundle (package and bundle have different
    // version
    if (osgiType == null || osgiType.equals(BundleInfo.BUNDLE_TYPE)) {
        super.checkModuleDescriptorRevision(systemMd, systemMrid);
    }
}
 
Example 3
Source File: AbstractPatternsBasedResolver.java    From ant-ivy with Apache License 2.0 5 votes vote down vote up
protected ModuleRevisionId convertM2ResourceSearchIdToNormal(ModuleRevisionId mrid) {
    if (mrid.getOrganisation() == null || mrid.getOrganisation().indexOf('/') == -1) {
        return mrid;
    }
    return ModuleRevisionId.newInstance(mrid.getOrganisation().replace('/', '.'),
        mrid.getName(), mrid.getBranch(), mrid.getRevision(),
        mrid.getQualifiedExtraAttributes());
}
 
Example 4
Source File: AbstractPatternsBasedResolver.java    From ant-ivy with Apache License 2.0 5 votes vote down vote up
protected ModuleRevisionId convertM2IdForResourceSearch(ModuleRevisionId mrid) {
    if (mrid.getOrganisation() == null || mrid.getOrganisation().indexOf('.') == -1) {
        return mrid;
    }
    return ModuleRevisionId.newInstance(mrid.getOrganisation().replace('.', '/'),
        mrid.getName(), mrid.getBranch(), mrid.getRevision(),
        mrid.getQualifiedExtraAttributes());
}
 
Example 5
Source File: DefaultModuleVersionIdentifier.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public static ModuleVersionIdentifier newId(ModuleRevisionId moduleRevisionId) {
    return new DefaultModuleVersionIdentifier(moduleRevisionId.getOrganisation(), moduleRevisionId.getName(), moduleRevisionId.getRevision());
}
 
Example 6
Source File: DefaultDependencyMetaData.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public DefaultDependencyMetaData(DependencyDescriptor dependencyDescriptor) {
    this.dependencyDescriptor = dependencyDescriptor;
    ModuleRevisionId dependencyRevisionId = dependencyDescriptor.getDependencyRevisionId();
    requested = new DefaultModuleVersionSelector(dependencyRevisionId.getOrganisation(), dependencyRevisionId.getName(), dependencyRevisionId.getRevision());
}
 
Example 7
Source File: DefaultModuleVersionIdentifier.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public static ModuleVersionIdentifier newId(ModuleRevisionId moduleRevisionId) {
    return new DefaultModuleVersionIdentifier(moduleRevisionId.getOrganisation(), moduleRevisionId.getName(), moduleRevisionId.getRevision());
}
 
Example 8
Source File: DefaultDependencyMetaData.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public DefaultDependencyMetaData(DependencyDescriptor dependencyDescriptor) {
    this.dependencyDescriptor = dependencyDescriptor;
    ModuleRevisionId dependencyRevisionId = dependencyDescriptor.getDependencyRevisionId();
    requested = new DefaultModuleVersionSelector(dependencyRevisionId.getOrganisation(), dependencyRevisionId.getName(), dependencyRevisionId.getRevision());
}
 
Example 9
Source File: DefaultModuleVersionIdentifier.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public static ModuleVersionIdentifier newId(ModuleRevisionId moduleRevisionId) {
    return new DefaultModuleVersionIdentifier(moduleRevisionId.getOrganisation(), moduleRevisionId.getName(), moduleRevisionId.getRevision());
}
 
Example 10
Source File: DefaultDependencyMetaData.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public DefaultDependencyMetaData(DependencyDescriptor dependencyDescriptor) {
    this.dependencyDescriptor = dependencyDescriptor;
    ModuleRevisionId dependencyRevisionId = dependencyDescriptor.getDependencyRevisionId();
    requested = new DefaultModuleVersionSelector(dependencyRevisionId.getOrganisation(), dependencyRevisionId.getName(), dependencyRevisionId.getRevision());
}
 
Example 11
Source File: DefaultModuleVersionIdentifier.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public static ModuleVersionIdentifier newId(ModuleRevisionId moduleRevisionId) {
    return new DefaultModuleVersionIdentifier(moduleRevisionId.getOrganisation(), moduleRevisionId.getName(), moduleRevisionId.getRevision());
}
 
Example 12
Source File: DefaultDependencyMetaData.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public DefaultDependencyMetaData(DependencyDescriptor dependencyDescriptor) {
    this.dependencyDescriptor = dependencyDescriptor;
    ModuleRevisionId dependencyRevisionId = dependencyDescriptor.getDependencyRevisionId();
    requested = new DefaultModuleVersionSelector(dependencyRevisionId.getOrganisation(), dependencyRevisionId.getName(), dependencyRevisionId.getRevision());
}
 
Example 13
Source File: ResolveEngine.java    From ant-ivy with Apache License 2.0 4 votes vote down vote up
private String getDependenciesFetchedKey(IvyNode node, String conf) {
    ModuleRevisionId moduleRevisionId = node.getResolvedId();
    return moduleRevisionId.getOrganisation() + "|" + moduleRevisionId.getName() + "|"
            + moduleRevisionId.getRevision() + "|" + conf;
}
 
Example 14
Source File: XmlModuleDescriptorUpdater.java    From ant-ivy with Apache License 2.0 4 votes vote down vote up
private void infoStarted(Attributes attributes) {

            String module = substitute(settings, attributes.getValue("module"));
            String rev = null;
            String branch = null;
            String status = null;
            String namespace = null;
            Map<String, String> extraAttributes = null;

            if (options.isMerge()) {
                // get attributes from merged descriptor, ignoring raw XML
                ModuleDescriptor merged = options.getMergedDescriptor();
                ModuleRevisionId mergedMrid = merged.getModuleRevisionId();
                organisation = mergedMrid.getOrganisation();
                branch = mergedMrid.getBranch();
                rev = mergedMrid.getRevision();
                status = merged.getStatus();

                // TODO: should namespace be added to ModuleDescriptor interface, so we don't
                // have to do this kind of check?
                if (merged instanceof DefaultModuleDescriptor) {
                    Namespace ns = ((DefaultModuleDescriptor) merged).getNamespace();
                    if (ns != null) {
                        namespace = ns.getName();
                    }
                }
                if (namespace == null) {
                    namespace = attributes.getValue("namespace");
                }

                extraAttributes = merged.getQualifiedExtraAttributes();
            } else {
                // get attributes from raw XML, performing property substitution
                organisation = substitute(settings, attributes.getValue("organisation"));
                rev = substitute(settings, attributes.getValue("revision"));
                branch = substitute(settings, attributes.getValue("branch"));
                status = substitute(settings, attributes.getValue("status"));
                namespace = substitute(settings, attributes.getValue("namespace"));
                extraAttributes = new LinkedHashMap<>(attributes.getLength());
                for (int i = 0; i < attributes.getLength(); i++) {
                    String qname = attributes.getQName(i);
                    if (!STD_ATTS.contains(qname)) {
                        extraAttributes.put(qname, substitute(settings, attributes.getValue(i)));
                    }
                }
            }

            // apply override values provided in options
            if (revision != null) {
                rev = revision;
            }
            if (options.getBranch() != null) {
                branch = options.getBranch();
            }
            if (this.status != null) {
                status = this.status;
            }

            // if necessary translate mrid using optional namespace argument
            ModuleRevisionId localMid = ModuleRevisionId.newInstance(organisation, module, branch,
                rev, ExtendableItemHelper.getExtraAttributes(settings, attributes,
                            Arrays.asList("organisation", "module", "revision", "status",
                                    "publication", "namespace")));
            ModuleRevisionId systemMid = (ns == null) ? localMid : ns.getToSystemTransformer()
                    .transform(localMid);

            write("<info");
            if (organisation != null) {
                write(" organisation=\"" + XMLHelper.escape(systemMid.getOrganisation()) + "\"");
            }
            write(" module=\"" + XMLHelper.escape(systemMid.getName()) + "\"");
            if (branch != null) {
                write(" branch=\"" + XMLHelper.escape(systemMid.getBranch()) + "\"");
            }
            if (systemMid.getRevision() != null) {
                write(" revision=\"" + XMLHelper.escape(systemMid.getRevision()) + "\"");
            }
            write(" status=\"" + XMLHelper.escape(status) + "\"");
            if (pubdate != null) {
                write(" publication=\"" + DateUtil.format(pubdate) + "\"");
            } else if (attributes.getValue("publication") != null) {
                write(" publication=\"" + substitute(settings, attributes.getValue("publication"))
                        + "\"");
            }
            if (namespace != null) {
                write(" namespace=\"" + namespace + "\"");
            }

            for (Map.Entry<String, String> extra : extraAttributes.entrySet()) {
                write(" " + extra.getKey() + "=\"" + extra.getValue() + "\"");
            }
        }
 
Example 15
Source File: PackagerCacheEntry.java    From ant-ivy with Apache License 2.0 4 votes vote down vote up
private static File getSubdir(File rootDir, ModuleRevisionId mr) {
    return new File(rootDir, mr.getOrganisation() + File.separatorChar + mr.getName()
            + File.separatorChar + mr.getRevision());
}