org.jwarp.service.web
Class WebService

java.lang.Object
  |
  +--org.jwarp.service.AService
        |
        +--org.jwarp.service.web.WebService
All Implemented Interfaces:
IConfigurable, IExceptionProvider, IReferenceable, IService, IWebService

public class WebService
extends AService
implements IWebService

The WebService class is the central processing unit. The class is conforming the Java serlvet API and controls initialisation of the different application areas. Such areas are:
- Loading of all text configurations
- Loading and initialising of all DB connections needed
- Initialising of all internal structures
- Loading of all ActionControllers and Actions
- Dispatching of commands to the registered Actions.
- Output of error mesages if necessary.

Version:
1.0
Author:
A. Tresch, M.Schaefer

Field Summary
protected  java.lang.String cacheName
           
protected  ICacheService cacheService
           
(package private)  IDispatchAlg dispatchHandler
          Dispatch handler alg reference
protected  boolean enableCaching
          Service reference: Web service reference.
(package private)  java.util.Hashtable forwarders
          Forward handler alg reference
(package private)  IRequestInit requestInit
          IRequestInit web alg reference
protected  int serviceCounter
          Counting the active services.
(package private)  ISessionInit sessionInit
          ISessionInit web alg reference
protected  long shutdownTime
           
protected  ICache webCache
           
protected  WebStatus webStatus
           
 
Fields inherited from class org.jwarp.service.AService
context, createdDate, dependencies, emptyProperties, exceptionListeners, log, resumedDate, serviceName, serviceStatus, serviceType, startedDate, stoppedDate, suspendedDate, systemTicket
 
Fields inherited from interface org.jwarp.service.web.IWebService
SERVICE_TYPE
 
Fields inherited from interface org.jwarp.service.IService
SERVICE_STATUS_CREATED, SERVICE_STATUS_NOT_AVAILABLE, SERVICE_STATUS_READY, SERVICE_STATUS_RESUMING, SERVICE_STATUS_RUNNING, SERVICE_STATUS_STARTING, SERVICE_STATUS_STOPPED, SERVICE_STATUS_STOPPING, SERVICE_STATUS_SUSPENDED
 
Constructor Summary
WebService()
           
 
Method Summary
 void configure(org.jdom.Element config)
          Pass the Configuration to the Configurable class.
 void disableCache()
           
 ICache enableCache(java.lang.String serviceName, java.lang.String cacheID)
           
protected  void enteringServiceMethod()
          Increment service count
 void forward(java.lang.String target, java.lang.String url, WebContext webContext)
           
 long getShutdownTime()
           
 WebStatus getWebStatus()
          Get an extended web service status.
 void handleException(java.lang.Exception e, WebContext c)
           
 void initRequest(WebContext webContext)
           
 void initSession(WebContext webContext)
           
protected  void leavingServiceMethod()
          Decrement service count
 int numServices()
          Return number of services operating at this moment
 void performRequest(WebContext webContext)
          Servlet service method.
 void setShutdownTime(long millis)
           
 void shutdown(ITicket ticket)
          Shutdown the service
 void start(ITicket ticket)
          Start the service with the given configuration.
 void suspend(ITicket ticket)
          Suspend the service
 
Methods inherited from class org.jwarp.service.AService
addExceptionListener, checkContext, createLogFromXML, getContext, getCreationDate, getDependencies, getExceptionListeners, getLog, getLogLevel, getName, getReference, getResumedDate, getShutDownDate, getStartDate, getStatus, getSuspendedDate, getType, removeAllExceptionListeners, removeExceptionListener, resume, sendExceptionEvent, setContext, setDependencies, setLogLevel, setName
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jwarp.service.IService
checkContext, getDependencies, getLogLevel, getName, getStatus, getType, resume, setContext, setDependencies, setLogLevel
 
Methods inherited from interface org.jwarp.common.IExceptionProvider
addExceptionListener, getExceptionListeners, removeAllExceptionListeners, removeExceptionListener
 

Field Detail

webStatus

protected WebStatus webStatus

