org.jwarp.app
Class JWebApplication

java.lang.Object
  |
  +--org.jwarp.app.JWebApplication

public class JWebApplication
extends java.lang.Object

The AAppController 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  IConfiguration config
          Configuration manager that holds further DB and connection setup.
protected  IContext context
          The application's/servlet's context
protected  boolean debugging
          Variable for switching on and off extensive debugging messages
protected  int errorNumber
          If the application status is STATUS_RUNTIME_ERROR or STATUS_CONFIG_ERROR then this variable contains the xact error number.
protected  ILogWriter log
          Log file access writer for the application.
protected  java.lang.String name
          The name of this servlet.
protected  java.lang.String propertyFilePath
          The path to the main application config file.
protected static long SHUTDOWN_INTERVAL
          How much time to give service methods before rechecking whether or not they have completed.
protected  short status
          current application status number.
static short STATUS_CONFIG_ERROR
          Status value that flags that the initialisation of the
application failed because user data was false or missing.
static short STATUS_CONFIGURED
          Status value signalling that the application is ready to run.
static short STATUS_CONFIGURING
          Status value signalling that the application is ready to run.
static short STATUS_CREATED
          Status value signalling that the application was created but is not configured yet.
static short STATUS_RUNNING
          Status value signalling that the application is up and running.
static short STATUS_RUNTIME_ERROR
          Status value that flags that some runtime error occurred during start or run.
static short STATUS_STARTING
          Status value signalling that the application is starting up..
static short STATUS_STOPPED
          Status value signalling that the application was stopped.
static short STATUS_STOPPING
          Status value sugnalling that the application is going down.
protected  ITicket systemTicket
          The ticket for system access to the context.
 
Constructor Summary
JWebApplication(java.lang.String[] args)
           
 
Method Summary
 void destroy()
          Servlet destroy method.
 java.lang.String getAppName()
          Get the servlet name.
 IConfiguration getConfig()
          This method returns the config object for the application configuration.
 int getError()
          Get the number of the current error (if any).
 java.lang.String getErrorMessage()
          Get the error message of the current error (if any)
 ILogWriter getMainLog()
          Return the controllers log object
 short getStatus()
          This method return the actual status of the application The status constants from the class are used for a more detailed description.
protected  void init()
          Servlet initialisation.
protected  void initApplication()
           
protected  void initConfiguration(java.lang.String propertyFilePath)
           
 boolean isDebugging()
          This method returns if the application actually is running in debugging mode and so printing more detailed information on errors
static void main(java.lang.String[] args)
           
static void printVersion()
           
 void setDebugging(boolean debugging)
          With this method debugging mode can be switched on and off
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

name

protected java.lang.String name
The name of this servlet. This name can be set within the XML configuration.

propertyFilePath

protected java.lang.String propertyFilePath
The path to the main application config file.

context

protected IContext context
The application's/servlet's context

debugging

protected boolean debugging
Variable for switching on and off extensive debugging messages

STATUS_CREATED

public static final short STATUS_CREATED
Status value signalling that the application was created but is not configured yet.

STATUS_CONFIGURING

public static final short STATUS_CONFIGURING
Status value signalling that the application is ready to run.

STATUS_CONFIGURED

public static final short STATUS_CONFIGURED
Status value signalling that the application is ready to run.

STATUS_STARTING

public static final short STATUS_STARTING
Status value signalling that the application is starting up..

STATUS_RUNNING

public static final short STATUS_RUNNING
Status value signalling that the application is up and running.

STATUS_STOPPING

public static final short STATUS_STOPPING
Status value sugnalling that the application is going down.

STATUS_STOPPED

public static final short STATUS_STOPPED
Status value signalling that the application was stopped.

STATUS_CONFIG_ERROR

public static final short STATUS_CONFIG_ERROR
Status value that flags that the initialisation of the
application failed because user data was false or missing.

STATUS_RUNTIME_ERROR

public static final short STATUS_RUNTIME_ERROR
Status value that flags that some runtime error occurred during start or run.

errorNumber

protected int errorNumber
If the application status is STATUS_RUNTIME_ERROR or STATUS_CONFIG_ERROR then this variable contains the xact error number.

config

protected IConfiguration config
Configuration manager that holds further DB and connection setup.

systemTicket

protected ITicket systemTicket
The ticket for system access to the context.

status

protected short status
current application status number. Possible values are:
JWebServer.STATUS_CREATEDThe application is created but not configured yet
JWebServer.STATUS_CONFIGUREDThe application is configured and ready to run.
JWebServer.STATUS_STARTINGThe application is starting.
JWebServer.STATUS_RUNNINGThe application is up and running.
JWebServer.STATUS_STOPPINGThe application is running the shutdown proecedure.
JWebServer.STATUS_STOPPEDThe application has been stopped running.
JWebServer.STATUS_CONFIG_ERRORThe application's configuration is invalid.
JWebServer.STATUS_RUNTIME_ERRORThe application encountered a fatal error during startup or run.


log

protected ILogWriter log
Log file access writer for the application.

SHUTDOWN_INTERVAL

protected static final long SHUTDOWN_INTERVAL
How much time to give service methods before rechecking whether or not they have completed. Only when all service methods have completed do we do terminate the destroy().
Constructor Detail

JWebApplication

public JWebApplication(java.lang.String[] args)
Method Detail

init

protected void init()
Servlet initialisation. Overrides the standard Servlet-init.
Performs the initialisation for JavaWeb. The following tasks are performed:
  1. Getting the INI_FILE parameter and initialising the defaultPropertyFile-property.
  2. If not available the property is set to the value of DEBUG_PROP_FILE.
  3. Creating and initialising of the log writer object stored in the logWriter-property
  4. Loading the file configuration as defined by the defaultPropertyFile-property. Here also
  5. other configuration loading mechanisms can be possible.
  6. It is checked if any JDBC drivers are provided in the App.PoolManager.Drivers-property. If so a new PoolManager is created.
  7. The action controller modules are created and loaded.
  8. A new session init object is created and initialised.

initConfiguration

protected void initConfiguration(java.lang.String propertyFilePath)
                          throws ConfigurationException

initApplication

protected void initApplication()
                        throws ConfigurationException

isDebugging

public final boolean isDebugging()
This method returns if the application actually is running in debugging mode and so printing more detailed information on errors

setDebugging

public final void setDebugging(boolean debugging)
With this method debugging mode can be switched on and off

getErrorMessage

public final java.lang.String getErrorMessage()
Get the error message of the current error (if any)
Returns:
The error message

getError

public final int getError()
Get the number of the current error (if any). Zero means no error. You can look up the message by calling getErrorMessage
Returns:
The error number

destroy

public void destroy()
Servlet destroy method. Overrides the standard Servlet destroy() method. By default if
a PoolManager object is created its release-methos its called to release all db connections.
This method does not terminate until the service count reaches zero. Not that we assume that client servicing threads will terminate at some point. If they do not, then this method will not terminate and the shutdown will require manual intervention i.e. kill process.

getConfig

public final IConfiguration getConfig()
This method returns the config object for the application configuration.

getStatus

public final short getStatus()
This method return the actual status of the application The status constants from the class are used for a more detailed description.

getAppName

public final java.lang.String getAppName()
Get the servlet name.

getMainLog

public final ILogWriter getMainLog()
Return the controllers log object

main

public static void main(java.lang.String[] args)

printVersion

public static void printVersion()

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