Rio Project 4.2 API Documentation



org.rioproject.jsb
Class JSBContext

java.lang.Object
  extended by org.rioproject.jsb.JSBContext
All Implemented Interfaces:
ComputeResourceManager, ServiceBeanContext

public class JSBContext
extends Object
implements ServiceBeanContext, ComputeResourceManager

JSBContext implements the ServiceBeanContext interface

Author:
Dennis Reedy

Constructor Summary
JSBContext(ServiceElement sElem, ServiceBeanManager serviceBeanManager, ComputeResource computeResource, Configuration sharedConfig)
          Create a JSBContext
 
Method Summary
 void addAttribute(Entry attribute)
          Add an attribute to the collection of attributes used to describe the ServiceBean.
 PlatformCapability addPlatformCapability(String className, URL location, Map<String,Object> mapping)
          Add a PlatformCapability.
static PlatformCapability createPlatformCapability(String className, URL[] classPath, Map<String,Object> mapping)
          Create a PlatformCapability
 AssociationManagement getAssociationManagement()
          Get the AssociationManagement object for the ServiceBean
 Collection<Entry> getAttributes()
          Get the attribute list
 ComponentLoader getComponentLoader()
          Get the ComponentLoader for the ServiceBean.
 ComputeResource getComputeResource()
          Get the ComputeResource object
 ComputeResourceManager getComputeResourceManager()
          The ComputeResourceManager provides a mechanism for the ServiceBean to obtain the ComputeResource object and acquire information about the environment and attributes of the ComputeResource
 Configuration getConfiguration()
          Get the ServiceBean Configuration object
 DiscoveryManagement getDiscoveryManagement()
          Get the DiscoveryManagement object based on declared discovery attributes
 Map<Long,EventHandler> getEventTable()
          The eventTable associates an EventHandler to an EventDescriptor for the ServiceBean.
 String getExportCodebase()
          Get the export codebase used to load ServiceBean download JARs
 Object getInitParameter(String name)
          Returns an Object containing the value of the named initialization parameter, or null if the parameter does not exist.
 Iterable<String> getInitParameterNames()
          Get the names (keys) for all initialization parameters
 MeasurableCapability[] getMatchedMeasurableCapabilities()
          Get the MeasurableCapability instances that match declared SLAs.
 PlatformCapability[] getMatchedPlatformCapabilities()
          Get the PlatformCapability instances that match declared system requirements
 String getOperationalStringName()
          Get the name of the OperationalString
 PlatformCapability getPlatformCapability(String name)
          Get a PlatformCapability instance from a name
 ServiceBeanConfig getServiceBeanConfig()
          Get the ServiceBeanConfig for the ServiceBean
 ServiceBeanManager getServiceBeanManager()
          The ServiceBeanManager provides a mechanism for the ServiceBean to obtain a DiscardManager, request it's ServiceElement be updated to OperationalStringManager instance(s) and obtain system resources
 ServiceElement getServiceElement()
          Get the ServiceElement for the ServiceBean
 Configuration getSharedConfiguration()
          Get the shared config
 Subject getSubject()
          Get the Subject used to authenticate the service
 WatchRegistry getWatchRegistry()
          Get the WatchRegistry for the ServiceBean.
 void registerEventHandler(EventDescriptor descriptor, EventHandler handler)
          Register an event handler.
 void removePlatformCapabilities()
          Remove all PlatformCapability instances the ServiceBean added
 boolean removePlatformCapability(PlatformCapability pCap)
          Remove a PlatformCapability that was added by the ServiceBean.
 void setServiceBeanManager(ServiceBeanManager serviceBeanManager)
          Set the ServiceBeanManager for the ServiceBean
 void setServiceElement(ServiceElement newElem)
          Set the ServiceElement for the ServiceBean
 void setSubject(Subject subject)
          Set the Subject used to authenticate the service
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JSBContext

public JSBContext(ServiceElement sElem,
                  ServiceBeanManager serviceBeanManager,
                  ComputeResource computeResource,
                  Configuration sharedConfig)
