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


Java FeaturesService.getFeature方法代码示例

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


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

示例1: installNexusEdition

import org.apache.karaf.features.FeaturesService; //导入方法依赖的package包/类
private static void installNexusEdition(final BundleContext ctx, @Nullable final String editionName)
    throws Exception
{
  if (editionName != null && editionName.length() > 0) {
    final ServiceTracker<?, FeaturesService> tracker = new ServiceTracker<>(ctx, FeaturesService.class, null);
    tracker.open();
    try {
      FeaturesService featuresService = tracker.waitForService(1000);
      Feature editionFeature = featuresService.getFeature(editionName);

      log.info("Installing: {}", editionFeature);

      // edition might already be installed in the cache; if so then skip installation
      if (!featuresService.isInstalled(editionFeature)) {
        // avoid auto-refreshing bundles as that could trigger unwanted restart/lifecycle events
        EnumSet<Option> options = EnumSet.of(NoAutoRefreshBundles, NoAutoRefreshManagedBundles);
        featuresService.installFeature(editionFeature.getId(), options);
      }

      log.info("Installed: {}", editionFeature);
    }
    finally {
      tracker.close();
    }
  }
}
 
开发者ID:sonatype,项目名称:nexus-public,代码行数:27,代码来源:BootstrapListener.java

示例2: getFeaturesReport

import org.apache.karaf.features.FeaturesService; //导入方法依赖的package包/类
private String getFeaturesReport( FeaturesService featuresService, List<String> uninstalledFeatures )
  throws Exception {
  ServiceReference<BundleService> serviceReferenceBundleService =
      bundleContext.getServiceReference( BundleService.class );
  BundleService bundleService = bundleContext.getService( serviceReferenceBundleService );
  List<BundleStateService> bundleStateServices = getBundleStateServices();

  String featuresReport = System.lineSeparator() + "--------- Karaf Feature Watcher Report Begin ---------";
  for ( String uninstalledFeature : uninstalledFeatures ) {
    Feature feature = featuresService.getFeature( uninstalledFeature );
    featuresReport +=
        System.lineSeparator() + getFeatureReport( featuresService, bundleService, bundleStateServices, feature );

  }
  return featuresReport + System.lineSeparator() + "--------- Karaf Feature Watcher Report End ---------";
}
 
开发者ID:pentaho,项目名称:pentaho-osgi-bundles,代码行数:17,代码来源:KarafFeatureWatcherImpl.java

示例3: waitForFeatures

import org.apache.karaf.features.FeaturesService; //导入方法依赖的package包/类
private void waitForFeatures( List<String> requiredFeatures, FeaturesService featuresService ) throws Exception {

    long entryTime = System.currentTimeMillis();
    // Loop through to see if features are all installed
    while ( true ) {

      List<String> uninstalledFeatures = new ArrayList<String>();

      for ( String requiredFeature : requiredFeatures ) {
        requiredFeature = requiredFeature.trim();
        Feature feature = featuresService.getFeature( requiredFeature );
        if ( feature != null && featuresService.isInstalled( feature ) == false ) {
          uninstalledFeatures.add( requiredFeature );
        }
      }
      if ( uninstalledFeatures.size() > 0 ) {
        if ( System.currentTimeMillis() - timeout > entryTime ) {
          IServiceBarrier serviceBarrier =
              IServiceBarrierManager.LOCATOR.getManager().getServiceBarrier( "KarafFeatureWatcherBarrier" );
          if ( serviceBarrier == null || serviceBarrier.isAvailable() ) {
            logger.debug( getFeaturesReport( featuresService, uninstalledFeatures ) );
            throw new FeatureWatcherException( "Timed out waiting for Karaf features to install: " + StringUtils
                .join( uninstalledFeatures, "," ) );
          } else {
            entryTime = System.currentTimeMillis();
          }
        }
        logger.debug( "KarafFeatureWatcher is waiting for the following features to install: " + StringUtils.join(
            uninstalledFeatures, "," ) );
        Thread.sleep( 100 );
        continue;
      }
      break;
    }
  }
 
开发者ID:pentaho,项目名称:pentaho-osgi-bundles,代码行数:36,代码来源:KarafFeatureWatcherImpl.java

示例4: ChildAwareFeatureWrapper

import org.apache.karaf.features.FeaturesService; //导入方法依赖的package包/类
ChildAwareFeatureWrapper(final Feature feature, final FeaturesService featuresService) throws Exception {
    super(featuresService.getFeature(feature.getName(), feature.getVersion()));
    Preconditions.checkNotNull(featuresService, "FeatureWrapper requires non-null FeatureService in constructor");
    this.featuresService = featuresService;
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:6,代码来源:ChildAwareFeatureWrapper.java


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