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.java,v 1.4 2002/02/22 07:00:15 cziegeler Exp $
Author:
Ovidiu Predescu

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 java.lang.String ROLE
           
static int SESSION_SCOPE
          The session scope.
static java.lang.String XSCRIPT_NS
           
 
Method Summary
 XScriptObject get(java.lang.String name, int scope, java.lang.String context)
          Obtains the object value of the name variable in scope.
 XScriptObject getFirst(java.lang.String name, java.lang.String sessionContext, java.lang.String pageContext)
          Search for the first occurence of the variable name.
 void put(java.lang.String name, XScriptObject value, int scope, java.lang.String context)
          Defines or overwrites the value of variable name in scope.
 void remove(java.lang.String name, int scope, java.lang.String context)
          Removes a variable previously declared in scope within context.
 void removeFirst(java.lang.String name, java.lang.String sessionContext, java.lang.String pageContext)
          Remove the first appearance of name in the all the currently accessible scopes.
 

Field Detail

ROLE

public static final java.lang.String ROLE

XSCRIPT_NS

public static final java.lang.String XSCRIPT_NS

GLOBAL_SCOPE

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

SESSION_SCOPE

public 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".

PAGE_SCOPE

public 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.

ALL_SCOPES

public 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.
Method Detail

get

public XScriptObject get(java.lang.String name,
                         int scope,
                         java.lang.String context)
                  throws java.lang.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:
name - a String value
scope - an int value
context - a String value whose interpretation depends on scope
Returns:
a XScriptObject value

getFirst

public XScriptObject getFirst(java.lang.String name,
                              java.lang.String sessionContext,
                              java.lang.String pageContext)
                       throws java.lang.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:
name - a String value
sessionContext - a String value
pageContext - a String value
Returns:
a XScriptObject value
Throws:
java.lang.IllegalArgumentException - if an error occurs

put

public void put(java.lang.String name,
                XScriptObject value,
                int scope,
                java.lang.String context)
         throws java.lang.IllegalArgumentException
Defines or overwrites the value of variable name in scope. The context argument is interpreted as described in get(String, int, String).
Parameters:
name - a String value
value - a XScriptObject value
scope - an int value
context - a String value whose interpretation depends on scope

remove

public void remove(java.lang.String name,
                   int scope,
                   java.lang.String context)
Removes a variable previously declared in scope within context. Such a variable could be declared using the put(String, XScriptObject, int, String) method.
Parameters:
name - a String value
scope - an int value
context - a String value

removeFirst

public void removeFirst(java.lang.String name,
                        java.lang.String sessionContext,
                        java.lang.String pageContext)
                 throws java.lang.IllegalArgumentException
Remove the first appearance of name in the all the currently accessible scopes. The search happens as described in getFirst(String,String,String).
Parameters:
name - a String value
sessionContext - a String value
pageContext - a String value
Throws:
java.lang.IllegalArgumentException - if an error occurs


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