User: mnf999
Date: 02/03/07 10:23:38
Added: src/main/org/jboss/proxy SecurityInterceptor.java
TransactionInterceptor.java
Log:
2 ez example interceptors
Revision Changes Path
1.1 jboss/src/main/org/jboss/proxy/SecurityInterceptor.java
Index: SecurityInterceptor.java
===================================================================
/*
* JBoss, the OpenSource J2EE webOS
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package org.jboss.proxy;
import java.io.IOException;
import java.io.ObjectOutput;
import java.io.ObjectInput;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.lang.reflect.Method;
import javax.ejb.EJBHome;
import javax.ejb.EJBMetaData;
import javax.ejb.RemoveException;
import javax.ejb.Handle;
import javax.ejb.EJBHome;
import javax.ejb.EJBObject;
import javax.ejb.HomeHandle;
import org.jboss.ejb.CacheKey;
import org.jboss.invocation.Invoker;
import org.jboss.proxy.ejb.handle.HomeHandleImpl;
import org.jboss.invocation.Invocation;
import org.jboss.security.SecurityAssociation;
import org.jboss.security.SimplePrincipal;
/*
import javax.naming.Name;
import org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker;
*/
/**
* The client-side proxy for an EJB Home object.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Marc Fleury</a>
* @version $Revision: 1.1 $
*
* <p><b>2001/11/21: marcf</b>
* <ol>
* <li>Initial checkin
* </ol>
*/
public class SecurityInterceptor
extends Interceptor
{
// Constants -----------------------------------------------------
/** Serial Version Identifier. */
// private static final long serialVersionUID = 432426690456622923L;
// Static --------------------------------------------------------
// Attributes ----------------------------------------------------
// Constructors --------------------------------------------------
/**
* No-argument constructor for externalization.
*/
public SecurityInterceptor() {}
// Public --------------------------------------------------------
public Object invoke(Invocation invocation)
throws Throwable
{
// Get Principal and credentials
invocation.setPrincipal( SecurityAssociation.getPrincipal());
invocation.setCredential(SecurityAssociation.getCredential());
return getNext().invoke(invocation);
}
}
1.1 jboss/src/main/org/jboss/proxy/TransactionInterceptor.java
Index: TransactionInterceptor.java
===================================================================
/*
* JBoss, the OpenSource J2EE webOS
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package org.jboss.proxy;
import java.io.IOException;
import java.io.ObjectOutput;
import java.io.ObjectInput;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.lang.reflect.Method;
import javax.ejb.EJBHome;
import javax.ejb.EJBMetaData;
import javax.ejb.RemoveException;
import javax.ejb.Handle;
import javax.ejb.EJBHome;
import javax.ejb.EJBObject;
import javax.ejb.HomeHandle;
import javax.transaction.TransactionManager;
import org.jboss.ejb.CacheKey;
import org.jboss.proxy.Interceptor;
import org.jboss.invocation.Invoker;
import org.jboss.proxy.ejb.handle.HomeHandleImpl;
import org.jboss.invocation.Invocation;
/*
import javax.naming.Name;
import org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker;
*/
/**
* The client-side proxy for an EJB Home object.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Marc Fleury</a>
* @version $Revision: 1.1 $
*
* <p><b>2001/11/21: marcf</b>
* <ol>
* <li>Initial checkin
* </ol>
*/
public class TransactionInterceptor
extends Interceptor
{
// Constants -----------------------------------------------------
/** Serial Version Identifier. */
// private static final long serialVersionUID = 432426690456622923L;
public static TransactionManager tm;
// Constructors --------------------------------------------------
/**
* No-argument constructor for externalization.
*/
public TransactionInterceptor() {}
// Public --------------------------------------------------------
public Object invoke(Invocation invocation)
throws Throwable
{
if (tm != null)
invocation.setTransaction(tm.getTransaction());
return getNext().invoke(invocation);
}
/** Transaction manager. */
public static void setTransactionManager(TransactionManager tmx) { tm = tmx;}
// Package protected ---------------------------------------------
// Protected -----------------------------------------------------
// Private -------------------------------------------------------
// Inner classes -------------------------------------------------
}
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development