congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
BundleRevision.getDeclaredCapabilities
Code IndexAdd Tabnine to your IDE (free)

How to use
getDeclaredCapabilities
method
in
org.osgi.framework.wiring.BundleRevision

Best Java code snippets using org.osgi.framework.wiring.BundleRevision.getDeclaredCapabilities (Showing top 20 results out of 315)

origin: org.apache.karaf.bundle/org.apache.karaf.bundle.core

private List<String> getExports(Bundle bundle) throws Exception {
  List<String> exports = new ArrayList<>();
  BundleRevision rev = bundle.adapt(BundleRevision.class);
  List<BundleCapability> caps = rev.getDeclaredCapabilities(BundleRevision.PACKAGE_NAMESPACE);
  for (BundleCapability cap : caps) {
    Map<String, Object> attr = cap.getAttributes();
    String packageName = (String)attr.get(BundleRevision.PACKAGE_NAMESPACE);
    exports.add(packageName);
  }
  return exports;
}
origin: org.apache.karaf.package/org.apache.karaf.package.core

@Override
public List<String> getExports(long bundleId) {
  Bundle bundle = bundleContext.getBundle(bundleId);
  BundleRevision rev = bundle.adapt(BundleRevision.class);
  List<BundleCapability> caps = rev.getDeclaredCapabilities(BundleRevision.PACKAGE_NAMESPACE);
  List<String> exports = new ArrayList<>();
  for (BundleCapability cap : caps) {
    Map<String, Object> attr = cap.getAttributes();
    String packageName = (String)attr.get(BundleRevision.PACKAGE_NAMESPACE);
    exports.add(packageName);
  }
  return exports;
}
origin: apache/karaf

private List<String> getExports(Bundle bundle) throws Exception {
  List<String> exports = new ArrayList<>();
  BundleRevision rev = bundle.adapt(BundleRevision.class);
  List<BundleCapability> caps = rev.getDeclaredCapabilities(BundleRevision.PACKAGE_NAMESPACE);
  for (BundleCapability cap : caps) {
    Map<String, Object> attr = cap.getAttributes();
    String packageName = (String)attr.get(BundleRevision.PACKAGE_NAMESPACE);
    exports.add(packageName);
  }
  return exports;
}
origin: apache/karaf

@Override
public List<String> getExports(long bundleId) {
  Bundle bundle = bundleContext.getBundle(bundleId);
  BundleRevision rev = bundle.adapt(BundleRevision.class);
  List<BundleCapability> caps = rev.getDeclaredCapabilities(BundleRevision.PACKAGE_NAMESPACE);
  List<String> exports = new ArrayList<>();
  for (BundleCapability cap : caps) {
    Map<String, Object> attr = cap.getAttributes();
    String packageName = (String)attr.get(BundleRevision.PACKAGE_NAMESPACE);
    exports.add(packageName);
  }
  return exports;
}
origin: org.eclipse.platform/org.eclipse.equinox.http.jetty

private boolean isBundleLazyActivationPolicyUsed(BundleContext context) {
  if (context.getBundle().adapt(BundleStartLevel.class).isActivationPolicyUsed()) {
    // checking for lazy capability; NOTE this is equinox specific
    // but we fall back to header lookup for other frameworks
    List<BundleCapability> moduleData = context.getBundle().adapt(BundleRevision.class).getDeclaredCapabilities("equinox.module.data"); //$NON-NLS-1$
    String activationPolicy = null;
    if (moduleData.isEmpty()) {
      activationPolicy = context.getBundle().getHeaders("").get(Constants.BUNDLE_ACTIVATIONPOLICY); //$NON-NLS-1$
    } else {
      activationPolicy = (String) moduleData.get(0).getAttributes().get("activation.policy"); //$NON-NLS-1$
    }
    return activationPolicy == null ? false : activationPolicy.startsWith(Constants.ACTIVATION_LAZY);
  }
  return false;
}
origin: apache/karaf

private boolean checkResolveAble(BundleRequirement req) {
  Bundle[] bundles = bundleContext.getBundles();
  for (Bundle bundle : bundles) {
    BundleRevision rev = bundle.adapt(BundleRevision.class);
    if (rev != null) {
      List<BundleCapability> caps = rev.getDeclaredCapabilities(BundleRevision.PACKAGE_NAMESPACE);
      for (BundleCapability cap : caps) {
        if (req.matches(cap)) {
          return true;
        }
      }
    }
  }
  return false;
}
origin: org.apache.karaf.package/org.apache.karaf.package.core

