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


Java BundleTrackerCustomizer类代码示例

本文整理汇总了Java中org.osgi.util.tracker.BundleTrackerCustomizer的典型用法代码示例。如果您正苦于以下问题:Java BundleTrackerCustomizer类的具体用法?Java BundleTrackerCustomizer怎么用?Java BundleTrackerCustomizer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: activate

import org.osgi.util.tracker.BundleTrackerCustomizer; //导入依赖的package包/类
@Activate
void activate(BundleContext ctx) {
    this.base = new File("").toURI();
    // Find the resolved vaadin bundle
    this.vaadinResourceBundles = new BundleTracker<Bundle>(ctx, Bundle.RESOLVED |
            Bundle.STARTING | Bundle.ACTIVE | Bundle.STOPPING,
                new BundleTrackerCustomizer<Bundle>() {
                    @Override
                    public Bundle addingBundle(Bundle bundle, BundleEvent event) {
                        return VAADIN_SERVER_BUNDLE.equals(bundle.getSymbolicName()) ?
                                bundle : null;
                    }

                    @Override
                    public void modifiedBundle(Bundle bundle, BundleEvent event, Bundle object) {

                    }

                    @Override
                    public void removedBundle(Bundle bundle, BundleEvent event, Bundle object) {
                    }
            });
    this.vaadinResourceBundles.open();
}
 
开发者ID:opensecuritycontroller,项目名称:osc-core,代码行数:25,代码来源:UiServletContext.java

示例2: ExtensibleBundleTracker

import org.osgi.util.tracker.BundleTrackerCustomizer; //导入依赖的package包/类
public ExtensibleBundleTracker(final BundleContext context, final int bundleState,
        final BundleTrackerCustomizer<T> primaryBundleTrackerCustomizer,
        final BundleTrackerCustomizer<?>... additionalBundleTrackerCustomizers) {
    super(context, bundleState, null);
    this.primaryTracker = primaryBundleTrackerCustomizer;
    this.additionalTrackers = additionalBundleTrackerCustomizers;
    eventExecutor = Executors.newSingleThreadExecutor(THREAD_FACTORY);
    LOG.trace("Registered as extender with context {} and bundle state {}", context, bundleState);
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:10,代码来源:ExtensibleBundleTracker.java

示例3: OsgiMessageInterpolator

import org.osgi.util.tracker.BundleTrackerCustomizer; //导入依赖的package包/类
public OsgiMessageInterpolator ( final BundleContext context )
{
    this.tracker = new BundleTracker<> ( context, Bundle.ACTIVE | Bundle.RESOLVED, new BundleTrackerCustomizer<Resolver> () {

        @Override
        public Resolver addingBundle ( final Bundle bundle, final BundleEvent event )
        {
            if ( bundle.getResource ( "META-INF/ValidationMessages.properties" ) != null )
            {
                return new Resolver ( bundle );
            }
            return null;
        }

        @Override
        public void modifiedBundle ( final Bundle bundle, final BundleEvent event, final Resolver resolver )
        {
        }

        @Override
        public void removedBundle ( final Bundle bundle, final BundleEvent event, final Resolver resolver )
        {
            resolver.dispose ();
        }
    } );
    this.tracker.open ();
}
 
开发者ID:eclipse,项目名称:packagedrone,代码行数:28,代码来源:OsgiMessageInterpolator.java

示例4: start

import org.osgi.util.tracker.BundleTrackerCustomizer; //导入依赖的package包/类
@Override
public void start(BundleContext context) {
    Collection<BundleTrackerCustomizer<Object>> handlers = 
            Arrays.asList(new CdiBundleChangeListener(context.getBundle()),
                    new ResourceHandlingBundleListener());
    trackers = handlers.stream().map((c) ->
        new BundleTracker<>(context, Bundle.ACTIVE, c)).collect(Collectors.toList());
    new Thread(() -> trackers.forEach((t) -> t.open())).start();
}
 
开发者ID:arievanwi,项目名称:osgi.ee,代码行数:10,代码来源:Activator.java

示例5: forEachAdditionalBundle

import org.osgi.util.tracker.BundleTrackerCustomizer; //导入依赖的package包/类
private void forEachAdditionalBundle(final BundleStrategy lambda) {
    for (BundleTrackerCustomizer<?> trac : additionalTrackers) {
        lambda.execute(trac);
    }
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:6,代码来源:ExtensibleBundleTracker.java

示例6: MyBundleTracker

import org.osgi.util.tracker.BundleTrackerCustomizer; //导入依赖的package包/类
public MyBundleTracker(BundleContext context, int stateMask,
                       BundleTrackerCustomizer customizer) {
    super(context, stateMask, customizer);
}
 
开发者ID:ahoffer,项目名称:osgi,代码行数:5,代码来源:MyBundleTracker.java

示例7: activate

import org.osgi.util.tracker.BundleTrackerCustomizer; //导入依赖的package包/类
@Activate
public void activate(final BundleContext context) {
	bt = new BundleTracker<ServiceRegistration<PersistenceProvider>>(context, Bundle.ACTIVE + Bundle.STARTING,
			new BundleTrackerCustomizer<ServiceRegistration<PersistenceProvider>>() {

				@Override
				public ServiceRegistration<PersistenceProvider> addingBundle(Bundle bundle, BundleEvent event) {
					String name = bundle.getSymbolicName();
					if (name == null || !name.equals("org.datanucleus.api.jpa"))
						return null;

					Version version = bundle.getVersion();
					if (version == null || baseVersion.compareTo(version) > 0)
						return null;

					URL url = bundle.getResource("META-INF/services/" + PersistenceProvider.class.getName());
					if (url == null)
						return null;

					ServiceLoader<PersistenceProvider> sl = ServiceLoader.load(PersistenceProvider.class, bundle
							.adapt(BundleWiring.class).getClassLoader());
					for (PersistenceProvider pp : sl) {
						return bundle.getBundleContext().registerService(PersistenceProvider.class,
								new DatanucleusWrapper(pp), null);
					}
					return null;
				}

				@Override
				public void modifiedBundle(Bundle bundle, BundleEvent event,
						ServiceRegistration<PersistenceProvider> object) {
					// TODO Auto-generated method stub

				}

				@Override
				public void removedBundle(Bundle bundle, BundleEvent event,
						ServiceRegistration<PersistenceProvider> reg) {
					reg.unregister();
				}
			});
	bt.open();
}
 
开发者ID:osgi,项目名称:bundles,代码行数:44,代码来源:DatanucleusBridge.java

示例8: execute

import org.osgi.util.tracker.BundleTrackerCustomizer; //导入依赖的package包/类
void execute(BundleTrackerCustomizer<?> tracker); 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:2,代码来源:ExtensibleBundleTracker.java


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