org.apache.cocoon.components.xscript
Interface XScriptManager

All Known Implementing Classes:
XScriptManagerImpl

public interface XScriptManager

XScriptManager is the public interface used to interact with the XScript component, which implements the supporting code for the XScript language.

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

Field Summary
static int ALL_SCOPES
          Search for a variable in all the accessible scopes.
static int GLOBAL_SCOPE
          The variable's global scope.
static int PAGE_SCOPE
          The page scope.
static int REQUEST_SCOPE
          The request scope.
static String ROLE
           
static int SESSION_SCOPE
          The session scope.
static String XSCRIPT_NS
           
 
Method Summary
 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 put(XScriptVariableScope pageScope, Map objectModel, String name, XScriptObject value, int scope)
          Defines or overwrites the value of variable name in scope.
 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.
 

Field Detail

ROLE

static final String ROLE
See Also:
Constant Field Values

XSCRIPT_NS

static final String XSCRIPT_NS
See Also:
Constant Field Values

GLOBAL_SCOPE

static final int GLOBAL_SCOPE
The variable's global scope. Each Cocoon instance has exactly one global scope for variables.

See Also:
Constant Field Values

SESSION_SCOPE

static final int SESSION_SCOPE
The session scope. This scope is specific to a particular activation of an XSP page, which is usually identified by the session id of the user that sent the HTTP request. From XScript's point of view however, the session identifier is not interpreted in any way, so a client can define its own notion of "session".

See Also:
Constant Field Values

PAGE_SCOPE

static final int PAGE_SCOPE
The page scope. This is scope very specific to an XSP page, and defines variables visible only within the context of that page. No other XSP page can access these variables, unless it knows the identifier used by that page to store its variables. This identifier is not necessarily the URL or full path of that page; it is up to the page to define it.

See Also:
Constant Field Values

REQUEST_SCOPE

static final int REQUEST_SCOPE
The request scope. This is scope specific to request, and defines variables visible only within the context of that request. Once request is processed, these variables are lost.

See Also:
Constant Field Values

ALL_SCOPES

static final int ALL_SCOPES
Search for a variable in all the accessible scopes. The variable is first searched in the current session scope. If no variable is found here, the current page scope is searched next. If nothing is found either, the global scope is searched.

See Also:
Constant Field Values
Method Detail

get

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

Parameters:
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

XScriptObject getFirst(XScriptVariableScope pageScope,
                       Map objectModel,
                       String name)
                       throws IllegalArgumentException
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.

Parameters:
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

void put(XScriptVariableScope pageScope,
         Map objectModel,
         String name,
         XScriptObject value,
         int scope)
         throws IllegalArgumentException
Defines or overwrites the value of variable name in scope. The context argument is interpreted as described in get(XScriptVariableScope, Map, String, int).

Parameters:
objectModel - an instance of Cocoon object model used to obtain context
name - a String value
value - a XScriptObject value
scope - an int value
Throws:
IllegalArgumentException

remove

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

Parameters:
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

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

Parameters:
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.