Class BundleHelper


  • public final class BundleHelper
    extends Object
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static org.osgi.framework.Bundle getCallerBundle​(org.osgi.framework.Bundle defaultBundle)
      Gets a Bundle invoking logging method which is the first bundle different than pax-logging-api.
      static org.osgi.framework.Bundle getCallerBundle​(org.osgi.framework.Bundle defaultBundle, int skip)
      Gets a Bundle with configurable number of top-most classes from context.
      static org.osgi.framework.Bundle getCallerBundle​(org.osgi.framework.Bundle defaultBundle, String fqcn)
      Gets a Bundle invoking logging method which is the first bundle before the class matching fqcn argument.
    • Method Detail

      • getCallerBundle

        public static org.osgi.framework.Bundle getCallerBundle​(org.osgi.framework.Bundle defaultBundle)
        Gets a Bundle invoking logging method which is the first bundle different than pax-logging-api. If no bundle can't be found, defaultBundle is returned. This method analyzes class context top down (skipping two topmost classes, as they're known to come from pax-logging-api bundle). Also, java.util.logging packages are skipped.
        Parameters:
        defaultBundle -
        Returns:
      • getCallerBundle

        public static org.osgi.framework.Bundle getCallerBundle​(org.osgi.framework.Bundle defaultBundle,
                                                                int skip)
        Gets a Bundle with configurable number of top-most classes from context. To be called from places where the class context stack is known. Be careful!
        Parameters:
        defaultBundle -
        skip -
        Returns:
      • getCallerBundle

        public static org.osgi.framework.Bundle getCallerBundle​(org.osgi.framework.Bundle defaultBundle,
                                                                String fqcn)
        Gets a Bundle invoking logging method which is the first bundle before the class matching fqcn argument. Checking is done bottom-up the stack trace. If no bundle can't be found, defaultBundle is returned.
        Parameters:
        defaultBundle -
        Returns: