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


Java Bundle.STARTING屬性代碼示例

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


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

示例1: 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

示例2: 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

示例3: isBundleLazyActivated

/**
 * Indicates if the given bundle is lazily activated or not. That is, the
 * bundle has a lazy activation policy and a STARTING state. Bundles that
 * have been lazily started but have been activated will return false.
 * 
 * <p/>
 * On OSGi R4.0 platforms, this method will always return false.
 * 
 * @param bundle OSGi bundle
 * @return true if the bundle is lazily activated, false otherwise.
 */
@SuppressWarnings("unchecked")
public static boolean isBundleLazyActivated(Bundle bundle) {
	Assert.notNull(bundle, "bundle is required");

	if (OsgiPlatformDetector.isR41()) {
		if (bundle.getState() == Bundle.STARTING) {
			Dictionary<String, String> headers = bundle.getHeaders();
			if (headers != null) {
				Object val = headers.get(Constants.BUNDLE_ACTIVATIONPOLICY);
				if (val != null) {
					String value = ((String) val).trim();
					return (value.startsWith(Constants.ACTIVATION_LAZY));
				}
			}
		}
	}
	return false;
}
 
開發者ID:eclipse,項目名稱:gemini.blueprint,代碼行數:29,代碼來源:OsgiBundleUtils.java

示例4: testIsBundleResolved

public void testIsBundleResolved() throws Exception {
	OsgiBundleUtilsTest.state = Bundle.UNINSTALLED;
	assertFalse(OsgiBundleUtils.isBundleResolved(bundle));

	OsgiBundleUtilsTest.state = Bundle.INSTALLED;
	assertFalse(OsgiBundleUtils.isBundleResolved(bundle));

	OsgiBundleUtilsTest.state = Bundle.ACTIVE;
	assertTrue(OsgiBundleUtils.isBundleResolved(bundle));

	OsgiBundleUtilsTest.state = Bundle.RESOLVED;
	assertTrue(OsgiBundleUtils.isBundleResolved(bundle));
	
	OsgiBundleUtilsTest.state = Bundle.STOPPING;
	assertTrue(OsgiBundleUtils.isBundleResolved(bundle));

	OsgiBundleUtilsTest.state = Bundle.STARTING;
	assertTrue(OsgiBundleUtils.isBundleResolved(bundle));

}
 
開發者ID:eclipse,項目名稱:gemini.blueprint,代碼行數:20,代碼來源:OsgiBundleUtilsTest.java

示例5: 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

示例6: start

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

示例7: 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

示例8: 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

示例9: 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

示例10: 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

示例11: assertAllBundlesResolved

private void assertAllBundlesResolved() {
    int mask = Bundle.RESOLVED | Bundle.STARTING | Bundle.STOPPING | Bundle.ACTIVE;
    for (Bundle bundle : this.bundleContext.getBundles()) {
        assertTrue("Unresolved bundle " + bundle.getSymbolicName(), (bundle.getState() & mask) > 0);
    }
}
 
開發者ID:opensecuritycontroller,項目名稱:osc-core,代碼行數:6,代碼來源:InstallerIntegrationTest.java

示例12: isBundleStartingResolvedOrActive

/**
 * Checks if the specified bundle is resolved or active.
 *
 * @param bundle the bundle
 * @return true, if the bundle is resolved or active
 */
private boolean isBundleStartingResolvedOrActive(Bundle bundle) {
	return (bundle.getState()==Bundle.STARTING || bundle.getState()==Bundle.RESOLVED || bundle.getState()==Bundle.ACTIVE); 
}
 
開發者ID:EnFlexIT,項目名稱:AgentWorkbench,代碼行數:9,代碼來源:BundleEvaluator.java


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