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


Java BundleEvent.getType方法代碼示例

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


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

示例1: bundleChanged

import org.osgi.framework.BundleEvent; //導入方法依賴的package包/類
public @Override void bundleChanged(BundleEvent event) {
        Bundle bundle = event.getBundle();
        switch (event.getType()) {
        case BundleEvent.STARTED:
//            System.err.println("started " + bundle.getSymbolicName());
            Dictionary<?,?> headers = bundle.getHeaders();
            load(queue.offer(bundle, provides(headers), requires(headers), needs(headers)));
            break;
        case BundleEvent.STOPPED:
//            System.err.println("stopped " + bundle.getSymbolicName());
            if (framework.getState() == Bundle.STOPPING) {
//                System.err.println("fwork stopping during " + bundle.getSymbolicName());
//                ActiveQueue.stop();
            } else {
                unload(queue.retract(bundle));
            }
            break;
        }
    }
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:20,代碼來源:Activator.java

示例2: bundleChanged

import org.osgi.framework.BundleEvent; //導入方法依賴的package包/類
@Override
public void bundleChanged(BundleEvent event) {
    Bundle bundle = event.getBundle();
    try {
        PrivilegedCarbonContext carbonContext = PrivilegedCarbonContext.getThreadLocalCarbonContext();
        carbonContext.setTenantDomain(MultitenantConstants.SUPER_TENANT_DOMAIN_NAME);
        carbonContext.setTenantId(MultitenantConstants.SUPER_TENANT_ID);

        if (event.getType() == BundleEvent.STARTED) {
            addUIPermissionFromBundle(bundle);
        }
    } catch (Exception e) {
        log.error("Error occured when processing component xml in bundle " +
                bundle.getSymbolicName(), e);
    }
}
 
開發者ID:wso2,項目名稱:carbon-identity-framework,代碼行數:17,代碼來源:ManagementPermissionsAdder.java

示例3: bundleChanged

import org.osgi.framework.BundleEvent; //導入方法依賴的package包/類
@Override
public void bundleChanged(BundleEvent bundleEvent) {
    if (providerBaseClassName == null || objectMapperClassName == null) {
        return;
    }

    if (bundleEvent.getBundle().getState() == Bundle.UNINSTALLED) return;

    Set<String> classNamesOfCurrentBundle = JacksonManagerService.getClassNames(bundleEvent.getBundle());

    if (classNamesOfCurrentBundle.contains(objectMapperClassName) || classNamesOfCurrentBundle.contains(providerBaseClassName)) {
        if (bundleEvent.getType() == BundleEvent.STARTED && isValid()) {
            jacksonServiceController = true;
        }
        if (bundleEvent.getType() == BundleEvent.STOPPED) {
            jacksonServiceController = false;
        }
    }
}
 
開發者ID:andyphillips404,項目名稱:awplab-core,代碼行數:20,代碼來源:JacksonJaxrsProvider.java

示例4: bundleChanged

import org.osgi.framework.BundleEvent; //導入方法依賴的package包/類
@Override
public void bundleChanged(BundleEvent bundleEvent) {
    if (moduleClassNames == null) {
        return;
    }


    Set<String> classNamesOfCurrentBundle = JacksonManagerService.getClassNames(bundleEvent.getBundle());

    boolean found = false;
    for (String className : moduleClassNames) {
        if (classNamesOfCurrentBundle.contains(className)) {
            found = true;
            break;
        }
    }
    if (found) {
        if (bundleEvent.getType() == BundleEvent.STARTED && isValid()) {
            jacksonServiceController = true;
        }
        if (bundleEvent.getType() == BundleEvent.STOPPED) {
            jacksonServiceController = false;
        }
    }
}
 
開發者ID:andyphillips404,項目名稱:awplab-core,代碼行數:26,代碼來源:JacksonModulesProvider.java

示例5: bundleChanged

import org.osgi.framework.BundleEvent; //導入方法依賴的package包/類
/**
 *
 * @param event
 */
@Override
public void bundleChanged(BundleEvent event) {
    switch (event.getType()) {
        case BundleEvent.STARTED:
            if(isBundleEligible(event.getBundle())) {
                m_classLoader.addBundle(event.getBundle());
            }
            break;
        case BundleEvent.STOPPED:
            if(isBundleEligible(event.getBundle())) {
                m_classLoader.removeBundle(event.getBundle());
            }
            break;
    }
}
 