private boolean checkResolveAble(BundleRequirement req) {
  Bundle[] bundles = bundleContext.getBundles();
  for (Bundle bundle : bundles) {
    BundleRevision rev = bundle.adapt(BundleRevision.class);
    if (rev != null) {
      List<BundleCapability> caps = rev.getDeclaredCapabilities(BundleRevision.PACKAGE_NAMESPACE);
      for (BundleCapability cap : caps) {
        if (req.matches(cap)) {
          return true;
        }
      }
    }
  }
  return false;
}
origin: apache/felix

/**
 * Returns true if the specified bundle revision is a singleton
 * (i.e., directive singleton:=true in Bundle-SymbolicName).
 *
 * @param revision the revision to check for singleton status.
 * @return true if the revision is a singleton, false otherwise.
**/
public static boolean isSingleton(BundleRevision revision)
{
  final List<BundleCapability> caps = revision.getDeclaredCapabilities(null);
  for (BundleCapability cap : caps)
  {
    // Find the bundle capability and check its directives.
    if (cap.getNamespace().equals(BundleRevision.BUNDLE_NAMESPACE))
    {
      for (Entry<String, String> entry : cap.getDirectives().entrySet())
      {
        if (entry.getKey().equalsIgnoreCase(Constants.SINGLETON_DIRECTIVE))
        {
          return Boolean.valueOf(entry.getValue());
        }
      }
      // Can only have one bundle capability, so break.
      break;
    }
  }
  return false;
}
origin: apache/felix

private synchronized void deindexCapabilities(BundleRevision br)
{
  // We only need be concerned with declared capabilities here,
  // because resolved capabilities will be a subset, since fragment
  // capabilities are not considered to be part of the host.
  List<BundleCapability> caps = br.getDeclaredCapabilities(null);
  if (caps != null)
  {
    for (BundleCapability cap : caps)
    {
      CapabilitySet capSet = m_capSets.get(cap.getNamespace());
      if (capSet != null)
      {
        capSet.removeCapability(cap);
      }
    }
  }
}
origin: org.apache.aries.jpa/org.apache.aries.jpa.container

public WrappingTransformer(ClassTransformer delegate, ServiceReference<?> persistenceProvider) {
  validate(delegate, persistenceProvider);
  this.delegate = delegate;
  Object packages = persistenceProvider.getProperty("org.apache.aries.jpa.container.weaving.packages");
  if (packages instanceof String[]) {
    for (String s : (String[])packages) {
      packageImportsToAdd.add(s);
    }
  } else {
    Bundle provider = persistenceProvider.getBundle();
    String suffix = ";" + Constants.BUNDLE_SYMBOLICNAME_ATTRIBUTE + "=" + provider.getSymbolicName()
            + ";" + Constants.BUNDLE_VERSION_ATTRIBUTE + "=" + provider.getVersion();
    BundleRevision br = provider.adapt(BundleWiring.class).getRevision();
    for (BundleCapability bc : br.getDeclaredCapabilities(BundleRevision.PACKAGE_NAMESPACE)) {
      packageImportsToAdd.add(bc.getAttributes().get(BundleRevision.PACKAGE_NAMESPACE) + suffix);
    }
  }
}
origin: apache/karaf

public List<PackageVersion> getExports() {
  Bundle[] bundles = bundleContext.getBundles();
  SortedMap<String, PackageVersion> packageVersionMap = new TreeMap<>();
  for (Bundle bundle : bundles) {
    BundleRevision rev = bundle.adapt(BundleRevision.class);
    if (rev != null) {
      List<BundleCapability> caps = rev.getDeclaredCapabilities(BundleRevision.PACKAGE_NAMESPACE);
      for (BundleCapability cap : caps) {
        Map<String, Object> attr = cap.getAttributes();
        String packageName = (String)attr.get(BundleRevision.PACKAGE_NAMESPACE);
        Version version = (Version)attr.get("version");
        String key = packageName + ":" + version.toString();
        PackageVersion pVer =
            packageVersionMap.computeIfAbsent(key, k -> new PackageVersion(packageName, version));
        pVer.addBundle(bundle);
      }
    }
  }
  return new ArrayList<>(packageVersionMap.values());
}
origin: org.apache.karaf.package/org.apache.karaf.package.core

