org.osgi.resource.Wiring.getResource()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(6.6k)|赞(0)|评价(0)|浏览(96)

本文整理了Java中org.osgi.resource.Wiring.getResource()方法的一些代码示例,展示了Wiring.getResource()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Wiring.getResource()方法的具体详情如下:
包路径:org.osgi.resource.Wiring
类名称:Wiring
方法名:getResource

Wiring.getResource介绍

[英]Returns the resource associated with this wiring.
[中]返回与此连线关联的资源。

代码示例

代码示例来源:origin: apache/felix

private static int getWiringID(Wiring bw)
{
  Resource res = bw.getResource();
  if (res != null)
  {
    return getResourceIDAndAdd(res, null);
  }
  return bw.hashCode();
}

代码示例来源:origin: biz.aQute.bnd/biz.aQute.resolve

public Map<Resource,List<Wire>> resolveDynamic(ResolveContext context,
    Wiring hostWiring, Requirement dynamicRequirement)
    throws ResolutionException
{
  Resource host = hostWiring.getResource();
  List<Capability> matches = context.findProviders(dynamicRequirement);
  // We can only create a dynamic import if the following
  // conditions are met:
  // 1. The package in question is not already imported.
  // 2. The package in question is not accessible via require-bundle.
  // 3. The package in question is not exported by the resource.
  if (!matches.isEmpty())
  {
    // Make sure all matching candidates are packages.
    for (Capability cap : matches)
    {
      if (!cap.getNamespace().equals(PackageNamespace.PACKAGE_NAMESPACE))
      {
        throw new IllegalArgumentException(
          "Matching candidate does not provide a package name.");
      }
    }
    ResolveSession session = ResolveSession.createSession(context,  new DumbExecutor(), host, dynamicRequirement, matches);
    return doResolve(session);
  }
  throw new Candidates.MissingRequirementError(dynamicRequirement).toException();
}

代码示例来源:origin: org.eclipse.tycho/org.eclipse.osgi

public Map<Resource,List<Wire>> resolveDynamic(ResolveContext context,
    Wiring hostWiring, Requirement dynamicRequirement)
    throws ResolutionException
{
  Resource host = hostWiring.getResource();
  List<Capability> matches = context.findProviders(dynamicRequirement);
  // We can only create a dynamic import if the following
  // conditions are met:
  // 1. The package in question is not already imported.
  // 2. The package in question is not accessible via require-bundle.
  // 3. The package in question is not exported by the resource.
  if (!matches.isEmpty())
  {
    // Make sure all matching candidates are packages.
    for (Capability cap : matches)
    {
      if (!cap.getNamespace().equals(PackageNamespace.PACKAGE_NAMESPACE))
      {
        throw new IllegalArgumentException(
          "Matching candidate does not provide a package name.");
      }
    }
    ResolveSession session = ResolveSession.createSession(context,  new DumbExecutor(), host, dynamicRequirement, matches);
    return doResolve(session);
  }
  throw new Candidates.MissingRequirementError(dynamicRequirement).toException();
}

代码示例来源:origin: apache/felix

