org.ow2.opensuit.xml.spring
Class PageContext

java.lang.Object
  extended by org.ow2.opensuit.xml.spring.PageContext
All Implemented Interfaces:
org.springframework.beans.factory.config.Scope

public class PageContext
extends Object
implements org.springframework.beans.factory.config.Scope

This class implements "page" scope for the Spring Framework. This customised scope, specify to Spring that bean affected with this scope are managed/hold just in the current page context. When the page context is reinitialized the bean is recreate. In order to add this scope to you application, add the following to your configuration:

 
   
     
       
         
       
     
   
 
 

Version:
1.0
Author:
Adrien Ruffie / Pierre Smeyers, http://opensuit.ow2.org/

Constructor Summary
PageContext()
           
 
Method Summary
 Object get(String name, org.springframework.beans.factory.ObjectFactory objectFactory)
          The main purpose of this method, is to retrieve the attribute linked with the name provided in function parameter.
 String getConversationId()
           
 void registerDestructionCallback(String name, Runnable callback)
          This method implements a destruction callback linked to, the page context scope.
 Object remove(String name)
          Remove the object with the given name from the page context scope.
 Object resolveContextualObject(String key)
          Spring 3.0.x
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PageContext

public PageContext()
Method Detail

get

public Object get(String name,
                  org.springframework.beans.factory.ObjectFactory objectFactory)
The main purpose of this method, is to retrieve the attribute linked with the name provided in function parameter. If no attached attribute was retrieved to the page context, an instance (possibly shared or independent) of the object managed by this factory can be return.

Specified by:
get in interface org.springframework.beans.factory.config.Scope
Parameters:
name - represent the name attribute which will be search into page context.
objectFactory - Defines a factory which can return an Object instance (possibly shared or independent) when invoked.
Returns:
the desired object (never null)
See Also:
Scope.get(String, ObjectFactory)

getConversationId

public String getConversationId()
Specified by:
getConversationId in interface org.springframework.beans.factory.config.Scope
See Also:
Scope.getConversationId()

registerDestructionCallback

public void registerDestructionCallback(String name,
                                        Runnable callback)
This method implements a destruction callback linked to, the page context scope. This callback can be execute in order to perform destruction of the specified object in the page scope

Specified by:
registerDestructionCallback in interface org.springframework.beans.factory.config.Scope
Parameters:
name - the name of the object located in the page context scope to execute the destruction callback
callback - the destruction callback to be executed.
See Also:
Scope.registerDestructionCallback(String, Runnable)

remove

public Object remove(String name)
Remove the object with the given name from the page context scope.

Returns null if no object was found; otherwise returns the removed Object from page context.

Specified by:
remove in interface org.springframework.beans.factory.config.Scope
Parameters:
name - the name of the object to remove from page context
Returns:
the removed object, or null if object wasn't present in page context
See Also:
Scope.remove(String)

resolveContextualObject

public Object resolveContextualObject(String key)
Spring 3.0.x

Specified by:
resolveContextualObject in interface org.springframework.beans.factory.config.Scope


Copyright © 2008-2012 OW2 Consortium. All Rights Reserved.