org.opencms.xml.containerpage
Class CmsDynamicFunctionParser

java.lang.Object
  extended by org.opencms.xml.containerpage.CmsDynamicFunctionParser

public class CmsDynamicFunctionParser
extends Object

The parser class for creating dynamic function beans from XML contents.


Field Summary
static String FORMATTER_PATH
          The path of the formatter which calls the JSP.
static String N_CONTAINER_SETTINGS
          The node name for the formatter settings.
static String TYPE_FUNCTION
          The resource type for dynamic functions.
 
Constructor Summary
CmsDynamicFunctionParser()
           
 
Method Summary
protected  List<CmsDynamicFunctionBean.Format> getAdditionalFormats(CmsObject cms, I_CmsXmlContentLocation location, CmsResource functionRes)
          Parses all the additional formats from the XML content.
protected  CmsResource getFunctionFormatter(CmsObject cms)
          Gets the function formatter resource, possibly from the cache.
protected  Locale getLocaleToUse(CmsObject cms, CmsXmlContent xmlContent)
          Gets the locale to use for parsing the dynamic function.
protected  CmsDynamicFunctionBean.Format getMainFormat(CmsObject cms, I_CmsXmlContentLocation location, CmsResource functionRes)
          Parses the main format from the XML content.
protected  String getString(CmsObject cms, I_CmsXmlContentValueLocation location)
          Gets the string value of an XML content location.
protected  String getStringValue(CmsObject cms, I_CmsXmlContentValueLocation location, String defaultValue)
          Converts a (possibly null) content value location to a string.
protected  CmsDynamicFunctionBean.Format parseAdditionalFormat(CmsObject cms, I_CmsXmlContentValueLocation location, CmsResource functionRes)
          Parses an additional format from the XML content.
 CmsDynamicFunctionBean parseFunctionBean(CmsObject cms, CmsResource res)
          Parses a dynamic function bean given a resource.
 CmsDynamicFunctionBean parseFunctionBean(CmsObject cms, CmsXmlContent content)
          Parses a dynamic function bean from an in-memory XML content object.
protected  CmsDynamicFunctionBean parseFunctionBean(CmsObject cms, I_CmsXmlContentLocation location, CmsResource functionRes, CmsResource functionFormatter)
          Parses a dynamic function bean.
protected  CmsPair<String,String> parseParameter(CmsObject cms, I_CmsXmlContentValueLocation valueLocation)
          Parses a request parameter for the JSP from the XML content.
protected  Map<String,String> parseParameters(CmsObject cms, I_CmsXmlContentLocation location, String name)
          Parses all parameters for the JSP from the XML content.
protected  CmsXmlContentProperty parseProperty(CmsObject cms, I_CmsXmlContentLocation field)
          Helper method for parsing a settings definition.
protected  Map<String,CmsXmlContentProperty> parseSettings(CmsObject cms, I_CmsXmlContentLocation location, CmsResource functionResource)
          Parses the settings for the dynamic function from the XML content.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FORMATTER_PATH

public static final String FORMATTER_PATH
The path of the formatter which calls the JSP.

See Also:
Constant Field Values

N_CONTAINER_SETTINGS

public static final String N_CONTAINER_SETTINGS
The node name for the formatter settings.

See Also:
Constant Field Values

TYPE_FUNCTION

public static final String TYPE_FUNCTION
The resource type for dynamic functions.

See Also:
Constant Field Values
Constructor Detail

CmsDynamicFunctionParser

public CmsDynamicFunctionParser()
Method Detail

parseFunctionBean

public CmsDynamicFunctionBean parseFunctionBean(CmsObject cms,
                                                CmsResource res)
                                         throws CmsException
Parses a dynamic function bean given a resource.

Parameters:
cms - the current CMS context
res - the resource from which to read the dynamic function
Returns:
the dynamic function bean created from the resource
Throws:
CmsException - if something goes wrong

parseFunctionBean

public CmsDynamicFunctionBean parseFunctionBean(CmsObject cms,
                                                CmsXmlContent content)
                                         throws CmsException
Parses a dynamic function bean from an in-memory XML content object.

Parameters:
cms - the current CMS context
content - the XML content from which to read the dynamic function bean
Returns:
the dynamic function bean read from the XML content
Throws:
CmsException - if something goes wrong