開發者ID:lburgazzoli,項目名稱:lb-karaf,代碼行數:20,代碼來源:CombinedClassLoaderHelper.java

示例6: handleEvent

import org.osgi.framework.BundleEvent; //導入方法依賴的package包/類
protected void handleEvent(BundleEvent event) {

			Bundle bundle = event.getBundle();

			switch (event.getType()) {
				case BundleEvent.STARTED: {
					maybeAddNamespaceHandlerFor(bundle);
					break;
				}
				case BundleEvent.STOPPED: {
					maybeRemoveNameSpaceHandlerFor(bundle);
					break;
				}
				default:
					break;
			}
		}
 
開發者ID:BeamFoundry,項目名稱:spring-osgi,代碼行數:18,代碼來源:ContextLoaderListener.java

示例7: bundleChanged

import org.osgi.framework.BundleEvent; //導入方法依賴的package包/類
@Override
public void bundleChanged(BundleEvent event) {

	Bundle bundle = event.getBundle();

	if (!bundleManager.isRegisterable(job, bundle.getSymbolicName()))
		return;

	switch (event.getType()) {

	case BundleEvent.STARTED:
		bundleManager.register(job, bundle.getSymbolicName());
		break;

	case BundleEvent.STOPPED:
		bundleManager.unregister(job, bundle.getSymbolicName());
		break;

	default:
		break;
	}
}
 
開發者ID:asupdev,項目名稱:asup,代碼行數:23,代碼來源:E4BundleListener.java

示例8: bundleChanged

import org.osgi.framework.BundleEvent; //導入方法依賴的package包/類
/**
 * {@inheritDoc}
 */
@Override
public void bundleChanged(BundleEvent bundleEvent) {
    final Bundle bundle = bundleEvent.getBundle();
    final String bundleName = bundle.getSymbolicName();
    if (bundleName != null && shouldProcessBundle(bundle)) {
        switch (bundleEvent.getType()) {
        case BundleEvent.STARTED:
            LOG.debug("The bundlde " + bundleName
                    + " has been activated and will be scanned for struts configuration");
            loadConfigFromBundle(bundle);
            break;
        case BundleEvent.STOPPED:
            onBundleStopped(bundle);
            break;
        default:
            break;
        }
    }
}
 
開發者ID:NCIP,項目名稱:caarray,代碼行數:23,代碼來源:OsgiConfigurationProvider.java

示例9: bundleChanged

import org.osgi.framework.BundleEvent; //導入方法依賴的package包/類
@Override
public void bundleChanged(final BundleEvent event) {
    switch (event.getType()) {
        // FIXME: STARTING instead of STARTED?
        case BundleEvent.STARTED:
            scanBundleForPlugins(event.getBundle());
            break;

        case BundleEvent.STOPPING:
            stopBundlePlugins(event.getBundle());
            break;

        default:
            break;
    }
}
 
開發者ID:apache,項目名稱:logging-log4j2,代碼行數:17,代碼來源:Activator.java

示例10: bundleChanged

import org.osgi.framework.BundleEvent; //導入方法依賴的package包/類
@Override
public void bundleChanged(BundleEvent event) {
	
	Bundle bundle = event.getBundle();
	if (this.debug==true) {
		String symbolicName = bundle.getSymbolicName();
		String type = this.getBundleEventAsString(event);
		System.out.println(this.getClass().getSimpleName() + "#bundleChanged(event): " + symbolicName + ", event.type: " + type);
	}
	
	// --- Make sure that only external bundles will be considered ------------------
	if (bundle.getSymbolicName().equals(PLUGIN_ID)==false) {
		switch (event.getType()) {
		case BundleEvent.STARTED:
			// --- Start searching for specific classes with the BundleEvaluator ----
			BundleEvaluator.getInstance().setBundleAdded(bundle);
			break;
			
		case BundleEvent.STOPPED:
			// --- Remove search results from the BundleEvaluator -------------------
			BundleEvaluator.getInstance().setBundleRemoved(bundle);
			break;

		default:
			break;
		}
	}
			
}
 
開發者ID:EnFlexIT,項目名稱:AgentWorkbench,代碼行數:30,代碼來源:PlugInActivator.java

