/**
   * Add a bundle listener. {@link BundleListener}s are notified when a bundle has a lifecycle state
   * change. The listener is added to the context bundle's list of listeners. See {@link
   * #getBundle() getBundle()} for a definition of context bundle.
   *
   * @param listener The bundle listener to add.
   * @exception java.lang.IllegalStateException If the bundle context has stopped.
   * @see BundleEvent
   * @see BundleListener
   */
  public void addBundleListener(BundleListener listener) {
    checkValid();
    if (listener == null) {
      throw new IllegalArgumentException();
    }

    if (Debug.DEBUG_EVENTS) {
      String listenerName =
          listener.getClass().getName()
              + "@"
              + Integer.toHexString(System.identityHashCode(listener)); // $NON-NLS-1$
      Debug.println(
          "addBundleListener["
              + bundle
              + "]("
              + listenerName
              + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    }

    framework.addBundleListener(listener, this);
  }
Пример #2
0
 /*
  * (non-Javadoc)
  *
  * @see com.yipsilon.osgi.IBundleContext#addBundleListener(com.yipsilon.osgi.IBundleListener)
  */
 public void addBundleListener(IBundleListener listener) {
   framework.addBundleListener(listener);
 }