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


Java BundleContext.addBundleListener方法代码示例

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


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

示例1: activate

import org.osgi.framework.BundleContext; //导入方法依赖的package包/类
@Activate
void activate(BundleContext context) {
    this.context = context;
    context.addFrameworkListener(this.frameworkListener);
    context.addBundleListener(this.bundleListener);

    this.processorThread = new Thread(() -> {
        this.log.log(LogService.LOG_INFO, "Deployment Installer thread starting");
        debug("Deployment Install thread starting");
        while (!Thread.interrupted()) {
            try {
                Runnable job = waitForJob();
                job.run();
            } catch (InterruptedException e) {
                debug("Deployment Install thread interrupted");
                this.log.log(LogService.LOG_INFO, "Deployment Installer thread interrupted");
                break;
            } catch (Exception e) {
                this.log.log(LogService.LOG_ERROR, "Error processing job on Deployment Installer thread", e);
            }
        }
        debug("Deployment Install thread terminated.");
        this.log.log(LogService.LOG_INFO, "Deployment Installer thread terminated");
    });
    this.processorThread.start();
}
 
开发者ID:opensecuritycontroller,项目名称:osc-core,代码行数:27,代码来源:DeploymentInstaller.java

示例2: PermissionManager

import org.osgi.framework.BundleContext; //导入方法依赖的package包/类
/**
 * Constructs a new <code>PermissionManager</code> instance.
 * 
 * @param bc
 */
private PermissionManager(BundleContext bc) {
	ServiceReference ref = bc.getServiceReference(PermissionAdmin.class.getName());
	if (ref != null) {
		logger.trace("Found permission admin " + ref);
		pa = (PermissionAdmin) bc.getService(ref);
		bc.addBundleListener(this);
		logger.trace("Default permissions are " + ObjectUtils.nullSafeToString(pa.getDefaultPermissions()));
		logger.warn("Security turned ON");

	}
	else {
		logger.warn("Security turned OFF");
		pa = null;
	}
}
 
开发者ID:eclipse,项目名称:gemini.blueprint,代码行数:21,代码来源:BaseIntegrationTest.java

示例3: initNamespaceHandlers

import org.osgi.framework.BundleContext; //导入方法依赖的package包/类
protected void initNamespaceHandlers(BundleContext extenderBundleContext) {
    nsManager = new NamespaceManager(extenderBundleContext);

    // register listener first to make sure any bundles in INSTALLED state
    // are not lost

    // if the property is defined and true, consider bundles in STARTED/LAZY-INIT state, otherwise use RESOLVED
    boolean nsResolved = !Boolean.getBoolean("org.eclipse.gemini.blueprint.ns.bundles.started");
    nsListener = new NamespaceBundleLister(nsResolved, this);
    extenderBundleContext.addBundleListener(nsListener);

    Bundle[] previousBundles = extenderBundleContext.getBundles();

    for (Bundle bundle : previousBundles) {
        // special handling for uber bundle being restarted
        if ((nsResolved && OsgiBundleUtils.isBundleResolved(bundle)) || (!nsResolved && OsgiBundleUtils.isBundleActive(bundle)) || bundleId == bundle.getBundleId()) {
            maybeAddNamespaceHandlerFor(bundle, false);
        } else if (OsgiBundleUtils.isBundleLazyActivated(bundle)) {
            maybeAddNamespaceHandlerFor(bundle, true);
        }
    }

    // discovery finished, publish the resolvers/parsers in the OSGi space
    nsManager.afterPropertiesSet();
}
 
开发者ID:eclipse,项目名称:gemini.blueprint,代码行数:26,代码来源:NamespaceHandlerActivator.java

示例4: start

