org.jwarp.service
Interface IContext

All Known Implementing Classes:
Context

public interface IContext

Interface of the basic application context. An application context provides a runtime environment controlling processes, threads and security of application services. All JWeb components actually are built on top of these services.

Version:
1.0
Author:
ORCA Systems GmbH, Martin Schäfer, ORCA Systems GmbH, Anatole Tresch

Field Summary
static int CONTEXT_STATUS_CREATED
          Service is created but not configured.
static int CONTEXT_STATUS_NOT_AVAILABLE
          Service is not available.
static int CONTEXT_STATUS_RUNNING
          Service is up and running.
static int CONTEXT_STATUS_STARTING
          Service is in starting process
static int CONTEXT_STATUS_STOPPED
          Service is stopped and cannot be used
static int CONTEXT_STATUS_STOPPING
          Service is in stopping process
static java.lang.String ELEM_CONTEXT
          XML element name
 
Method Summary
 void addService(org.jdom.Element config, ITicket ticket)
          Add dynamically a new service.
 void addService(IService service, java.lang.String serviceName, ITicket ticket)
          Add dynamically a new service.
 void checkAccess(java.lang.String object, int level, ITicket ticket)
          Direct access to the security service for right authorization.
 IService connectService(org.jdom.Element tree, ITicket ticket)
          This method is used for reusal of the service intitialization and reference code.
 ILogWriter getLog()
          Returns the context's default log writer object.
 java.lang.String getName()
          Returns the name of this context
 IReferenceResolver getResolver()
           
 IService getService(java.lang.String serviceName, ITicket ticket)
          Return the service with the given name.
 int getStatus()
          Returns the current status of the context
 ITicket login(java.lang.String user, java.lang.String pwd)
          Login to this context.
 ILogWriter makeLog(org.jdom.Element tree, ITicket ticket)
          This method is used for reusal of the log intitialization and reference code.
 void removeService(java.lang.String serviceName, ITicket ticket)
          Add dynamically a new service.
 void start(ITicket ticket)
           
 void stop(ITicket ticket)
           
 

Field Detail

ELEM_CONTEXT

public static final java.lang.String ELEM_CONTEXT
XML element name

CONTEXT_STATUS_NOT_AVAILABLE

public static final int CONTEXT_STATUS_NOT_AVAILABLE
Service is not available. This is an error condition.

CONTEXT_STATUS_CREATED

public static final int CONTEXT_STATUS_CREATED
Service is created but not configured. As long as the service is not configured it can not be started.

CONTEXT_STATUS_RUNNING

public static final int CONTEXT_STATUS_RUNNING
Service is up and running.

CONTEXT_STATUS_STOPPED

public static final int CONTEXT_STATUS_STOPPED
Service is stopped and cannot be used

CONTEXT_STATUS_STARTING

public static final int CONTEXT_STATUS_STARTING
Service is in starting process

CONTEXT_STATUS_STOPPING

public static final int CONTEXT_STATUS_STOPPING
Service is in stopping process
Method Detail

login

public ITicket login(java.lang.String user,
                     java.lang.String pwd)
              throws java.lang.SecurityException
Login to this context. This method is called by the contextFactory for logging in.
Parameters:
user - The user id,
pwd - The user password
Throws:
java.lang.SecurityException - When access to the context was denied.

getName

public java.lang.String getName()
Returns the name of this context

getService

public IService getService(java.lang.String serviceName,
                           ITicket ticket)
                    throws java.lang.SecurityException
Return the service with the given name. The service factory itself is not returned directly. But a administration service can implemented that supports the factory's operations such as starting and stopping of services.
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.

getStatus

public int getStatus()
Returns the current status of the context

start

public void start(ITicket ticket)
           throws java.lang.SecurityException,
                  ServiceInitializationException,
                  ServiceRuntimeException

stop

public void stop(ITicket ticket)
          throws java.lang.SecurityException,
                 ServiceRuntimeException

addService

public void addService(IService service,
                       java.lang.String serviceName,
                       ITicket ticket)
                throws java.lang.SecurityException
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
Throws:
java.lang.SecurityException - If access was denied or a service with the same name is running yet

addService

public void addService(org.jdom.Element config,
                       ITicket ticket)
                throws java.lang.SecurityException
Add dynamically a new service.
Parameters:
config - The service's XML configuration tree
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

removeService

public void removeService(java.lang.String serviceName,
                          ITicket ticket)
                   throws java.lang.SecurityException,
                          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

checkAccess

public void checkAccess(java.lang.String object,
                        int level,
                        ITicket ticket)
                 throws java.lang.SecurityException
Direct access to the security service for right authorization.
Parameters:
object - The object
level - The access level
ticket - The user to access the object

getLog

public ILogWriter getLog()
Returns the context's default log writer object. Use this object for writing down any general exceptions and messages.
Returns:
The log

connectService

public IService connectService(org.jdom.Element tree,
                               ITicket ticket)
                        throws java.lang.SecurityException
This method is used for reusal of the service intitialization and reference code. Service that parse their configuration can call this method for accessing an existing service (reference) or creating one.
Parameters:
tree - The service or reference jdom tree
ticket - The system ticket

makeLog

public ILogWriter makeLog(org.jdom.Element tree,
                          ITicket ticket)
                   throws java.lang.SecurityException,
                          ConfigurationException
This method is used for reusal of the log intitialization and reference code. Service that parse their configuration can call this method for accessing an existing log (reference) or creating a new one.
Parameters:
tree - The log or reference jdom tree
logName - The name of the log (when creating a new one)
ticket - The system ticket

getResolver

public IReferenceResolver getResolver()

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