|
|||||||||
| Home >> All >> com >> opencms >> [ launcher overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
com.opencms.launcher
Class A_CmsLauncher

java.lang.Objectcom.opencms.launcher.A_CmsLauncher
- All Implemented Interfaces:
- com.opencms.core.I_CmsConstants, I_CmsLauncher, com.opencms.boot.I_CmsLogChannels
- Direct Known Subclasses:
- CmsDumpLauncher, CmsJavascriptLauncher, CmsLinkLauncher, CmsXmlLauncher
- abstract class A_CmsLauncher
- extends java.lang.Object
- implements I_CmsLauncher, com.opencms.boot.I_CmsLogChannels, com.opencms.core.I_CmsConstants
- extends java.lang.Object
Abstract OpenCms launcher class.
This class implements basic functionality for all OpenCms launchers. For each relevant file type (e.g. XML control files, plain text files, JavaScript files,...) a customized launcher has to be implemented.
Every extending class has to implement the abstract methods
- getLauncherId() to indicate the type of the launcher
- launch() to be called by initlaunch
The functionality of this class is
- provide a global cache for template class results
- receive the system's launcher call, do some relevant initial things and call the launch() method
- provide some utility methods
- Version:
- $Revision: 1.41 $ $Date: 2003/02/26 10:30:36 $
| Field Summary | |
private static boolean |
C_DEBUG
Boolean for additional debug output control |
private static long |
m_lastFsCounterFile
Value of the filesystem counter, when the last XML file clear cache was done. |
private static long |
m_lastFsCounterTemplate
Value of the filesystem counter, when the last template clear cache was done. |
protected static I_CmsTemplateCache |
m_templateCache
The template cache that holds all cached templates |
| Fields inherited from interface com.opencms.launcher.I_CmsLauncher |
C_TYPE_DUMP, C_TYPE_JAVASCRIPT, C_TYPE_JSP, C_TYPE_LINK, C_TYPE_PDF, C_TYPE_VELOCITY, C_TYPE_XML |
| Fields inherited from interface com.opencms.boot.I_CmsLogChannels |
C_FLEX_CACHE, C_FLEX_LOADER, C_LOGGING, C_MODULE_CRITICAL, C_MODULE_DEBUG, C_MODULE_INFO, C_OPENCMS_CACHE, C_OPENCMS_CRITICAL, C_OPENCMS_CRONSCHEDULER, C_OPENCMS_DEBUG, C_OPENCMS_ELEMENTCACHE, C_OPENCMS_INFO, C_OPENCMS_INIT, C_OPENCMS_POOL, C_OPENCMS_STATICEXPORT, C_OPENCMS_STREAMING, C_PREPROCESSOR_IS_LOGGING |
| Constructor Summary | |
(package private) |
A_CmsLauncher()
|
| Method Summary | |
protected byte[] |
callCanonicalRoot(com.opencms.file.CmsObject cms,
com.opencms.template.I_CmsTemplate templateClass,
com.opencms.file.CmsFile masterTemplate,
java.util.Hashtable parameters)
Utility method used by the launcher implementation to give control to the CanonicalRoot. |
void |
clearCache()
Method for clearing this launchers template cache. |
static void |
clearLauncherCache(com.opencms.file.CmsObject cms)
Clear the XML template cache that is maintained in the launcher. |
private static void |
clearLauncherCache(com.opencms.file.CmsObject cms,
boolean clearFiles,
boolean clearTemplates)
Compatibility method to ensure the legacy cache command line parameters are still supported. |
protected java.lang.String |
getClassName()
Gets the name of the class in the form "[ClassName] " This can be used for error logging purposes. |
abstract int |
getLauncherId()
Gets the ID that indicates the type of the launcher. |
static I_CmsTemplateCache |
getTemplateCache()
Gets a reference to the global template cache |
protected com.opencms.template.I_CmsTemplate |
getTemplateClass(com.opencms.file.CmsObject cms,
java.lang.String classname)
Calls the CmsClassManager to get an instance of the given template class. |
void |
handleException(com.opencms.file.CmsObject cms,
java.lang.Exception e,
java.lang.String errorText)
Utility method to handle any occurence of an execption. |
void |
initlaunch(com.opencms.file.CmsObject cms,
com.opencms.file.CmsFile file,
java.lang.String startTemplateClass,
com.opencms.core.A_OpenCms openCms)
Start method called by the OpenCms system to show a resource. |
protected abstract void |
launch(com.opencms.file.CmsObject cms,
com.opencms.file.CmsFile file,
java.lang.String startTemplateClass,
com.opencms.core.A_OpenCms openCms)
Unitary method to start generating the output. |
void |
setOpenCms(com.opencms.core.A_OpenCms openCms)
Sets the currently running OpenCms instance. |
protected void |
writeBytesToResponse(com.opencms.file.CmsObject cms,
byte[] result)
Writes a given byte array to the HttpServletRespose output stream. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
C_DEBUG
private static final boolean C_DEBUG
- Boolean for additional debug output control
- See Also:
- Constant Field Values
m_lastFsCounterTemplate
private static long m_lastFsCounterTemplate
- Value of the filesystem counter, when the last template clear cache was done.
m_lastFsCounterFile
private static long m_lastFsCounterFile
- Value of the filesystem counter, when the last XML file clear cache was done.
m_templateCache
protected static I_CmsTemplateCache m_templateCache
- The template cache that holds all cached templates
| Constructor Detail |
A_CmsLauncher
A_CmsLauncher()
| Method Detail |
callCanonicalRoot
protected byte[] callCanonicalRoot(com.opencms.file.CmsObject cms, com.opencms.template.I_CmsTemplate templateClass, com.opencms.file.CmsFile masterTemplate, java.util.Hashtable parameters) throws com.opencms.core.CmsException
- Utility method used by the launcher implementation to give control
to the CanonicalRoot.
The CanonicalRoot will call the master template and return a byte array of the
generated output.
clearCache
public void clearCache()
- Method for clearing this launchers template cache.
- Specified by:
clearCachein interfaceI_CmsLauncher
getClassName
protected java.lang.String getClassName()
- Gets the name of the class in the form "[ClassName] "
This can be used for error logging purposes.
getLauncherId
public abstract int getLauncherId()
- Gets the ID that indicates the type of the launcher.
- Specified by:
getLauncherIdin interfaceI_CmsLauncher
getTemplateCache
public static I_CmsTemplateCache getTemplateCache()
- Gets a reference to the global template cache
getTemplateClass
protected com.opencms.template.I_CmsTemplate getTemplateClass(com.opencms.file.CmsObject cms, java.lang.String classname) throws com.opencms.core.CmsException
- Calls the CmsClassManager to get an instance of the given template class.
The returned object is checked to be an implementing class of the interface
I_CmsTemplate.
If the template cache of the template class is not yet setted, this will
be done, too.
handleException
public void handleException(com.opencms.file.CmsObject cms, java.lang.Exception e, java.lang.String errorText) throws com.opencms.core.CmsException
- Utility method to handle any occurence of an execption.
If the Exception is NO CmsException (i.e. it was not detected previously) it will be written to the logfile.
If the current user is the anonymous user, no further execption will be thrown, but a server error will be sent (we want to prevent the user from seeing any exeptions). Otherwise a new Exception will be thrown.
initlaunch
public void initlaunch(com.opencms.file.CmsObject cms, com.opencms.file.CmsFile file, java.lang.String startTemplateClass, com.opencms.core.A_OpenCms openCms) throws com.opencms.core.CmsException
- Start method called by the OpenCms system to show a resource.
In this method initial values valid for all launchers can be set and the _clearcache parameter is checked. After this the abstract method launch(...) is called to invoke the customized part of the launcher.
- Specified by:
initlaunchin interfaceI_CmsLauncher
clearLauncherCache
private static void clearLauncherCache(com.opencms.file.CmsObject cms, boolean clearFiles, boolean clearTemplates)
- Compatibility method to ensure the legacy cache command line parameters
are still supported.
clearLauncherCache
public static void clearLauncherCache(com.opencms.file.CmsObject cms)
- Clear the XML template cache that is maintained in the launcher.
To use this method, call it on one of the classes that extend
A_CmsLauncher (e.g. com.opencms.launcher.CmsXmlLauncher.clearLauncherCache()).
launch
protected abstract void launch(com.opencms.file.CmsObject cms, com.opencms.file.CmsFile file, java.lang.String startTemplateClass, com.opencms.core.A_OpenCms openCms) throws com.opencms.core.CmsException
- Unitary method to start generating the output.
Every launcher has to implement this method.
In it possibly the selected file will be analyzed, and the
Canonical Root will be called with the appropriate
template class, template file and parameters. At least the
canonical root's output must be written to the HttpServletResponse.
writeBytesToResponse
protected void writeBytesToResponse(com.opencms.file.CmsObject cms, byte[] result) throws com.opencms.core.CmsException
- Writes a given byte array to the HttpServletRespose output stream.
setOpenCms
public void setOpenCms(com.opencms.core.A_OpenCms openCms)
- Sets the currently running OpenCms instance.
- Specified by:
setOpenCmsin interfaceI_CmsLauncher
|
|||||||||
| Home >> All >> com >> opencms >> [ launcher overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
com.opencms.launcher.A_CmsLauncher