|
EAF 7.4 API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.lutris.appserver.server.StandardApplication
public abstract class StandardApplication
Default application implementation. This class provides standard start/stop services. This can be used as a base class to derive Application objects.
Nested Class Summary | |
---|---|
static class |
StandardApplication.ContextMBean
|
Field Summary | |
---|---|
protected com.lutris.appserver.server.StandardApplication.ApplicationConfigMBean |
appConfigMBean
|
protected java.lang.String |
appName
The name of the application; defaults to the unqualified class name. |
protected com.lutris.util.Config |
config
This applications config object. |
protected StandardApplication.ContextMBean |
contextMBean
|
protected com.lutris.appserver.server.ApplicationData |
data
Application Data accessable through Jolt Fields. |
protected DatabaseManager |
databaseManager
Database manager instance for application. |
protected java.lang.String |
defaultUrl
Default URL used for application if defined in Config file. |
protected org.enhydra.util.jivan.JivanFactory |
jivanFactory
Jivan Factory. |
protected LogChannel |
logChannel
The log channel for this application to write to. |
protected Logger |
logger
|
protected static LogChannel |
loggerSys
The logger that logs on System.out. |
protected com.lutris.appserver.server.ResponsePostProcessingManager |
postProcessingManager
Response Post Processing Manager instance for application. |
protected com.lutris.appserver.server.RequestPreProcessingManager |
preProcessingManager
Request Pre Processing Manager instance for application. |
protected com.lutris.appserver.server.httpPresentation.HttpPresentationManager |
presentationManager
Presentation manager instance for application. |
protected com.lutris.appserver.server.StandardApplication.PresentationManagerMBean |
presentationManagerMBean
|
protected boolean |
sendCookieForNewSession
Determines if a cookie with the session id is sent to the client. |
protected javax.management.MBeanServer |
server
|
protected SessionManager |
sessionManager
Session manager for all application sessions. |
protected com.lutris.appserver.server.StandardApplication.SessionManagerMBean |
sessionManagerMBean
|
protected int |
state
Current state of the application. |
protected org.enhydra.xml.xmlc.XMLCFactory |
xmlcFactory
XMLC Factory. |
Fields inherited from interface com.lutris.appserver.server.Application |
---|
DEAD, HALTED, INCOMPLETE, RUNNING, STOPPED |
Constructor Summary | |
---|---|
StandardApplication()
A constructor with no arguments is required. |
Method Summary | |
---|---|
protected DatabaseManager |
createDatabaseManager(com.lutris.util.Config databaseMgrConfig)
Create the database manager to be used by this application. |
protected com.lutris.appserver.server.ResponsePostProcessingManager |
createPostProcessingManager(com.lutris.util.Config ppConfig)
Create the response post-processing manager to be used by this application. |
protected com.lutris.appserver.server.RequestPreProcessingManager |
createPreProcessingManager(com.lutris.util.Config ppConfig)
Create the request pre-processing manager to be used by this application. |
protected Session |
createSession(com.lutris.appserver.server.httpPresentation.HttpPresentationComms comms)
Create a new session for application. |
protected SessionManager |
createSessionManager(com.lutris.util.Config sessionMgrConfig)
Create the session manager to be used by this application. |
java.lang.String |
encodeUrl(java.lang.String url,
java.lang.String sessionKey)
Returns the specified url rewritten to include the sessionId |
java.lang.String |
encodeUrl(java.lang.String url,
java.lang.String sessionKey,
java.lang.String appName)
Deprecated. Use encodeUrl(String,String) |
protected void |
ensureSession(com.lutris.appserver.server.httpPresentation.HttpPresentationComms comms)
Default method used by requestPreprocessor
to ensure that a session exists and initialize the
session and sessionData fields
in the HttpPresentationComms object. |
com.lutris.util.Config |
getConfig()
Get the application's config object. |
DatabaseManager |
getDatabaseManager()
Get the DatabaseManager associated with this application. |
com.lutris.appserver.server.httpPresentation.HttpPresentationManager |
getHttpPresentationManager()
Get the HttpPresentationManager associated with this
application. |
org.enhydra.util.jivan.JivanFactory |
getJivanFactory()
Get the Jivan factory object being used by the application. |
LogChannel |
getLogChannel()
Get the LogChannel associated with this application. |
java.lang.String |
getName()
Get the application symbolic name. |
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 |
initDodsAsyncCaches()
Initialize Asynchronous DODS Caches! |
void |
initDodsAsyncCaches(int threadNumber)
Initialize Asynchronous DODS Caches! |
protected void |
initializeNewSession(com.lutris.appserver.server.httpPresentation.HttpPresentationComms comms)
This is called when no valid session is found in an incoming request. |
void |
printCopyrightHeader()
|
void |
requestPostProcessor(com.lutris.appserver.server.httpPresentation.HttpPresentationComms comms)
Calls application session manager's passivateSession method for the session associated with this request. |
boolean |
requestPreprocessor(com.lutris.appserver.server.httpPresentation.HttpPresentationComms comms)
Default application request preprocessor. |
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 is a hook that allows applications to act on requests before they enter the Enhydra framework. |
void |
setCookieForNewSession(boolean flag)
Tells the application if a cookie is used to bind new sessions to a client. |
void |
setHttpPresentationManager(com.lutris.appserver.server.httpPresentation.HttpPresentationManager pm)
Tells the application about the Presentation Manager running it. |
void |
setJivanFactory(boolean reload)
Initializes the Jivan factory object which can be used by application. |
void |
setLogChannel(LogChannel chan)
Set the LogChannel associated with this application. |
void |
setName(java.lang.String applName)
Set the application name. |
void |
setXMLCFactory()
Set the XMLC factory based on the deferred parsing option. |
void |
shutdown()
Shutdown the application. |
void |
shutdownWithoutMBeanUnRegistration()
Shutdown the application. |
void |
startup(com.lutris.util.Config appConfig)
Start the application. |
java.lang.String |
toHtml()
Get the Application Info HTML presentation. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected boolean sendCookieForNewSession
protected java.lang.String appName
protected int state
protected SessionManager sessionManager
protected com.lutris.appserver.server.httpPresentation.HttpPresentationManager presentationManager
protected com.lutris.appserver.server.RequestPreProcessingManager preProcessingManager
protected com.lutris.appserver.server.ResponsePostProcessingManager postProcessingManager
protected DatabaseManager databaseManager
protected com.lutris.util.Config config
Config
protected java.lang.String defaultUrl
protected LogChannel logChannel
protected Logger logger
protected static LogChannel loggerSys
protected com.lutris.appserver.server.ApplicationData data
protected org.enhydra.xml.xmlc.XMLCFactory xmlcFactory
protected org.enhydra.util.jivan.JivanFactory jivanFactory
protected javax.management.MBeanServer server
protected com.lutris.appserver.server.StandardApplication.ApplicationConfigMBean appConfigMBean
protected com.lutris.appserver.server.StandardApplication.PresentationManagerMBean presentationManagerMBean
protected com.lutris.appserver.server.StandardApplication.SessionManagerMBean sessionManagerMBean
protected StandardApplication.ContextMBean contextMBean
Constructor Detail |
---|
public StandardApplication()
Method Detail |
---|
public int getState()
getState
in interface Application
public void setCookieForNewSession(boolean flag)
flag
- indicates whether to send a cookie or not.public com.lutris.util.Config getConfig()
getConfig
in interface Application
public void setName(java.lang.String applName)
setName
in interface Application
name
- The new name for the application.public java.lang.String getName()
N.B. Purposely not syncronized for speed.
getName
in interface Application
public void setLogChannel(LogChannel chan)
LogChannel
associated with this application.
setLogChannel
in interface Application
The
- LogChannel
to write to.public LogChannel getLogChannel()
LogChannel
associated with this application.
getLogChannel
in interface Application
null
if this application
does not have one.public void startup(com.lutris.util.Config appConfig) throws ApplicationException
RUNNING
.
startup
in interface Application
appConfig
- Application configuration object.
ApplicationException
- If an error occurs starting the application.public void initDodsAsyncCaches() throws ApplicationException
ApplicationException
- If an error occurs restart the application.public void initDodsAsyncCaches(int threadNumber) throws ApplicationException
threadNumber
- Number of parallel cache loading threads
ApplicationException
- If an error occurs restart the application.public void printCopyrightHeader()
public void restartup(com.lutris.util.Config appConfig) throws ApplicationException
INCOMPLETE
state. The default method generates an
error, as the application should never be in the INCOMPLETE
state if it doesn't implment this method.
restartup
in interface Application
appConfig
- The same appConfig
object that was passed to
startup
.
ApplicationException
- If an error occurs restarting the application.public void shutdown()
STOPPED
.
shutdown
in interface Application
public void shutdownWithoutMBeanUnRegistration()
STOPPED
.
protected SessionManager createSessionManager(com.lutris.util.Config sessionMgrConfig) throws ApplicationException
sessionMgrConfig
- Configuration object containing "SessionManager" keys.
This can be null
to use defaults.
ApplicationException
- If an error occurs in creating a session manager.protected com.lutris.appserver.server.RequestPreProcessingManager createPreProcessingManager(com.lutris.util.Config ppConfig)
ppConfig
- Configuration object containing "RequestPreProcessor" keys.
This can be null
to use none.
protected com.lutris.appserver.server.ResponsePostProcessingManager createPostProcessingManager(com.lutris.util.Config ppConfig)
ppConfig
- Configuration object containing "ResponsePostProcessor" keys.
This can be null
to use none.
protected DatabaseManager createDatabaseManager(com.lutris.util.Config databaseMgrConfig) throws ApplicationException
StandardDatabaseManager
.
This method can be overwritten to create a custom session
manager.
databaseMgrConfig
- Configuration object containing "DatabaseManager" keys.
ApplicationException
- If an error occurs in creating a database manager.protected Session createSession(com.lutris.appserver.server.httpPresentation.HttpPresentationComms comms) throws ApplicationException
StandardSession
.
This method can be overwritten to create a custom session.
comms
- Object containing request, response and redirect objects.
Warning: comms.session and comms.sessionData will be null.
they are filled in after this method returns.
ApplicationException
- If an error occurs in creating the session.protected void ensureSession(com.lutris.appserver.server.httpPresentation.HttpPresentationComms comms) throws ApplicationException
requestPreprocessor
to ensure that a session exists and initialize the
session
and sessionData
fields
in the HttpPresentationComms
object.
New sessions are only created on requests to presentation
objects, not requests for other types of files (such as gifs).
This avoids allocating multiple sessions when a browser makes
multiple requests for HREFs. If the session already exist, it
is alwasy set in comms
This normally looks up the session using a session key from a cookie.
comms
- Object containing request, response and redirect objects.
ApplicationException
- If an error occurs setting up the session.public void requestPostProcessor(com.lutris.appserver.server.httpPresentation.HttpPresentationComms comms) throws ApplicationException
requestPostProcessor
in interface Application
comms
- Object containing request, response and redirect objects.
ApplicationException
- If the session manager was unable to "passivate" the session.com.lutris.appserver.server.session.SessionManager.passivateSession
protected void initializeNewSession(com.lutris.appserver.server.httpPresentation.HttpPresentationComms comms) throws ApplicationException
comms
. If
sending session cookies is enabled, a cookie is created and
added to the response, so future requests will be associated
with the newly created session. If sending session cookies is
disabled, it is the application's responsibility to include
the session ID in URLs to associate further requests with the
session.
Warning: At first comms.session
and comms.sessionData
are null. This method initializes
them both.
comms
- Object containing request, response and redirect objects. Session
and SessionData objects are initialized.
ApplicationException
- If an error occurs setting up the session.setCookieForNewSession(boolean)
public java.lang.String encodeUrl(java.lang.String url, java.lang.String sessionKey) throws ApplicationException
url
- String to urlencode
ApplicationException
public java.lang.String encodeUrl(java.lang.String url, java.lang.String sessionKey, java.lang.String appName) throws ApplicationException
url
- String to urlencode
ApplicationException
public boolean requestPreprocessor(com.lutris.appserver.server.httpPresentation.HttpPresentationComms comms) throws java.lang.Exception
N.B. Purposely not syncronized for speed/concurrency.
requestPreprocessor
in interface Application
comms
- Object containing request, response and redirect objects.
java.lang.Exception
- May throw any exception, as with a presentation object;
including page redirects.public SessionManager getSessionManager()
SessionManager
associated with this application.
getSessionManager
in interface Application
null
if the application
doesn't have a SessionManager
.public DatabaseManager getDatabaseManager()
DatabaseManager
associated with this application.
getDatabaseManager
in interface Application
null
if the application
doesn't have a DatabaseManager
.public com.lutris.appserver.server.httpPresentation.HttpPresentationManager getHttpPresentationManager()
HttpPresentationManager
associated with this
application.
getHttpPresentationManager
in interface Application
public void setHttpPresentationManager(com.lutris.appserver.server.httpPresentation.HttpPresentationManager pm)
setHttpPresentationManager
in interface Application
pm
- The HTTP presentation manager running this application.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
In contrast, the method requestPreprocessor() is commonly overridden. It provides applications with a centeral place to put code that has to be run on every request before it is sent to the presentation objects.
servletRequestPreprocessor
in interface Application
servlet
- The servlet we are running in.context
- The ServletContext that was used to initialize our servlet.request
- The incomming request object.response
- The incomming response object.
javax.servlet.ServletException
- You are allowed to throw the same exceptions that the servlet's
service() method throws.
java.io.IOException
- You are allowed to throw the same exceptions that the servlet's
service() method throws.public org.enhydra.xml.xmlc.XMLCFactory getXMLCFactory()
getXMLCFactory
in interface Application
public void setXMLCFactory()
setXMLCFactory
in interface Application
public void setJivanFactory(boolean reload)
setJivanFactory
in interface Application
reload
- swich which indicates realoading status of Jivan generated
pages in presentation layer (true = reload is on, false = reload is off)public org.enhydra.util.jivan.JivanFactory getJivanFactory()
getJivanFactory
in interface Application
public java.lang.String toHtml()
|
EAF 7.4 API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |