org.eclipse.stardust.engine.api.runtime
Interface ServiceFactory

All Known Implementing Classes:
org.eclipse.stardust.engine.core.runtime.beans.AbstractSessionAwareServiceFactory, org.eclipse.stardust.engine.core.runtime.beans.DefaultServiceFactory, EjbEnvServiceFactory, EmbeddedServiceFactory

public interface ServiceFactory

The ServiceFactory is the central point to retrieve CARNOT services. Based on the CARNOT configuration it shields several aspects from the programmer:

By default a ServiceFactory is configured to use per thread caching of services.

A typical usage pattern of using a ServiceFactory is

 ServiceFactory sf = ServiceFactoryLocator.get("user", "password");
 WorkflowService ws = sf.getWorkflowService();
 // use service methods

 QueryService qs = sf.getQueryService();
 // use service methods

 // release all services and related resources
 sf.close();
 

Version:
$Revision$
Author:
ubirkemeyer
See Also:
ServiceFactoryLocator, WorkflowService, AdministrationService, UserService, QueryService, DocumentManagementService

Method Summary
 void close()
          Releases all resources hold by the service factory and its single services.
 AdministrationService getAdministrationService()
          Returns an AdministrationService.
 DocumentManagementService getDocumentManagementService()
          Returns a document management service.
 QueryService getQueryService()
          Returns a QueryService.
<T extends org.eclipse.stardust.engine.api.runtime.Service>
T
getService(Class<T> type)
          Retrieves a service instance.
 String getSessionId()
          Gets the user session id
 UserService getUserService()
          Returns a UserService.
 WorkflowService getWorkflowService()
          Returns a WorkflowService.
 void release(org.eclipse.stardust.engine.api.runtime.Service service)
          Provides explicit service resource management.
 void setCredentials(Map credentials)
           
 void setProperties(Map properties)
           
 

Method Detail

getService

<T extends org.eclipse.stardust.engine.api.runtime.Service> T getService(Class<T> type)
                                                                     throws ServiceNotAvailableException,
                                                                            org.eclipse.stardust.common.error.LoginFailedException
Retrieves a service instance. Is provided for extensibility beyond the core service set.

Parameters:
type - The class name of the service to be retrieved.
Returns:
An instance of the requested service.
Throws:
ServiceNotAvailableException - In case the (possible remote) service could not be reached.
org.eclipse.stardust.common.error.LoginFailedException - In case the authentication to the service fails.

getWorkflowService

WorkflowService getWorkflowService()
                                   throws ServiceNotAvailableException,
                                          org.eclipse.stardust.common.error.LoginFailedException
Returns a WorkflowService.

Returns:
An instance of the requested service.
Throws:
ServiceNotAvailableException - In case the (possible remote) service could not be reached.
org.eclipse.stardust.common.error.LoginFailedException - In case the authentication to the service fails.

getUserService

UserService getUserService()
                           throws ServiceNotAvailableException,
                                  org.eclipse.stardust.common.error.LoginFailedException
Returns a UserService.

Returns:
An instance of the requested service.
Throws:
ServiceNotAvailableException - In case the (possible remote) service could not be reached.
org.eclipse.stardust.common.error.LoginFailedException - In case the authentication to the service fails.

getAdministrationService

AdministrationService getAdministrationService()
                                               throws ServiceNotAvailableException,
                                                      org.eclipse.stardust.common.error.LoginFailedException
Returns an AdministrationService.

Returns:
An instance of the requested service.
Throws:
ServiceNotAvailableException - In case the (possible remote) service could not be reached.
org.eclipse.stardust.common.error.LoginFailedException - In case the authentication to the service fails.

getQueryService

QueryService getQueryService()
                             throws ServiceNotAvailableException,
                                    org.eclipse.stardust.common.error.LoginFailedException
Returns a QueryService.

Returns:
An instance of the requested service.
Throws:
ServiceNotAvailableException - In case the (possible remote) service could not be reached.
org.eclipse.stardust.common.error.LoginFailedException - In case the authentication to the service fails.

getDocumentManagementService

DocumentManagementService getDocumentManagementService()
                                                       throws ServiceNotAvailableException,
                                                              org.eclipse.stardust.common.error.LoginFailedException
Returns a document management service.

Returns:
An instance of the requested service.
Throws:
ServiceNotAvailableException - In case the (possible remote) service could not be reached.
org.eclipse.stardust.common.error.LoginFailedException - In case the authentication to the service fails.

release

void release(org.eclipse.stardust.engine.api.runtime.Service service)
Provides explicit service resource management. May be used to release resources associated with a service (like connection handles or locked instances) early.

Explicitly releasing a service may be help conserving resources but is not necessary as the ServiceFactory provides automatic resource cleanup.

Parameters:
service - The service to be released.
See Also:
close()

close

void close()
Releases all resources hold by the service factory and its single services. All services retrieved from this ServiceFactory will be closed too.


setCredentials

void setCredentials(Map credentials)

setProperties

void setProperties(Map properties)

getSessionId

String getSessionId()
Gets the user session id

Returns:
the user session id - may be null


Copyright © 2017 Eclipse Stardust. All Rights Reserved.