|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
A Serviceable
which manages a collection of services.
A service may be any object. If it implements the Serviceable
interface, then its lifecycle will be managed by this.
Services may be registered using their class types, or instances. Only a single instance of a particular service may exist at any time.
Services that are registered using their class types will be created
when first accessed via getService(java.lang.Class)
. This will recursively resolve
any other services that the service is dependent on.
Method Summary | |
void |
addService(java.lang.Class type)
Add a service of the specified type. |
void |
addService(java.lang.Object service)
Add a service instance. |
java.lang.Object |
getService(java.lang.Class type)
Returns a service given its type. |
Methods inherited from interface org.exolab.jms.service.Serviceable |
start, stop |
Method Detail |
public void addService(java.lang.Class type) throws ServiceException
The service will be constructed when it is first accessed via
getService(java.lang.Class)
.
type
- the type of the serviceServiceAlreadyExistsException
- if the service already existsServiceException
- for any service errorpublic void addService(java.lang.Object service) throws ServiceException
service
- the service instanceServiceAlreadyExistsException
- if the service already existsServiceException
- for any service errorpublic java.lang.Object getService(java.lang.Class type) throws ServiceException
If the service has been registered but not constructed, it will be created and any setters populated.
type
- the type of the servicetype
ServiceDoesNotExistException
- if the service doesn't exist, or
is dependent on a service which doesn't existServiceException
- for any service error
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |