[jbosscache-commits] JBoss Cache SVN: r6947 - core/branches/flat/src/main/java/org/jboss/starobrno/interceptors.
jbosscache-commits at lists.jboss.org
jbosscache-commits at lists.jboss.org
Tue Oct 14 13:50:19 EDT 2008
Author: mircea.markus
Date: 2008-10-14 13:50:19 -0400 (Tue, 14 Oct 2008)
New Revision: 6947
Modified:
core/branches/flat/src/main/java/org/jboss/starobrno/interceptors/MarshalledValueInterceptor.java
Log:
Modified: core/branches/flat/src/main/java/org/jboss/starobrno/interceptors/MarshalledValueInterceptor.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/starobrno/interceptors/MarshalledValueInterceptor.java 2008-10-14 17:50:03 UTC (rev 6946)
+++ core/branches/flat/src/main/java/org/jboss/starobrno/interceptors/MarshalledValueInterceptor.java 2008-10-14 17:50:19 UTC (rev 6947)
@@ -27,9 +27,9 @@
import org.jboss.starobrno.commands.write.RemoveCommand;
import org.jboss.starobrno.context.InvocationContext;
import org.jboss.starobrno.interceptors.base.CommandInterceptor;
-import org.jboss.starobrno.marshall.MarshalledValue;
-import org.jboss.starobrno.marshall.MarshalledValueHelper;
-//import org.jboss.starobrno.marshall.MarshalledValueHelper;
+import org.jboss.starobrno.marshall.MarshalledValue2;
+import org.jboss.starobrno.marshall.MarshalledValueHelper2;
+//import org.jboss.starobrno.marshall.MarshalledValueHelper2;
import java.io.IOException;
import java.io.NotSerializableException;
@@ -40,14 +40,14 @@
import java.util.Set;
/**
- * Interceptor that handles the wrapping and unwrapping of cached data using {@link MarshalledValue}s.
+ * Interceptor that handles the wrapping and unwrapping of cached data using {@link org.jboss.starobrno.marshall.MarshalledValue2}s.
* Known "excluded" types are not wrapped/unwrapped, which at this time include {@link String}, Java primitives
* and their Object wrappers, as well as arrays of excluded types.
* <p/>
- * The {@link MarshalledValue} wrapper handles lazy deserialization from byte array representations.
+ * The {@link org.jboss.starobrno.marshall.MarshalledValue2} wrapper handles lazy deserialization from byte array representations.
*
* @author Manik Surtani (<a href="mailto:manik at jboss.org">manik at jboss.org</a>)
- * @see MarshalledValue
+ * @see org.jboss.starobrno.marshall.MarshalledValue2
* @since 2.1.0
*/
public class MarshalledValueInterceptor extends CommandInterceptor
@@ -55,7 +55,7 @@
@Override
public Object visitPutMapCommand(InvocationContext ctx, PutMapCommand command) throws Throwable
{
- Set<MarshalledValue> marshalledValues = new HashSet<MarshalledValue>();
+ Set<MarshalledValue2> marshalledValues = new HashSet<MarshalledValue2>();
command.setMap(wrapMap(command.getMap(), marshalledValues, ctx));
Object retVal = invokeNextInterceptor(ctx, command);
@@ -65,13 +65,13 @@
@Override
public Object visitPutKeyValueCommand(InvocationContext ctx, PutKeyValueCommand command) throws Throwable
{
- Set<MarshalledValue> marshalledValues = new HashSet<MarshalledValue>();
- if (!MarshalledValueHelper.isTypeExcluded(command.getKey().getClass()))
+ Set<MarshalledValue2> marshalledValues = new HashSet<MarshalledValue2>();
+ if (!MarshalledValueHelper2.isTypeExcluded(command.getKey().getClass()))
{
Object newKey = createAndAddMarshalledValue(command.getKey(), marshalledValues, ctx);
command.setKey(newKey);
}
- if (!MarshalledValueHelper.isTypeExcluded(command.getValue().getClass()))
+ if (!MarshalledValueHelper2.isTypeExcluded(command.getValue().getClass()))
{
Object value = createAndAddMarshalledValue(command.getValue(), marshalledValues, ctx);
command.setValue(value);
@@ -83,8 +83,8 @@
@Override
public Object visitRemoveCommand(InvocationContext ctx, RemoveCommand command) throws Throwable
{
- Set<MarshalledValue> marshalledValues = new HashSet<MarshalledValue>();
- if (!MarshalledValueHelper.isTypeExcluded(command.getKey().getClass()))
+ Set<MarshalledValue2> marshalledValues = new HashSet<MarshalledValue2>();
+ if (!MarshalledValueHelper2.isTypeExcluded(command.getKey().getClass()))
{
Object value = createAndAddMarshalledValue(command.getKey(), marshalledValues, ctx);
command.setKey(value);
@@ -96,8 +96,8 @@
@Override
public Object visitGetKeyValueCommand(InvocationContext ctx, GetKeyValueCommand command) throws Throwable
{
- Set<MarshalledValue> marshalledValues = new HashSet<MarshalledValue>();
- if (!MarshalledValueHelper.isTypeExcluded(command.getKey().getClass()))
+ Set<MarshalledValue2> marshalledValues = new HashSet<MarshalledValue2>();
+ if (!MarshalledValueHelper2.isTypeExcluded(command.getKey().getClass()))
{
Object value = createAndAddMarshalledValue(command.getKey(), marshalledValues, ctx);
command.setKey(value);
@@ -106,11 +106,11 @@
return compactAndProcessRetVal(marshalledValues, retVal);
}
- private Object compactAndProcessRetVal(Set<MarshalledValue> marshalledValues, Object retVal)
+ private Object compactAndProcessRetVal(Set<MarshalledValue2> marshalledValues, Object retVal)
throws IOException, ClassNotFoundException
{
if (trace) log.trace("Compacting MarshalledValues created");
- for (MarshalledValue mv : marshalledValues) mv.compact(false, false);
+ for (MarshalledValue2 mv : marshalledValues) mv.compact(false, false);
return processRetVal(retVal);
}
@@ -118,16 +118,16 @@
private Object processRetVal(Object retVal)
throws IOException, ClassNotFoundException
{
- if (retVal instanceof MarshalledValue)
+ if (retVal instanceof MarshalledValue2)
{
- if (trace) log.trace("Return value is a MarshalledValue. Unwrapping.");
- retVal = ((MarshalledValue) retVal).get();
+ if (trace) log.trace("Return value is a MarshalledValue2. Unwrapping.");
+ retVal = ((MarshalledValue2) retVal).get();
}
return retVal;
}
@SuppressWarnings("unchecked")
- protected Map wrapMap(Map<Object, Object> m, Set<MarshalledValue> marshalledValues, InvocationContext ctx) throws NotSerializableException
+ protected Map wrapMap(Map<Object, Object> m, Set<MarshalledValue2> marshalledValues, InvocationContext ctx) throws NotSerializableException
{
if (m == null)
{
@@ -140,15 +140,15 @@
{
Object key = me.getKey();
Object value = me.getValue();
- copy.put((key == null || MarshalledValueHelper.isTypeExcluded(key.getClass())) ? key : createAndAddMarshalledValue(key, marshalledValues, ctx),
- (value == null || MarshalledValueHelper.isTypeExcluded(value.getClass())) ? value : createAndAddMarshalledValue(value, marshalledValues, ctx));
+ copy.put((key == null || MarshalledValueHelper2.isTypeExcluded(key.getClass())) ? key : createAndAddMarshalledValue(key, marshalledValues, ctx),
+ (value == null || MarshalledValueHelper2.isTypeExcluded(value.getClass())) ? value : createAndAddMarshalledValue(value, marshalledValues, ctx));
}
return copy;
}
- protected MarshalledValue createAndAddMarshalledValue(Object toWrap, Set<MarshalledValue> marshalledValues, InvocationContext ctx) throws NotSerializableException
+ protected MarshalledValue2 createAndAddMarshalledValue(Object toWrap, Set<MarshalledValue2> marshalledValues, InvocationContext ctx) throws NotSerializableException
{
- MarshalledValue mv = new MarshalledValue(toWrap);
+ MarshalledValue2 mv = new MarshalledValue2(toWrap);
marshalledValues.add(mv);
if (!ctx.isOriginLocal()) mv.setEqualityPreferenceForInstance(false);
return mv;
More information about the jbosscache-commits
mailing list