本文整理汇总了Java中org.osgi.framework.BundleEvent.STOPPED属性的典型用法代码示例。如果您正苦于以下问题:Java BundleEvent.STOPPED属性的具体用法?Java BundleEvent.STOPPED怎么用?Java BundleEvent.STOPPED使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.osgi.framework.BundleEvent
的用法示例。
在下文中一共展示了BundleEvent.STOPPED属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: bundleChanged
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: startBundle
public synchronized void startBundle() throws BundleException {
if (this.state == BundleEvent.INSTALLED) {
throw new IllegalStateException("Cannot start uninstalled bundle "
+ toString());
} else if (this.state != BundleEvent.RESOLVED) {
if (this.state == BundleEvent.STARTED) {
resolveBundle(true);
}
this.state = BundleEvent.UPDATED;
try {
isValid = true;
this.state = BundleEvent.RESOLVED;
Framework.notifyBundleListeners(BundleEvent.STARTED, this);
if (Framework.DEBUG_BUNDLES && log.isInfoEnabled()) {
log.info("Framework: Bundle " + toString() + " started.");
}
} catch (Throwable th) {
Framework.clearBundleTrace(this);
this.state = BundleEvent.STOPPED;
String msg = "Error starting bundle " + toString();
log.error(msg,th);
}
}
}
示例3: stopBundle
public synchronized void stopBundle() throws BundleException {
if (this.state == BundleEvent.INSTALLED) {
throw new IllegalStateException("Cannot stop uninstalled bundle "
+ toString());
} else if (this.state == BundleEvent.RESOLVED) {
this.state = BundleEvent.UNINSTALLED;
try {
if (Framework.DEBUG_BUNDLES && log.isInfoEnabled()) {
log.info("Framework: Bundle " + toString() + " stopped.");
}
Framework.clearBundleTrace(this);
this.state = BundleEvent.STOPPED;
Framework.notifyBundleListeners(BundleEvent.STOPPED, this);
isValid = false;
} catch (Throwable th) {
Framework.clearBundleTrace(this);
this.state = BundleEvent.STOPPED;
Framework.notifyBundleListeners(BundleEvent.STOPPED, this);
isValid = false;
}
}
}
示例4: bundleChanged
@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;
}
}
}
示例5: bundleChanged
@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;
}
}
}
示例6: getBundleEventTypeText
private String getBundleEventTypeText(int type) {
switch (type) {
case BundleEvent.INSTALLED:
return "Installed";
case BundleEvent.RESOLVED:
return "Resolved";
case BundleEvent.LAZY_ACTIVATION:
return "Lazy Activation";
case BundleEvent.STARTING:
return "Starting";
case BundleEvent.STARTED:
return "Started";
case BundleEvent.STOPPING:
return "Stopping";
case BundleEvent.STOPPED:
return "Stopped";
case BundleEvent.UPDATED:
return "Updated";
case BundleEvent.UNRESOLVED:
return "Unresolved";
case BundleEvent.UNINSTALLED:
return "Uninstalled";
default:
return type + " ???";
}
}
示例7: bundleChanged
/**
*
* @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;
}
}
示例8: handleEvent
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;
}
}
示例9: bundleChanged
@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;
}
}
示例10: bundleChanged
/**
* {@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;
}
}
}
示例11: bundleChanged
@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;
}
}
}
示例12: getBundleEventAsString
/**
* 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;
}
}
示例13: addingBundle
@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;
}
示例14: bundleChanged
@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;
}
}
示例15: bundleChanged
@SuppressLint("NewApi") @Override
public void bundleChanged(final BundleEvent event){
switch (event.getType()) {
case 0:/* LOADED */
loaded(event.getBundle());
break;
case BundleEvent.INSTALLED:
//todo 注意主dex bundle
installed(event.getBundle());
break;
case BundleEvent.UPDATED:
updated(event.getBundle());
break;
case BundleEvent.UNINSTALLED:
uninstalled(event.getBundle());
break;
case BundleEvent.STARTED:
if(isLewaOS()){
if(Looper.myLooper() == null){
Looper.prepare();
}
started(event.getBundle());
}else{
started(event.getBundle());
}
break;
case BundleEvent.STOPPED:
stopped(event.getBundle());
break;
}
}