getAdditionalFormats

protected List<CmsDynamicFunctionBean.Format> getAdditionalFormats(CmsObject cms,
                                                                   I_CmsXmlContentLocation location,
                                                                   CmsResource functionRes)
Parses all the additional formats from the XML content.

Parameters:
cms - the current CMS context
location - the location from which to parse the additional formats
functionRes - the dynamic function resource
Returns:
the list of parsed formats

getFunctionFormatter

protected CmsResource getFunctionFormatter(CmsObject cms)
                                    throws CmsException
Gets the function formatter resource, possibly from the cache.

Parameters:
cms - the current CMS context
Returns:
the function formatter resource
Throws:
CmsException - if something goes wrong

getLocaleToUse

protected Locale getLocaleToUse(CmsObject cms,
                                CmsXmlContent xmlContent)
Gets the locale to use for parsing the dynamic function.

Parameters:
cms - the current CMS context
xmlContent - the xml content from which the dynamic function should be read
Returns:
the locale from which the dynamic function should be read

getMainFormat

protected CmsDynamicFunctionBean.Format getMainFormat(CmsObject cms,
                                                      I_CmsXmlContentLocation location,
                                                      CmsResource functionRes)
Parses the main format from the XML content.

Parameters:
cms - the current CMS context
location - the location from which to parse main format
functionRes - the dynamic function resource
Returns:
the parsed main format

getString

protected String getString(CmsObject cms,
                           I_CmsXmlContentValueLocation location)
Gets the string value of an XML content location.

Parameters:
cms - the current CMS context
location - an XML content location
Returns:
the string value of that XML content location

getStringValue

protected String getStringValue(CmsObject cms,
                                I_CmsXmlContentValueLocation location,
                                String defaultValue)
Converts a (possibly null) content value location to a string.

Parameters:
cms - the current CMS context
location - the content value location
defaultValue - the value to return if the location is null
Returns:
the string value of the content value location

parseAdditionalFormat

protected CmsDynamicFunctionBean.Format parseAdditionalFormat(CmsObject cms,
                                                              I_CmsXmlContentValueLocation location,
                                                              CmsResource functionRes)
Parses an additional format from the XML content.

Parameters:
cms - the current CMS context
location - the location from which to parse the additional format
functionRes - the dynamic function resource
Returns:
the additional format

parseFunctionBean

protected CmsDynamicFunctionBean parseFunctionBean(CmsObject cms,
                                                   I_CmsXmlContentLocation location,
                                                   CmsResource functionRes,
                                                   CmsResource functionFormatter)
Parses a dynamic function bean.

Parameters:
cms - the current CMS context
location - the location from which to parse the dynamic function bean
functionRes - the dynamic function resource
functionFormatter - the function formatter resource
Returns:
the parsed dynamic function bean

parseParameter

protected CmsPair<String,String> parseParameter(CmsObject cms,
                                                I_CmsXmlContentValueLocation valueLocation)
Parses a request parameter for the JSP from the XML content.

Parameters:
cms - the current CMS context
valueLocation - the location from which to parse the parameter
Returns:
the parsed parameter key/value pair

parseParameters

protected Map<String,String> parseParameters(CmsObject cms,
                                             I_CmsXmlContentLocation location,
                                             String name)
Parses all parameters for the JSP from the XML content.

Parameters:
cms - the current CMS context
location - the location from which to read the parameters
name - the name of the tag from which to read the parameters
Returns:
the parsed map of parameters

parseProperty

protected CmsXmlContentProperty parseProperty(CmsObject cms,
                                              I_CmsXmlContentLocation field)
Helper method for parsing a settings definition.

Parameters:
cms - the current CMS context
field - the node from which to read the settings definition
Returns:
the parsed setting definition

parseSettings

protected Map<String,CmsXmlContentProperty> parseSettings(CmsObject cms,
                                                          I_CmsXmlContentLocation location,
                                                          CmsResource functionResource)
Parses the settings for the dynamic function from the XML content.

Parameters:
cms - the current CMS context
location - the location from which to read the dynamic function settings
functionResource - the dynamic function resource
Returns:
the parsed map of settings for the dynamic function