org.eclipse.osgi.service.resolver.State.getBundle()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(6.8k)|赞(0)|评价(0)|浏览(157)

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

State.getBundle介绍

[英]Returns the bundle descriptor for the bundle with the given id. null is returned if no such bundle is found in this state.
[中]返回具有给定id的捆绑包的捆绑包描述符。如果在此状态下找不到此类捆绑包,则返回null

代码示例

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

public BundleDescription getBundle(long id) {
  return target.getBundle(id);
}

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

private BundleDescription getBundleDescriptionFromToken(State state, String token) {
  try {
    long id = Long.parseLong(token);
    return state.getBundle(id);
  } catch (NumberFormatException nfe) {
    BundleDescription[] allBundles = state.getBundles(token);
    if (allBundles.length > 0)
      return allBundles[0];
  }
  return null;
}

代码示例来源:origin: org.jibx.config.3rdparty.org.eclipse/org.eclipse.osgi

public BundleDescription getBundle(long id) {
  return target.getBundle(id);
}

代码示例来源:origin: org.jibx.config.3rdparty.org.eclipse/org.eclipse.osgi

private BundleDescription getBundleDescriptionFromToken(State state, String token) {
  try {
    long id = Long.parseLong(token);
    return state.getBundle(id);
  } catch (NumberFormatException nfe) {
    BundleDescription[] allBundles = state.getBundles(token);
    if (allBundles.length > 0)
      return allBundles[0];
  }
  return null;
}

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

public BundleDescription getBundle(String symbolicName, Version version) {
  return target.getBundle(symbolicName, version);
}

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

public BundleDescription getBundle(long id) {
  return platformAdmin.getSystemState().getBundle(id);
}

代码示例来源:origin: org.everit.persistence/org.everit.persistence.lqmg

private List<BundleCapability> getAllCapabilities(final Bundle[] bundles, final State state) {
 List<BundleCapability> availableCapabilities = new ArrayList<BundleCapability>();
 for (Bundle bundle : bundles) {
  BundleDescription bundleDescription = state.getBundle(bundle.getBundleId());
  List<BundleCapability> declaredCapabilities = bundleDescription.getDeclaredCapabilities(null);
  availableCapabilities.addAll(declaredCapabilities);
 }
 return availableCapabilities;
}

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

public BundleDescription getBundle(String symbolicName, Version version) {
  return platformAdmin.getSystemState().getBundle(symbolicName, version);
}

代码示例来源:origin: com.github.veithen.cosmos.bootstrap/org.eclipse.osgi.compatibility.state

public BundleDescription getBundle(long id) {
  return platformAdmin.getSystemState().getBundle(id);
}

代码示例来源:origin: com.github.veithen.cosmos.bootstrap/org.eclipse.osgi.compatibility.state

public BundleDescription getBundle(String symbolicName, Version version) {
  return platformAdmin.getSystemState().getBundle(symbolicName, version);
}

代码示例来源:origin: org.jibx.config.3rdparty.org.eclipse/org.eclipse.osgi

static void setDisabled(boolean disable, Bundle bundle, BundleContext systemContext) {
  ServiceReference ref = systemContext.getServiceReference(PlatformAdmin.class.getName());
  PlatformAdmin pa = (PlatformAdmin) (ref == null ? null : systemContext.getService(ref));
  if (pa == null)
    throw new RuntimeException("No Platform Admin service is available."); //$NON-NLS-1$
  try {
    State state = pa.getState(false);
    BundleDescription desc = state.getBundle(bundle.getBundleId());
    setDisabled(disable, desc);
  } finally {
    systemContext.ungetService(ref);
  }
}

代码示例来源:origin: org.jibx.config.3rdparty.org.eclipse/org.eclipse.osgi

private Collection<BundleDescription> getDescriptionClosure(Collection<Bundle> bundles) {
  State state = framework.adaptor.getState();
  Collection<BundleDescription> descriptions = new ArrayList<BundleDescription>();
  for (Bundle bundle : bundles) {
    BundleDescription description = state.getBundle(bundle.getBundleId());
    if (description != null)
      descriptions.add(description);
  }
  return state.getDependencyClosure(descriptions);
}

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

static void setDisabled(boolean disable, Bundle bundle, BundleContext systemContext) {
  ServiceReference ref = systemContext.getServiceReference(PlatformAdmin.class.getName());
  PlatformAdmin pa = (PlatformAdmin) (ref == null ? null : systemContext.getService(ref));
  if (pa == null)
    throw new RuntimeException("No Platform Admin service is available."); //$NON-NLS-1$
  try {
    State state = pa.getState(false);
    BundleDescription desc = state.getBundle(bundle.getBundleId());
    setDisabled(disable, desc);
  } finally {
    systemContext.ungetService(ref);
  }
}

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

private Collection<BundleDescription> getDescriptionClosure(Collection<Bundle> bundles) {
  State state = framework.adaptor.getState();
  Collection<BundleDescription> descriptions = new ArrayList<BundleDescription>();
  for (Bundle bundle : bundles) {
    BundleDescription description = state.getBundle(bundle.getBundleId());
    if (description != null)
      descriptions.add(description);
  }
  return state.getDependencyClosure(descriptions);
}

代码示例来源:origin: org.eclipse.equinox.frameworkadmin/equinox

private BundleDescription getSystemBundleDescription() {
  BundleDescription bundle = state.getBundle(0);
  if (bundle == null || bundle.getHost() != null) { // null or a
    // fragment bundle.
    return null;
  }
  return (EquinoxConstants.FW_SYMBOLIC_NAME.equals(bundle.getSymbolicName()) ? bundle : null);
}

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

private BundleDescription getSystemBundleDescription() {
  BundleDescription bundle = state.getBundle(0);
  if (bundle == null || bundle.getHost() != null) { // null or a
    // fragment bundle.
    return null;
  }
  return (EquinoxConstants.FW_SYMBOLIC_NAME.equals(bundle.getSymbolicName()) ? bundle : null);
}

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

public BundleDescription getBundleDescription() {
  return framework.adaptor.getState().getBundle(getBundleId());
}

代码示例来源:origin: org.eclipse.pde/org.eclipse.pde.runtime

private static Long getBundleId(String name) {
  BundleDescription descr = PDERuntimePlugin.getDefault().getPlatformAdmin().getState(false).getBundle(name, null);
  return descr == null ? null : Long.valueOf(descr.getBundleId());
}

代码示例来源:origin: org.eclipse.pde/org.eclipse.pde.runtime

private static boolean getIsEnabled(org.osgi.framework.Bundle bundle) {
  PlatformAdmin plaformAdmin = PDERuntimePlugin.getDefault().getPlatformAdmin();
  State state = plaformAdmin.getState(false);
  BundleDescription description = state.getBundle(bundle.getBundleId());
  return (state.getDisabledInfos(description)).length == 0;
}

代码示例来源:origin: org.eclipse.pde/org.eclipse.pde.ui

private Image getObjectImage(IProductPlugin obj) {
  Version version = (obj.getVersion() != null && obj.getVersion().length() > 0 && !obj.getVersion().equals(ICoreConstants.DEFAULT_VERSION)) ? Version.parseVersion(obj.getVersion()) : null;
  BundleDescription desc = TargetPlatformHelper.getState().getBundle(obj.getId(), version);
  if (desc != null) {
    return desc.getHost() == null ? get(PDEPluginImages.DESC_PLUGIN_OBJ) : get(PDEPluginImages.DESC_FRAGMENT_OBJ);
  }
  return get(PDEPluginImages.DESC_PLUGIN_OBJ, F_ERROR);
}

相关文章