本文整理汇总了Java中org.osgi.framework.BundleEvent.STARTED属性的典型用法代码示例。如果您正苦于以下问题:Java BundleEvent.STARTED属性的具体用法?Java BundleEvent.STARTED怎么用?Java BundleEvent.STARTED使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.osgi.framework.BundleEvent
的用法示例。
在下文中一共展示了BundleEvent.STARTED属性的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: BundleImpl
BundleImpl(File file) throws Exception {
long currentTimeMillis = System.currentTimeMillis();
DataInputStream dataInputStream = new DataInputStream(new FileInputStream(new File(file, "meta")));
this.location = dataInputStream.readUTF();
this.currentStartlevel = dataInputStream.readInt();
this.persistently = dataInputStream.readBoolean();
dataInputStream.close();
this.bundleDir = file;
this.state = BundleEvent.STARTED;
try {
this.archive = new BundleArchive(this.location, file);
resolveBundle(false);
Framework.bundles.put(this.location, this);
Framework.notifyBundleListeners(BundleEvent.INSTALLED, this);
if (Framework.DEBUG_BUNDLES && log.isInfoEnabled()) {
log.info("Framework: Bundle " + toString() + " loaded. " + (System.currentTimeMillis() - currentTimeMillis) + " ms");
}
} catch (Exception e) {
throw new BundleException("Could not load bundle " + this.location, e.getCause());
}
}
示例3: 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);
}
}
}
示例4: bundleChanged
@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);
}
}
示例5: 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;
}
}
}
示例6: 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;
}
}
}
示例7: 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 + " ???";
}
}
示例8: 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;
}
}
示例9: 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;
}
}
示例10: 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;
}
}
示例11: 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;
}
}
}
示例12: bundleChanged
@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;
}
}
示例13: 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;
}
}
}
示例14: 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;
}
}
示例15: 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;
}
}