org.jboss.cache.marshall
Class AbstractMarshaller

java.lang.Object
  extended by org.jboss.cache.marshall.AbstractMarshaller
All Implemented Interfaces:
Marshaller, org.jgroups.blocks.RpcDispatcher.Marshaller
Direct Known Subclasses:
CacheMarshaller200, VersionAwareMarshaller

public abstract class AbstractMarshaller
extends java.lang.Object
implements Marshaller

Abstract AbstractMarshaller for JBoss Cache.

Author:
Manik Surtani (manik@jboss.org)

Field Summary
protected  boolean defaultInactive
           
protected  RegionManager regionManager
           
protected  boolean useRegionBasedMarshalling
           
 
Constructor Summary
AbstractMarshaller()
           
 
Method Summary
protected  Fqn extractFqn(MethodCall methodCall)
           
protected  Fqn extractFqnFromListOfMethodCall(MethodCall call)
          This is "replicate" call with a list of MethodCall argument.
protected  Fqn extractFqnFromMethodCall(MethodCall call)
          This is "replicate" call with a single MethodCall argument.
protected  Region getRegion(Fqn fqn)
          Retrieves the Region from the RegionManager after taking into account that this may be a Buddy Backup Fqn.
protected  void init(RegionManager manager, boolean defaultInactive, boolean useRegionBasedMarshalling)
           
 java.lang.Object objectFromByteBuffer(byte[] bytes)
           
 java.lang.Object objectFromStream(java.io.InputStream in)
          Unmarshalls an object from an InputStream
 byte[] objectToByteBuffer(java.lang.Object obj)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jboss.cache.marshall.Marshaller
objectFromObjectStream, objectToObjectStream, objectToObjectStream
 

Field Detail

useRegionBasedMarshalling

protected boolean useRegionBasedMarshalling

regionManager

protected RegionManager regionManager

defaultInactive

protected boolean defaultInactive
Constructor Detail

AbstractMarshaller

public AbstractMarshaller()
Method Detail

init

protected void init(RegionManager manager,
                    boolean defaultInactive,
                    boolean useRegionBasedMarshalling)

objectToByteBuffer

public byte[] objectToByteBuffer(java.lang.Object obj)
                          throws java.lang.Exception
Specified by:
objectToByteBuffer in interface org.jgroups.blocks.RpcDispatcher.Marshaller
Throws:
java.lang.Exception

objectFromByteBuffer

public java.lang.Object objectFromByteBuffer(byte[] bytes)
                                      throws java.lang.Exception
Specified by:
objectFromByteBuffer in interface org.jgroups.blocks.RpcDispatcher.Marshaller
Throws:
java.lang.Exception

objectFromStream

public java.lang.Object objectFromStream(java.io.InputStream in)
                                  throws java.lang.Exception
Description copied from interface: Marshaller
Unmarshalls an object from an InputStream

Specified by:
objectFromStream in interface Marshaller
Parameters:
in - stream to unmarshall from
Returns:
Object from stream passed in.
Throws:
java.lang.Exception

extractFqnFromMethodCall

protected Fqn extractFqnFromMethodCall(MethodCall call)
This is "replicate" call with a single MethodCall argument.

Parameters:
call -

extractFqnFromListOfMethodCall

protected Fqn extractFqnFromListOfMethodCall(MethodCall call)
This is "replicate" call with a list of MethodCall argument.

Parameters:
call -

extractFqn

protected Fqn extractFqn(MethodCall methodCall)

getRegion

protected Region getRegion(Fqn fqn)
Retrieves the Region from the RegionManager after taking into account that this may be a Buddy Backup Fqn. If the fqn passed in is null, the region has been deactivated or if a region cannot be found, this method returns a null.

Parameters:
fqn - of the region to locate
Returns:
a region