Package com.adaptris.core.fs
Class MarshallingItemCache
- java.lang.Object
-
- com.adaptris.core.fs.InlineItemCache
-
- com.adaptris.core.fs.MarshallingItemCache
-
- All Implemented Interfaces:
ComponentLifecycle
,ProcessedItemCache
- Direct Known Subclasses:
XStreamItemCache
public abstract class MarshallingItemCache extends InlineItemCache
Extension toInlineItemCache
that stores the procssed items to disk.The items are stored and to disk upon close() and save() respectively; Items are only read from disk upon init(). If multiple instances of this class point to the same persistentStore then results are undefined.
-
-
Field Summary
-
Fields inherited from class com.adaptris.core.fs.InlineItemCache
cache, logR
-
-
Constructor Summary
Constructors Constructor Description MarshallingItemCache()
Default Constructor PersistentStore = System.getProperty("user.dir")+ "/uniqueid"MarshallingItemCache(java.lang.String store)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
close()
Closes the component.java.lang.String
getPersistentStore()
void
init()
Initialises the component.protected abstract AdaptrisMarshaller
initMarshaller()
void
save()
Explicitly save the state of the cache.void
setPersistentStore(java.lang.String filename)
-
Methods inherited from class com.adaptris.core.fs.InlineItemCache
clear, contains, evict, get, getAgeBeforeEviction, setAgeBeforeEviction, size, start, stop, update, update
-
-
-
-
Constructor Detail
-
MarshallingItemCache
public MarshallingItemCache() throws java.lang.Exception
Default Constructor- PersistentStore = System.getProperty("user.dir")+ "/uniqueid"
- Throws:
java.lang.Exception
-
MarshallingItemCache
public MarshallingItemCache(java.lang.String store) throws java.lang.Exception
- Throws:
java.lang.Exception
-
-
Method Detail
-
initMarshaller
protected abstract AdaptrisMarshaller initMarshaller() throws java.lang.Exception
- Throws:
java.lang.Exception
-
init
public void init() throws CoreException
Description copied from interface:ComponentLifecycle
Initialises the component.Component initialisation includes config verification, creation of connections etc.
- Specified by:
init
in interfaceComponentLifecycle
- Overrides:
init
in classInlineItemCache
- Throws:
CoreException
- wrapping any underlyingException
s
-
close
public void close()
Description copied from interface:ComponentLifecycle
Closes the component.A closed component should release any connections it uses, etc. and clean up completely. Throwing a
RuntimeException
may cause unintended consequences- Specified by:
close
in interfaceComponentLifecycle
- Overrides:
close
in classInlineItemCache
-
save
public void save()
Description copied from interface:ProcessedItemCache
Explicitly save the state of the cache.- Specified by:
save
in interfaceProcessedItemCache
- Overrides:
save
in classInlineItemCache
-
getPersistentStore
public java.lang.String getPersistentStore()
- Returns:
- the filename
-
setPersistentStore
public void setPersistentStore(java.lang.String filename)
- Parameters:
filename
- the file where to store cached items.
-
-