com.opencms.template
Class CmsXmlTemplate

java.lang.Object
  |
  +--com.opencms.template.A_CmsTemplate
        |
        +--com.opencms.template.CmsXmlTemplate
All Implemented Interfaces:
I_CmsConstants, I_CmsLogChannels, I_CmsTemplate, I_CmsXmlTemplate
Direct Known Subclasses:
A_CmsNavBase, CmsLinkCheck, CmsLoginNew, CmsShowBackofficeMedia, CmsShowContent, CmsShowMedia, CmsWorkplaceDefault, CmsXmlFormTemplate

public class CmsXmlTemplate
extends A_CmsTemplate
implements I_CmsXmlTemplate

Template class for displaying the processed contents of hierachical XML template files that can include other subtemplates.

Version:
$Revision: 1.110 $ $Date: 2003/03/02 18:43:55 $
Author:
Alexander Lucas

Field Summary
static String C_BODY_ELEMENT
          name of the special body element
static boolean C_DEBUG
          Boolean for additional debug output control
static String C_FRAME_SELECTOR
           
protected static I_CmsTemplateCache m_cache
          Template cache for storing cacheable results of the subtemplates.
 
Fields inherited from interface com.opencms.core.I_CmsConstants
C_ACCESS_DEFAULT_FLAGS, C_ACCESS_GROUP, C_ACCESS_GROUP_READ, C_ACCESS_GROUP_VISIBLE, C_ACCESS_GROUP_WRITE, C_ACCESS_INTERNAL_READ, C_ACCESS_OWNER, C_ACCESS_OWNER_READ, C_ACCESS_OWNER_VISIBLE, C_ACCESS_OWNER_WRITE, C_ACCESS_PUBLIC, C_ACCESS_PUBLIC_READ, C_ACCESS_PUBLIC_VISIBLE, C_ACCESS_PUBLIC_WRITE, C_ACCESS_READ, C_ACCESS_VISIBLE, C_ACCESS_WRITE, C_ADDITIONAL_INFO_EXPLORERSETTINGS, C_ADDITIONAL_INFO_PREFERENCES, C_ADDITIONAL_INFO_STARTSETTINGS, C_ADDITIONAL_INFO_TASKSETTINGS, C_ADDITIONAL_INFO_TOWN, C_ADDITIONAL_INFO_ZIPCODE, C_AT_LEAST_ONCE, C_CLUSTERURL, C_CONFIGURATION_CACHE, C_CONFIGURATION_CLASS, C_CONFIGURATION_REGISTRY, C_CONFIGURATION_RESOURCEBROKER, C_COPYRIGHT, C_DEFAULT_SITE, C_DELETE_HISTORY, C_ENABLE_HISTORY, C_ERRPREFIX, C_ERRSPERATOR, C_EXPORT_TAG_ACCESS, C_EXPORT_TAG_ADDRESS, C_EXPORT_TAG_CREATOR, C_EXPORT_TAG_DATE, C_EXPORT_TAG_DEFAULTGROUP, C_EXPORT_TAG_DESCRIPTION, C_EXPORT_TAG_DESTINATION, C_EXPORT_TAG_EMAIL, C_EXPORT_TAG_EXPORT, C_EXPORT_TAG_FILE, C_EXPORT_TAG_FIRSTNAME, C_EXPORT_TAG_FLAGS, C_EXPORT_TAG_GROUP, C_EXPORT_TAG_GROUPDATA, C_EXPORT_TAG_GROUPNAME, C_EXPORT_TAG_INFO, C_EXPORT_TAG_LASTMODIFIED, C_EXPORT_TAG_LASTNAME, C_EXPORT_TAG_LAUNCHER_START_CLASS, C_EXPORT_TAG_MODULEXPORT, C_EXPORT_TAG_NAME, C_EXPORT_TAG_OC_VERSION, C_EXPORT_TAG_PARENTGROUP, C_EXPORT_TAG_PASSWORD, C_EXPORT_TAG_PROJECT, C_EXPORT_TAG_PROPERTIES, C_EXPORT_TAG_PROPERTY, C_EXPORT_TAG_RECOVERYPASSWORD, C_EXPORT_TAG_SECTION, C_EXPORT_TAG_SOURCE, C_EXPORT_TAG_TYPE, C_EXPORT_TAG_USER, C_EXPORT_TAG_USERDATA, C_EXPORT_TAG_USERGROUPDATA, C_EXPORT_TAG_USERGROUPS, C_EXPORT_TAG_USERINFO, C_EXPORT_TAG_VALUE, C_EXPORT_TAG_VERSION, C_EXPORT_VERSION, C_EXPORT_XMLFILENAME, C_EXPORTONLYFILES, C_EXPORTONLYUSERS, C_EXPORTPOINT, C_EXPORTPOINT_PATH, C_EXPORTUSERSFILES, C_FCONTENT, C_FELEMENT, C_FILE, C_FILECONTENT, C_FILES_IMPORTED, C_FLAG_DISABLED, C_FLAG_ENABLED, C_FLAG_GROUP_PROJECTCOWORKER, C_FLAG_GROUP_PROJECTMANAGER, C_FLAG_GROUP_ROLE, C_FOLDER, C_FOLDER_SEPARATOR, C_GROUP, C_GROUP_ADMIN, C_GROUP_GUEST, C_GROUP_PROJECTLEADER, C_GROUP_USERS, C_LINKCHECKTABLE_DATE, C_MAX_LENGTH_RESOURCE_NAME, C_MODULE_PROPERTY_ADDITIONAL_RESOURCES, C_MODULE_PROPERTY_ADDITIONAL_RESOURCES_SEPARATOR, C_MODUS_AUTO, C_MODUS_EXPORT, C_MODUS_EXTERN, C_MODUS_OFFLINE, C_MODUS_ONLINE, C_MOUNTPOINT_FILESYSTEM, C_MOUNTPOINT_MYSQL, C_NEVER, C_NO_FILES_IMPORTED, C_ORDER_AGENTUSER, C_ORDER_ENDTIME, C_ORDER_ID, C_ORDER_INITIATORUSER, C_ORDER_NAME, C_ORDER_ORIGINALUSER, C_ORDER_PERCENTAGE, C_ORDER_PRIORITY, C_ORDER_ROLE, C_ORDER_STARTTIME, C_ORDER_STATE, C_ORDER_TASKTYPE, C_ORDER_TIMEOUT, C_ORDER_WAKEUPTIME, C_PASSWORD_MINIMUMSIZE, C_PROJECT_ONLINE, C_PROJECT_ONLINE_ID, C_PROJECT_STATE_ARCHIVE, C_PROJECT_STATE_INVISIBLE, C_PROJECT_STATE_LOCKED, C_PROJECT_STATE_UNLOCKED, C_PROJECT_TYPE_INVISIBLE, C_PROJECT_TYPE_NORMAL, C_PROJECT_TYPE_TEMPORARY, C_PROPERTY_ACTIV, C_PROPERTY_CHANNELID, C_PROPERTY_CONTENT_ENCODING, C_PROPERTY_DEFAULT_FILE, C_PROPERTY_DESCRIPTION, C_PROPERTY_EXPORT, C_PROPERTY_EXPORTNAME, C_PROPERTY_KEYWORDS, C_PROPERTY_NAVPOS, C_PROPERTY_NAVTEXT, C_PROPERTY_RELATIVEROOT, C_PROPERTY_TEMPLATETYPE, C_PROPERTY_TITLE, C_PROPERTY_VISIBLE, C_PUBLISH_METHOD_LINK, C_REGISTRY_DESTINATION, C_REGISTRY_HISTORY, C_REGISTRY_KNOWNLAUNCHERS, C_REGISTRY_LAUNCHER, C_REGISTRY_SOURCE, C_REQUEST_CONSOLE, C_REQUEST_HTTP, C_RESPONSE_CONSOLE, C_RESPONSE_HTTP, C_ROOT, C_ROOT_TEMPLATE_NAME, C_ROOTNAME_COS, C_ROOTNAME_VFS, C_SESSION_ADMIN_POS, C_SESSION_BROADCASTMESSAGE, C_SESSION_CONTENT_ENCODING, C_SESSION_CURRENTGROUP, C_SESSION_DATA, C_SESSION_IS_DIRTY, C_SESSION_MESSAGEPENDING, C_SESSION_MODULE_VECTOR, C_SESSION_PROJECT, C_SESSION_THREAD_ERROR, C_SESSION_USERNAME, C_SORT_ASC, C_SORT_DESC, C_START_ACCESSFLAGS, C_START_DEFAULTGROUP, C_START_LANGUAGE, C_START_LOCKDIALOG, C_START_PROJECT, C_START_VIEW, C_STATE_CHANGED, C_STATE_DELETED, C_STATE_NEW, C_STATE_UNCHANGED, C_STATICEXPORT_PATH, C_STATICEXPORT_START, C_SYNCHRONISATION_PATH, C_SYNCHRONISATION_PROJECT, C_SYNCHRONISATION_RESOURCE, C_SYNCHRONISATION_RESOURCETAG, C_SYSTEMPROPERTY_CRONTABLE, C_SYSTEMPROPERTY_EXPORTPATH, C_SYSTEMPROPERTY_EXTENSIONS, C_SYSTEMPROPERTY_LINKCHECKTABLE, C_SYSTEMPROPERTY_MIMETYPES, C_SYSTEMPROPERTY_MOUNTPOINT, C_SYSTEMPROPERTY_RESOURCE_TYPE, C_TABLE_CHANNELID, C_TASK_FILTER, C_TASK_MESSAGES, C_TASK_MESSAGES_ACCEPTED, C_TASK_MESSAGES_COMPLETED, C_TASK_MESSAGES_FORWARDED, C_TASK_MESSAGES_MEMBERS, C_TASK_ORDER_BY_DATE, C_TASK_ORDER_BY_NAME, C_TASK_PRIORITY_HIGH, C_TASK_PRIORITY_LOW, C_TASK_PRIORITY_NORMAL, C_TASK_STATE_ENDED, C_TASK_STATE_HALTED, C_TASK_STATE_NOTENDED, C_TASK_STATE_PREPARE, C_TASK_STATE_START, C_TASK_STATE_STARTED, C_TASK_VIEW_ALL, C_TASKLOG_SYSTEM, C_TASKLOG_USER, C_TASKORDER_NONE, C_TASKORDER_STARTDATE, C_TASKORDER_TIMEOUT, C_TASKS_ACTIVE, C_TASKS_ALL, C_TASKS_DONE, C_TASKS_NEW, C_TASKS_OPEN, C_TASKSORDER_TASKNAME, C_TEMP_PREFIX, C_TFACCESS, C_TFGROUP, C_TFILEOBJ, C_TFILES, C_TFNAME, C_TFPROPERTYINFO, C_TFPROPERTYNAME, C_TFPROPERTYTYPE, C_TFPROPERTYVALUE, C_TFTYPE, C_TFTYPENAME, C_TFUSER, C_TGDESC, C_TGFLAG, C_TGNAME, C_TGPARENTGROUP, C_TGROUPOBJ, C_TGROUPS, C_TGROUPUSERS, C_TGUSER, C_TUADDINFO, C_TUDESC, C_TUDGROUP, C_TUDISABLED, C_TUEMAIL, C_TUFIRSTNAME, C_TUFLAG, C_TUGROUP, C_TUINFOKEY, C_TUINFOVALUE, C_TULOGIN, C_TUNAME, C_TUPASSWD, C_TUSERGROUPS, C_TUSEROBJ, C_TUSERS, C_TYPE_BODY_NAME, C_TYPE_COMPATIBLEPLAIN_NAME, C_TYPE_FOLDER, C_TYPE_FOLDER_NAME, C_TYPE_IMAGE_NAME, C_TYPE_LAST_INDEX, C_TYPE_PAGE_NAME, C_TYPE_PLAIN_NAME, C_UNKNOWN_ID, C_UNKNOWN_INT, C_UNKNOWN_LAUNCHER, C_UNKNOWN_LAUNCHER_ID, C_UNKNOWN_LONG, C_URL_PREFIX_EXPORT, C_URL_PREFIX_HTTP, C_URL_PREFIX_HTTPS, C_URL_PREFIX_SERVERNAME, C_USER, C_USER_ADMIN, C_USER_GUEST, C_USER_TYPE_SYSTEMANDWEBUSER, C_USER_TYPE_SYSTEMUSER, C_USER_TYPE_WEBUSER, C_WEB_APP_REPLACE_KEY, C_WEEKS_HISTORY, C_WHATEVER, C_XML_BODY_ELEMENT
 
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
CmsXmlTemplate()
           
 
Method Summary
 CmsCacheDirectives collectCacheDirectives(CmsObject cms, String templateFile, String elementName, Hashtable parameters, String templateSelector)
          Collect caching informations from the current template class.
 Integer counter(CmsObject cms, String tagcontent, A_CmsXmlContent doc, Object userObject)
          For debugging purposes only.
 A_CmsElement createElement(CmsObject cms, String templateFile, Hashtable parameters)
          Create a new element for the element cache consisting of the current template class and the given template file.
 CmsCacheDirectives getCacheDirectives(CmsObject cms, String templateFile, String elementName, Hashtable parameters, String templateSelector)
          gets the caching information from the current template class.