Create a JSBContext

Parameters:
sElem - The ServiceElement
serviceBeanManager - The ServiceBeanManager
computeResource - The ComputeResource object representing capabilities of the compute resource the service has been instantiated on
sharedConfig - Configuration from the "platform" which will be used as the shared configuration with an AggregateConfig
Method Detail

getSharedConfiguration

public Configuration getSharedConfiguration()
Get the shared config

Returns:
The shared Configuration

setSubject

public void setSubject(Subject subject)
Set the Subject used to authenticate the service

Parameters:
subject - The Subject

getSubject

public Subject getSubject()
Get the Subject used to authenticate the service

Returns:
The Subject

setServiceElement

public void setServiceElement(ServiceElement newElem)
Set the ServiceElement for the ServiceBean

Parameters:
newElem - The ServiceElement

getComponentLoader

public ComponentLoader getComponentLoader()
Description copied from interface: ServiceBeanContext
Get the ComponentLoader for the ServiceBean. The ComponentLoader provides a mechanism for the ServiceBean to load classes and resources (such as native libraries) making them (and the resources it uses) available to all services

Specified by:
getComponentLoader in interface ServiceBeanContext
Returns:
The ComponentLoader
See Also:
ServiceBeanContext.getComponentLoader()

getExportCodebase

public String getExportCodebase()
Description copied from interface: ServiceBeanContext
Get the export codebase used to load ServiceBean download JARs

Specified by:
getExportCodebase in interface ServiceBeanContext
Returns:
The codebase identifies the codebase of the export JARs for the ServiceBean. The returned value is suitable for use in creating an HTTP protocol URL
See Also:
ServiceBeanContext.getExportCodebase()

getConfiguration

public Configuration getConfiguration()
                               throws ConfigurationException
Description copied from interface: ServiceBeanContext
Get the ServiceBean Configuration object

Specified by:
getConfiguration in interface ServiceBeanContext
Returns:
The Configuration object for a ServiceBean. A new Configuration object will be returned each time this method is invoked
Throws:
ConfigurationException - if there are problems creating the Configuration
See Also:
ServiceBeanContext.getConfiguration()

getServiceBeanConfig

public ServiceBeanConfig getServiceBeanConfig()
Description copied from interface: ServiceBeanContext
Get the ServiceBeanConfig for the ServiceBean

Specified by:
getServiceBeanConfig in interface ServiceBeanContext
Returns:
The ServiceBeanConfig object
See Also:
ServiceBeanContext.getServiceBeanConfig()

getServiceElement

public ServiceElement getServiceElement()
Description copied from interface: ServiceBeanContext
Get the ServiceElement for the ServiceBean

Specified by:
getServiceElement in interface ServiceBeanContext
Returns:
The ServiceElement object
See Also:
ServiceBeanContext.getServiceElement()

setServiceBeanManager

public void setServiceBeanManager(ServiceBeanManager serviceBeanManager)
Set the ServiceBeanManager for the ServiceBean

Parameters:
serviceBeanManager - The ServiceBeanManager

getServiceBeanManager

public ServiceBeanManager getServiceBeanManager()
Description copied from interface: ServiceBeanContext
The ServiceBeanManager provides a mechanism for the ServiceBean to obtain a DiscardManager, request it's ServiceElement be updated to OperationalStringManager instance(s) and obtain system resources

Specified by:
getServiceBeanManager in interface ServiceBeanContext
Returns:
The ServiceBeanManager for the ServiceBean
See Also:
ServiceBeanContext.getServiceBeanManager()

getComputeResourceManager

public ComputeResourceManager getComputeResourceManager()
Description copied from interface: ServiceBeanContext
The ComputeResourceManager provides a mechanism for the ServiceBean to obtain the ComputeResource object and acquire information about the environment and attributes of the ComputeResource

Specified by:
getComputeResourceManager in interface ServiceBeanContext
Returns:
The ComputeResourceManager for the ServiceBean
See Also:
ServiceBeanContext.getComputeResourceManager()

