org.apache.cocoon.components.xscript
Class XScriptManagerImpl

java.lang.Object
  extended by org.apache.avalon.framework.logger.AbstractLogEnabled
      extended by org.apache.cocoon.components.xscript.XScriptManagerImpl
All Implemented Interfaces:
Disposable, Component, Contextualizable, LogEnabled, Parameterizable, Serviceable, ThreadSafe, XScriptManager

public class XScriptManagerImpl
extends AbstractLogEnabled
implements XScriptManager, Serviceable, Component, Parameterizable, Contextualizable, ThreadSafe, Disposable

The actual implementation of the XScriptManager interface.

Since:
August 4, 2001
Version:
CVS $Id: XScriptManagerImpl.html 1304258 2012-03-23 10:09:27Z ilgrosso $
Author:
Ovidiu Predescu

Field Summary
protected  Context context
          The Context instance.
static String CONTEXT
           
protected  ServiceManager manager
          The ServiceManager instance.
 
Fields inherited from interface org.apache.cocoon.components.xscript.XScriptManager
ALL_SCOPES, GLOBAL_SCOPE, PAGE_SCOPE, REQUEST_SCOPE, ROLE, SESSION_SCOPE, XSCRIPT_NS
 
Constructor Summary
XScriptManagerImpl()
           
 
Method Summary
 void contextualize(Context context)
           
 void dispose()
           
 XScriptObject get(XScriptVariableScope pageScope, Map objectModel, String name, int scope)
          Obtains the object value of the name variable in scope.
 XScriptObject getFirst(XScriptVariableScope pageScope, Map objectModel, String name)
          Search for the first occurence of the variable name.
 void parameterize(Parameters params)
           
 void put(XScriptVariableScope pageScope, Map objectModel, String name, XScriptObject value, int scope)
          Defines or overwrites the value of variable name in scope.
 void register(XScriptObject object)
           
 XScriptObject remove(XScriptVariableScope pageScope, Map objectModel, String name, int scope)
          Removes a variable previously declared in scope within context.
 XScriptObject removeFirst(XScriptVariableScope pageScope, Map objectModel, String name)
          Remove the first appearance of name in the all the currently accessible scopes.
 void service(ServiceManager manager)
           
 
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONTEXT

public static final String CONTEXT
See Also:
Constant Field Values

manager

protected ServiceManager manager
The ServiceManager instance.


context

protected Context context
The Context instance.

Constructor Detail

XScriptManagerImpl

public XScriptManagerImpl()
Method Detail

contextualize

public void contextualize(Context context)
                   throws ContextException
Specified by:
contextualize in interface Contextualizable
Throws:
ContextException

service

public void service(ServiceManager manager)
             throws ServiceException
Specified by:
service in interface Serviceable
Throws:
ServiceException

register

public void register(XScriptObject object)

parameterize

public void parameterize(Parameters params)
                  throws ParameterException
Specified by:
parameterize in interface Parameterizable
Throws:
ParameterException

dispose

public void dispose()
Specified by:
dispose in interface Disposable

get

public XScriptObject get(XScriptVariableScope pageScope,
                         Map objectModel,
                         String name,
                         int scope)
                  throws IllegalArgumentException
Description copied from interface: XScriptManager
Obtains the object value of the name variable in scope. The context parameter is interpreted differently depending on the value of scope, as follows:

Specified by:
get in interface XScriptManager
objectModel - an instance of Cocoon object model used to obtain context
name - a String value
scope - an int value
Returns:
a XScriptObject value
Throws:
IllegalArgumentException

getFirst

public XScriptObject getFirst(XScriptVariableScope pageScope,
                              Map objectModel,
                              String name)
                       throws IllegalArgumentException
Description copied from interface: XScriptManager
Search for the first occurence of the variable name.

The search happens first in the session scope identified by sessionContext. If no variable is found here, the search continues in the page scope identified by pageContext. If no variable is found here, it's finally searched in the global scope.

The XScriptObject value of the variable is returned if a variable is found in one of the scopes, otherwise an exception is thrown.

Specified by:
getFirst in interface XScriptManager
objectModel - an instance of Cocoon object model used to obtain context
name - a String value
Returns:
a XScriptObject value
Throws:
IllegalArgumentException - if an error occurs

put

public void put(XScriptVariableScope pageScope,
                Map objectModel,
                String name,
                XScriptObject value,
                int scope)
Description copied from interface: XScriptManager
Defines or overwrites the value of variable name in scope. The context argument is interpreted as described in XScriptManager.get(XScriptVariableScope, Map, String, int).

Specified by:
put in interface XScriptManager
objectModel - an instance of Cocoon object model used to obtain context
name - a String value
value - a XScriptObject value
scope - an int value

remove

public XScriptObject remove(XScriptVariableScope pageScope,
                            Map objectModel,
                            String name,
                            int scope)
                     throws IllegalArgumentException
Description copied from interface: XScriptManager
Removes a variable previously declared in scope within context. Such a variable could be declared using the XScriptManager.put(XScriptVariableScope, Map, String, XScriptObject, int) method.

Specified by:
remove in interface XScriptManager
objectModel - an instance of Cocoon object model used to obtain context
name - a String value
scope - an int value
Throws:
IllegalArgumentException - if an error occurs

removeFirst

public XScriptObject removeFirst(XScriptVariableScope pageScope,
                                 Map objectModel,
                                 String name)
                          throws IllegalArgumentException
Description copied from interface: XScriptManager
Remove the first appearance of name in the all the currently accessible scopes. The search happens as described in XScriptManager.getFirst(XScriptVariableScope, Map, String).

Specified by:
removeFirst in interface XScriptManager
objectModel - an instance of Cocoon object model used to obtain context
name - a String value
Throws:
IllegalArgumentException - if an error occurs


Copyright © 1999-2010 The Apache Software Foundation. All Rights Reserved.