本文整理匯總了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;
}
}
示例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);
}
}
示例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;
}
}
}
示例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;
}
}
}
示例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;
}
}
示例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;
}
}
示例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;
}
}
示例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;
}
}
}
示例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;
}
}
示例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;
}
}
}
示例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;
}
}
示例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;
}
示例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;
}
示例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();
}
}
}
示例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;
}
}