getInitParameter

public Object getInitParameter(String name)
Description copied from interface: ServiceBeanContext
Returns an Object containing the value of the named initialization parameter, or null if the parameter does not exist.

Specified by:
getInitParameter in interface ServiceBeanContext
Parameters:
name - A String containing the name of the parameter whose value is requested
Returns:
The Object corresponding to the value of the parameter requested, or null if the parameter does not exist.
See Also:
ServiceBeanContext.getInitParameter(java.lang.String)

getInitParameterNames

public Iterable<String> getInitParameterNames()
Description copied from interface: ServiceBeanContext
Get the names (keys) for all initialization parameters

Specified by:
getInitParameterNames in interface ServiceBeanContext
Returns:
An Iterator of the names of the ServiceBean's initialization parameters, or an empty Iterator if the ServiceBean has no initialization parameters. A new Iterator is returned each time this method is called
See Also:
ServiceBeanContext.getInitParameterNames()

getOperationalStringName

public String getOperationalStringName()
Get the name of the OperationalString

Returns:
The name of the OperationalString

getDiscoveryManagement

public DiscoveryManagement getDiscoveryManagement()
                                           throws IOException
Description copied from interface: ServiceBeanContext
Get the DiscoveryManagement object based on declared discovery attributes

Specified by:
getDiscoveryManagement in interface ServiceBeanContext
Returns:
The DiscoveryManagement object for the ServiceBean
Throws:
IOException - If there are problems acquiring a DiscoveryManagement instance
See Also:
ServiceBeanContext.getDiscoveryManagement()

getAssociationManagement

public AssociationManagement getAssociationManagement()
Description copied from interface: ServiceBeanContext
Get the AssociationManagement object for the ServiceBean

Specified by:
getAssociationManagement in interface ServiceBeanContext
Returns:
The AssociationManagement object for the ServiceBean
See Also:
ServiceBeanContext.getAssociationManagement()

getWatchRegistry

public WatchRegistry getWatchRegistry()
Description copied from interface: ServiceBeanContext
Get the WatchRegistry for the ServiceBean.

Specified by:
getWatchRegistry in interface ServiceBeanContext
Returns:
The WatchRegistry object for the ServiceBean
See Also:
ServiceBeanContext.getWatchRegistry()

getEventTable

public Map<Long,EventHandler> getEventTable()
The eventTable associates an EventHandler to an EventDescriptor for the ServiceBean. Event registration requests for events this ServiceBean has advertised will consult the eventTable to determine the correct EventHandler to use in order to return an event registration

Returns:
The Map of event IDs to EventHandler instances

registerEventHandler

public void registerEventHandler(EventDescriptor descriptor,
                                 EventHandler handler)
Description copied from interface: ServiceBeanContext
Register an event handler. This associates an EventHandler to an EventDescriptor for the ServiceBean.

Specified by:
registerEventHandler in interface ServiceBeanContext
Parameters:
descriptor - The EventDescriptor for the event
handler - The associated EventHandler
See Also:
ServiceBeanContext.registerEventHandler(org.rioproject.event.EventDescriptor, org.rioproject.event.EventHandler)

addAttribute

public void addAttribute(Entry attribute)
Description copied from interface: ServiceBeanContext
Add an attribute to the collection of attributes used to describe the ServiceBean. Attributes added to the ServiceBeanContext will be accessed when the ServiceBean is being advertised for the first time.

Specified by:
addAttribute in interface ServiceBeanContext
Parameters:
attribute - Entry to add
See Also:
ServiceBeanContext.addAttribute(net.jini.core.entry.Entry)

getAttributes

public Collection<Entry> getAttributes()
Get the attribute list

Returns:
The attribute list

getComputeResource

public ComputeResource getComputeResource()
Description copied from interface: ComputeResourceManager
Get the ComputeResource object

Specified by:
getComputeResource in interface ComputeResourceManager
Returns:
The Object representing the platform and measurable capabilities of the compute resource upon which the service has been instantiated
See Also:
ComputeResourceManager.getComputeResource()

