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


Java Bundle.INSTALLED屬性代碼示例

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


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

示例1: getOSGiBundle

private Bundle getOSGiBundle(String symbolicName, BundleContext bcontext) {

		ServiceReference<PackageAdmin> ref = bcontext.getServiceReference(PackageAdmin.class);
		PackageAdmin packageAdmin = bcontext.getService(ref);
		if (packageAdmin == null)
			return null;
		Bundle[] bundles = packageAdmin.getBundles(symbolicName, null);
		if (bundles == null)
			return null;
		//Return the first bundle that is not installed or uninstalled
		for (int i = 0; i < bundles.length; i++) {
			if ((bundles[i].getState() & (Bundle.INSTALLED | Bundle.UNINSTALLED)) == 0) {
				return bundles[i];
			}
		}
		return null;
	}
 
開發者ID:eclipse,項目名稱:scanning,代碼行數:17,代碼來源:TypeEditor.java

示例2: getOSGiBundle

private Bundle getOSGiBundle(String symbolicName) {

		ServiceReference<PackageAdmin> ref = context.getBundleContext().getServiceReference(PackageAdmin.class);
		PackageAdmin packageAdmin = context.getBundleContext().getService(ref);
		if (packageAdmin == null)
			return null;
		Bundle[] bundles = packageAdmin.getBundles(symbolicName, null);
		if (bundles == null)
			return null;
		//Return the first bundle that is not installed or uninstalled
		for (int i = 0; i < bundles.length; i++) {
			if ((bundles[i].getState() & (Bundle.INSTALLED | Bundle.UNINSTALLED)) == 0) {
				return bundles[i];
			}
		}
		return null;
	}
 
開發者ID:eclipse,項目名稱:scanning,代碼行數:17,代碼來源:PseudoSpringParser.java

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

示例4: isResolved

private static boolean isResolved(Bundle b) {
    if (b.getState() == Bundle.INSTALLED) {
        // try to ask for a known resource which is known to resolve 
        // the bundle
        b.findEntries("META-INF", "MANIFEST.MF", false); // NOI18N
    }
    return b.getState() != Bundle.INSTALLED;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:8,代碼來源:Netigso.java

示例5: resolveBundles

/**
 * Helps to diagnose bundles that are not resolved as it will throw a detailed exception
 * 
 * @throws BundleException
 */
public void resolveBundles() throws BundleException {
    Bundle[] bundles = bundleContext.getBundles();
    for (Bundle bundle : bundles) {
        if (bundle.getState() == Bundle.INSTALLED) {
            System.out.println("Found non resolved bundle " + bundle.getBundleId() + ":"
                + bundle.getSymbolicName() + ":" + bundle.getVersion());
            bundle.start();
        }
    }
}
 
開發者ID:apache,項目名稱:aries-jpa,代碼行數:15,代碼來源:AbstractJPAItest.java

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

示例7: createEntityManagerFactory

@Override
public EntityManagerFactory createEntityManagerFactory(Map<String, Object> props) {
	
	synchronized (this) {
		if (closed) {
			throw new IllegalStateException("The EntityManagerFactoryBuilder for " + 
					getPUName() + " is no longer valid");
		}
	}
	
	if (bundle.getState() == Bundle.UNINSTALLED || bundle.getState() == Bundle.INSTALLED
			|| bundle.getState() == Bundle.STOPPING) {
		// Not sure why but during the TCK tests updated sometimes was
		// called for uninstalled bundles
		throw new IllegalStateException("The EntityManagerFactoryBuilder for " + 
				getPUName() + " is no longer valid");
	}
	
	Map<String, Object> processedProperties = processProperties(props);
	
	synchronized (this) {
		if(processedProperties.equals(activeProps) && emf != null) {
			return emf;
		}
	}
	
	closeEMF();
	
	final EntityManagerFactory toUse = createAndPublishEMF(processedProperties);
	
	return (EntityManagerFactory) Proxy.newProxyInstance(getClass().getClassLoader(), 
			new Class<?>[] {EntityManagerFactory.class}, new InvocationHandler() {
				
				@Override
				public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
					if("close".equals(method.getName())) {
						// Close the registration as per the spec
						closeEMF();
						// Do not delegate as the closeEMF call already closes
						return null;
					}
					return method.invoke(toUse, args);
				}
			});
}
 
開發者ID:apache,項目名稱:aries-jpa,代碼行數:45,代碼來源:AriesEntityManagerFactoryBuilder.java


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