org.apache.cocoon.components.language.markup.xsp
Class XSPModuleHelper

java.lang.Object
  |
  +--org.apache.cocoon.components.language.markup.xsp.XSPModuleHelper

public class XSPModuleHelper
extends java.lang.Object

Helper class that caches references to InputModules for use in XSPs. Works in conjunction with the input.xsl logicsheet. References are obtained the first time a module is accessed and kept until the page is completely displayed.

Version:
$Id: XSPModuleHelper.java,v 1.1.2.3 2002/12/06 10:01:24 haul Exp $
Author:
Christian Haul

Field Summary
protected static java.lang.String INPUT_MODULE_SELECTOR
           
 
Constructor Summary
XSPModuleHelper()
           
 
Method Summary
 java.lang.Object getAttribute(java.util.Map objectModel, java.lang.String module, java.lang.String name, java.lang.Object deflt)
          Get a single attribute value from a module.
 void getAttributeNames(java.util.Map objectModel, org.xml.sax.ContentHandler contentHandler, java.lang.String module)
          Output attribute names for a given request
 java.util.Iterator getAttributeNames(java.util.Map objectModel, java.lang.String module)
          Get an iterator to a collection of attribute names from a module.
 void getAttributeValues(java.util.Map objectModel, org.xml.sax.ContentHandler contentHandler, java.lang.String module, java.lang.String name)
          Output the request attribute values for a given name to the content handler.
 java.lang.Object[] getAttributeValues(java.util.Map objectModel, java.lang.String module, java.lang.String name, java.lang.Object[] deflt)
          Get an array of values from a module.
 void releaseAll()
          Releases all obtained module references.
 void setup(org.apache.avalon.framework.component.ComponentManager manager)
          Initializes the instance for first use.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INPUT_MODULE_SELECTOR

protected static final java.lang.String INPUT_MODULE_SELECTOR
Constructor Detail

XSPModuleHelper

public XSPModuleHelper()
Method Detail

setup

public void setup(org.apache.avalon.framework.component.ComponentManager manager)
           throws java.lang.RuntimeException
Initializes the instance for first use. Stores references to component manager and component selector in instance if ThreadSafe.

Parameters:
manager - a ComponentManager value
Throws:
java.lang.RuntimeException - if an error occurs

getAttribute

public java.lang.Object getAttribute(java.util.Map objectModel,
                                     java.lang.String module,
                                     java.lang.String name,
                                     java.lang.Object deflt)
                              throws java.lang.RuntimeException
Get a single attribute value from a module. Uses cached reference if existing.

Parameters:
objectModel - a Map value
module - a String value holding the module name
name - a String value holding the attribute name
deflt - an Object value holding a default value
Returns:
an Object value
Throws:
java.lang.RuntimeException - if an error occurs

getAttributeValues

public java.lang.Object[] getAttributeValues(java.util.Map objectModel,
                                             java.lang.String module,
                                             java.lang.String name,
                                             java.lang.Object[] deflt)
                                      throws java.lang.RuntimeException
Get an array of values from a module. Uses cached reference if existing.

Parameters:
objectModel - a Map value
module - a String value holding the module name
name - a String value holding the attribute name
deflt - an Object[] value holding a default value
Returns:
an Object[] value
Throws:
java.lang.RuntimeException - if an error occurs

getAttributeValues

public void getAttributeValues(java.util.Map objectModel,
                               org.xml.sax.ContentHandler contentHandler,
                               java.lang.String module,
                               java.lang.String name)
                        throws org.xml.sax.SAXException,
                               java.lang.RuntimeException
Output the request attribute values for a given name to the content handler.

Parameters:
objectModel - The Map objectModel
contentHandler - The SAX content handler
module - a String value holding the module name
name - a String value holding the attribute name
Throws:
org.xml.sax.SAXException - If a SAX error occurs
java.lang.RuntimeException - if an error occurs

getAttributeNames

public java.util.Iterator getAttributeNames(java.util.Map objectModel,
                                            java.lang.String module)
                                     throws java.lang.RuntimeException
Get an iterator to a collection of attribute names from a module.

Parameters:
objectModel - a Map value
module - the module's name
Returns:
an Iterator value
Throws:
java.lang.RuntimeException - if an error occurs

getAttributeNames

public void getAttributeNames(java.util.Map objectModel,
                              org.xml.sax.ContentHandler contentHandler,
                              java.lang.String module)
                       throws org.xml.sax.SAXException,
                              java.lang.RuntimeException
Output attribute names for a given request

Parameters:
objectModel - The Map objectModel
contentHandler - The SAX content handler
module - the module's name
Throws:
org.xml.sax.SAXException - If a SAX error occurs
java.lang.RuntimeException - if an error occurs

releaseAll

public void releaseAll()
                throws java.lang.RuntimeException
Releases all obtained module references.

Throws:
java.lang.RuntimeException - if an error occurs


Copyright © 1999-2002 Apache Software Foundation. All Rights Reserved.