com.amazon.carbonado.raw
Interface RawSupport<S extends Storable>

All Superinterfaces:
MasterSupport<S>, StorableSupport<S>, TriggerSupport<S>

public interface RawSupport<S extends Storable>
extends MasterSupport<S>

Provides runtime support for Storable classes generated by RawStorableGenerator.

Author:
Brian S O'Neill

Method Summary
 void decode(S dest, int generation, byte[] data)
          Used for decoding different generations of Storable.
 Blob getBlob(S storable, String name, long locator)
          Returns the Blob for the given locator, returning null if not found.
 Clob getClob(S storable, String name, long locator)
          Returns the Clob for the given locator, returning null if not found.
 long getLocator(Blob blob)
          Returns the locator for the given Blob, returning zero if null.
 long getLocator(Clob clob)
          Returns the locator for the given Clob, returning zero if null.
 void store(S storable, byte[] key, byte[] value)
          Try to store the entry referenced by the given key with the given value.
 boolean tryDelete(S storable, byte[] key)
          Try to delete the entry referenced by the given key.
 boolean tryInsert(S storable, byte[] key, byte[] value)
          Try to insert the entry referenced by the given key with the given value.
 byte[] tryLoad(S storable, byte[] key)
          Try to load the entry referenced by the given key, but return null if not found.
 
Methods inherited from interface com.amazon.carbonado.gen.MasterSupport
getSequenceValueProducer
 
Methods inherited from interface com.amazon.carbonado.gen.TriggerSupport
getDeleteTrigger, getInsertTrigger, getLoadTrigger, getUpdateTrigger, locallyDisableLoadTrigger, locallyEnableLoadTrigger
 
Methods inherited from interface com.amazon.carbonado.gen.StorableSupport
getRootRepository, isPropertySupported
 

Method Detail

tryLoad

byte[] tryLoad(S storable,
               byte[] key)
               throws FetchException
Try to load the entry referenced by the given key, but return null if not found.

Parameters:
storable - user storable which will have its properties set
key - non-null key to search for
Returns:
non-null value that was found, or null if not found
Throws:
FetchException

tryInsert

boolean tryInsert(S storable,
                  byte[] key,
                  byte[] value)
                  throws PersistException
Try to insert the entry referenced by the given key with the given value.

Parameters:
storable - user storable that key and value were derived from
key - non-null key to insert
value - non-null value to insert
Returns:
false if unique constraint prevents insert
Throws:
PersistException

store

void store(S storable,
           byte[] key,
           byte[] value)
           throws PersistException
Try to store the entry referenced by the given key with the given value. If the entry does not exist, insert it. Otherwise, update it.

Parameters:
storable - user storable that key and value were derived from
key - non-null key to store
value - non-null value to store
Throws:
PersistException

tryDelete

boolean tryDelete(S storable,
                  byte[] key)
                  throws PersistException
Try to delete the entry referenced by the given key.

Parameters:
storable - user supplied storable object
key - non-null key to delete
Returns:
true if entry existed and is now deleted
Throws:
PersistException

getBlob

Blob getBlob(S storable,
             String name,
             long locator)
             throws FetchException
Returns the Blob for the given locator, returning null if not found.

Parameters:
storable - storable that contains Blob
name - name of Blob property
locator - Blob locator
Throws:
FetchException

getLocator

long getLocator(Blob blob)
                throws PersistException
Returns the locator for the given Blob, returning zero if null.

Throws:
PersistException - if blob is unrecognized

getClob

Clob getClob(S storable,
             String name,
             long locator)
             throws FetchException
Returns the Clob for the given locator, returning null if not found.

Parameters:
storable - storable that contains Blob
name - name of Clob property
locator - Clob locator
Throws:
FetchException

getLocator

long getLocator(Clob clob)
                throws PersistException
Returns the locator for the given Clob, returning zero if null.

Throws:
PersistException - if blob is unrecognized

decode

void decode(S dest,
            int generation,
            byte[] data)
            throws CorruptEncodingException
Used for decoding different generations of Storable. If layout generations are not supported, simply throw a CorruptEncodingException.

Parameters:
dest - storable to receive decoded properties
generation - storable layout generation number
data - decoded into properties, some of which may be dropped if destination storable doesn't have it
Throws:
CorruptEncodingException - if generation is unknown or if data cannot be decoded
Since:
1.2.1


Copyright © 2006-2009 Amazon Technologies, Inc.. All Rights Reserved.