org.objectweb.medor.eval.prefetch.lib
Class PrefetchCacheImpl

java.lang.Object
  extended byorg.objectweb.medor.eval.prefetch.lib.PrefetchCacheImpl
All Implemented Interfaces:
PrefetchCache

public class PrefetchCacheImpl
extends java.lang.Object
implements PrefetchCache

Author:
P. Dechamboux

Constructor Summary
PrefetchCacheImpl()
           
PrefetchCacheImpl(Logger logger)
           
 
Method Summary
 PrefetchBuffer createPrefetchBuffer(PrefetchBufferFactory pbf, java.lang.Object cat, java.lang.Object ctxt, int indexpos, boolean register)
          Allocates a prefetched buffer for the object category and the connection context in order to register prefetched tuples.
 PrefetchBuffer createPrefetchBuffer(PrefetchBufferFactory pbf, java.lang.Object cat, java.lang.Object ctxt, int indexpos, boolean multithread, boolean register)
          Allocates a prefetched buffer for the object category and the connection context in order to register prefetched tuples.
 Logger getLogger()
           
 Tuple getPrefetchTuple(java.lang.Object index, java.lang.Object cat, java.lang.Object ctxt)
          Retrieves the prefetched tuple from this cache associated with this index information, within the given caching context.
 TupleCollection getPrefetchTupleCollection(java.lang.Object index, java.lang.Object cat, java.lang.Object ctxt)
          Same as getPrefetchTuple, except it returns the TupleCollection.
 void invalidatePrefetchBuffer(java.lang.Object ctxt)
          Invalidates all the prefetched tuples that are associated with the given caching connection context.
static java.lang.String printTuple(Tuple t)
           
 boolean registerPrefetchBuffer(PrefetchBuffer pb, java.lang.Object cat, java.lang.Object ctxt)
          Register the prefetched buffer pb for the object category and the connection context in order to register prefetched tuples.
 void setLogger(Logger logger)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PrefetchCacheImpl

public PrefetchCacheImpl()

PrefetchCacheImpl

public PrefetchCacheImpl(Logger logger)
Method Detail

getLogger

public Logger getLogger()

setLogger

public void setLogger(Logger logger)

getPrefetchTuple

public Tuple getPrefetchTuple(java.lang.Object index,
                              java.lang.Object cat,
                              java.lang.Object ctxt)
                       throws MedorException
Description copied from interface: PrefetchCache
Retrieves the prefetched tuple from this cache associated with this index information, within the given caching context. The prefetched tuple also belongs to the given object category.

Specified by:
getPrefetchTuple in interface PrefetchCache
Parameters:
index - The index that allows the yielded prefetched data item to be identified into the cache.
cat - The category (e.g., class) to which the objects, that can be built using the prefetched data, belong to.
ctxt - The caching context within which the data has been prefetched.
Returns:
The prefetched tuple.
Throws:
MedorException

getPrefetchTupleCollection

public TupleCollection getPrefetchTupleCollection(java.lang.Object index,
                                                  java.lang.Object cat,
                                                  java.lang.Object ctxt)
                                           throws MedorException
Description copied from interface: PrefetchCache
Same as getPrefetchTuple, except it returns the TupleCollection.

Specified by:
getPrefetchTupleCollection in interface PrefetchCache
Throws:
MedorException

invalidatePrefetchBuffer

public void invalidatePrefetchBuffer(java.lang.Object ctxt)
Description copied from interface: PrefetchCache
Invalidates all the prefetched tuples that are associated with the given caching connection context.

Specified by:
invalidatePrefetchBuffer in interface PrefetchCache
Parameters:
ctxt - The invalid caching context.

createPrefetchBuffer

public PrefetchBuffer createPrefetchBuffer(PrefetchBufferFactory pbf,
                                           java.lang.Object cat,
                                           java.lang.Object ctxt,
                                           int indexpos,
                                           boolean register)
                                    throws MedorException
Description copied from interface: PrefetchCache
Allocates a prefetched buffer for the object category and the connection context in order to register prefetched tuples.

Specified by:
createPrefetchBuffer in interface PrefetchCache
Parameters:
pbf - The factory for creating actual PrefetchBuffer
cat - The associated object category.
ctxt - The associated caching context.
indexpos - The position of the index field within the prefetched tuples.
register - if true, call the register method
Returns:
The allocated PrefetchBuffer.
Throws:
MedorException

createPrefetchBuffer

public PrefetchBuffer createPrefetchBuffer(PrefetchBufferFactory pbf,
                                           java.lang.Object cat,
                                           java.lang.Object ctxt,
                                           int indexpos,
                                           boolean multithread,
                                           boolean register)
                                    throws MedorException
Description copied from interface: PrefetchCache
Allocates a prefetched buffer for the object category and the connection context in order to register prefetched tuples.

Specified by:
createPrefetchBuffer in interface PrefetchCache
Parameters:
pbf - The factory for creating actual PrefetchBuffer
cat - The associated object category.
ctxt - The associated caching context.
indexpos - The position of the index field within the prefetched
multithread - indicates if the context is used by several threads
register - if true, call the register method
Returns:
The allocated PrefetchBuffer.
Throws:
MedorException

registerPrefetchBuffer

public boolean registerPrefetchBuffer(PrefetchBuffer pb,
                                      java.lang.Object cat,
                                      java.lang.Object ctxt)
                               throws MedorException
Description copied from interface: PrefetchCache
Register the prefetched buffer pb for the object category and the connection context in order to register prefetched tuples.

Specified by:
registerPrefetchBuffer in interface PrefetchCache
Parameters:
cat - The associated object category.
ctxt - The associated caching context.
Returns:
true if the registration is done, false else
Throws:
MedorException

printTuple

public static java.lang.String printTuple(Tuple t)