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


Java Bundle.getBundleContext方法代码示例

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


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

示例1: emit

import org.osgi.framework.Bundle; //导入方法依赖的package包/类
@Override
protected void emit(
	ServiceReference<NestedCollectionRouter> serviceReference,
	Emitter<String> emitter) {

	Bundle bundle = FrameworkUtil.getBundle(
		NestedCollectionRouterManagerImpl.class);

	BundleContext bundleContext = bundle.getBundleContext();

	CustomServiceReferenceMapper<NestedCollectionRouter>
		customServiceReferenceMapper = new CustomServiceReferenceMapper<>(
			bundleContext, NestedCollectionRouter.class);

	NestedCollectionRouter nestedCollectionRouter =
		bundleContext.getService(serviceReference);

	Class<?> genericClass = getGenericClassFromPropertyOrElse(
		serviceReference, PARENT_MODEL_CLASS,
		() -> getTypeParamOrFail(
			nestedCollectionRouter, NestedCollectionRouter.class, 1));

	customServiceReferenceMapper.map(
		serviceReference,
		key -> emitter.emit(key + "-" + genericClass.getName()));
}
 
开发者ID:liferay,项目名称:com-liferay-apio-architect,代码行数:27,代码来源:NestedCollectionRouterManagerImpl.java

示例2: trackProvider

import org.osgi.framework.Bundle; //导入方法依赖的package包/类
private void trackProvider(Bundle bundle, PersistenceUnit punit) {
    LOGGER.info(String.format("Found persistence unit %s in bundle %s with provider %s.",
                              punit.getPersistenceUnitName(), bundle.getSymbolicName(),
                              punit.getPersistenceProviderClassName()));
    PersistenceProviderTracker tracker = new PersistenceProviderTracker(bundle.getBundleContext(), punit);
    tracker.open();
    getTrackers(bundle).add(tracker);
}
 
开发者ID:apache,项目名称:aries-jpa,代码行数:9,代码来源:PersistenceBundleTracker.java

示例3: ensureInitialized

import org.osgi.framework.Bundle; //导入方法依赖的package包/类
private static void ensureInitialized() {
    boolean startTracker = false;
    synchronized (HibernateUtil.class) {
        if(tracker == null) {
            Bundle bundle = FrameworkUtil.getBundle(HibernateUtil.class);
            tracker = new ServiceTracker<>(bundle.getBundleContext(),
                    DBConnectionManager.class, null);
            startTracker = true;
        }
    }

    if (startTracker) {
        tracker.open();
    }
}
 
开发者ID:opensecuritycontroller,项目名称:osc-core,代码行数:16,代码来源:HibernateUtil.java

示例4: emit

import org.osgi.framework.Bundle; //导入方法依赖的package包/类
/**
 * Emits a the key of a service using an {@link Emitter<String>}.
 *
 * @param  serviceReference the service reference
 * @param  emitter the emitter
 * @review
 */
protected void emit(
	ServiceReference<T> serviceReference, Emitter<String> emitter) {

	Bundle bundle = FrameworkUtil.getBundle(BaseManager.class);

	BundleContext bundleContext = bundle.getBundleContext();

	CustomServiceReferenceMapper<T> customServiceReferenceMapper =
		new CustomServiceReferenceMapper<>(
			bundleContext, getManagedClass());

	customServiceReferenceMapper.map(serviceReference, emitter);
}
 
开发者ID:liferay,项目名称:com-liferay-apio-architect,代码行数:21,代码来源:BaseManager.java

示例5: emit

import org.osgi.framework.Bundle; //导入方法依赖的package包/类
@Override
protected void emit(
	ServiceReference<Representable> serviceReference,
	Emitter<String> emitter) {

	Bundle bundle = FrameworkUtil.getBundle(
		NestedCollectionRouterManagerImpl.class);

	BundleContext bundleContext = bundle.getBundleContext();

	Representable representable = bundleContext.getService(
		serviceReference);

	emitter.emit(representable.getName());
}
 
开发者ID:liferay,项目名称:com-liferay-apio-architect,代码行数:16,代码来源:ModelClassManagerImpl.java

示例6: removedService

import org.osgi.framework.Bundle; //导入方法依赖的package包/类
@Override
public default void removedService(
	ServiceReference<T> serviceReference,
	ServiceRegistration<?> serviceRegistration) {

	Bundle bundle = FrameworkUtil.getBundle(
		ServiceRegistrationServiceTrackerCustomizer.class);

	BundleContext bundleContext = bundle.getBundleContext();

	bundleContext.ungetService(serviceReference);

	serviceRegistration.unregister();
}
 
开发者ID:liferay,项目名称:com-liferay-apio-architect,代码行数:15,代码来源:ServiceRegistrationServiceTrackerCustomizer.java

示例7: addingService

import org.osgi.framework.Bundle; //导入方法依赖的package包/类
@Override
public U addingService(ServiceReference<T> serviceReference) {
	Bundle bundle = FrameworkUtil.getBundle(
		TransformServiceTrackerCustomizer.class);

	BundleContext bundleContext = bundle.getBundleContext();

	T t = bundleContext.getService(serviceReference);

	Class<?> modelClass = getGenericClassFromPropertyOrElse(
		serviceReference, MODEL_CLASS,
		() -> getTypeParamOrFail(t, _managedClass, 0));

	return map(t, serviceReference, modelClass);
}
 
开发者ID:liferay,项目名称:com-liferay-apio-architect,代码行数:16,代码来源:TransformServiceTrackerCustomizer.java

示例8: removedService

import org.osgi.framework.Bundle; //导入方法依赖的package包/类
@Override
public void removedService(ServiceReference<T> serviceReference, U u) {
	Bundle bundle = FrameworkUtil.getBundle(
		TransformServiceTrackerCustomizer.class);

	BundleContext bundleContext = bundle.getBundleContext();

	bundleContext.ungetService(serviceReference);

	onRemovedService(serviceReference, u);
}
 
开发者ID:liferay,项目名称:com-liferay-apio-architect,代码行数:12,代码来源:TransformServiceTrackerCustomizer.java

示例9: getBundleContext

import org.osgi.framework.Bundle; //导入方法依赖的package包/类
public BundleContext getBundleContext(Bundle bundle) {
	return bundle.getBundleContext();
}
 
开发者ID:eclipse,项目名称:gemini.blueprint,代码行数:4,代码来源:OsgiBundleUtils.java


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