[jboss-cvs] JBossCache/src-50/org/jboss/cache/pojo/interceptors ...
Ben Wang
bwang at jboss.com
Thu Jul 13 03:53:24 EDT 2006
User: bwang
Date: 06/07/13 03:53:24
Added: src-50/org/jboss/cache/pojo/interceptors
CheckNonSerializableInterceptor.java
Log:
Added CheckNonSerializableInterceptor to check for marshalling non-serializable pojo.
Revision Changes Path
1.1 date: 2006/07/13 07:53:24; author: bwang; state: Exp;JBossCache/src-50/org/jboss/cache/pojo/interceptors/CheckNonSerializableInterceptor.java
Index: CheckNonSerializableInterceptor.java
===================================================================
/*
* JBoss, Home of Professional Open Source
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package org.jboss.cache.pojo.interceptors;
import org.jboss.aop.joinpoint.Invocation;
import org.jboss.aop.joinpoint.MethodInvocation;
import org.jboss.cache.Fqn;
import org.jboss.cache.pojo.InternalDelegate;
import org.jboss.cache.pojo.util.AopUtil;
/** Interceptor (done via aop advice) to check the validity of the id specified by the user.
* @version $Id: CheckNonSerializableInterceptor.java,v 1.1 2006/07/13 07:53:24 bwang Exp $
*/
public class CheckNonSerializableInterceptor extends AbstractInterceptor
{
private boolean marshallNonSerializable_ = false;
public Object invoke(Invocation in) throws Throwable
{
if(!(in instanceof MethodInvocation))
{
throw new IllegalArgumentException("CheckIdInterceptor.invoke(): invocation not MethodInvocation");
}
MethodInvocation invocation = (MethodInvocation)in;
String id = (String) invocation.getArguments()[0];
Object obj = invocation.getArguments()[1];
if (!marshallNonSerializable_)
{
AopUtil.checkObjectType(obj);
} else
{
log.debug("invoke(): marshallNonSerializable is set to true. We will skip object type checking for id:"
+ id);
}
try {
return invocation.invokeNext(); // proceed to next advice or actual call
} finally {
}
}
public void setMarshallNonSerializable(boolean isTrue)
{
marshallNonSerializable_ = isTrue;
}
}
More information about the jboss-cvs-commits
mailing list