org.cishell.framework
Class LocalCIShellContext
java.lang.Object
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)
Method Summary |
Object |
getService(String service)
Locates and returns a standard service given the service name. |
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 servicesstandardServices
- An array of strings specifying the services that
are allowed to be retrieved from this class
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)