org.apache.muse.core.platform.osgi.util
Class OSGiReflectUtilHelper

java.lang.Object
  extended by org.apache.muse.core.platform.osgi.util.OSGiReflectUtilHelper
All Implemented Interfaces:
EventListener, ReflectUtilHelper, org.osgi.framework.ServiceListener

public class OSGiReflectUtilHelper
extends Object
implements ReflectUtilHelper, org.osgi.framework.ServiceListener

OSGiReflectUtilHelper is an implementation of the ReflectUtilHelper interface, which allows platforms to extend the behavior of the ReflectUtils class. Additonally, this class acts as a repository for Resource and Capability implementations that may be shared between bundles - simplifying the management of bundle dependencies when using default capability and resource implementations provide by Muse. The repository is initialized by locating instance of ResourceManagementImplementation services exported by bundles with contributions to make to the helper class. Most of the muse-*-impl or muse-*-api bundle activators are contribution providers.

Author:
Joel Hawkins (joelh)
See Also:
ReflectUtilHelper, ReflectUtils, ResourceManagementImplementation

Method Summary
 boolean exists(String className)
          existence check for a class
 Class getClass(String className)
          attempts to load a Class from the executing thread's bundle context.
static OSGiReflectUtilHelper getDefault()
          access to the singleton instance of the OSGiReflectUtilHelper
 InputStream getResource(String name)
          attempts to resolve a resource from contributions made by other bundles.
 org.osgi.framework.Bundle getThreadLocalBundle()
          getter for the thread local bundle of the executing thread.
 void initialize(org.osgi.framework.BundleContext context)
          initializes the helper class by locating all instances of ResourceManagementImplementation services and loading their contributions into the helper class.
 void serviceChanged(org.osgi.framework.ServiceEvent event)
          ServiceListener method for dealing with ResourceManagementImplementation service lifecycle events.
 void setThreadLocalBundle(org.osgi.framework.Bundle bundle)
          setter for the thread local bundle for the executing thread.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

setThreadLocalBundle

public void setThreadLocalBundle(org.osgi.framework.Bundle bundle)
setter for the thread local bundle for the executing thread. This bundle will be used for reflection requests delagated to this helper by the executing thread.

Parameters:
bundle -

getThreadLocalBundle

public org.osgi.framework.Bundle getThreadLocalBundle()
getter for the thread local bundle of the executing thread.

Returns:
the thread local Bundle for the executing thread.

getDefault

public static OSGiReflectUtilHelper getDefault()
access to the singleton instance of the OSGiReflectUtilHelper

Returns:

initialize

public void initialize(org.osgi.framework.BundleContext context)
initializes the helper class by locating all instances of ResourceManagementImplementation services and loading their contributions into the helper class.

Parameters:
context -

exists

public boolean exists(String className)
existence check for a class

Specified by:
exists in interface ReflectUtilHelper
Parameters:
className - the name of the class in question return true if the class exists in the executing thread's bundle context, otherwise false

getClass

public Class getClass(String className)
attempts to load a Class from the executing thread's bundle context. If the class is not found, an attempt is made to resolve the class based on contributions made by other bundes.

Specified by:
getClass in interface ReflectUtilHelper
Parameters:
className - the name of the class in question
Returns:
the Class if the class exists in the executing thread's bundle context, otherwise null

getResource

public InputStream getResource(String name)
attempts to resolve a resource from contributions made by other bundles. These resources are typically wsdl or schema files.

Parameters:
name -
Returns:

serviceChanged

public void serviceChanged(org.osgi.framework.ServiceEvent event)
ServiceListener method for dealing with ResourceManagementImplementation service lifecycle events.

Specified by:
serviceChanged in interface org.osgi.framework.ServiceListener


Copyright © 2005-2011 Apache Web Services - Muse. All Rights Reserved.