pl.aislib.fm
Class Application

java.lang.Object
  extended bypl.aislib.fm.Application
All Implemented Interfaces:
Pasture

public class Application
extends java.lang.Object
implements Pasture

Describes an application. Uses following components:

Since:
AISLIB 0.1
Version:
$Revision: 1.14 $
Author:
Tomasz Pik, AIS.PL
Michal Jastak, AIS.PL

Constructor Summary
Application(java.lang.String _applicationName, javax.servlet.http.HttpServlet _servlet)
          Main constructor.
 
Method Summary
 void dispatch(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Process request and response.
 AttributeNameWrapper getAttributeNameWrapper()
           
 ConfigAdapter getConfigAdapter()
           
 Database getDatabase()
           
 java.lang.String getDefaultContentType()
           
 Form getForm(java.lang.String formName)
          Deprecated. As of AISLIB 0.5 replaced by Page.getForm(String) which supports multi language.
 Form getForm(java.lang.String formName, java.lang.String language)
          Gets form.
 org.apache.commons.logging.Log getLog()
           
 org.apache.commons.logging.Log getLog(java.lang.String loggerName)
           
 Message getMessage(int messageCode)
          Deprecated. As of AISLIB 0.5 replaced by Page.getMessage(int) with default language.
 Message getMessage(int messageCode, java.lang.String lang)
          Method getMessage returns the message for given code and language.
 java.util.List getMessageGroup(int groupCode)
           
 java.lang.String getName()
          Returns Pasture name.
 javax.servlet.http.HttpServlet getServlet()
           
 void initForms(org.xml.sax.InputSource formsSource)
          Initialize FormsHandler component.
 void initForms(java.io.InputStream formsStream)
          Initialize FormsHandler component.
 void initMessages(org.xml.sax.InputSource messagesSource)
          Initialize MessagesHandler component.
 void initMessages(java.io.InputStream messagesStream)
          Initialize MessagesHandler component.
 void initWorkflow(org.xml.sax.InputSource workflowSource)
          Initialize Workflow component.
 void initWorkflow(java.io.InputStream workflowStream)
          Initialize Workflow component.
 void setConfigAdapter(ConfigAdapter _configAdapter)
          Set ConfigAdapter for this Application.
 void setDatabase(Database _database)
          Set Database for this Application During setting as a component inside Application, jdbc logger is pushed into given Database.
 void setDefaultContentType(java.lang.String _contentType)
          Sets default ContentType for the application.
 void setPageSelector(PageSelector _pageSelector)
          Set PageSelector for this Application.
 void setTemplateEngine(TemplateEngine _templateEngine)
          Set TemplateEngine for this Application.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Application

public Application(java.lang.String _applicationName,
                   javax.servlet.http.HttpServlet _servlet)
Main constructor.

Parameters:
_applicationName - name of the application.
_servlet - that requests this application handle. Throws NullPointerException if the _applicationName or _servlet is null
Method Detail

initWorkflow

public void initWorkflow(java.io.InputStream workflowStream)
                  throws ApplicationConfigurationException
Initialize Workflow component.

Parameters:
workflowStream - contains XML definition of application workflow
Throws:
ApplicationConfigurationException - if something goes wrong

initWorkflow

public void initWorkflow(org.xml.sax.InputSource workflowSource)
                  throws ApplicationConfigurationException
Initialize Workflow component.

Parameters:
workflowSource - contains XML definition of application workflow
Throws:
ApplicationConfigurationException - if something goes wrong

initMessages

public void initMessages(java.io.InputStream messagesStream)
                  throws ApplicationConfigurationException
Initialize MessagesHandler component.

Parameters:
messagesStream - contains XML definition of application messages
Throws:
ApplicationConfigurationException - if something goes wrong

initMessages

public void initMessages(org.xml.sax.InputSource messagesSource)
                  throws ApplicationConfigurationException
Initialize MessagesHandler component.

Parameters:
messagesSource - contains XML definition of application messages
Throws:
ApplicationConfigurationException - if something goes wrong

initForms

public void initForms(java.io.InputStream formsStream)
               throws ApplicationConfigurationException
Initialize FormsHandler component.

Parameters:
formsStream - contains XML definition of application forms
Throws:
ApplicationConfigurationException - if something goes wrong

initForms

public void initForms(org.xml.sax.InputSource formsSource)
               throws ApplicationConfigurationException
Initialize FormsHandler component.

Parameters:
formsSource - contains XML definition of application forms
Throws:
ApplicationConfigurationException - if something goes wrong

setTemplateEngine

public void setTemplateEngine(TemplateEngine _templateEngine)
Set TemplateEngine for this Application.

Parameters:
_templateEngine - which should be used to load templates.

setDatabase

public void setDatabase(Database _database)
Set Database for this Application During setting as a component inside Application, jdbc logger is pushed into given Database.

Parameters:
_database - for using within given Application. Throws NullPointerException if given argument is null

getDatabase

public Database getDatabase()
Returns:
Database defined for Application.

setConfigAdapter

public void setConfigAdapter(ConfigAdapter _configAdapter)
Set ConfigAdapter for this Application.

Parameters:
_configAdapter - which should be used to access application parameters.

setPageSelector

public void setPageSelector(PageSelector _pageSelector)
Set PageSelector for this Application.

Parameters:
_pageSelector - which slould be used for determinig page of user's request.

setDefaultContentType

public void setDefaultContentType(java.lang.String _contentType)
Sets default ContentType for the application. text/html is hard-coded as default one.

Parameters:
_contentType - default ContentType

getDefaultContentType

public java.lang.String getDefaultContentType()
Returns:
default ContentType for the application.

getConfigAdapter

public ConfigAdapter getConfigAdapter()
Returns:
the configuration adapter for the application.

getAttributeNameWrapper

public AttributeNameWrapper getAttributeNameWrapper()
Returns:
AttributeNameWrapper for the application

getName

public java.lang.String getName()
Description copied from interface: Pasture
Returns Pasture name.

Specified by:
getName in interface Pasture
Returns:
name of the application.

getServlet

public javax.servlet.http.HttpServlet getServlet()
Returns:
servlet that uses the application.

getLog

public org.apache.commons.logging.Log getLog()
Returns:
main logging object for the application.

getLog

public org.apache.commons.logging.Log getLog(java.lang.String loggerName)
Parameters:
loggerName - name of a logging object.
Returns:
a "sublogger" of the application's main logging object.

getMessage

public Message getMessage(int messageCode)
Deprecated. As of AISLIB 0.5 replaced by Page.getMessage(int) with default language.

See Also:
getMessage(int, String).

getMessage

public Message getMessage(int messageCode,
                          java.lang.String lang)
Method getMessage returns the message for given code and language.

Parameters:
messageCode - code of message.
lang - language of message content.
Returns:
Message for given messageCode and lang (if lang is null it returns default content).

getMessageGroup

public java.util.List getMessageGroup(int groupCode)
Parameters:
groupCode - code of message group.
Returns:
List of Message objects defined as group with given code.

getForm

public Form getForm(java.lang.String formName)
Deprecated. As of AISLIB 0.5 replaced by Page.getForm(String) which supports multi language.

Gets form.

Parameters:
formName - name of a form.
Returns:
Form object.

getForm

public Form getForm(java.lang.String formName,
                    java.lang.String language)
Gets form.

Parameters:
formName - name of a form.
language - language for the form.
Returns:
Form object.

dispatch

public void dispatch(javax.servlet.http.HttpServletRequest request,
                     javax.servlet.http.HttpServletResponse response)
              throws java.io.IOException,
                     javax.servlet.ServletException
Process request and response. This method should always be used in servlet object.

Throws:
java.io.IOException
javax.servlet.ServletException
See Also:
Servlet.service(javax.servlet.ServletRequest, javax.servlet.ServletResponse)


Copyright © 2002-2005 AIS.PL. All Rights Reserved.