org.jwarp.service
Interface IServiceFactory

All Known Implementing Classes:
ServiceFactory

public interface IServiceFactory

This interface is responsible for managing the services of an application context. Services are configured and initialized by this class based on a xml configuration tree.

Version:
1.0
Author:
Martin Schaefer, Anatole Tresch

Method Summary
 IService addService(org.jdom.Element config)
          Add dynamically a new service.
 void addService(IService service, java.lang.String serviceName)
          Add dynamically a new service.
 void configure(org.jdom.Element configuration)
          Start the services found in the given configuration
 java.lang.String[][] getSecurityObjects()
           
 IService getService(java.lang.String serviceName)
          Return the service with the given name
 java.util.Iterator getServices()
          Returns all services for the user
 void removeService(java.lang.String serviceName)
          Add dynamically a new service.
 void resumeService(java.lang.String serviceName, ITicket ticket)
          Try to resume a service
 void shutdownService(java.lang.String name, ITicket ticket)
          Shut down a service.
 void start(ITicket ticket)
          Tries to start the configured services.
 void startService(java.lang.String name, ITicket ticket)
          Start the service with the given root configuration
 void stop(ITicket ticket)
          Tries to start the configured services.
 void suspendService(java.lang.String serviceName, ITicket ticket)
          Try to suspend a service.
 

Method Detail

configure

public void configure(org.jdom.Element configuration)
               throws ConfigurationException
Start the services found in the given configuration
Parameters:
configuration - the configuration containing other service configurations
Throws:
ServiceConfigurationException - If the configuration is missing or invalid

getSecurityObjects

public java.lang.String[][] getSecurityObjects()

start

public void start(ITicket ticket)
           throws ServiceInitializationException,
                  ServiceRuntimeException
Tries to start the configured services. Only the services should be started that are defined to be started per default thus also services can be configured that start on their first use or even must be started manually.
Throws:
ServiceInitializationException - One or more services are initialized well. Well initialize services should all be started.

stop

public void stop(ITicket ticket)
          throws ServiceInitializationException,
                 ServiceRuntimeException
Tries to start the configured services. Only the services should be started that are defined to be started per default thus also services can be configured that start on their first use or even must be started manually.
Throws:
ServiceInitializationException - One or more services are initialized well. Well initialize services should all be started.

suspendService

public void suspendService(java.lang.String serviceName,
                           ITicket ticket)
                    throws ServiceRuntimeException,
                           ServiceNotFoundException,
                           java.lang.SecurityException
Try to suspend a service.
Parameters:
The - service name
The - user ticket
Throws:
ServiceRuntimeException - If the service failed to suspend
java.lang.SecurityException - If access was denied.

resumeService

public void resumeService(java.lang.String serviceName,
                          ITicket ticket)
                   throws ServiceRuntimeException,
                          ServiceNotFoundException,
                          java.lang.SecurityException
Try to resume a service
Parameters:
The - service name
The - user ticket
Throws:
ServiceRuntimeException - If the service failed to resume
java.lang.SecurityException - If access was denied.

startService

public void startService(java.lang.String name,
                         ITicket ticket)
                  throws ServiceInitializationException,
                         ServiceNotFoundException,
                         java.lang.SecurityException
Start the service with the given root configuration
Parameters:
serviceRoot - the configuration root for this service
Throws:
ServiceInitializationException - If the service could not started
ServiceNotFoundException - If the service could not be located
java.lang.SecurityException - If access was denied.

shutdownService

public void shutdownService(java.lang.String name,
                            ITicket ticket)
                     throws ServiceRuntimeException,
                            java.lang.SecurityException,
                            ServiceNotFoundException
Shut down a service.
Parameters:
The - service name
The - user ticket
Throws:
ServiceRuntimeException - If the service could not be shut own
ServiceNotFoundException - If the service could not be located
java.lang.SecurityException - If access was denied.

getService

public IService getService(java.lang.String serviceName)
                    throws java.lang.SecurityException
Return the service with the given name
Parameters:
serviceName - The name of the service to return
The - user ticket
Returns:
The service instance of the requested service
Throws:
ServiceNotFoundException - If the service could not be located
java.lang.SecurityException - If access was denied.

getServices

public java.util.Iterator getServices()
Returns all services for the user
Returns:
The services

addService

public void addService(IService service,
                       java.lang.String serviceName)
Add dynamically a new service.
Parameters:
service - The new service
serviceName - The service name under which the service should registered
ticket - The system user who must WRITE access to the factory

addService

public IService addService(org.jdom.Element config)
Add dynamically a new service.
Parameters:
config - The XML config subtree for the service
Returns:
The newly created service instance

removeService

public void removeService(java.lang.String serviceName)
                   throws ServiceNotFoundException
Add dynamically a new service.
Parameters:
serviceName - The service name under which the service should registered
ticket - The system user who must WRITE access to the factory
Throws:
java.lang.SecurityException - If access was denied or a service with the same name is running yet
ServiceNotFoundException - If the service could not be found

©   O R C A   S y s t e m s