sessionInit

ISessionInit sessionInit
ISessionInit web alg reference

requestInit

IRequestInit requestInit
IRequestInit web alg reference

dispatchHandler

IDispatchAlg dispatchHandler
Dispatch handler alg reference

forwarders

java.util.Hashtable forwarders
Forward handler alg reference

serviceCounter

protected int serviceCounter
Counting the active services.

shutdownTime

protected long shutdownTime

enableCaching

protected boolean enableCaching
Service reference: Web service reference.

webCache

protected ICache webCache

cacheName

protected java.lang.String cacheName

cacheService

protected ICacheService cacheService
Constructor Detail

WebService

public WebService()
Method Detail

configure

public void configure(org.jdom.Element config)
               throws ConfigurationException
Description copied from interface: IConfigurable
Pass the Configuration to the Configurable class. This method must always be called after the constructor and before any other method.
Specified by:
configure in interface IConfigurable
Overrides:
configure in class AService
Following copied from interface: org.jwarp.service.configuration.IConfigurable
Parameters:
configuration - the class configurations.

enableCache

public ICache enableCache(java.lang.String serviceName,
                          java.lang.String cacheID)
Specified by:
enableCache in interface IWebService

disableCache

public void disableCache()
Specified by:
disableCache in interface IWebService

initSession

public void initSession(WebContext webContext)
                 throws InitializationException

initRequest

public void initRequest(WebContext webContext)
                 throws InitializationException

performRequest

public void performRequest(WebContext webContext)
Description copied from interface: IWebService
Servlet service method. This is the main entry-point for JavaWeb. it does the following steps:
  1. if there is a new session, it will call the sssion-init object.
  2. the HttpRequest is wrapped into a JavawebRequest which provides more flexibility
  3. it calls the dispatch-method of the supplied ActionController
Specified by:
performRequest in interface IWebService

forward

public void forward(java.lang.String target,
                    java.lang.String url,
                    WebContext webContext)
             throws InvalidForwardException,
                    InvalidForwardTypeException
Specified by:
forward in interface IWebService

getWebStatus

public WebStatus getWebStatus()
Get an extended web service status.
Specified by:
getWebStatus in interface IWebService
Returns:
a web service status object

enteringServiceMethod

protected final void enteringServiceMethod()
Increment service count

leavingServiceMethod

protected final void leavingServiceMethod()
Decrement service count

numServices

public final int numServices()
Return number of services operating at this moment
Specified by:
numServices in interface IWebService
Following copied from interface: org.jwarp.service.web.IWebService
Returns:
The current service request count

start

public void start(ITicket ticket)
           throws java.lang.SecurityException,
                  ServiceInitializationException
Description copied from interface: IService
Start the service with the given configuration.
Specified by:
start in interface IService
Overrides:
start in class AService
Following copied from interface: org.jwarp.service.IService
Throws:
ServiceInitializationException - If the service could not started
java.lang.SecurityException - If access was denied.

handleException

public void handleException(java.lang.Exception e,
                            WebContext c)

shutdown

public void shutdown(ITicket ticket)
              throws java.lang.SecurityException,
                     ServiceRuntimeException
Description copied from interface: IService
Shutdown the service
Specified by:
shutdown in interface IService
Overrides:
shutdown in class AService
Following copied from interface: org.jwarp.service.IService
Parameters:
ticket - The user ticket
Throws:
ServiceRuntimeException - If the service could not be shut own
java.lang.SecurityException - If access was denied.

suspend

public void suspend(ITicket ticket)
             throws java.lang.SecurityException,
                    ServiceRuntimeException
Description copied from interface: IService
Suspend the service
Specified by:
suspend in interface IService
Overrides:
suspend in class AService
Following copied from interface: org.jwarp.service.IService
Parameters:
ticket - The user ticket
Throws:
ServiceRuntimeException - If the service could not be suspended
java.lang.SecurityException - If access was denied.

setShutdownTime

public void setShutdownTime(long millis)

getShutdownTime

public long getShutdownTime()

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