protected  String getClassName()
          Help method to print nice classnames in error messages
 byte[] getContent(CmsObject cms, String templateFile, String elementName, Hashtable parameters)
          Gets the content of a given template file and its subtemplates with the given parameters.
 byte[] getContent(CmsObject cms, String templateFile, String elementName, Hashtable parameters, String templateSelector)
          Gets the content of a defined section in a given template file and its subtemplates with the given parameters.
 Object getDescription(CmsObject cms, String tagcontent, A_CmsXmlContent doc, Object userObject)
          Inserts the correct document description into the template.
 Object getEncoding(CmsObject cms, String tagcontent, A_CmsXmlContent doc, Object userObject)
           
 Object getFileUri(CmsObject cms, String tagcontent, A_CmsXmlContent doc, Object userObject)
           
 Object getFrameQueryString(CmsObject cms, String tagcontent, A_CmsXmlContent doc, Object userObject)
          Gets the QueryString for CmsFrameTemplates.
 Object getFrameTarget(CmsObject cms, String tagcontent, A_CmsXmlContent doc, Object userObject)
          Gets the target for a link.
 Object getKey(CmsObject cms, String templateFile, Hashtable parameters, String templateSelector)
          Gets the key that should be used to cache the results of this template class.
 Object getKeywords(CmsObject cms, String tagcontent, A_CmsXmlContent doc, Object userObject)
          Inserts the correct document keyword into the template.
 CmsMethodCacheDirectives getMethodCacheDirectives(CmsObject cms, String methodName)
          gets the caching information for a specific methode.
 CmsXmlTemplateFile getOwnTemplateFile(CmsObject cms, String templateFile, String elementName, Hashtable parameters, String templateSelector)
          Reads in the template file and starts the XML parser for the expected content type.
 Object getPathUri(CmsObject cms, String tagcontent, A_CmsXmlContent doc, Object userObject)
           
 Object getProperty(CmsObject cms, String tagcontent, A_CmsXmlContent doc, Object userObject)
          Inserts the value of the given property in the template.
 Object getQueryString(CmsObject cms, String tagcontent, A_CmsXmlContent doc, Object userObject)
          Inserts the correct servlet path title into the template.
 String getRequestIp(CmsObject cms, String tagcontent, A_CmsXmlContent doc, Object userObject)
          Get the IP address of the current request.
 Object getServletPath(CmsObject cms, String tagcontent, A_CmsXmlContent doc, Object userObject)
          Deprecated. instead of this method you should use the link tag.
 String getSessionId(CmsObject cms, String tagcontent, A_CmsXmlContent doc, Object userObject)
          Get the session id.
 String getStylesheet(CmsObject cms, String tagcontent, A_CmsXmlContent doc, Object userObject)
          Inserts the correct stylesheet into the layout template.
