|
|||||||||
| Home >> All >> com >> lutris >> appserver >> [ server overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
com.lutris.appserver.server
Interface Application

- All Known Implementing Classes:
- StandardApplication
- public interface Application
Interface used to define a Lutris server application. Each application defines a class that implements this interface. The specific application class serves as an entry and control point for the application. This class is responsible for initializing any application specific resources, including instance of standard services that are needed. The class must have a constructor with a configuration file argument.
The class is instantiated from a presentation manager and is used to start and stop the application. This structure allows applications to be started on demand by URL reference, as is required for applications running under servlets in HTTPD virtual machines. If remote threads are part of the application, they are normally started from this object.
The application is in one of several states, documented below. The application state is used to determine what actions are take when a request is made for the application.
The following states are possible:
-
STOPPED- The application is not running and maybe started. This is the initial state and the state normally entered on ashutdown(). -
RUNNING- The application is currently running. -
INCOMPLETE- The application is not completely running and the restartup() method maybe called to attempt to bring it into theRUNNINGstate. This state is normally used when a remote server that is required by the application is not available whenstartup()is called. Partial initialization will take place, but the request that caused the startup will fail. A subsequent requests will results in calls torestartup()until the application can be fully started. This eliminates startup order dependencies when initializing a distributed application. The state may also be entered by the application when a remote server fails. -
DEAD- The application is in an fatal error state and can not be restarted. -
HALTED- shutdown was called on the application and the application is not designed so that in can be restarted.
RUNNING state
when startup() is called and the STOPPED state
when shutdown() is called.
The server provides synchronization on state changes to the application; however multiple requests threats may enter the application at the same time.
Two configuration parameters are required to start an application. Under servlets, these are specified as init args for the presentation servlet. They are:
-
appClass- This is the class name of the application class. If not specified, the presentation servlet will run without an application object. -
appConfig- An arbitrary string to pass to thestartup(0method. It normally contains the path or URL of a Config or properties file containing the application configuration. If not specified,nullis passed tostartup.
- Version:
- $Revision: 1.24.14.1 $
| Field Summary | |
static int |
DEAD
Dead state code. |
static int |
HALTED
|
static int |
INCOMPLETE
Incomplete state code. |
static int |
RUNNING
Running state code. |
static int |
STOPPED
Stopped state code. |
| Method Summary | |
ApplicationData |
getApplicationData()
Application Data accessible through Jolt Fields. |
com.lutris.util.Config |
getConfig()
Get the application's config object. |
com.lutris.appserver.server.sql.DatabaseManager |
getDatabaseManager()
Get the DatabaseManager associated with this application. |
com.lutris.appserver.server.httpPresentation.HttpPresentationManager |
getHttpPresentationManager()
Get the HttpPresentationManager associated with this
application. |
com.lutris.logging.LogChannel |
getLogChannel()
Get the LogChannel associated with this application. |
java.lang.String |
getName()
Get the application symbolic name. |
com.lutris.appserver.server.session.SessionManager |
getSessionManager()
Get the SessionManager associated with this application. |
int |
getState()
Get the application state. |
org.enhydra.xml.xmlc.XMLCFactory |
getXMLCFactory()
Get the XMLC factory object being used by the application. |
void |
requestPostProcessor(com.lutris.appserver.server.httpPresentation.HttpPresentationComms comms)
Request post-processing method. |
boolean |
requestPreprocessor(com.lutris.appserver.server.httpPresentation.HttpPresentationComms comms)
Request preprocessing method. |
void |
restartup(com.lutris.util.Config appConfig)
Continue the startup up process with the application is in the INCOMPLETE state. |
boolean |
servletRequestPreprocessor(javax.servlet.Servlet servlet,
javax.servlet.ServletContext context,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
This preprocessor hook is called before the request/response pair is processed by the HttpPresentationServlet. |
void |
setHttpPresentationManager(com.lutris.appserver.server.httpPresentation.HttpPresentationManager pm)
Called to tell the application about the presentation manager instance. |
void |
setLogChannel(com.lutris.logging.LogChannel chan)
Set the LogChannel associated with this application. |
void |
setName(java.lang.String name)
Set the application symbolic name. |
void |
setXMLCFactory(boolean enableReload,
boolean enableRecompilation)
Set the XMLC factory based on the recload and recompilation options. |
void |
shutdown()
Shutdown the application. |
void |
startup(com.lutris.util.Config appConfig)
Start the application. |
| Field Detail |
STOPPED
public static final int STOPPED
- Stopped state code.
- See Also:
- Constant Field Values
RUNNING
public static final int RUNNING
- Running state code.
- See Also:
- Constant Field Values
INCOMPLETE
public static final int INCOMPLETE
- Incomplete state code.
- See Also:
- Constant Field Values
DEAD
public static final int DEAD
- Dead state code.
- See Also:
- Constant Field Values
HALTED
public static final int HALTED
- See Also:
- Constant Field Values
| Method Detail |
getState
public int getState()
- Get the application state.
getApplicationData
public ApplicationData getApplicationData()
- Application Data accessible through Jolt Fields.
setName
public void setName(java.lang.String name)
- Set the application symbolic name.
getName
public java.lang.String getName()
- Get the application symbolic name.
getConfig
public com.lutris.util.Config getConfig()
- Get the application's config object.
startup
public void startup(com.lutris.util.Config appConfig) throws ApplicationException
- Start the application. The default method sets the state to
RUNNING.
restartup
public void restartup(com.lutris.util.Config appConfig) throws ApplicationException
- Continue the startup up process with the application is in the
INCOMPLETEstate. The default method generates an error, as the application should never be in theINCOMPLETEstate if it doesn't implement this method.
shutdown
public void shutdown()
- Shutdown the application. The default method sets the state to
STOPPED.
requestPreprocessor
public boolean requestPreprocessor(com.lutris.appserver.server.httpPresentation.HttpPresentationComms comms) throws java.lang.Exception
- Request preprocessing method. All requests for URLs associated
with this application go through this function. It may do any
preprocessing desired, including handling the request or generating
a page redirect. It can be used to force login, allocate session
objects, restrict access, etc.
Page redirect requests also go through this method, so care must be taken not to generate an endless page redirect loop. ErrorHandler presentation objects do not go through this method if they are invoked from within the presentation manager. However, direct URL requests to ErrorHandler presentation objects will go through this function.
Note: unlike the method servletRequestPreprocessor(), this method is commonly used in most applications. It is the only place that the application has where all requests come through. So you could, for example, put a check for HTTP basic authentication here, and that would automatically protect your entire application. Or, if you were so inclined, you could have a counter that counts the total pages served by your application.
requestPostProcessor
public void requestPostProcessor(com.lutris.appserver.server.httpPresentation.HttpPresentationComms comms) throws java.lang.Exception
- Request post-processing method. All requests for URLs associated
with this application go through this function. It may do any
post-processing desired (e.g. saving sessions to persistent store).
servletRequestPreprocessor
public boolean servletRequestPreprocessor(javax.servlet.Servlet servlet, javax.servlet.ServletContext context, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException, java.io.IOException
- This preprocessor hook is called before the request/response pair
is processed by the HttpPresentationServlet. It gives the
application a chance to work with the raw request/response pair
before they are wrapped by HttpPresentationRequest and
HttpPresentationResponse objects. Return false to indicate
that the request should continue to be processed normally
or true to indicate that this method has handled the request,
and all processing of the request should stop, in which case
it will not be passed on to the presentation manager etc...
The default method in StandardApplication always returns false.
Almost all applications should not override this! The version provided by StandardApplication simply returns false. Currently the debugger is the only application that used this, to support the flow-through debugging of non-Enhydra servlets, it needs to pass the raw request/response pair to the target servlet.
setLogChannel
public void setLogChannel(com.lutris.logging.LogChannel chan)
- Set the
LogChannelassociated with this application.
getLogChannel
public com.lutris.logging.LogChannel getLogChannel()
- Get the
LogChannelassociated with this application.
getSessionManager
public com.lutris.appserver.server.session.SessionManager getSessionManager()
- Get the
SessionManagerassociated with this application.
getDatabaseManager
public com.lutris.appserver.server.sql.DatabaseManager getDatabaseManager()
- Get the
DatabaseManagerassociated with this application.
getHttpPresentationManager
public com.lutris.appserver.server.httpPresentation.HttpPresentationManager getHttpPresentationManager()
- Get the
HttpPresentationManagerassociated with this application.
setHttpPresentationManager
public void setHttpPresentationManager(com.lutris.appserver.server.httpPresentation.HttpPresentationManager pm)
- Called to tell the application about the presentation manager
instance. This is necessary because the Presentation Manager is
created in parallel with the application by the
HttpPresentationServlet.
getXMLCFactory
public org.enhydra.xml.xmlc.XMLCFactory getXMLCFactory()
- Get the XMLC factory object being used by the application.
If one was not configured, a default one is created on the
first call to this method.
setXMLCFactory
public void setXMLCFactory(boolean enableReload,
boolean enableRecompilation)
- Set the XMLC factory based on the recload and recompilation options.
|
|||||||||
| Home >> All >> com >> lutris >> appserver >> [ server overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC