org.apache.commons.workflow
Interface Scope

All Superinterfaces:
Map
All Known Implementing Classes:
BaseScope, HttpSessionScope, ServletContextScope, ServletRequestScope

public interface Scope
extends Map

A Scope is a collection of arbitrary Java objects, keyed by String-valued names. Specialized workflow implementations will register their own Scope implementations to connect the workflow engine processing to their own execution environments. For example, a web layer implementation would most likely adapt Scopes to the request attributes, session attributes, and servlet context attributes provided by the Servlet API.

A Scope implements the API contracts of java.util.Map with the following additional rules:

Version:
$Revision: 155475 $ $Date: 2005-02-26 13:31:11 +0000 (Sat, 26 Feb 2005) $
Author:
Craig R. McClanahan

Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
Map.Entry
 
Method Summary
 void addScopeListener(ScopeListener listener)
          Add a listener that is notified each time beans are added, replaced, or removed in this scope.
 void clear()
          Remove all beans from this Map and call scopeCleared() on all registered ScopeListeners.
 Object put(String key, Object bean)
          Add the specified bean, associated with the specified key, to this scope and replace any previous bean associated with this key.
 Object remove(String key)
          Remove the bean associated with the specified key (if any).
 void removeScopeListener(ScopeListener listener)
          Remove a listener that is notified each time beans are added, replaced, or removed in this scope.
 
Methods inherited from interface java.util.Map
containsKey, containsValue, entrySet, equals, get, hashCode, isEmpty, keySet, put, putAll, remove, size, values
 

Method Detail

clear

void clear()
Remove all beans from this Map and call scopeCleared() on all registered ScopeListeners.

Specified by:
clear in interface Map

put

Object put(String key,
           Object bean)
Add the specified bean, associated with the specified key, to this scope and replace any previous bean associated with this key. If the bean was added, call beanAdded() on all registered listeners after the add is done. If an old bean was replaced, call beanReplaced() (passing the old value in the event) on all registered ScopeListeners after the removal is done. If a bean was replaced, the old value is also returned; otherwise null is returned.

Parameters:
key - Key with which the new value should be associated (cannot be null)
bean - Bean to be associated with this key (cannot be null)
Throws:
IllegalArgumentException - if key or bean is null

remove

Object remove(String key)
Remove the bean associated with the specified key (if any). If such a bean is found and removed, call beanRemoved() on all registered ScopeListeners after the removal is done. Return the old value (if any); otherwise return null.

Parameters:
key - Key of the bean to remove (cannot be null)
Throws:
IllegalArgumentException - if key is null

addScopeListener

void addScopeListener(ScopeListener listener)
Add a listener that is notified each time beans are added, replaced, or removed in this scope.

Parameters:
listener - The ScopeListener to be added

removeScopeListener

void removeScopeListener(ScopeListener listener)
Remove a listener that is notified each time beans are added, replaced, or removed in this scope.

Parameters:
listener - The ScopeListener to be removed


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