LEONARDI Application Composer - 8.9.0.40 by W4 S.A.

leon.view.web.struts.action
Class LyStrutsLeonardiPlugin

java.lang.Object
  extended by leon.view.web.struts.action.LyStrutsLeonardiPlugin
All Implemented Interfaces:
org.apache.struts.action.PlugIn

public class LyStrutsLeonardiPlugin
extends java.lang.Object
implements org.apache.struts.action.PlugIn

Type : leon.view.web.struts.LyStrutsLeonardiPlugin
This class implements the org.apache.struts.action.PlugIn interface of the Struts framework.
This class manages the link between the Leonardi applications, Leonardi sessions and the WEB Container.
Once created, this plugin is stored inside the current ServletContext with the key LEONARDI_PLUGIN so that it may be retreived by any Leonardi Struts Action.
To configure this plugin, add a plugin declaration inside the struts-config.xml file:
<plug-in className="leon.view.web.struts.LyStrutsLeonardiPlugin">
    <set-property property="initName" value="$identfier of your Leonardi application$"/>
    <set-property property="initFile" value="$intitialisation file name of your Leonardi application$"/>
</plug-in>

This class is also a LyApplication and LySession factory : see the createLySession and createLyApplication methods.


Field Summary
static java.lang.String __VERSION
           
static java.lang.String LEONARDI_PLUGIN
          The key to store the Leonardi plugin inside the context.
 java.lang.String LOCK_HTTP_SESSION
          A lock for the HTTP SESSION.
 
Constructor Summary
LyStrutsLeonardiPlugin()
          Default constructor without parameters.
 
Method Summary
 java.lang.String clearContextPath(javax.servlet.http.HttpServletRequest request, java.lang.String page)
          Removes the context path from URLS to enable forwarding into a JSP.
static LyApplication createApplication(javax.servlet.ServletContext context)
          Factory method for creating a new LyApplication.
static LySession createSession(javax.servlet.ServletContext context)
          Factory method for creating a new LySession.
static LySession createSession(javax.servlet.ServletContext context, java.lang.String sessionCode)
          Factory method for creating a new LySession.
 void destroy()
          Implementation of the PlugIn interface, calls for the destruction of all Leonardi application with the current id.
 java.lang.String getInitFile()
          Gets the ".ini" file name.
 java.lang.String getInitName()
          Gets the name of the Leonardi application.
static LyStrutsLeonardiPlugin getPlugin(javax.servlet.ServletContext context)
          Method that search for the Leonardi plugin inside the given context.
 javax.servlet.ServletContext getServletContext()
          Method overriden to return the context of the Struts servlet.
 void init(org.apache.struts.action.ActionServlet servlet, org.apache.struts.config.ModuleConfig config)
          Implementation of the PlugIn interface, intialise the default Leonardi servlet for request processing.
 boolean isLoadingData()
          Indicates whether application is being loaded.
 java.lang.String isPreloadApplication()
          Gets the value of the isPreloadApplication parameter.
 void setInitFile(java.lang.String file)
          Sets the ".ini" file name.
 void setInitName(java.lang.String name)
          Sets the name of the Leonardi application.
 void setIsPreloadApplication(java.lang.String isPreloadApplication)
          Sets the name value of the isPreloadApplication parameter.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

__VERSION

public static final java.lang.String __VERSION
See Also:
Constant Field Values

LEONARDI_PLUGIN

public static final java.lang.String LEONARDI_PLUGIN
The key to store the Leonardi plugin inside the context.

See Also:
Constant Field Values

LOCK_HTTP_SESSION

public final java.lang.String LOCK_HTTP_SESSION
A lock for the HTTP SESSION.

See Also:
Constant Field Values
Constructor Detail

LyStrutsLeonardiPlugin

public LyStrutsLeonardiPlugin()
Default constructor without parameters.
This constructor should be kept for JAVA reflection.

Method Detail

getPlugin

public static LyStrutsLeonardiPlugin getPlugin(javax.servlet.ServletContext context)
                                        throws java.lang.IllegalStateException
Method that search for the Leonardi plugin inside the given context.

Parameters:
context - A servlet context, i.e. the object that wraps the WEB application configuration.
Returns:
The current Leonardi Struts plugin.
Throws:
java.lang.IllegalStateException - An illegal state exception if the plugin is not found.

createApplication

public static LyApplication createApplication(javax.servlet.ServletContext context)
Factory method for creating a new LyApplication.
Retrieves the current plugin instance in the servlet context and create an application with the initName and initFile parameters.

Parameters:
context - A servlet context, i.e. the object that wraps the WEB application configuration.
Returns:
a new LyApplication.

createSession

public static LySession createSession(javax.servlet.ServletContext context)
Factory method for creating a new LySession.
Retrieves the current plugin instance in the servlet context and create a session with the current application.

Parameters:
context - A servlet context, i.e. the object that wraps the WEB application configuration.
Returns:
a new LySession.

createSession

public static LySession createSession(javax.servlet.ServletContext context,
                                      java.lang.String sessionCode)
Factory method for creating a new LySession.
Retrieves the current plugin instance in the servlet context and create a session with the current application.

Parameters:
context - A servlet context, i.e. the object that wraps the WEB application configuration.
sessionCode - hashcode of the session that must be retrieved
Returns:
a new LySession.

init

public void init(org.apache.struts.action.ActionServlet servlet,
                 org.apache.struts.config.ModuleConfig config)
          throws javax.servlet.ServletException
Implementation of the PlugIn interface, intialise the default Leonardi servlet for request processing.

Specified by:
init in interface org.apache.struts.action.PlugIn
Parameters:
servlet - The current Struts Servlet.
config - The Configuration of the Struts module realted to this plugin.
Throws:
javax.servlet.ServletException

destroy

public void destroy()
Implementation of the PlugIn interface, calls for the destruction of all Leonardi application with the current id.

Specified by:
destroy in interface org.apache.struts.action.PlugIn

isLoadingData

public boolean isLoadingData()
Indicates whether application is being loaded.


clearContextPath

public java.lang.String clearContextPath(javax.servlet.http.HttpServletRequest request,
                                         java.lang.String page)
Removes the context path from URLS to enable forwarding into a JSP.

Parameters:
request - request which should contains the attrributes
page - with possibly a context path
Returns:
the page for the forward

getInitFile

public java.lang.String getInitFile()
Gets the ".ini" file name.

Returns:
the name of the ".ini" file
See Also:
setInitFile(String)

setInitFile

public void setInitFile(java.lang.String file)
Sets the ".ini" file name.

Parameters:
file - the new name of the ".ini" file.
See Also:
getInitFile()

getInitName

public java.lang.String getInitName()
Gets the name of the Leonardi application.

Returns:
Leonardi application's name.
See Also:
setInitName(String)

setInitName

public void setInitName(java.lang.String name)
Sets the name of the Leonardi application.

Parameters:
name - the new Leonardi application's name.
See Also:
getInitName()

isPreloadApplication

public java.lang.String isPreloadApplication()
Gets the value of the isPreloadApplication parameter.

Returns:
the value of the isPreloadApplication parameter.
See Also:
setIsPreloadApplication(String)

setIsPreloadApplication

public void setIsPreloadApplication(java.lang.String isPreloadApplication)
Sets the name value of the isPreloadApplication parameter.

Parameters:
isPreloadApplication - the new isPreloadApplication parameter's value.
See Also:
isPreloadApplication()

getServletContext

public javax.servlet.ServletContext getServletContext()
Method overriden to return the context of the Struts servlet.

Returns:
the servlet context.

(c) January 2013 - W4 S.A.

Website: W4 S.A., contact us: support@w4global.com