当前位置: 首页>>代码示例>>Java>>正文


Java BundleCapability.getAttributes方法代码示例

本文整理汇总了Java中org.osgi.framework.wiring.BundleCapability.getAttributes方法的典型用法代码示例。如果您正苦于以下问题:Java BundleCapability.getAttributes方法的具体用法?Java BundleCapability.getAttributes怎么用?Java BundleCapability.getAttributes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.osgi.framework.wiring.BundleCapability的用法示例。


在下文中一共展示了BundleCapability.getAttributes方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: PackageResource

import org.osgi.framework.wiring.BundleCapability; //导入方法依赖的package包/类
/**
 * Constructor for package resource
 *
 * @param bundleCapability {@code BundleCapability} that this package is coming from
 */
public PackageResource(BundleCapability bundleCapability) {
    super(PackageResourceManager.PACKAGE_PATH.addElements(uniqueCapabilityId(bundleCapability)));
    m_bundleCapability = bundleCapability;
    m_attributes = bundleCapability.getAttributes();
    m_directives = bundleCapability.getDirectives();
    m_packageName = (String) m_attributes.get(PACKAGE_NAMESPACE);
    m_version = (Version) m_attributes.get(PACKAGE_VERSION_ATTRIBUTE);

    calculateImporters();
    // provider bundle
    Bundle bundle = m_bundleCapability.getRevision().getBundle();
    Path bundlePath = BundleResourceManager.getInstance().getPath().addElements(Long.toString(bundle.getBundleId()));

    // Set relations
    setRelations(
            new DefaultRelation(bundlePath, Action.READ, PROVIDER_BUNDLE_NAME)
    );

}
 
开发者ID:ow2-chameleon,项目名称:everest,代码行数:25,代码来源:PackageResource.java

示例2: processBundleCapabilities

import org.osgi.framework.wiring.BundleCapability; //导入方法依赖的package包/类
private boolean processBundleCapabilities( Bundle bundle ) {
  BundleWiring wiring = bundle.adapt( BundleWiring.class );

  boolean foundPentahoWebPackageCapability = false;

  if ( wiring != null ) {
    List<BundleCapability> capabilities = wiring.getCapabilities( CAPABILITY_NAMESPACE );

    if ( capabilities != null ) {
      for ( BundleCapability bundleCapability : capabilities ) {
        Map<String, Object> attributes = bundleCapability.getAttributes();

        String root = (String) attributes.getOrDefault( "root", "" );
        while ( root.endsWith( "/" ) ) {
          root = root.substring( 0, root.length() - 1 );
        }

        try {
          URL capabilityPackageJsonUrl = bundle.getResource( root + "/package.json" );
          if ( capabilityPackageJsonUrl != null ) {
            boolean didParsePackageJson = this.parsePackageInformation( bundle, capabilityPackageJsonUrl );

            foundPentahoWebPackageCapability = foundPentahoWebPackageCapability || didParsePackageJson;
          } else {
            logger.warn( bundle.getSymbolicName() + " [" + bundle.getBundleId() + "]: " + root + "/package.json not found." );
          }
        } catch ( RuntimeException ignored ) {
          logger.error( bundle.getSymbolicName() + " [" + bundle.getBundleId() + "]: Error parsing " + root + "/package.json." );

          // throwing here would make everything fail
          // what damage control should we do?
          // **don't register this capability?** <-- this is what we're doing now
          // ignore and use only the capability info?
          // don't register all the bundle's capabilities?
        }
      }
    }
  }

  return foundPentahoWebPackageCapability;
}
 
开发者ID:pentaho,项目名称:pentaho-osgi-bundles,代码行数:42,代码来源:RequireJsConfigManager.java

示例3: matches

import org.osgi.framework.wiring.BundleCapability; //导入方法依赖的package包/类
@Override
protected boolean matches(final BundleCapability capability, final Filter filter) {
  Map<String, Object> attributes = capability.getAttributes();
  return filter.matches(attributes);
}
 
开发者ID:everit-org,项目名称:osgi-capability-collector,代码行数:6,代码来源:BundleCapabilityCollector.java


注:本文中的org.osgi.framework.wiring.BundleCapability.getAttributes方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。