當前位置: 首頁>>代碼示例>>Java>>正文


Java Bundle.ACTIVE屬性代碼示例

本文整理匯總了Java中org.osgi.framework.Bundle.ACTIVE屬性的典型用法代碼示例。如果您正苦於以下問題:Java Bundle.ACTIVE屬性的具體用法?Java Bundle.ACTIVE怎麽用?Java Bundle.ACTIVE使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在org.osgi.framework.Bundle的用法示例。


在下文中一共展示了Bundle.ACTIVE屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: stopAndUninstallBundles

/**
 * Stops and un-installs the current bundle.
 */
public void stopAndUninstallBundles() {
	
	// --- Get a copy of loaded bundles -----
	Vector<Bundle> bundlesToRemove = new Vector<>(this.getBundleVector());
	for (Bundle bundle: bundlesToRemove) {
		try {
			// --- Remove, if active --------
			if (bundle.getState()==Bundle.ACTIVE) {
				bundle.stop();
				bundle.uninstall();
			}
			// --- Remove from vector -------
			this.getBundleVector().remove(bundle);
			if (this.debug) System.out.println("=> - " + bundle.getSymbolicName() + " stoped & uninstalled");
			
		} catch (BundleException bEx) {
			bEx.printStackTrace();
		}
	}
}
 
開發者ID:EnFlexIT,項目名稱:AgentWorkbench,代碼行數:23,代碼來源:ProjectBundleLoader.java

示例2: testBundleActivation

@Test
public void testBundleActivation()
{
    String bundleName = getBundleName();

    boolean bundleFound = false;
    boolean bundleActive = false;
    Bundle[] bundles = context.getBundles();
    for ( Bundle bundle : bundles )
    {
        //System.out.println( "### bundle=" + bundle + " " + bundle.getState() );
        if ( bundle != null && bundle.getSymbolicName() != null && bundle.getSymbolicName().equals( bundleName ) )
        {
            bundleFound = true;
            if ( bundle.getState() == Bundle.ACTIVE )
            {
                bundleActive = true;
            }
        }
    }

    assertTrue( "Bundle " + bundleName + " not found.", bundleFound );
    assertTrue( "Bundle " + bundleName + " is not active.", bundleActive );
}
 
開發者ID:apache,項目名稱:directory-ldap-api,代碼行數:24,代碼來源:ApiOsgiTestBase.java

示例3: activate

@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,代碼行數:24,代碼來源:UiServletContext.java

示例4: addEvent

void addEvent(BlueprintEvent event) {
	// copy event
	BlueprintEvent replay = new BlueprintEvent(event, true);
	Bundle bnd = replay.getBundle();
	if (bnd.getState() == Bundle.ACTIVE || bnd.getState() == Bundle.STARTING || bnd.getState() == Bundle.STOPPING) {
		events.put(bnd, replay);
		if (log.isTraceEnabled())
			log.trace("Adding replay event  " + replay.getType() + " for bundle " + replay.getBundle());
	} else {
		if (log.isTraceEnabled()) {
			log.trace("Replay event " + replay.getType() + " ignored; " + "owning bundle has been uninstalled "
					+ bnd);
			events.remove(bnd);
		}
	}
}
 
開發者ID:eclipse,項目名稱:gemini.blueprint,代碼行數:16,代碼來源:ReplayEventManager.java

示例5: modifiedBundle

/**
 * Implemented from BundleTrackerCustomizer.
 */
@Override
public void modifiedBundle(final Bundle bundle, final BundleEvent event, final Bundle object) {
    if (shuttingDown) {
        return;
    }

    if (bundle.getState() == Bundle.ACTIVE) {
        List<Object> paths = findBlueprintPaths(bundle);

        if (!paths.isEmpty()) {
            LOG.info("Creating blueprint container for bundle {} with paths {}", bundle, paths);

            blueprintExtenderService.createContainer(bundle, paths);
        }
    }
}
 
開發者ID:hashsdn,項目名稱:hashsdn-controller,代碼行數:19,代碼來源:BlueprintBundleTracker.java

示例6: testSecondSceneServiceNotSelected

/**
 * Ensures that if a second SceneService is deployed, that is it not loaded into the Stage.
 */
@Test
public void testSecondSceneServiceNotSelected() throws Exception
{
    final String installDummyBundleTwoCommand ="bundle:install mvn:"
            + OSGIFX_GROUP_ID + "/"
            + DUMMY_TWO_BUNDLE_ARTIFACT_ID + "/"
            + PROJECT_VERSION;
    // Ensure the dummy bundle two is not installed.
    Bundle dummyTwoBundle = getInstalledBundle(OSGIFX_GROUP_ID + "." + DUMMY_TWO_BUNDLE_ARTIFACT_ID);
    assertNull("Dummy Bundle Two found to be already deployed.", dummyTwoBundle);

    session.execute(installDummyBundleTwoCommand);

    dummyTwoBundle = getInstalledBundle(OSGIFX_GROUP_ID + "." + DUMMY_TWO_BUNDLE_ARTIFACT_ID);
    assertNotNull("Dummy Bundle Two was not installed.", dummyTwoBundle);
    if (dummyTwoBundle.getState() != Bundle.ACTIVE)
    {
        dummyTwoBundle.start();
    }
    assertEquals("Dummy Two bundle not active.", Bundle.ACTIVE, dummyTwoBundle.getState());
    dummyTwoBundle.uninstall();

}
 
開發者ID:jtkb,項目名稱:flexfx,代碼行數:26,代碼來源:TFxTest.java

示例7: findBundle