getPlatformCapability

public PlatformCapability getPlatformCapability(String name)
Description copied from interface: ComputeResourceManager
Get a PlatformCapability instance from a name

Specified by:
getPlatformCapability in interface ComputeResourceManager
Parameters:
name - The name of the PlatformCapability
Returns:
The first PlatformCapability that matches the name. If no PlatformCapability matches the name, return null
See Also:
ComputeResourceManager.getPlatformCapability(java.lang.String)

getMatchedPlatformCapabilities

public PlatformCapability[] getMatchedPlatformCapabilities()
Description copied from interface: ComputeResourceManager
Get the PlatformCapability instances that match declared system requirements

Specified by:
getMatchedPlatformCapabilities in interface ComputeResourceManager
Returns:
An array of PlatformCapability instances that match declared operational requirements. If there are no declared PlatformCapability requirements, then return a zero-length array
See Also:
ComputeResourceManager.getMatchedPlatformCapabilities()

addPlatformCapability

public PlatformCapability addPlatformCapability(String className,
                                                URL location,
                                                Map<String,Object> mapping)
Description copied from interface: ComputeResourceManager
Add a PlatformCapability. A PlatformCapability will be added to the ComputeResource object for the duration of the ServiceBean's lifetime

Specified by:
addPlatformCapability in interface ComputeResourceManager
Parameters:
className - The class name of the PlatformCapability. This name must be suitable for Class.forName use
location - An URL indicating where to load the PlatformCapability from. If this parmater is null, the PlatformCapability will be loaded from platform-capabilities.jar
mapping - The Map of name,value pairs the PlatformCapability will set
Returns:
The added PlatformCapability, or null if the PlatformCapability could not be created or added
See Also:
ComputeResourceManager.addPlatformCapability(java.lang.String, java.net.URL, java.util.Map)

createPlatformCapability

public static PlatformCapability createPlatformCapability(String className,
                                                          URL[] classPath,
                                                          Map<String,Object> mapping)
                                                   throws ClassNotFoundException,
                                                          InstantiationException,
                                                          IllegalAccessException
Create a PlatformCapability

Parameters:
className - The fully qualified classname to instantiate, must not be null
classPath - Array of URL locations defining the classpath to load the PlatformCapability. The common classloader will be checked first to determine if the class can be loaded, if it cannot, and the classpath parameter contains URL values, the classPath location(s) will be added to the common classloader
mapping - If not null, the attributes will be set to the instantiated PlatformCapability
Returns:
A PlatformCapability object with attributes applied
Throws:
ClassNotFoundException - If the platform capability class cannot be found
IllegalAccessException - If there is a security exception
InstantiationException - If the class cannot be created

removePlatformCapability

public boolean removePlatformCapability(PlatformCapability pCap)
Description copied from interface: ComputeResourceManager
Remove a PlatformCapability that was added by the ServiceBean. Only PlatformCapability instances that were added by the ServiceBean may be removed using this method

Specified by:
removePlatformCapability in interface ComputeResourceManager
Parameters:
pCap - The PlatformCapability to remove
Returns:
True if removed
See Also:
ComputeResourceManager.removePlatformCapability(org.rioproject.system.capability.PlatformCapability)

removePlatformCapabilities

public void removePlatformCapabilities()
Remove all PlatformCapability instances the ServiceBean added


getMatchedMeasurableCapabilities

public MeasurableCapability[] getMatchedMeasurableCapabilities()
Description copied from interface: ComputeResourceManager
Get the MeasurableCapability instances that match declared SLAs.

Specified by:
getMatchedMeasurableCapabilities in interface ComputeResourceManager
Returns:
An array of MeasurableCapability instances that match declared operational requirements. If there are no declared SLAs which match MeasurableCapability identifiers, then return a zero-length array
See Also:
ComputeResourceManager.getMatchedMeasurableCapabilities()

Copyright © Rio Project.

Copyright © 2006-2011 Rio Project. All Rights Reserved.