org.springframework.osgi.util
Class OsgiStringUtils

java.lang.Object
  extended by org.springframework.osgi.util.OsgiStringUtils

public abstract class OsgiStringUtils
extends Object

Utility class for creating nice string representations of various OSGi classes.

Author:
Costin Leau

Field Summary
static Constants BUNDLE_EVENTS
          Constant over the Bundle events
static Constants BUNDLE_STATES
          Constant over the Bundle states
static Constants FRAMEWORK_EVENTS
          Constant over the Framework events
static Constants SERVICE_EVENTS
          Constant over the Service events
 
Constructor Summary
OsgiStringUtils()
           
 
Method Summary
static String bundleStateAsString(Bundle bundle)
          Returns a String representation of the Bundle state.
static String nullSafeBundleEventToString(int eventType)
          Returns a String representation for the given bundle event.
static String nullSafeName(Bundle bundle)
          Returns the name of the given Bundle in a null-safe manner.
static String nullSafeNameAndSymName(Bundle bundle)
          Returns the bundle name and symbolic name - useful when logging bundle info.
static String nullSafeSymbolicName(Bundle bundle)
          Returns the given Bundle symbolic name.
static String nullSafeToString(BundleEvent event)
          Returns a String representation for the given bundle event.
static String nullSafeToString(FrameworkEvent event)
          Returns a String representation for the given FrameworkEvent.
static String nullSafeToString(ServiceEvent event)
          Returns a String representation for the given ServiceEvent.
static String nullSafeToString(ServiceReference reference)
          Returns a String representation of the given ServiceReference.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BUNDLE_EVENTS

public static final Constants BUNDLE_EVENTS
Constant over the Bundle events


FRAMEWORK_EVENTS

public static final Constants FRAMEWORK_EVENTS
Constant over the Framework events


SERVICE_EVENTS

public static final Constants SERVICE_EVENTS
Constant over the Service events


BUNDLE_STATES

public static final Constants BUNDLE_STATES
Constant over the Bundle states

Constructor Detail

OsgiStringUtils

public OsgiStringUtils()
Method Detail

nullSafeBundleEventToString

public static String nullSafeBundleEventToString(int eventType)
Returns a String representation for the given bundle event.

Parameters:
eventType - OSGi BundleEvent given as an int
Returns:
String representation for the bundle event

nullSafeToString

public static String nullSafeToString(BundleEvent event)
Returns a String representation for the given bundle event.

Parameters:
event - OSGi BundleEvent (can be null)
Returns:
String representation for the given bundle event

nullSafeToString

public static String nullSafeToString(ServiceEvent event)
Returns a String representation for the given ServiceEvent.

Parameters:
event - OSGi ServiceEvent (can be null)
Returns:
String representation for the given event

nullSafeToString

public static String nullSafeToString(FrameworkEvent event)
Returns a String representation for the given FrameworkEvent.

Parameters:
event - OSGi FrameworkEvent (can be null)
Returns:
String representation of the given event

nullSafeToString

public static String nullSafeToString(ServiceReference reference)
Returns a String representation of the given ServiceReference.

Parameters:
reference - OSGi service reference (can be null)
Returns:
String representation of the given service reference

bundleStateAsString

public static String bundleStateAsString(Bundle bundle)
Returns a String representation of the Bundle state.

Parameters:
bundle - OSGi bundle (can be null)
Returns:
bundle state as a string

nullSafeSymbolicName

public static String nullSafeSymbolicName(Bundle bundle)
Returns the given Bundle symbolic name.

Parameters:
bundle - OSGi bundle (can be null)
Returns:
the bundle, symbolic name

nullSafeName

public static String nullSafeName(Bundle bundle)
Returns the name of the given Bundle in a null-safe manner.

Parameters:
bundle - OSGi bundle (can be null)
Returns:
bundle name

nullSafeNameAndSymName

public static String nullSafeNameAndSymName(Bundle bundle)
Returns the bundle name and symbolic name - useful when logging bundle info.

Parameters:
bundle - OSGi bundle (can be null)
Returns:
the bundle name and symbolic name


Copyright © 2006-2008 Spring Framework. All Rights Reserved.