本文整理汇总了Java中org.osgi.framework.BundleEvent.getBundle方法的典型用法代码示例。如果您正苦于以下问题:Java BundleEvent.getBundle方法的具体用法?Java BundleEvent.getBundle怎么用?Java BundleEvent.getBundle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.osgi.framework.BundleEvent
的用法示例。
在下文中一共展示了BundleEvent.getBundle方法的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) {
logger.debug("Bundle changed: {}", event);
if (stopped) {
return;
}
Bundle bundle = event.getBundle();
if (bundle.getState() != Bundle.ACTIVE && bundle.getState() != Bundle.STARTING) {
// The bundle is not in STARTING or ACTIVE state anymore
// so destroy the bundleContext. Ignore our own bundle since it
// needs to kick the orderly shutdown.
if (bundle != this.bundleContext.getBundle()) {
destroyExtension(bundle);
}
}
}
示例3: 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);
}
}
示例4: 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;
}
}
示例5: 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;
}
}
示例6: 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;
}
}
}
示例7: 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;
}
}
}
示例8: 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;
}
}
示例9: handleEvent
import org.osgi.framework.BundleEvent; //导入方法依赖的package包/类
protected void handleEvent(BundleEvent event) {
Bundle bundle = event.getBundle();
switch (event.getType()) {
case BundleEvent.RESOLVED:
if (resolved) {
this.namespaceHandlerActivator.maybeAddNamespaceHandlerFor(bundle, false);
}
break;
case LAZY_ACTIVATION_EVENT_TYPE: {
if (!resolved) {
push(bundle);
this.namespaceHandlerActivator.maybeAddNamespaceHandlerFor(bundle, true);
}
break;
}
case BundleEvent.STARTED: {
if (!resolved) {
if (!pop(bundle)) {
this.namespaceHandlerActivator.maybeAddNamespaceHandlerFor(bundle, false);
}
}
break;
}
case BundleEvent.STOPPED: {
pop(bundle);
this.namespaceHandlerActivator.maybeRemoveNameSpaceHandlerFor(bundle);
break;
}
default:
break;
}
}
示例10: bundleChanged
import org.osgi.framework.BundleEvent; //导入方法依赖的package包/类
public void bundleChanged(BundleEvent event) {
Bundle bundle = event.getBundle();
if (event.getType() == BundleEvent.RESOLVED) {
checkBundle(bundle);
} else if (event.getType() == BundleEvent.STARTED) {
checkBundleScriptEngines(bundle);
}
}
示例11: bundleChanged
import org.osgi.framework.BundleEvent; //导入方法依赖的package包/类
/**
* <code>BundleListener</code> method for the <code>BundleTracker</code>
* class. This method must NOT be synchronized to avoid deadlock
* potential.
*
* @param event <code>BundleEvent</code> object from the framework.
*/
public void bundleChanged(final BundleEvent event) {
/*
* Check if we had a delayed call (which could happen when we
* close).
*/
if (closed) {
return;
}
final Bundle bundle = event.getBundle();
final int state = bundle.getState();
if (DEBUG) {
System.out.println("BundleTracker.Tracked.bundleChanged[" + state + "]: " + bundle);
}
if ((state & mask) != 0) {
track(bundle, event);
/*
* If the customizer throws an unchecked exception, it is safe
* to let it propagate
*/
} else {
untrack(bundle, event);
/*
* If the customizer throws an unchecked exception, it is safe
* to let it propagate
*/
}
}
示例12: exists
import org.osgi.framework.BundleEvent; //导入方法依赖的package包/类
boolean exists(String bundleName) {
for (int i = 0; i < eventList.size(); i++) {
BundleEvent fe = (BundleEvent) eventList.get(i);
Bundle b = fe.getBundle();
System.out.println("===[" + b + "]");
if (bundleName.equals(b.getSymbolicName())) {
return true;
}
}
return false;
}
示例13: exists
import org.osgi.framework.BundleEvent; //导入方法依赖的package包/类
boolean exists(String bundleName) {
for (int i = 0; i < eventList.size(); i++) {
BundleEvent fe = (BundleEvent) eventList.get(i);
Bundle b = fe.getBundle();
System.out.println("===["+b+"]");
if (bundleName.equals(b.getSymbolicName())) {
return true;
}
}
return false;
}
示例14: bundleChanged
import org.osgi.framework.BundleEvent; //导入方法依赖的package包/类
/**
* Invoked, when an event about bundle change is received. In case a new bundle gets installed
* or an existing bundle is updated, we need to scan that bundle for MDS annotations and process them.
*
* @param event BundleEvent, generated by the OSGi framework
*/
@Override
public void bundleChanged(BundleEvent event) {
final Bundle bundle = event.getBundle();
final int eventType = event.getType();
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Bundle event of type {} received from {}: {} -> {}", OsgiStringUtils.nullSafeBundleEventToString(event.getType()),
bundle.getSymbolicName(), String.valueOf(eventType), String.valueOf(bundle.getState()));
}
handleBundleEvent(bundle, eventType);
}
示例15: bundleChanged
import org.osgi.framework.BundleEvent; //导入方法依赖的package包/类
public void bundleChanged(BundleEvent event) {
Bundle bundle = event.getBundle();
if (bundle.getState() != Bundle.ACTIVE && bundle.getState() != Bundle.STARTING) {
// The bundle is not in STARTING or ACTIVE state anymore
// so destroy the context. Ignore our own bundle since it
// needs to kick the orderly shutdown.
if (bundle != _context.getBundle()) {
destroyExtension(bundle);
}
}
}