Class ResourceUtils


  • public class ResourceUtils
    extends java.lang.Object
    • Field Detail

      • IDENTITY_VERSION_COMPARATOR

        public static final java.util.Comparator<org.osgi.resource.Resource> IDENTITY_VERSION_COMPARATOR
        A comparator that compares the identity versions
      • DUMMY_RESOURCE

        public static final org.osgi.resource.Resource DUMMY_RESOURCE
      • WORKSPACE_NAMESPACE

        public static final java.lang.String WORKSPACE_NAMESPACE
        See Also:
        Constant Field Values
    • Constructor Detail

      • ResourceUtils

        public ResourceUtils()
    • Method Detail

      • getIdentityVersion

        public static java.lang.String getIdentityVersion​(org.osgi.resource.Resource resource)
      • getBundleCapability

        public static ResourceUtils.BundleCap getBundleCapability​(org.osgi.resource.Resource resource)
      • toVersion

        public static Version toVersion​(java.lang.Object v)
      • getVersion

        public static final Version getVersion​(org.osgi.resource.Capability cap)
      • getURI

        public static java.net.URI getURI​(org.osgi.resource.Capability contentCapability)
      • getVersionAttributeForNamespace

        public static java.lang.String getVersionAttributeForNamespace​(java.lang.String ns)
      • as

        public static <T extends org.osgi.resource.Capability> T as​(org.osgi.resource.Capability cap,
                                                                    java.lang.Class<T> type)
      • as

        public static <T extends org.osgi.resource.Requirement> T as​(org.osgi.resource.Requirement req,
                                                                     java.lang.Class<T> type)
      • getResources

        public static java.util.Set<org.osgi.resource.Resource> getResources​(java.util.Collection<? extends org.osgi.resource.Capability> providers)
      • createWildcardRequirement

        public static org.osgi.resource.Requirement createWildcardRequirement()
      • isEffective

        public static boolean isEffective​(org.osgi.resource.Requirement r,
                                          org.osgi.resource.Capability c)
      • matches

        public static boolean matches​(org.osgi.resource.Requirement r,
                                      org.osgi.resource.Resource resource)
      • matches

        public static boolean matches​(org.osgi.resource.Requirement r,
                                      org.osgi.resource.Capability c)
      • getEffective

        public static java.lang.String getEffective​(java.util.Map<java.lang.String,​java.lang.String> directives)
      • getResolution

        public static ResolutionDirective getResolution​(org.osgi.resource.Requirement r)
      • toRequireCapability

        public static java.lang.String toRequireCapability​(org.osgi.resource.Requirement req)
                                                    throws java.lang.Exception
        Throws:
        java.lang.Exception
      • toProvideCapability

        public static java.lang.String toProvideCapability​(org.osgi.resource.Capability cap)
                                                    throws java.lang.Exception
        Throws:
        java.lang.Exception
      • getLocations

        public static java.util.Map<java.net.URI,​java.lang.String> getLocations​(org.osgi.resource.Resource resource)
      • findProviders

        public static java.util.List<org.osgi.resource.Capability> findProviders​(org.osgi.resource.Requirement requirement,
                                                                                 java.util.Collection<? extends org.osgi.resource.Capability> capabilities)
      • isFragment

        public static boolean isFragment​(org.osgi.resource.Resource resource)
      • stripDirective

        public static java.lang.String stripDirective​(java.lang.String name)
      • getIdentity

        public static java.lang.String getIdentity​(org.osgi.resource.Capability identityCapability)
                                            throws java.lang.IllegalArgumentException
        Throws:
        java.lang.IllegalArgumentException
      • toVersionClause

        public static VersionedClause toVersionClause​(org.osgi.resource.Resource resource,
                                                      java.lang.String mask)
        Create a VersionedClause by applying a version range mask to the resource! Masks are defined by Macro._range(String[]). If the resource should represent a project in the bnd workspace, then instead the VersionClause will refer to it as a snapshot version: e.g. ;version=snapshot