org.exolab.jms.service
Class ServiceManager
java.lang.Object
|
+--org.exolab.jms.service.Service
|
+--org.exolab.jms.service.ServiceManager
- All Implemented Interfaces:
- Serviceable, Services
- public class ServiceManager
- extends Service
- implements Services
Default implementation of the Services
interface.
- Version:
- $Revision: 1.3 $ $Date: 2005/08/31 00:42:17 $
- Author:
- Tim Anderson, Jim Alateras
- See Also:
Service
,
Serviceable
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. |
protected void |
checkExists(java.lang.Class type)
Checks if a service has been registered. |
protected java.lang.Object |
createService(java.lang.Class type,
java.util.LinkedList creating,
java.util.List created)
Create a new service given its type. |
protected void |
doStart()
Start the service. |
protected void |
doStop()
Stop the service. |
java.lang.Object |
getService(java.lang.Class type)
Returns a service given its type. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
ServiceManager
public ServiceManager()
- Construct a new
ServiceManager
.
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)
.
- Specified by:
addService
in interface Services
- 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.
- Specified by:
addService
in interface Services
- 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.
- Specified by:
getService
in interface Services
- 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
doStart
protected void doStart()
throws ServiceException
- Start the service.
- Overrides:
doStart
in class Service
- Throws:
ServiceException
- if the service fails to start, or is already
running
doStop
protected void doStop()
throws ServiceException
- Stop the service.
- Overrides:
doStop
in class Service
- Throws:
ServiceException
- if the service fails to stop, or is already
stopped
createService
protected java.lang.Object createService(java.lang.Class type,
java.util.LinkedList creating,
java.util.List created)
throws ServiceException
- Create a new service given its type.
- Parameters:
type
- the service typecreating
- the set of services currently being createdcreated
- the set of services already created- Returns:
- the service corresponding to
type- Throws:
ServiceException
- if the service can't be constructed
checkExists
protected void checkExists(java.lang.Class type)
throws ServiceAlreadyExistsException
- Checks if a service has been registered.
- Parameters:
type
- the type of the service- Throws:
ServiceAlreadyExistsException
- if the service is already
registered
Copyright © 1999-2007 The OpenJMS Group. All Rights Reserved.