jason.service.crusader
Class CrusaderCore

java.lang.Object
  |
  +--jason.service.crusader.CrusaderCore
All Implemented Interfaces:
java.lang.Runnable

public class CrusaderCore
extends java.lang.Object
implements java.lang.Runnable


Field Summary
protected  java.lang.String className
          The class name has to be the fully qualified class-name of the Servlet class, the object of which shall be encapsulated in the servletCapsule.
protected  java.io.OutputStream clientOStream
          Contains the OutputStream to the client/or wherever the output from the Servlet is supposed to go.
protected  java.lang.String fileName
          Stores the file name of the Servlet class which shall be encapsulated in the servletCapsule.
protected  ServletCapsuleInt servletCapsule
          Stores the ServletCapsule embedded in this Core.
protected  ServletConfigImpl servletConfig
          Conatins the ServletConfig inplementation - there exists as many ServletConfig implementation as there are servlets.
protected  HttpServletRequestImpl servletRequest
          The ServletRequest implementation.
protected  HttpServletResponseImpl servletResponse
          The ServletResponse implementation.
protected static ServletStoreInt servletStore
          Stores the reference to the ServletStore from where ServletCapsules are to be retrieved - there exists only one ServletStore globally.
 
Constructor Summary
CrusaderCore(HttpRequestParser parser)
          Default constructor initializes all the non static variable to null.
 
Method Summary
 ServletConfigImpl getServletConfig()
          This static method returns the ServletConfig implementation which is attached with this thread - redundent method, should be removed.
static ServletStoreInt getServletStore()
          This method returns the reference to the ServletStore - the repository for ServletCapsule objects.
 void initializeService()
          This method is responsible to decide what kind of initialization shall be performed for the servletCapsule.
protected  javax.servlet.Servlet initializeServlet(java.lang.Class servletClass)
          This method is responsible to create and call the init() on the Servlet instance This method is exclusively called by the initializeServletCapsule(boolean,long,File) of the same class.
protected  void initializeServletCapsule(boolean newCapsuleInitialization, long fileLastModified, java.io.File servletClassFile)
          This method is responsible to initialize a new ServletCapsule and register it with the ServletStore.
 void run()
          This method shall actually contain the code to initialize the services and run the Servlet embeded in the ServletCapsule - this is where all the work gets done.
 void setClassName(java.lang.String className)
          This method is called by the run() of this same class to set the className parameter.
 void setClientOStream(java.io.OutputStream clientOStream)
          This method is used exclusively by the Crusader Engine to set the OutputStream through which the output from the Servlet shall be channelised out.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

servletStore

protected static ServletStoreInt servletStore
Stores the reference to the ServletStore from where ServletCapsules are to be retrieved - there exists only one ServletStore globally.


servletConfig

protected ServletConfigImpl servletConfig
Conatins the ServletConfig inplementation - there exists as many ServletConfig implementation as there are servlets.


servletCapsule

protected ServletCapsuleInt servletCapsule
Stores the ServletCapsule embedded in this Core.

See Also:
ServletCapsuleInt

servletRequest

protected HttpServletRequestImpl servletRequest
The ServletRequest implementation. See ServletRequestImpl & HttpServletRequestImpl for more information.


servletResponse

protected HttpServletResponseImpl servletResponse
The ServletResponse implementation. See ServletResponseImpl & HttpServletResponseImpl for more information.


className

protected java.lang.String className
The class name has to be the fully qualified class-name of the Servlet class, the object of which shall be encapsulated in the servletCapsule.


fileName

protected java.lang.String fileName
Stores the file name of the Servlet class which shall be encapsulated in the servletCapsule.


clientOStream

protected java.io.OutputStream clientOStream
Contains the OutputStream to the client/or wherever the output from the Servlet is supposed to go.

Constructor Detail

CrusaderCore

public CrusaderCore(HttpRequestParser parser)
Default constructor initializes all the non static variable to null. Required by the ThreadPool class.

Method Detail

getServletStore

public static ServletStoreInt getServletStore()
This method returns the reference to the ServletStore - the repository for ServletCapsule objects.
This is the only method to get reference to the store.

Returns:
ServletStoreInt An instance of a class which implements ServletStoreInt interface.

getServletConfig

public ServletConfigImpl getServletConfig()
This static method returns the ServletConfig implementation which is attached with this thread - redundent method, should be removed.


setClientOStream

public void setClientOStream(java.io.OutputStream clientOStream)
This method is used exclusively by the Crusader Engine to set the OutputStream through which the output from the Servlet shall be channelised out.


setClassName

public void setClassName(java.lang.String className)
This method is called by the run() of this same class to set the className parameter.


initializeService

public void initializeService()
                       throws java.lang.Exception
This method is responsible to decide what kind of initialization shall be performed for the servletCapsule.
This method is called from the run() of the same class.

java.lang.Exception

initializeServletCapsule

protected void initializeServletCapsule(boolean newCapsuleInitialization,
                                        long fileLastModified,
                                        java.io.File servletClassFile)
                                 throws java.lang.Exception
This method is responsible to initialize a new ServletCapsule and register it with the ServletStore. It also can perform partial initialization if required. True - full initialization, False - partial initialization. This method shall be called in only two situations - 1) If the Servlet is a new Servlet, 2) The Servlet .class file has undergone some modification. THIS METHOD SHALL NOT BE CALLED IN ANY OTHER SITUATION. This method is called only by the initializeService() of the same class.

Parameters:
newCapsuleInitialization - A boolean indicating wether there has to be a new instantiation and initialization of a ServletCapsule or not.
fileLastModified - The long value which indicates the last modified time for the .class file of theServlet.
servletClassFile - The java .io.File object representing the Servlet .class file.
java.lang.Exception

initializeServlet

protected javax.servlet.Servlet initializeServlet(java.lang.Class servletClass)
                                           throws java.lang.InstantiationException,
                                                  java.lang.IllegalAccessException
This method is responsible to create and call the init() on the Servlet instance This method is exclusively called by the initializeServletCapsule(boolean,long,File) of the same class.

Parameters:
servletClass - The java.lang.Class object representing the Servlet class.
java.lang.InstantiationException
java.lang.IllegalAccessException

run

public void run()
This method shall actually contain the code to initialize the services and run the Servlet embeded in the ServletCapsule - this is where all the work gets done.

Specified by:
run in interface java.lang.Runnable