示例11: getBundleEventAsString

import org.osgi.framework.BundleEvent; //導入方法依賴的package包/類
/**
 * Returns the specified bundle event as string.
 * @param event the bundle event
 * @return the bundle event as string
 */
private String getBundleEventAsString(BundleEvent event) {
	
	if (event == null) return "null";
	
	int type = event.getType();
	switch (type) {
	case BundleEvent.INSTALLED:
		return "INSTALLED";
	case BundleEvent.LAZY_ACTIVATION:
		return "LAZY_ACTIVATION";
	case BundleEvent.RESOLVED:
		return "RESOLVED";
	case BundleEvent.STARTED:
		return "STARTED";
	case BundleEvent.STARTING:
		return "STARTING";
	case BundleEvent.STOPPED:
		return "STOPPED";
	case BundleEvent.UNINSTALLED:
		return "UNINSTALLED";
	case BundleEvent.UNRESOLVED:
		return "UNRESOLVED";
	case BundleEvent.UPDATED:
		return "UPDATED";
	default:
		return "unknown event type: " + type;
	}
}
 
開發者ID:EnFlexIT,項目名稱:AgentWorkbench,代碼行數:34,代碼來源:PlugInActivator.java

示例12: addingBundle

import org.osgi.framework.BundleEvent; //導入方法依賴的package包/類
@Override
public synchronized Bundle addingBundle(Bundle bundle, BundleEvent event) {
	
	if(incompatibleExtender(bundle)) {
		// We must not process bundles that we aren't compatible with
		LOGGER.info("The bundle {} is wired to a different JPA Extender and must be ignored.", 
				bundle.getSymbolicName());
		return null;
	}
	
	if(incompatibleClassSpace(bundle)) {
		// We must not process bundles that we aren't compatible with
		LOGGER.warn("The bundle {} does not share a class space with the JPA Extender and must be ignored.", 
				bundle.getSymbolicName());
		return null;
	}
	
    if (event != null && event.getType() == BundleEvent.STOPPED) {
        // Avoid starting persistence units in state STOPPED.
        // TODO No idea why we are called at all in this state
        return bundle;
    }
    if (getTrackers(bundle).isEmpty()) {
        findPersistenceUnits(bundle, event);
    }
    return bundle;
}
 
開發者ID:apache,項目名稱:aries-jpa,代碼行數:28,代碼來源:PersistenceBundleTracker.java

示例13: getType

import org.osgi.framework.BundleEvent; //導入方法依賴的package包/類
private String getType(BundleEvent event) {
    if (event == null) {
        return "null";
    }
    int type = event.getType();
    String typeSt = typeMap.get(type);
    return (typeSt != null) ? typeSt : "unknown event type: " + type;
}
 
開發者ID:apache,項目名稱:aries-jpa,代碼行數:9,代碼來源:PersistenceBundleTracker.java

示例14: bundleChanged

import org.osgi.framework.BundleEvent; //導入方法依賴的package包/類
@Override
public void bundleChanged(BundleEvent event) {
    if ((event.getType() & (BundleEvent.RESOLVED)) != 0) {
        handlePotentialEclipseLink(event.getBundle());
    } else if (event.getType() == BundleEvent.UNRESOLVED || event.getType() == BundleEvent.UNINSTALLED) {
        ServiceRegistration<?> reg = registeredProviders.remove(event.getBundle());
        if (reg != null) {
            reg.unregister();
        }
    }
}
 
開發者ID:apache,項目名稱:aries-jpa,代碼行數:12,代碼來源:Activator.java

示例15: bundleChanged

import org.osgi.framework.BundleEvent; //導入方法依賴的package包/類
@Override
public void bundleChanged(BundleEvent event) {
    switch (event.getType()) {
        case BundleEvent.INSTALLED:
        case BundleEvent.UPDATED:
            Message msg = Message.obtain();
            msg.obj = event.getBundle();
            mHandler.sendMessageDelayed(msg,3000);
            break;
        case BundleEvent.STARTED:
        case BundleEvent.STOPPED:
        case BundleEvent.UNINSTALLED:
            break;
    }
}
 
開發者ID:alibaba,項目名稱:atlas,代碼行數:16,代碼來源:SecurityHandler.java


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