public List<PackageVersion> getExports() {
  Bundle[] bundles = bundleContext.getBundles();
  SortedMap<String, PackageVersion> packageVersionMap = new TreeMap<>();
  for (Bundle bundle : bundles) {
    BundleRevision rev = bundle.adapt(BundleRevision.class);
    if (rev != null) {
      List<BundleCapability> caps = rev.getDeclaredCapabilities(BundleRevision.PACKAGE_NAMESPACE);
      for (BundleCapability cap : caps) {
        Map<String, Object> attr = cap.getAttributes();
        String packageName = (String)attr.get(BundleRevision.PACKAGE_NAMESPACE);
        Version version = (Version)attr.get("version");
        String key = packageName + ":" + version.toString();
        PackageVersion pVer =
            packageVersionMap.computeIfAbsent(key, k -> new PackageVersion(packageName, version));
        pVer.addBundle(bundle);
      }
    }
  }
  return new ArrayList<>(packageVersionMap.values());
}
origin: org.apache.karaf.package/org.apache.karaf.package.core

  private SortedMap<String, PackageVersion> getDuplicatePackages(Bundle[] bundles) {
    SortedMap<String, PackageVersion> packageVersionMap = new TreeMap<>();
    for (Bundle bundle : bundles) {
      BundleRevision rev = bundle.adapt(BundleRevision.class);
      if (rev != null) {
        List<BundleCapability> caps = rev.getDeclaredCapabilities(BundleRevision.PACKAGE_NAMESPACE);
        for (BundleCapability cap : caps) {
          Map<String, Object> attr = cap.getAttributes();
          String packageName = (String)attr.get(BundleRevision.PACKAGE_NAMESPACE);
          Version version = (Version)attr.get("version");
          String key = packageName + ":" + version.toString();
          PackageVersion pVer =
              packageVersionMap.computeIfAbsent(key, k -> new PackageVersion(packageName, version));
          pVer.addBundle(bundle);
        }
      }
    }
    return packageVersionMap;
  }
}
origin: apache/karaf

  private SortedMap<String, PackageVersion> getDuplicatePackages(Bundle[] bundles) {
    SortedMap<String, PackageVersion> packageVersionMap = new TreeMap<>();
    for (Bundle bundle : bundles) {
      BundleRevision rev = bundle.adapt(BundleRevision.class);
      if (rev != null) {
        List<BundleCapability> caps = rev.getDeclaredCapabilities(BundleRevision.PACKAGE_NAMESPACE);
        for (BundleCapability cap : caps) {
          Map<String, Object> attr = cap.getAttributes();
          String packageName = (String)attr.get(BundleRevision.PACKAGE_NAMESPACE);
          Version version = (Version)attr.get("version");
          String key = packageName + ":" + version.toString();
          PackageVersion pVer =
              packageVersionMap.computeIfAbsent(key, k -> new PackageVersion(packageName, version));
          pVer.addBundle(bundle);
        }
      }
    }
    return packageVersionMap;
  }
}
origin: org.eclipse/osgi

private BundleRevisionDTO getBundleRevisionDTO(BundleRevision revision) {
  if (revision == null) {
    return null;
  }
  BundleRevisionDTO dto = resources.get(revision);
  if (dto != null) {
    return dto;
  }
  dto = new BundleRevisionDTO();
  dto.id = identifier(revision);
  resources.put(revision, dto);
  dto.bundle = revision.getBundle().getBundleId();
  dto.symbolicName = revision.getSymbolicName();
  dto.type = revision.getTypes();
  dto.version = revision.getVersion().toString();
  dto.capabilities = getListCapabilityDTO(revision.getDeclaredCapabilities(null));
  dto.requirements = getListRequirementDTO(revision.getDeclaredRequirements(null));
  return dto;
}
origin: org.eclipse.platform/org.eclipse.osgi

private BundleRevisionDTO getBundleRevisionDTO(BundleRevision revision) {
  if (revision == null) {
    return null;
  }
  BundleRevisionDTO dto = resources.get(revision);
  if (dto != null) {
    return dto;
  }
  dto = new BundleRevisionDTO();
  dto.id = identifier(revision);
  resources.put(revision, dto);
  dto.bundle = revision.getBundle().getBundleId();
  dto.symbolicName = revision.getSymbolicName();
  dto.type = revision.getTypes();
  dto.version = revision.getVersion().toString();
  dto.capabilities = getListCapabilityDTO(revision.getDeclaredCapabilities(null));
  dto.requirements = getListRequirementDTO(revision.getDeclaredRequirements(null));
  return dto;
}
origin: org.eclipse.tycho/org.eclipse.osgi

