org.osgi.framework.BundleEvent#UNRESOLVED源码实例Demo

下面列出了org.osgi.framework.BundleEvent#UNRESOLVED 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: knopflerfish.org   文件: LogFrameworkListener.java
/**
  * The bundle event callback method inserts all bundle events into the
  * log. Events are all assigned the log level info.
  * 
  * @param be
  *            the bundle event that has occured.
  */
 public void bundleChanged(BundleEvent be) {
     String msg = null;
     switch (be.getType()) {
     case BundleEvent.INSTALLED:
         msg = "BundleEvent INSTALLED";
         break;
     case BundleEvent.STARTED:
         msg = "BundleEvent STARTED";
         break;
     case BundleEvent.STOPPED:
         msg = "BundleEvent STOPPED";
         break;
     case BundleEvent.UNINSTALLED:
         msg = "BundleEvent UNINSTALLED";
         break;
     case BundleEvent.UPDATED:
         msg = "BundleEvent UPDATED";
         break;
     case BundleEvent.RESOLVED:
         msg = "BundleEvent RESOLVED";
         break;  
     case BundleEvent.UNRESOLVED:
         msg = "BundleEvent UNRESOLVED";
         break;
/*     case BundleEvent.STARTING:
         msg = "BundleEvent STARTING";
         break;
     case BundleEvent.STOPPING:
         msg = "BundleEvent STOPPING";
         break;  
         */   
     }
     lrsf.log(new LogEntryImpl(be.getBundle(), LogService.LOG_INFO, msg));
 }
 
源代码2 项目: knopflerfish.org   文件: Util.java
public static String bundleEventName(int type)
{
  switch (type) {
  case BundleEvent.INSTALLED:
    return "installed";
  case BundleEvent.STARTED:
    return "started";
  case BundleEvent.STOPPED:
    return "stopped";
  case BundleEvent.UNINSTALLED:
    return "uninstalled";
  case BundleEvent.UPDATED:
    return "updated";
  case BundleEvent.RESOLVED:
    return "resolved";
  case BundleEvent.UNRESOLVED:
    return "unresolved";
  case BundleEvent.STARTING:
    return "starting";
  case BundleEvent.STOPPING:
    return "stopping";
  case BundleEvent.LAZY_ACTIVATION:
    return "lazyActivation";
  default:
    return "<" + type + ">";
  }
}
 
源代码3 项目: attic-stratos   文件: UIBundleDeployer.java
public void bundleChanged(BundleEvent event) {
    Bundle bundle = event.getBundle();
    if(log.isDebugEnabled()){
        log.debug("Received new bundle event  : " + event.getType());
    }
    try {
        switch (event.getType()) {
            //TODO need to fix here.
            case BundleEvent.RESOLVED:
                if(log.isDebugEnabled()){
                    log.debug("Add ui component event received....");
                }
                processUIBundle(bundle, CarbonConstants.ADD_UI_COMPONENT);
                break;

            case BundleEvent.UNRESOLVED:
                if(log.isDebugEnabled()){
                log.debug("Remove ui component event received....");
                }
                processUIBundle(bundle, CarbonConstants.REMOVE_UI_COMPONENT);
                break;
        }
    } catch (Exception e) {
        log.error("Error occured when processing component xml in bundle " + bundle.getSymbolicName(), e);
        e.printStackTrace();
    }
}
 
源代码4 项目: cxf   文件: CXFExtensionBundleListener.java
/** {@inheritDoc}*/
public void bundleChanged(BundleEvent event) {
    if (event.getType() == BundleEvent.RESOLVED && id != event.getBundle().getBundleId()) {
        register(event.getBundle());
    } else if (event.getType() == BundleEvent.UNRESOLVED || event.getType() == BundleEvent.UNINSTALLED) {
        unregister(event.getBundle().getBundleId());
    }
}
 
源代码5 项目: knopflerfish.org   文件: MultiListener.java
/**
 * A listener for events sent by bundles
 * @param bundleEvent The event sent by the bundle
 * @author Johnny Baveras
 */


public void bundleChanged(BundleEvent bundleEvent) {
  String topic = null;
  boolean knownMessageType = true;

  switch (bundleEvent.getType()) {
  case BundleEvent.INSTALLED:
    topic = INSTALLED_TOPIC;
    break;
  case BundleEvent.STARTED:
    topic = STARTED_TOPIC;
    break;
  case BundleEvent.STOPPED:
    topic = STOPPED_TOPIC;
    break;
  case BundleEvent.UPDATED:
    topic = UPDATED_TOPIC;
    break;
  case BundleEvent.UNINSTALLED:
    topic = UNINSTALLED_TOPIC;
    break;
  case BundleEvent.RESOLVED:
    topic = RESOLVED_TOPIC;
    break;
  case BundleEvent.UNRESOLVED:
    topic = UNRESOLVED_TOPIC;
    break;
  default:
    /* Setting the boolean to false if an unknown event arrives */
    knownMessageType = false;
    break;
  }


  /* Stores the properties of the event in the dictionary, if the event is known */
  if (knownMessageType) {
    if(!Activator.handlerTracker.anyHandlersMatching(topic)) {
      return;
    }
    Map<String,Object> props = new HashMap<String,Object>();
    Bundle bundle = bundleEvent.getBundle();
    putProp(props, EventConstants.EVENT, bundleEvent);
    putProp(props, "bundle.id", new Long(bundle.getBundleId()));
    putProp(props, EventConstants.BUNDLE_SYMBOLICNAME, bundle.getSymbolicName());
    putProp(props, "bundle", bundle);
    /* Tries posting the event once the properties are set */
    try {
      Activator.eventAdmin.postEvent(new Event(topic, props));
    } catch (Exception e) {
      Activator.log.error("EXCEPTION in bundleChanged()", e);
    }
  } else {
    /* Logs an error if the event, which arrived, were of an unknown type */
    Activator.log.error("Recieved unknown bundle event message (type="
              +bundleEvent.getType() +"), discarding");
  }
  // }
}