import org.osgi.framework.BundleContext; //导入方法依赖的package包/类
public @Override void start(final BundleContext context) throws Exception {
        if (System.getProperty("netbeans.home") != null) {
            throw new IllegalStateException("Should not be run from inside regular NetBeans module system");
        }
        String storage = context.getProperty(Constants.FRAMEWORK_STORAGE);
        if (storage != null) {
            System.setProperty("netbeans.user", storage);
        }
        System.setProperty("TopSecurityManager.disable", "true");
        NbBundle.setBranding(System.getProperty("branding.token"));
        OSGiMainLookup.initialize(context);
        queue = new DependencyQueue<String,Bundle>();
        this.context = context;
        framework = ((Framework) context.getBundle(0));
        if (framework.getState() == Bundle.STARTING) {
            LOG.fine("framework still starting");
            final AtomicReference<FrameworkListener> frameworkListener = new AtomicReference<FrameworkListener>();
            frameworkListener.set(new FrameworkListener() {
                public @Override void frameworkEvent(FrameworkEvent event) {
                    if (event.getType() == FrameworkEvent.STARTED) {
//                        System.err.println("framework started");
                        context.removeFrameworkListener(frameworkListener.get());
                        context.addBundleListener(Activator.this);
                        processLoadedBundles();
                    }
                }
            });
            context.addFrameworkListener(frameworkListener.get());
        } else {
            LOG.fine("framework already started");
            context.addBundleListener(this);
            processLoadedBundles();
        }
    }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:35,代码来源:Activator.java

示例5: start

import org.osgi.framework.BundleContext; //导入方法依赖的package包/类
@Override
public void start(BundleContext ctx) {
    LOG.debug("Starting EclipseLink adapter");
    context = ctx;
    ctx.addBundleListener(this);
    
    for (Bundle b : ctx.getBundles()) {
        if ((b.getState() & (Bundle.ACTIVE | Bundle.STARTING | Bundle.RESOLVED | Bundle.STOPPING)) != 0) 
            handlePotentialEclipseLink(b);
    }
}
 
开发者ID:apache,项目名称:aries-jpa,代码行数:12,代码来源:Activator.java

示例6: testStart

import org.osgi.framework.BundleContext; //导入方法依赖的package包/类
public void testStart() throws Exception {
	BundleContext context = createMock(BundleContext.class);
	// platform determination

	// extracting bundle id from bundle
	expect(context.getBundle()).andReturn(new MockBundle());

	// look for existing resolved bundles
	expect(context.getBundles()).andReturn(new Bundle[0]).times(2);

	// register context service
	expect(context.registerService((String[]) null, null, null)).andReturn(null).atLeastOnce();

	// create task executor
	EntryLookupControllingMockBundle aBundle = new EntryLookupControllingMockBundle(null);
	aBundle.setEntryReturnOnNextCallToGetEntry(null);
	expect(context.getBundle()).andReturn(aBundle).atLeastOnce();

	// listen for bundle events
	context.addBundleListener(null);
       expectLastCall().times(2);

	expect(context.registerService(new String[0], null, new Hashtable<String, Object>())).andReturn(new MockServiceRegistration()).atLeastOnce();
	replay(context);

	this.listener.start(context);
	verify(context);
}
 
开发者ID:eclipse,项目名称:gemini.blueprint,代码行数:29,代码来源:ContextLoaderListenerTest.java

示例7: start

import org.osgi.framework.BundleContext; //导入方法依赖的package包/类
public void start(BundleContext context) throws Exception {
	super.start(context);
	thisActivator = this;
	context.addBundleListener(this);
}
 
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:6,代码来源:PlugInActivator.java

示例8: ReplayEventManager

import org.osgi.framework.BundleContext; //导入方法依赖的package包/类
ReplayEventManager(BundleContext bundleContext) {
	this.bundleContext = bundleContext;
	bundleContext.addBundleListener(listener);
}
 
开发者ID:eclipse,项目名称:gemini.blueprint,代码行数:5,代码来源:ReplayEventManager.java

示例9: activate

import org.osgi.framework.BundleContext; //导入方法依赖的package包/类
/**
 * Activate component
 *
 * @param context
 */
@Activate
public void activate(BundleContext context){
    context.addBundleListener(this);
}
 
开发者ID:DantaFramework,项目名称:JahiaDF,代码行数:10,代码来源:JahiaConfigurationProviderImpl.java


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