org.nuiton.web.struts2.interceptor
Class OpenTopiaTransactionInterceptor

java.lang.Object
  extended by com.opensymphony.xwork2.interceptor.AbstractInterceptor
      extended by org.nuiton.web.struts2.interceptor.OpenTopiaTransactionInterceptor
All Implemented Interfaces:
com.opensymphony.xwork2.interceptor.Interceptor, Serializable

Deprecated. since 1.6, prefer use the neutral filter org.nuiton.web.filter.TopiaTransactionFilter from nuiton-web module

@Deprecated
public abstract class OpenTopiaTransactionInterceptor
extends com.opensymphony.xwork2.interceptor.AbstractInterceptor

The aim of this Interceptor is to manage a transaction all along a action which implements TopiaTransactionAware contract.

Technicaly, the action will receive only a proxy of a transaction and a real transaction will only be created as soon as a method will be asked on it.

The interceptor is abstract and let user to implement the way how to open a new transaction via the method beginTransaction().

Note that the transaction pushed in the action can be limited using a list of methods to exclude on it. The list of methods to forbid can be customized using the interceptor parameter excludeMethods.

Note also that the transaction is not commited nor closed. If you want the transaction to be closed, you may use CloseTopiaTransactionFilter by adding it to your web.xml file.

This interceptor, as it provides connection to database should be in the interceptor stack before any other interceptor requiring access to database. For example, it is a common behaviour to do such calls in a prepare method, so make sure to place this interceptor before the prepare interceptor.

Interceptor parameters:

Since:
1.5
Author:
tchemit , bleny
See Also:
Serialized Form

Nested Class Summary
 class OpenTopiaTransactionInterceptor.TopiaTransactionProxyInvocationHandler
          Deprecated. Handler of a proxy on a TopiaContext.
 
Field Summary
static String[] DEFAULT_EXCLUDE_METHODS
          Deprecated.  
protected  Set<String> excludeMethods
          Deprecated. names of methods to forbid access while using proxy.
static String TOPIA_TRANSACTION_REQUEST_ATTRIBUTE
          Deprecated.  
 
Constructor Summary
OpenTopiaTransactionInterceptor()
          Deprecated.  
 
Method Summary
protected abstract  org.nuiton.topia.TopiaContext beginTransaction()
          Deprecated. Method to open a new transaction.
 Set<String> getExcludeMethods()
          Deprecated.  
 void init()
          Deprecated.  
 String intercept(com.opensymphony.xwork2.ActionInvocation invocation)
          Deprecated.  
 void setExcludeMethods(String excludeMethods)
          Deprecated.  
 
Methods inherited from class com.opensymphony.xwork2.interceptor.AbstractInterceptor
destroy
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TOPIA_TRANSACTION_REQUEST_ATTRIBUTE

public static final String TOPIA_TRANSACTION_REQUEST_ATTRIBUTE
Deprecated. 
See Also:
Constant Field Values

DEFAULT_EXCLUDE_METHODS

public static final String[] DEFAULT_EXCLUDE_METHODS
Deprecated. 

excludeMethods

protected Set<String> excludeMethods
Deprecated. 
names of methods to forbid access while using proxy.

Constructor Detail

OpenTopiaTransactionInterceptor

public OpenTopiaTransactionInterceptor()
Deprecated. 
Method Detail

getExcludeMethods

public Set<String> getExcludeMethods()
Deprecated. 

setExcludeMethods

public void setExcludeMethods(String excludeMethods)
Deprecated. 

beginTransaction

protected abstract org.nuiton.topia.TopiaContext beginTransaction()
                                                           throws org.nuiton.topia.TopiaException
Deprecated. 
Method to open a new transaction.

Returns:
the new freshly opened transaction
Throws:
org.nuiton.topia.TopiaException - if any problem while opening a new transaction

init

public void init()
Deprecated. 
Specified by:
init in interface com.opensymphony.xwork2.interceptor.Interceptor
Overrides:
init in class com.opensymphony.xwork2.interceptor.AbstractInterceptor

intercept

public String intercept(com.opensymphony.xwork2.ActionInvocation invocation)
                 throws Exception
Deprecated. 
Specified by:
intercept in interface com.opensymphony.xwork2.interceptor.Interceptor
Specified by:
intercept in class com.opensymphony.xwork2.interceptor.AbstractInterceptor
Throws:
Exception


Copyright © 2010-2012 CodeLutin. All Rights Reserved.