org.exolab.jms.service
Interface Services
- All Superinterfaces:
- Serviceable
- All Known Implementing Classes:
- ServiceManager
- public interface Services
- extends Serviceable
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.
- Version:
- $Revision: 1.1 $ $Date: 2005/08/30 04:56:14 $
- Author:
- Tim Anderson
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. |
addService
public void addService(java.lang.Class type)
throws ServiceException
- Add a service of the specified type.
The service will be constructed when it is first accessed via
getService(java.lang.Class)
.
- Parameters:
type
- the type of the service- Throws:
ServiceAlreadyExistsException
- if the service already existsServiceException
- for any service error
addService
public void addService(java.lang.Object service)
throws ServiceException
- Add a service instance.
- Parameters:
service
- the service instance- Throws:
ServiceAlreadyExistsException
- if the service already existsServiceException
- for any service error
getService
public java.lang.Object getService(java.lang.Class type)
throws ServiceException
- Returns a service given its type.
If the service has been registered but not constructed, it will be
created and any setters populated.
- Parameters:
type
- the type of the service- Returns:
- an instance of
type
- Throws:
ServiceDoesNotExistException
- if the service doesn't exist, or
is dependent on a service which doesn't existServiceException
- for any service error
Copyright © 1999-2007 The OpenJMS Group. All Rights Reserved.