public Map<Resource,List<Wire>> resolveDynamic(ResolveContext context,
    Wiring hostWiring, Requirement dynamicRequirement)
    throws ResolutionException
{
  Resource host = hostWiring.getResource();
  List<Capability> matches = context.findProviders(dynamicRequirement);
  // We can only create a dynamic import if the following
  // conditions are met:
  // 1. The package in question is not already imported.
  // 2. The package in question is not accessible via require-bundle.
  // 3. The package in question is not exported by the resource.
  if (!matches.isEmpty())
  {
    // Make sure all matching candidates are packages.
    for (Capability cap : matches)
    {
      if (!cap.getNamespace().equals(PackageNamespace.PACKAGE_NAMESPACE))
      {
        throw new IllegalArgumentException(
          "Matching candidate does not provide a package name.");
      }
    }
    ResolveSession session = ResolveSession.createSession(context,  new DumbExecutor(), host, dynamicRequirement, matches);
    return doResolve(session);
  }
  throw new Candidates.MissingRequirementError(dynamicRequirement).toException();
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.osgi

public Map<Resource,List<Wire>> resolveDynamic(ResolveContext context,
    Wiring hostWiring, Requirement dynamicRequirement)
    throws ResolutionException
{
  Resource host = hostWiring.getResource();
  List<Capability> matches = context.findProviders(dynamicRequirement);
  // We can only create a dynamic import if the following
  // conditions are met:
  // 1. The package in question is not already imported.
  // 2. The package in question is not accessible via require-bundle.
  // 3. The package in question is not exported by the resource.
  if (!matches.isEmpty())
  {
    // Make sure all matching candidates are packages.
    for (Capability cap : matches)
    {
      if (!cap.getNamespace().equals(PackageNamespace.PACKAGE_NAMESPACE))
      {
        throw new IllegalArgumentException(
          "Matching candidate does not provide a package name.");
      }
    }
    ResolveSession session = ResolveSession.createSession(context,  new DumbExecutor(), host, dynamicRequirement, matches);
    return doResolve(session);
  }
  throw new Candidates.MissingRequirementError(dynamicRequirement).toException();
}

代码示例来源:origin: apache/felix

for (Capability cap : wiring.getResource().getCapabilities(null))

代码示例来源:origin: biz.aQute.bnd/biz.aQute.bnd

public Map<Resource,List<Wire>> resolveDynamic(ResolveContext context,
    Wiring hostWiring, Requirement dynamicRequirement)
    throws ResolutionException
{
  Resource host = hostWiring.getResource();
  List<Capability> matches = context.findProviders(dynamicRequirement);
  // We can only create a dynamic import if the following
  // conditions are met:
  // 1. The package in question is not already imported.
  // 2. The package in question is not accessible via require-bundle.
  // 3. The package in question is not exported by the resource.
  if (!matches.isEmpty())
  {
    // Make sure all matching candidates are packages.
    for (Capability cap : matches)
    {
      if (!cap.getNamespace().equals(PackageNamespace.PACKAGE_NAMESPACE))
      {
        throw new IllegalArgumentException(
          "Matching candidate does not provide a package name.");
      }
    }
    ResolveSession session = ResolveSession.createSession(context,  new DumbExecutor(), host, dynamicRequirement, matches);
    return doResolve(session);
  }
  throw new Candidates.MissingRequirementError(dynamicRequirement).toException();
}

代码示例来源:origin: biz.aQute.bnd/biz.aQute.resolve

for (Capability cap : wiring.getResource().getCapabilities(null)) {
  if (PackageNamespace.PACKAGE_NAMESPACE.equals(cap.getNamespace())) {
    exportNames.add((String) cap.getAttributes()

代码示例来源:origin: org.eclipse.tycho/org.eclipse.osgi

for (Capability cap : wiring.getResource().getCapabilities(null)) {
  if (PackageNamespace.PACKAGE_NAMESPACE.equals(cap.getNamespace())) {
    exportNames.add((String) cap.getAttributes()

代码示例来源:origin: apache/felix

for (Capability cap : wiring.getResource().getCapabilities(null)) {
  if (PackageNamespace.PACKAGE_NAMESPACE.equals(cap.getNamespace())) {
    exportNames.add((String) cap.getAttributes()

代码示例来源:origin: org.eclipse.platform/org.eclipse.osgi

for (Capability cap : wiring.getResource().getCapabilities(null)) {
  if (PackageNamespace.PACKAGE_NAMESPACE.equals(cap.getNamespace())) {
    exportNames.add((String) cap.getAttributes()

代码示例来源:origin: biz.aQute.bnd/biz.aQute.bnd

for (Capability cap : wiring.getResource().getCapabilities(null)) {
  if (PackageNamespace.PACKAGE_NAMESPACE.equals(cap.getNamespace())) {
    exportNames.add((String) cap.getAttributes()

相关文章