T
- public abstract class FilePersisterBase<T extends Model> extends BasePersister<T>
Modifier and Type | Field and Description |
---|---|
protected String |
sortDirection |
protected String |
sortField |
Constructor and Description |
---|
FilePersisterBase() |
Modifier and Type | Method and Description |
---|---|
void |
attachWatcher()
Attach any file system watchers for changed objects
|
abstract T |
doFetchOne(File file) |
List<T> |
fetchAll()
Fetch all the items from the underlying data store.
|
T |
fetchOne(Long id)
Fetch one object with the given ID
|
T |
fetchOne(String filePath) |
T |
fetchOne(T obj)
Re-fetch the passed in object from the underlying data stores
|
FilterChain<T> |
filterChain() |
String |
fullFilePathForId(Long id) |
String |
fullFilePathForObj(T obj) |
String |
getBucketFolderPath() |
abstract Set<String> |
getFileExtensions() |
Map<String,Long> |
getFileToIdMap() |
Map<Long,String> |
getIdToFileMap() |
String |
getItemArrayName() |
void |
hardDelete(T obj)
Permanently delete the object from the datastore
|
void |
init(DataAccessRegistration registration,
ModelController<T> controller,
Stash<T> stash)
Initialize the persister, called during DalRegistery.register
|
boolean |
isManyItemsPerFile() |
Long |
makeIdFromFilePath(String path)
Derives a Long id by hashing the file path and then taking the first 8 bytes
of the path.
|
String |
makePathForObject(T obj) |
boolean |
matchesExtension(String path) |
void |
onPostLoadFromFile(T obj,
String path) |
String |
relativeFilePathForObj(T obj) |
boolean |
reloadIfNewer(T obj)
Reload the object if the version in the datastore is more recent than the
local object
|
FilePersisterBase |
setBucketFolderPath(String bucketFolderPath) |
FilePersisterBase |
setFileToIdMap(Map<String,Long> fileToIdMap) |
FilePersisterBase |
setIdToFileMap(Map<Long,String> idToFileMap) |
FilePersisterBase |
setItemArrayName(String itemArrayName) |
FilePersisterBase |
setManyItemsPerFile(boolean manyItemsPerFile) |
void |
watchEventCallback(String filePath)
Callback for file-based datastores when an object is changed in the file system
|
getBucket, getItemController, getModelClass, getStash, handleFetchOne, isDbBacked, onFetchOne, onPreRead, setBucket, setItemController, setModelClass, setStash
protected String sortDirection
public FilePersisterBase()
public void init(DataAccessRegistration registration, ModelController<T> controller, Stash<T> stash)
Persister
public abstract Set<String> getFileExtensions()
public boolean matchesExtension(String path)
public List<T> fetchAll()
Persister
public T fetchOne(T obj)
Persister
public T fetchOne(Long id)
Persister
public abstract T doFetchOne(File file)
public FilterChain<T> filterChain()
public void hardDelete(T obj)
Persister
public void onPostLoadFromFile(T obj, String path)
public boolean reloadIfNewer(T obj)
Persister
reloadIfNewer
in interface Persister<T extends Model>
reloadIfNewer
in class BasePersister<T extends Model>
public String relativeFilePathForObj(T obj)
public String makePathForObject(T obj)
public String fullFilePathForObj(T obj)
public String fullFilePathForId(Long id)
public void watchEventCallback(String filePath)
Persister
public void attachWatcher()
Persister
public Long makeIdFromFilePath(String path)
path
- public String getBucketFolderPath()
public FilePersisterBase setBucketFolderPath(String bucketFolderPath)
public Map<String,Long> getFileToIdMap()
public FilePersisterBase setFileToIdMap(Map<String,Long> fileToIdMap)
public Map<Long,String> getIdToFileMap()
public FilePersisterBase setIdToFileMap(Map<Long,String> idToFileMap)
public boolean isManyItemsPerFile()
public FilePersisterBase setManyItemsPerFile(boolean manyItemsPerFile)
public String getItemArrayName()
public FilePersisterBase setItemArrayName(String itemArrayName)
Copyright © 2016. All rights reserved.