Class AbstractLazyLoadingListener<R,T>
- java.lang.Object
-
- org.projectbarbel.histo.extension.AbstractLazyLoadingListener<R,T>
-
- Type Parameters:
R- the data resource to accessT- the type stored in the resource
- All Implemented Interfaces:
LazyLoadingListenerProtocol<R,T>
- Direct Known Subclasses:
DefaultLazyLoadingListener
public abstract class AbstractLazyLoadingListener<R,T> extends Object implements LazyLoadingListenerProtocol<R,T>
Mongo shadow lazy loading listener implementation to pre-fetch saved data from previous sessions back toBarbelHisto.
The simple listener implementations provide support for allBarbelQueriesand all custom queries as long they use theBarbelQueries.DOCUMENT_IDas a filter criterion. If you run an instance ofBarbelHistoas global singleton in your application set-up, set thesingletonContextflag to true. This will increase performance as data is the listener refuses to refresh data on each retrieve operation. This is safe, if only ever oneBarbelHistoinstance is using the accessed data resource.- Author:
- Niklas Schlimm
-
-
Field Summary
Fields Modifier and Type Field Description protected StringdocumentIdFieldNameprotected booleanfullfetchAllowedprotected com.google.gson.Gsongsonprotected Class<?>managedTypeprotected BarbelModemodeprotected Class<?>persistedTypeprotected Rshadowprotected booleansingletonContext
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractLazyLoadingListener(Class<?> managedType, com.google.gson.Gson gson, boolean singletonContext, boolean fullfetchAllowed)
-
Method Summary
Modifier and Type Method Description abstract StringfromStoredDocumentToPersistenceObjectJson(T document)BitemporalfromStoreDocumentPersistenceObject(T document)voidhandleInitialization(EventType.BarbelInitializedEvent event)voidhandleInitializeJournal(EventType.InitializeJournalEvent event)voidhandleRetrieveData(EventType.RetrieveDataEvent event)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.projectbarbel.histo.extension.LazyLoadingListenerProtocol
getExternalDataResource, queryAll, queryJournal
-
-
-
-
Field Detail
-
managedType
protected final Class<?> managedType
-
persistedType
protected final Class<?> persistedType
-
mode
protected final BarbelMode mode
-
gson
protected final com.google.gson.Gson gson
-
singletonContext
protected final boolean singletonContext
-
fullfetchAllowed
protected final boolean fullfetchAllowed
-
documentIdFieldName
protected final String documentIdFieldName
-
shadow
protected R shadow
-
-
Constructor Detail
-
AbstractLazyLoadingListener
protected AbstractLazyLoadingListener(Class<?> managedType, com.google.gson.Gson gson, boolean singletonContext, boolean fullfetchAllowed)
-
-
Method Detail
-
handleInitialization
public void handleInitialization(EventType.BarbelInitializedEvent event)
- Specified by:
handleInitializationin interfaceLazyLoadingListenerProtocol<R,T>
-
handleRetrieveData
public void handleRetrieveData(EventType.RetrieveDataEvent event)
- Specified by:
handleRetrieveDatain interfaceLazyLoadingListenerProtocol<R,T>
-
handleInitializeJournal
public void handleInitializeJournal(EventType.InitializeJournalEvent event)
- Specified by:
handleInitializeJournalin interfaceLazyLoadingListenerProtocol<R,T>
-
fromStoreDocumentPersistenceObject
public Bitemporal fromStoreDocumentPersistenceObject(T document)
- Specified by:
fromStoreDocumentPersistenceObjectin interfaceLazyLoadingListenerProtocol<R,T>
-
-