private BundleRevisionDTO getBundleRevisionDTO(BundleRevision revision) {
  if (revision == null) {
    return null;
  }
  BundleRevisionDTO dto = resources.get(revision);
  if (dto != null) {
    return dto;
  }
  dto = new BundleRevisionDTO();
  dto.id = identifier(revision);
  resources.put(revision, dto);
  dto.bundle = revision.getBundle().getBundleId();
  dto.symbolicName = revision.getSymbolicName();
  dto.type = revision.getTypes();
  dto.version = revision.getVersion().toString();
  dto.capabilities = getListCapabilityDTO(revision.getDeclaredCapabilities(null));
  dto.requirements = getListRequirementDTO(revision.getDeclaredRequirements(null));
  return dto;
}
origin: org.eclipse.scout.sdk.deps/org.eclipse.osgi

private BundleRevisionDTO getBundleRevisionDTO(BundleRevision revision) {
  if (revision == null) {
    return null;
  }
  BundleRevisionDTO dto = resources.get(revision);
  if (dto != null) {
    return dto;
  }
  dto = new BundleRevisionDTO();
  dto.id = identifier(revision);
  resources.put(revision, dto);
  dto.bundle = revision.getBundle().getBundleId();
  dto.symbolicName = revision.getSymbolicName();
  dto.type = revision.getTypes();
  dto.version = revision.getVersion().toString();
  dto.capabilities = getListCapabilityDTO(revision.getDeclaredCapabilities(null));
  dto.requirements = getListRequirementDTO(revision.getDeclaredRequirements(null));
  return dto;
}
origin: at.bestsolution.efxclipse.eclipse/org.eclipse.osgi

private BundleRevisionDTO getBundleRevisionDTO(BundleRevision revision) {
  if (revision == null) {
    return null;
  }
  BundleRevisionDTO dto = resources.get(revision);
  if (dto != null) {
    return dto;
  }
  dto = new BundleRevisionDTO();
  dto.id = identifier(revision);
  resources.put(revision, dto);
  dto.bundle = revision.getBundle().getBundleId();
  dto.symbolicName = revision.getSymbolicName();
  dto.type = revision.getTypes();
  dto.version = revision.getVersion().toString();
  dto.capabilities = getListCapabilityDTO(revision.getDeclaredCapabilities(null));
  dto.requirements = getListRequirementDTO(revision.getDeclaredRequirements(null));
  return dto;
}
origin: com.github.veithen.cosmos/cosmos-equinox

private BundleRevisionDTO getBundleRevisionDTO(BundleRevision revision) {
  if (revision == null) {
    return null;
  }
  BundleRevisionDTO dto = resources.get(revision);
  if (dto != null) {
    return dto;
  }
  dto = new BundleRevisionDTO();
  dto.id = identifier(revision);
  resources.put(revision, dto);
  dto.bundle = revision.getBundle().getBundleId();
  dto.symbolicName = revision.getSymbolicName();
  dto.type = revision.getTypes();
  dto.version = revision.getVersion().toString();
  dto.capabilities = getListCapabilityDTO(revision.getDeclaredCapabilities(null));
  dto.requirements = getListRequirementDTO(revision.getDeclaredRequirements(null));
  return dto;
}
org.osgi.framework.wiringBundleRevisiongetDeclaredCapabilities

Javadoc

Returns the capabilities declared by this bundle revision.

Popular methods of BundleRevision

  • getBundle
  • getTypes
    Returns the special types of this bundle revision. The bundle revision type values are: * #TYPE_FRA
  • getWiring
    Returns the bundle wiring which is using this bundle revision.
  • getDeclaredRequirements
    Returns the requirements declared by this bundle revision.
  • getSymbolicName
    Returns the symbolic name for this bundle revision.
  • getVersion
    Returns the version for this bundle revision.
  • equals
  • getCapabilities
    This method returns the same value as #getDeclaredCapabilities(String).
  • getRequirements
    This method returns the same value as #getDeclaredRequirements(String).

Popular in Java

  • Parsing JSON documents to java classes using gson
  • getContentResolver (Context)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • notifyDataSetChanged (ArrayAdapter)
  • Pointer (com.sun.jna)
    An abstraction for a native pointer data type. A Pointer instance represents, on the Java side, a na
  • Proxy (java.net)
    This class represents proxy server settings. A created instance of Proxy stores a type and an addres
  • UnknownHostException (java.net)
    Thrown when a hostname can not be resolved.
  • SortedSet (java.util)
    SortedSet is a Set which iterates over its elements in a sorted order. The order is determined eithe
  • JLabel (javax.swing)
  • Response (javax.ws.rs.core)
    Defines the contract between a returned instance and the runtime when an application needs to provid
  • Top 17 Free Sublime Text Plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now