org.cishell.framework
Class LocalCIShellContext

java.lang.Object
  extended by org.cishell.framework.LocalCIShellContext
All Implemented Interfaces:
CIShellContext

public class LocalCIShellContext
extends Object
implements CIShellContext

A simple implementation of CIShellContext that pulls the CIShell services from the provided BundleContext that all OSGi bundles receive on activation. This was included in the standard API since it will be used frequently by CIShell application developers. This implementation only returns standard services or the service strings given to it in its constructor.

Author:
Bruce Herr (bh2@bh2.net)

Field Summary
 
Fields inherited from interface org.cishell.framework.CIShellContext
DEFAULT_SERVICES
 
Constructor Summary
LocalCIShellContext(BundleContext bContext)
          Initializes the CIShell context based on the provided BundleContext
LocalCIShellContext(BundleContext bContext, String[] standardServices)
          Initializes the CIShell context with a custom set of standard services.
 
Method Summary
 Object getService(String service)
          Locates and returns a standard service given the service name.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LocalCIShellContext

public LocalCIShellContext(BundleContext bContext)
Initializes the CIShell context based on the provided BundleContext

Parameters:
bContext - The BundleContext to use to find the registered standard services

LocalCIShellContext

public LocalCIShellContext(BundleContext bContext,
                           String[] standardServices)
Initializes the CIShell context with a custom set of standard services. Only the service in the array will be allowed to be retrieved from this CIShellContext.

Parameters:
bContext - The BundleContext to use to find registered standard services
standardServices - An array of strings specifying the services that are allowed to be retrieved from this class
Method Detail

getService

public Object getService(String service)
Description copied from interface: CIShellContext
Locates and returns a standard service given the service name. The service name is generally the full class name of the service interface. For example, LogService's string is org.osgi.service.log.LogService.

Specified by:
getService in interface CIShellContext
Parameters:
service - A string (usually the associated interface's full class name) that specifies the service to retrieve
Returns:
An instantiated version of the service requested
See Also:
CIShellContext.getService(java.lang.String)