protected  String getTemplateClassName(String elementName, CmsXmlTemplateFile doc, Hashtable parameters)
          Find the corresponding template class to be loaded.
protected  String getTemplateFileName(String elementName, CmsXmlTemplateFile doc, Hashtable parameters)
          Find the corresponding template file to be loaded by the template class.
protected  String getTemplateSelector(String elementName, CmsXmlTemplateFile doc, Hashtable parameters)
          Find the corresponding template selector to be activated.
 Object getTitle(CmsObject cms, String tagcontent, A_CmsXmlContent doc, Object userObject)
          Inserts the document title into the template.
 Object getTitleEscaped(CmsObject cms, String tagcontent, A_CmsXmlContent doc, Object userObject)
          Inserts the document title into the template, escaping special and non - ASCII characters with their HTML number representation (e.g.
 Object getUri(CmsObject cms, String tagcontent, A_CmsXmlContent doc, Object userObject)
           
 Object getUriWithParameter(CmsObject cms, String tagcontent, A_CmsXmlContent doc, Object userObject)
           
 boolean isStreamable(CmsObject cms, String templateFile, String elementName, Hashtable parameters, String templateSelector)
          Indicates if the current template class is able to stream it's results directly to the response oputput stream.
 boolean isTemplateCacheSet()
          Tests, if the template cache is setted.
 Object mergeAbsolutePath(CmsObject cms, String tagcontent, A_CmsXmlContent doc, Object userObject)
          Returns the absolute path of a resource merged with the absolute path of the file and the relative path in the tagcontent.
 Object mergeAbsoluteUrl(CmsObject cms, String tagcontent, A_CmsXmlContent doc, Object userObject)
          Returns the absolute path of a resource merged with the absolute path of the file and the relative path in the tagcontent.
 String parameters(CmsObject cms, String tagcontent, A_CmsXmlContent doc, Object userObject)
          For debugging purposes only.
protected  void registerVariantDeps(CmsObject cms, String templateName, String elementName, String templateSelector, Hashtable parameters, Vector vfsDeps, Vector cosDeps, Vector cosClassDeps)
          Saves the dependencies for this elementvariante.
 Object setEncoding(CmsObject cms, String tagcontent, A_CmsXmlContent doc, Object userObject)
           
 void setTemplateCache(I_CmsTemplateCache c)
          Set the instance of template cache that should be used to store cacheable results of the subtemplates.
 boolean shouldReload(CmsObject cms, String templateFile, String elementName, Hashtable parameters, String templateSelector)
          Indicates if a previous cached result should be reloaded.
protected  byte[] startProcessing(CmsObject cms, CmsXmlTemplateFile xmlTemplateDocument, String elementName, Hashtable parameters, String templateSelector)
          Starts the processing of the given template file by calling the getProcessedTemplateContent() method of the content defintition of the corresponding content type.
 Object templateElement(CmsObject cms, String tagcontent, A_CmsXmlContent doc, Object userObject)
          Handles any occurence of an <ELEMENT> tag.
protected  void throwException(String errorMessage)
          Help method that handles any occuring error by writing an error message to the OpenCms logfile and throwing a CmsException of the type "unknown".
protected  void throwException(String errorMessage, Exception e)
          Help method that handles any occuring error by writing an error message to the OpenCms logfile and re-throwing a caught exception.
protected  void throwException(String errorMessage, int type)
          Help method that handles any occuring error by writing an error message to the OpenCms logfile and throwing a CmsException of the given type.
 
Methods inherited from class com.opencms.template.A_CmsTemplate
debugPrint, isCacheable, isExportable, isProxyPrivateCacheable, isProxyPublicCacheable
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.opencms.template.I_CmsTemplate
isCacheable, isExportable, isProxyPrivateCacheable, isProxyPublicCacheable
 

Field Detail

C_FRAME_SELECTOR

public static final String C_FRAME_SELECTOR
See Also:
Constant Field Values

C_BODY_ELEMENT

public static final String C_BODY_ELEMENT
name of the special body element

See Also:
Constant Field Values

C_DEBUG

public static final boolean C_DEBUG
Boolean for additional debug output control

See Also:
Constant Field Values

m_cache

protected static I_CmsTemplateCache m_cache
Template cache for storing cacheable results of the subtemplates.

Constructor Detail

CmsXmlTemplate

public CmsXmlTemplate()
Method Detail

counter

public Integer counter(CmsObject cms,
                       String tagcontent,
                       A_CmsXmlContent doc,
                       Object userObject)
                throws CmsException
For debugging purposes only. Increments the class variable counter and prints out its new value..

May be called from the template file using <METHOD name="counter">.

Parameters:
cms - CmsObject Object for accessing system resources.
tagcontent - Unused in this special case of a user method. Can be ignored.
doc - Reference to the A_CmsXmlContent object the initiating XLM document.
Returns:
Actual value of counter.
CmsException

getClassName

protected String getClassName()
Help method to print nice classnames in error messages

Overrides:
getClassName in class A_CmsTemplate
Returns:
class name in [ClassName] format

getContent

public byte[] getContent(CmsObject cms,
                         String templateFile,
                         String elementName,
                         Hashtable parameters)
                  throws CmsException
Gets the content of a given template file and its subtemplates with the given parameters. The default section in the template file will be used.

Parameters are stored in a hashtable and can derive from

Paramter names must be in "elementName.parameterName" format.

Specified by:
getContent in interface I_CmsTemplate
Parameters:
cms - CmsObject Object for accessing system resources
templateFile - Filename of the template file
elementName - Element name of this template in our parent template
parameters - Hashtable with all template class parameters.
Returns:
Content of the template and all subtemplates.
Throws:
CmsException

getContent

public byte[] getContent(CmsObject cms,
                         String templateFile,
                         String elementName,
                         Hashtable parameters,
                         String templateSelector)
                  throws CmsException
Gets the content of a defined section in a given template file and its subtemplates with the given parameters.

Specified by:
getContent in interface I_CmsTemplate
Parameters:
cms - CmsObject Object for accessing system resources.
templateFile - Filename of the template file.
elementName - Element name of this template in our parent template.
parameters - Hashtable with all template class parameters.
templateSelector - template section that should be processed.
Returns:
Content of the template and all subtemplates.
Throws:
CmsException
See Also:
getContent(CmsObject, String, String, Hashtable, String)

getFileUri

public Object getFileUri(CmsObject cms,
                         String tagcontent,
                         A_CmsXmlContent doc,
                         Object userObject)
                  throws CmsException
Parameters:
cms - CmsObject Object for accessing system resources.
tagcontent - Unused in this special case of a user method. Can be ignored.
doc - Reference to the A_CmsXmlContent object of the initiating XLM document.
Returns:
String or byte[] with the content of this subelement.
Throws:
CmsException

mergeAbsolutePath

public Object mergeAbsolutePath(CmsObject cms,
                                String tagcontent,
                                A_CmsXmlContent doc,
                                Object userObject)
                         throws CmsException
Returns the absolute path of a resource merged with the absolute path of the file and the relative path in the tagcontent. This path is a intern OpenCms path (i.e. it starts with a "/" ).

Parameters:
cms - CmsObject Object for accessing system resources.
tagcontent - The relative path of the resource incl. name of the resource.
doc - Reference to the A_CmsXmlContent object of the initiating XLM document.
Returns:
String or byte[] with the content of this subelement.
Throws:
CmsException

mergeAbsoluteUrl

public Object mergeAbsoluteUrl(CmsObject cms,
                               String tagcontent,
                               A_CmsXmlContent doc,
                               Object userObject)
                        throws CmsException
Returns the absolute path of a resource merged with the absolute path of the file and the relative path in the tagcontent. This method adds the servlet path at the beginning of the path.

Parameters:
cms - CmsObject Object for accessing system resources.
tagcontent - The relative path of the resource incl. name of the resource.
doc - Reference to the A_CmsXmlContent object of the initiating XLM document.
Returns:
String or byte[] with the content of this subelement.
Throws:
CmsException

getFrameQueryString

public Object getFrameQueryString(CmsObject cms,
                                  String tagcontent,
                                  A_CmsXmlContent doc,
                                  Object userObject)
                           throws CmsException
Gets the QueryString for CmsFrameTemplates.

This method can be called using <METHOD name="getCmsQueryString"> in the template file.

Parameters:
cms - CmsObject Object for accessing system resources.
tagcontent - Unused in this special case of a user method. Can be ignored.
doc - Reference to the A_CmsXmlContent object of the initiating XLM document.
Returns:
String or byte[] with the content of this subelement.
Throws:
CmsException

getFrameTarget

public Object getFrameTarget(CmsObject cms,
                             String tagcontent,
                             A_CmsXmlContent doc,
                             Object userObject)
                      throws CmsException
Gets the target for a link.

This method can be called using <METHOD name="getCmsFrame"> in the template file.

Parameters:
cms - CmsObject Object for accessing system resources.
tagcontent - Unused in this special case of a user method. Can be ignored.
doc - Reference to the A_CmsXmlContent object of the initiating XLM document.
Returns:
String or byte[] with the content of this subelement.
Throws:
CmsException

getKey

public Object getKey(CmsObject cms,
                     String templateFile,
                     Hashtable parameters,
                     String templateSelector)
Gets the key that should be used to cache the results of this template class.

Since our results may depend on the used template file, the parameters and the requested body document, we must build a complex key using this three arguments.

Specified by:
getKey in interface I_CmsTemplate
Parameters:
cms - CmsObject Object for accessing system resources
templateFile - Filename of the template file
parameters - Hashtable with all template class parameters.
templateSelector - template section that should be processed.
Returns:
key that can be used for caching

getOwnTemplateFile

public CmsXmlTemplateFile getOwnTemplateFile(CmsObject cms,
                                             String templateFile,
                                             String elementName,
                                             Hashtable parameters,
                                             String templateSelector)
                                      throws CmsException
Reads in the template file and starts the XML parser for the expected content type.

Every extending class using not CmsXmlTemplateFile as content type, but any derived type should override this method.

Specified by:
getOwnTemplateFile in interface I_CmsXmlTemplate
Parameters:
cms - CmsObject Object for accessing system resources.
templateFile - Filename of the template file.
elementName - Element name of this template in our parent template.
parameters - Hashtable with all template class parameters.
templateSelector - template section that should be processed.
CmsException

getPathUri

public Object getPathUri(CmsObject cms,
                         String tagcontent,
                         A_CmsXmlContent doc,
                         Object userObject)
                  throws CmsException
Parameters:
cms - CmsObject Object for accessing system resources.
tagcontent - Unused in this special case of a user method. Can be ignored.
doc - Reference to the A_CmsXmlContent object of the initiating XLM document.
Returns:
String or byte[] with the content of this subelement.
Throws:
CmsException

getQueryString

public Object getQueryString(CmsObject cms,
                             String tagcontent,
                             A_CmsXmlContent doc,
                             Object userObject)
                      throws CmsException
Inserts the correct servlet path title into the template.

This method can be called using <METHOD name="getTitle"> in the template file.

Parameters:
cms - CmsObject Object for accessing system resources.
tagcontent - Unused in this special case of a user method. Can be ignored.
doc - Reference to the A_CmsXmlContent object of the initiating XLM document.
Returns:
String or byte[] with the content of this subelement.
Throws:
CmsException

getRequestIp

public String getRequestIp(CmsObject cms,
                           String tagcontent,
                           A_CmsXmlContent doc,
                           Object userObject)
                    throws CmsException
Get the IP address of the current request.

This method can be called using <METHOD name="getRequestIp"> in the template file.

Parameters:
cms - CmsObject Object for accessing system resources.
tagcontent - Unused in this special case of a user method. Can be ignored.
doc - Reference to the A_CmsXmlContent object of the initiating XLM document.
Returns:
String or byte[] with the content of this subelement.
Throws:
CmsException

getServletPath

public Object getServletPath(CmsObject cms,
                             String tagcontent,
                             A_CmsXmlContent doc,
                             Object userObject)
                      throws CmsException
Deprecated. instead of this method you should use the link tag.

Inserts the correct servlet path title into the template.

This method can be called using <METHOD name="getTitle"> in the template file.

Parameters:
cms - CmsObject Object for accessing system resources.
tagcontent - Unused in this special case of a user method. Can be ignored.
doc - Reference to the A_CmsXmlContent object of the initiating XLM document.
Returns:
String or byte[] with the content of this subelement.
Throws:
CmsException

getSessionId

public String getSessionId(CmsObject cms,
                           String tagcontent,
                           A_CmsXmlContent doc,
                           Object userObject)
                    throws CmsException
Get the session id. If no session exists, a new one will be created.

This method can be called using <METHOD name="getSessionId"> in the template file.

Parameters:
cms - CmsObject Object for accessing system resources.
tagcontent - Unused in this special case of a user method. Can be ignored.
doc - Reference to the A_CmsXmlContent object of the initiating XLM document.
Returns:
String or byte[] with the content of this subelement.
Throws:
CmsException

getStylesheet

public String getStylesheet(CmsObject cms,
                            String tagcontent,
                            A_CmsXmlContent doc,
                            Object userObject)
                     throws CmsException
Inserts the correct stylesheet into the layout template.

This method can be called using <METHOD name="getStylesheet"> in the template file.

When using this method follwing parameters should be defined either in the page file or in the template file:

These parameters should contain the correct OpenCms path for the Internet Explorer and Netscape Navigate specific stylesheets.

Parameters:
cms - CmsObject Object for accessing system resources.
tagcontent - Unused in this special case of a user method. Can be ignored.
doc - Reference to the A_CmsXmlContent object of the initiating XLM document.
Returns:
String or byte[] with the content of this subelement.
Throws:
CmsException - In case no stylesheet was found (or there were errors accessing the CmsObject)

getTemplateClassName

protected String getTemplateClassName(String elementName,
                                      CmsXmlTemplateFile doc,
                                      Hashtable parameters)
                               throws CmsException
Find the corresponding template class to be loaded. this should be defined in the template file of the parent template and can be overwritten in the body file.

Parameters:
elementName - Element name of this template in our parent template.
doc - CmsXmlTemplateFile object of our template file including a subtemplate.
parameters - Hashtable with all template class parameters.
Returns:
Name of the class that should generate the output for the included template file.
CmsException

getTemplateFileName

protected String getTemplateFileName(String elementName,
                                     CmsXmlTemplateFile doc,
                                     Hashtable parameters)
                              throws CmsException
Find the corresponding template file to be loaded by the template class. this should be defined in the template file of the parent template and can be overwritten in the body file.

Parameters:
elementName - Element name of this template in our parent template.
doc - CmsXmlTemplateFile object of our template file including a subtemplate.
parameters - Hashtable with all template class parameters.
Returns:
Name of the template file that should be included.
CmsException

getTemplateSelector

protected String getTemplateSelector(String elementName,
                                     CmsXmlTemplateFile doc,
                                     Hashtable parameters)
                              throws CmsException
Find the corresponding template selector to be activated. This may be defined in the template file of the parent template and can be overwritten in the body file.

Parameters:
elementName - Element name of this template in our parent template.
doc - CmsXmlTemplateFile object of our template file including a subtemplate.
parameters - Hashtable with all template class parameters.
Returns:
Name of the class that should generate the output for the included template file.
CmsException

getTitle

public Object getTitle(CmsObject cms,
                       String tagcontent,
                       A_CmsXmlContent doc,
                       Object userObject)
                throws CmsException
Inserts the document title into the template.

This method can be called using <METHOD name="getTitle"> in the template file.

Parameters:
cms - CmsObject Object for accessing system resources.
tagcontent - Unused in this special case of a user method. Can be ignored.
doc - Reference to the A_CmsXmlContent object of the initiating XLM document.
Returns:
String or byte[] with the content of this subelement.
Throws:
CmsException

getTitleEscaped

public Object getTitleEscaped(CmsObject cms,
                              String tagcontent,
                              A_CmsXmlContent doc,
                              Object userObject)
                       throws CmsException
Inserts the document title into the template, escaping special and non - ASCII characters with their HTML number representation (e.g. & becomes &#38;).

This method can be called using <METHOD name="getTitleEscaped"> in the template file.

Parameters:
cms - CmsObject Object for accessing system resources.
tagcontent - Unused in this special case of a user method. Can be ignored.
doc - Reference to the A_CmsXmlContent object of the initiating XLM document.
Returns:
String or byte[] with the content of this subelement.
Throws:
CmsException

getDescription

public Object getDescription(CmsObject cms,
                             String tagcontent,
                             A_CmsXmlContent doc,
                             Object userObject)
                      throws CmsException
Inserts the correct document description into the template.

This method can be called using <METHOD name="getDescription"> in the template file.

Parameters:
cms - CmsObject Object for accessing system resources.
tagcontent - Unused in this special case of a user method. Can be ignored.
doc - Reference to the A_CmsXmlContent object of the initiating XLM document.
Returns:
String or byte[] with the content of this subelement.
Throws:
CmsException

getProperty

public Object getProperty(CmsObject cms,
                          String tagcontent,
                          A_CmsXmlContent doc,
                          Object userObject)
                   throws CmsException
Inserts the value of the given property in the template.

This method can be called using <METHOD name="getProperty"> in the template file.

Parameters:
cms - CmsObject Object for accessing system resources.
tagcontent - The name of the property.
doc - Reference to the A_CmsXmlContent object of the initiating XLM document.
Returns:
String or byte[] with the content of this subelement.
Throws:
CmsException

getKeywords

public Object getKeywords(CmsObject cms,
                          String tagcontent,
                          A_CmsXmlContent doc,
                          Object userObject)
                   throws CmsException
Inserts the correct document keyword into the template.

This method can be called using <METHOD name="getKeywords"> in the template file.

Parameters:
cms - CmsObject Object for accessing system resources.
tagcontent - Unused in this special case of a user method. Can be ignored.
doc - Reference to the A_CmsXmlContent object of the initiating XLM document.
Returns:
String or byte[] with the content of this subelement.
Throws:
CmsException

getEncoding

public Object getEncoding(CmsObject cms,
                          String tagcontent,
                          A_CmsXmlContent doc,
                          Object userObject)
                   throws CmsException
CmsException

setEncoding

public Object setEncoding(CmsObject cms,
                          String tagcontent,
                          A_CmsXmlContent doc,
                          Object userObject)
                   throws CmsException
CmsException

getUri

public Object getUri(CmsObject cms,
                     String tagcontent,
                     A_CmsXmlContent doc,
                     Object userObject)
              throws CmsException
Parameters:
cms - CmsObject Object for accessing system resources.
tagcontent - May contain the parameter for framesets to work in the static export.
doc - Reference to the A_CmsXmlContent object of the initiating XLM document.
Returns:
String or byte[] with the content of this subelement.
Throws:
CmsException

getUriWithParameter

public Object getUriWithParameter(CmsObject cms,
                                  String tagcontent,
                                  A_CmsXmlContent doc,
                                  Object userObject)
                           throws CmsException
Parameters:
cms - CmsObject Object for accessing system resources.
tagcontent - Contains the parameter for framesets.
doc - Reference to the A_CmsXmlContent object of the initiating XLM document.
Returns:
String or byte[] with the content of this subelement.
Throws:
CmsException

isStreamable

public boolean isStreamable(CmsObject cms,
                            String templateFile,
                            String elementName,
                            Hashtable parameters,
                            String templateSelector)
Indicates if the current template class is able to stream it's results directly to the response oputput stream.

Classes must not set this feature, if they might throw special exception that cause HTTP errors (e.g. 404/Not Found), or if they might send HTTP redirects.

If a class sets this feature, it has to check the isStreaming() property of the RequestContext. If this is set to true the results must be streamed directly to the output stream. If it is false the results must not be streamed.

Complex classes that are able top include other subtemplates have to check the streaming ability of their subclasses here!

Specified by:
isStreamable in interface I_CmsTemplate
Overrides:
isStreamable in class A_CmsTemplate
Parameters:
cms - CmsObject Object for accessing system resources
templateFile - Filename of the template file
elementName - Element name of this template in our parent template.
parameters - Hashtable with all template class parameters.
templateSelector - template section that should be processed.
Returns:
true if this class may stream it's results, false otherwise.

collectCacheDirectives

public CmsCacheDirectives collectCacheDirectives(CmsObject cms,
                                                 String templateFile,
                                                 String elementName,
                                                 Hashtable parameters,
                                                 String templateSelector)
Collect caching informations from the current template class.

Complex classes that are able to include other subtemplates have to check the streaming ability of their subclasses here!

Specified by:
collectCacheDirectives in interface I_CmsTemplate
Overrides:
collectCacheDirectives in class A_CmsTemplate
Parameters:
cms - CmsObject Object for accessing system resources
templateFile - Filename of the template file
elementName - Element name of this template in our parent template.
parameters - Hashtable with all template class parameters.
templateSelector - template section that should be processed.
Returns:
true if this class may stream it's results, false otherwise.

getCacheDirectives

public CmsCacheDirectives getCacheDirectives(CmsObject cms,
                                             String templateFile,
                                             String elementName,
                                             Hashtable parameters,
                                             String templateSelector)
gets the caching information from the current template class.

Parameters:
cms - CmsObject Object for accessing system resources
templateFile - Filename of the template file
elementName - Element name of this template in our parent template.
parameters - Hashtable with all template class parameters.
templateSelector - template section that should be processed.
Returns:
true if this class may stream it's results, false otherwise.

getMethodCacheDirectives

public CmsMethodCacheDirectives getMethodCacheDirectives(CmsObject cms,
                                                         String methodName)
gets the caching information for a specific methode.

Parameters:
cms - the cms object.
methodName - the name of the method for witch the MethodCacheDirectives are wanted.

isTemplateCacheSet

public final boolean isTemplateCacheSet()
Tests, if the template cache is setted.

Specified by:
isTemplateCacheSet in interface I_CmsTemplate
Returns:
true if setted, false otherwise.

parameters

public String parameters(CmsObject cms,
                         String tagcontent,
                         A_CmsXmlContent doc,
                         Object userObject)
For debugging purposes only. Prints out all parameters.

May be called from the template file using <METHOD name="parameters">.

Parameters:
cms - CmsObject Object for accessing system resources.
tagcontent - Unused in this special case of a user method. Can be ignored.
doc - Reference to the A_CmsXmlContent object the initiating XLM document.
Returns:
Debugging information about all parameters.

setTemplateCache

public final void setTemplateCache(I_CmsTemplateCache c)
Set the instance of template cache that should be used to store cacheable results of the subtemplates. If the template cache is not set, caching will be disabled.

Specified by:
setTemplateCache in interface I_CmsTemplate
Parameters:
c - Template cache to be used.

shouldReload

public boolean shouldReload(CmsObject cms,
                            String templateFile,
                            String elementName,
                            Hashtable parameters,
                            String templateSelector)
Indicates if a previous cached result should be reloaded.

not implemented. Returns always false.

Specified by:
shouldReload in interface I_CmsTemplate
Parameters:
cms - CmsObject Object for accessing system resources
templateFile - Filename of the template file
elementName - Element name of this template in our parent template.
parameters - Hashtable with all template class parameters.
templateSelector - template section that should be processed.
Returns:
false

registerVariantDeps

protected void registerVariantDeps(CmsObject cms,
                                   String templateName,
                                   String elementName,
                                   String templateSelector,
                                   Hashtable parameters,
                                   Vector vfsDeps,
                                   Vector cosDeps,
                                   Vector cosClassDeps)
                            throws CmsException
Saves the dependencies for this elementvariante. We save the deps two ways. First we have an so called extern Hashtable where we use as key a resource (represented by a String) and as values an Vector with all ElementVariants that depend on this resource (again represented by a String in which we save the variant and the element it is in) The second saveplace is the elementvariant itselv. The intern way to save. There we store which resoucess affect this variant.

Parameters:
cms - The cms object.
elementName - only needed for getCachDirectives, if it is not used there it may be null
templateSelector - only needed for getCachDirectives, if it is not used there it may be null
vfsDeps - A vector (of CmsResource objects) with the resources that variant depends on.
cosDeps - A vector (of CmsContentDefinitions) with the cd-resources that variant depends on.
cosClassDeps - A vector (of Class objects) with the contentdefinitions that variant depends on.
CmsException

startProcessing

protected byte[] startProcessing(CmsObject cms,
                                 CmsXmlTemplateFile xmlTemplateDocument,
                                 String elementName,
                                 Hashtable parameters,
                                 String templateSelector)
                          throws CmsException
Starts the processing of the given template file by calling the getProcessedTemplateContent() method of the content defintition of the corresponding content type.

Any exceptions thrown while processing the template will be caught, printed and and thrown again.

If element cache is enabled, generateElementCacheVariant() will be called instead of getProcessedTemplateContent() for generating a new element cache variant instead of the completely processed output data. This new variant will be stored in the current element using the cache key given by the cache directives.

Parameters:
cms - CmsObject Object for accessing system resources.
xmlTemplateDocument - XML parsed document of the content type "XML template file" or any derived content type.
elementName - Element name of this template in our parent template.
parameters - Hashtable with all template class parameters.
templateSelector - template section that should be processed.
Returns:
Content of the template and all subtemplates.
Throws:
CmsException

templateElement

public Object templateElement(CmsObject cms,
                              String tagcontent,
                              A_CmsXmlContent doc,
                              Object userObject)
                       throws CmsException
Handles any occurence of an <ELEMENT> tag.

Every XML template class should use CmsXmlTemplateFile as the interface to the XML file. Since CmsXmlTemplateFile is an extension of A_CmsXmlContent by the additional tag <ELEMENT> this user method ist mandatory.

Specified by:
templateElement in interface I_CmsXmlTemplate
Parameters:
cms - CmsObject Object for accessing system resources.
tagcontent - Unused in this special case of a user method. Can be ignored.
doc - Reference to the A_CmsXmlContent object of the initiating XLM document.
Returns:
String or byte[] with the content of this subelement.
Throws:
CmsException

throwException

protected void throwException(String errorMessage)
                       throws CmsException
Help method that handles any occuring error by writing an error message to the OpenCms logfile and throwing a CmsException of the type "unknown".

Overrides:
throwException in class A_CmsTemplate
Parameters:
errorMessage - String with the error message to be printed.
Throws:
CmsException

throwException

protected void throwException(String errorMessage,
                              int type)
                       throws CmsException
Help method that handles any occuring error by writing an error message to the OpenCms logfile and throwing a CmsException of the given type.

Overrides:
throwException in class A_CmsTemplate
Parameters:
errorMessage - String with the error message to be printed.
type - Type of the exception to be thrown.
Throws:
CmsException

throwException

protected void throwException(String errorMessage,
                              Exception e)
                       throws CmsException
Help method that handles any occuring error by writing an error message to the OpenCms logfile and re-throwing a caught exception.

Overrides:
throwException in class A_CmsTemplate
Parameters:
errorMessage - String with the error message to be printed.
e - Exception to be re-thrown.
Throws:
CmsException

createElement

public A_CmsElement createElement(CmsObject cms,
                                  String templateFile,
                                  Hashtable parameters)
Create a new element for the element cache consisting of the current template class and the given template file.

Complex template classes that are able to include other (sub-)templates must generate a collection of element definitions for their possible subtemplates. This collection is part of the new element.

Specified by:
createElement in interface I_CmsTemplate
Parameters:
cms - CmsObject for accessing system resources.
templateFile - Name of the template file for the new element
parameters - All parameters of the current request
Returns:
New element for the element cache