public static Bundle findBundle(String bsn) throws Exception {
    Bundle[] arr = findFramework().getBundleContext().getBundles();
    Bundle candidate = null;
    for (Bundle b : arr) {
        if (bsn.equals(b.getSymbolicName())) {
            candidate = b;
            if ((b.getState() & Bundle.ACTIVE) != 0) {
                return b;
            }
        }
    }
    return candidate;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:13,代碼來源:NetigsoServicesTest.java

示例8: isEnabled

public @Override boolean isEnabled() {
    switch (b.getState()) {
    case Bundle.RESOLVED:
    case Bundle.ACTIVE:
    case Bundle.STARTING:
    case Bundle.STOPPING:
        return true;
    default:
        return false;
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:11,代碼來源:OSGiMainLookup.java

示例9: processLoadedBundles

private void processLoadedBundles() {
        List<Bundle> toLoad = new ArrayList<Bundle>();
        for (Bundle b : context.getBundles()) {
            if (b.getState() == Bundle.ACTIVE) {
                Dictionary<?,?> headers = b.getHeaders();
                toLoad.addAll(queue.offer(b, provides(headers), requires(headers), needs(headers)));
            }
        }
//        System.err.println("processing already loaded bundles: " + toLoad);
        load(toLoad);
    }
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:11,代碼來源:Activator.java

示例10: start

@Override
public void start(BundleContext context) throws Exception {
    registerWeavingHook(context, TransformerRegistrySingleton.get());

    PersistenceBundleTracker customizer = new PersistenceBundleTracker(context.getBundle().adapt(BundleWiring.class));
    persistenceBundleManager = new BundleTracker<Bundle>(context, Bundle.STARTING | Bundle.ACTIVE, customizer);
    persistenceBundleManager.open();
}
 
開發者ID:apache,項目名稱:aries-jpa,代碼行數:8,代碼來源:Activator.java

示例11: start

@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,代碼行數:11,代碼來源:Activator.java

示例12: testGetBundleStateAsName

public void testGetBundleStateAsName() throws Exception {
	OsgiStringUtilsTest.state = Bundle.ACTIVE;
	assertEquals("ACTIVE", OsgiStringUtils.bundleStateAsString(bundle));
	OsgiStringUtilsTest.state = Bundle.STARTING;
	assertEquals("STARTING", OsgiStringUtils.bundleStateAsString(bundle));
	OsgiStringUtilsTest.state = Bundle.STOPPING;
	assertEquals("STOPPING", OsgiStringUtils.bundleStateAsString(bundle));
	OsgiStringUtilsTest.state = -123;
	assertEquals("UNKNOWN STATE", OsgiStringUtils.bundleStateAsString(bundle));
}
 
開發者ID:eclipse,項目名稱:gemini.blueprint,代碼行數:10,代碼來源:OsgiStringUtilsTest.java

示例13: testIsInActiveBundleState

public void testIsInActiveBundleState() throws Exception {
	OsgiBundleUtilsTest.state = Bundle.ACTIVE;
	assertTrue(OsgiBundleUtils.isBundleActive(bundle));

	OsgiBundleUtilsTest.state = Bundle.STARTING;
	assertFalse(OsgiBundleUtils.isBundleActive(bundle));

	OsgiBundleUtilsTest.state = Bundle.INSTALLED;
	assertFalse(OsgiBundleUtils.isBundleActive(bundle));
}
 
開發者ID:eclipse,項目名稱:gemini.blueprint,代碼行數:10,代碼來源:OsgiBundleUtilsTest.java

示例14: readMetanodes

private void readMetanodes() {
	// iterate over the meta node config elements and create meta node templates
	IExtension[] metanodeExtensions = getExtensions(ID_META_NODE);
	for (IExtension mnExt : metanodeExtensions) {
		IConfigurationElement[] mnConfigElems = mnExt.getConfigurationElements();
		for (IConfigurationElement mnConfig : mnConfigElems) {

			try {
				MetaNodeTemplate metaNode = RepositoryFactory.createMetaNode(mnConfig);
				LOGGER.debug("Found meta node definition '" + metaNode.getID() + "': " + metaNode.getName());

				IContainerObject parentContainer = m_root.findContainer(metaNode.getCategoryPath());
				// If parent category is illegal, log an error and append the node to the
				// repository root.
				if (parentContainer == null) {
					LOGGER.warn("Invalid category-path for node contribution: '" + metaNode.getCategoryPath()
							+ "' - adding to root instead");
					m_root.addChild(metaNode);
				} else {
					// everything is fine, add the node to its parent category
					parentContainer.addChild(metaNode);
				}
			} catch (Throwable t) {
				String message = "MetaNode " + mnConfig.getAttribute("id") + "' from plugin '"
						+ mnConfig.getNamespaceIdentifier() + "' could not be created: " + t.getMessage();
				Bundle bundle = Platform.getBundle(mnConfig.getNamespaceIdentifier());

				if (bundle == null || bundle.getState() != Bundle.ACTIVE) {
					// if the plugin is null, the plugin could not be activated maybe due to a not
					// activateable plugin (plugin class cannot be found)
					message = message + " The corresponding plugin bundle could not be activated!";
				}

				LOGGER.error(message, t);
			}
		}
	}
}
 
開發者ID:qqilihq,項目名稱:knime-json-node-doc-generator,代碼行數:38,代碼來源:RepositoryManager.java

示例15: start

public void start() throws BundleException {
    state = Bundle.ACTIVE;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:3,代碼來源:NetigsoSelfQueryTest.java


注:本文中的org.osgi.framework.Bundle.ACTIVE屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。