Class DbFileStorePlugin
- java.lang.Object
-
- io.vertigo.datastore.plugins.filestore.db.DbFileStorePlugin
-
- All Implemented Interfaces:
io.vertigo.core.node.component.Activeable
,io.vertigo.core.node.component.CoreComponent
,io.vertigo.core.node.component.Plugin
,FileStorePlugin
public final class DbFileStorePlugin extends Object implements FileStorePlugin, io.vertigo.core.node.component.Activeable
Permet de gérer les accès atomiques à n'importe quel type de stockage SQL/ non SQL pour les traitements de FileInfo.- Author:
- pchretien, npiedeloup
-
-
Constructor Summary
Constructors Constructor Description DbFileStorePlugin(Optional<String> name, String storeDtDefinitionName, String fileInfoClassName)
Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
checkDefinitionStoreBinding(FileInfoDefinition fileInfoDefinition)
Check this store is the good one for this definition.protected void
checkReadonly()
Check readonly.FileInfo
create(FileInfo fileInfo)
Save a file.void
delete(FileInfoURI uri)
Delete a file.protected static EntityStoreManager
getEntityStoreManager()
Class<? extends FileInfo>
getFileInfoClass()
Get's the FileInfo Class that are handled by the particular pluginString
getFileInfoClassName()
String
getName()
protected static <V> V
getValue(DtObject dto, DtFieldName fieldName, Class<V> valueClass)
Retourne une valeur d'un champ à partir du DtObject.FileInfo
read(FileInfoURI uri)
Load a file by its URI.protected static void
setIdValue(DtObject dto, FileInfoURI uri)
protected static void
setValue(DtObject dto, DtFieldName fieldName, Object value)
Fixe une valeur d'un champ d'un DtObject.void
start()
void
stop()
void
update(FileInfo fileInfo)
Save a file.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.vertigo.datastore.impl.filestore.FileStorePlugin
getName
-
-
-
-
Method Detail
-
start
public void start()
- Specified by:
start
in interfaceio.vertigo.core.node.component.Activeable
-
stop
public void stop()
- Specified by:
stop
in interfaceio.vertigo.core.node.component.Activeable
-
read
public FileInfo read(FileInfoURI uri)
Load a file by its URI.- Specified by:
read
in interfaceFileStorePlugin
- Parameters:
uri
- FileURI requested- Returns:
- FileInfo for this uri (null if not found).
-
create
public FileInfo create(FileInfo fileInfo)
Save a file. Input FileInfo must have an empty URI : insert mode- Specified by:
create
in interfaceFileStorePlugin
- Parameters:
fileInfo
- File to save (creation)- Returns:
- the created FileInfo
-
update
public void update(FileInfo fileInfo)
Save a file. Input FileInfo must have an URI : update mode- Specified by:
update
in interfaceFileStorePlugin
- Parameters:
fileInfo
- File to save (modification)
-
delete
public void delete(FileInfoURI uri)
Delete a file.- Specified by:
delete
in interfaceFileStorePlugin
- Parameters:
uri
- File's URI to remove
-
getFileInfoClass
public Class<? extends FileInfo> getFileInfoClass()
Description copied from interface:FileStorePlugin
Get's the FileInfo Class that are handled by the particular plugin- Specified by:
getFileInfoClass
in interfaceFileStorePlugin
- Returns:
-
getName
public String getName()
- Returns:
- This store name
-
getFileInfoClassName
public String getFileInfoClassName()
- Returns:
- the fileInfo className
-
checkReadonly
protected void checkReadonly()
Check readonly.
-
checkDefinitionStoreBinding
protected void checkDefinitionStoreBinding(FileInfoDefinition fileInfoDefinition)
Check this store is the good one for this definition.- Parameters:
fileInfoDefinition
- Definition du FileInfo
-
getValue
protected static <V> V getValue(DtObject dto, DtFieldName fieldName, Class<V> valueClass)
Retourne une valeur d'un champ à partir du DtObject.- Type Parameters:
V
- Type de la valeur *- Parameters:
dto
- DtObjectfieldName
- Nom du champvalueClass
- Type du champ- Returns:
- Valeur typé du champ
-
setValue
protected static void setValue(DtObject dto, DtFieldName fieldName, Object value)
Fixe une valeur d'un champ d'un DtObject.- Parameters:
dto
- DtObjectfieldName
- Nom du champsvalue
- Valeur
-
setIdValue
protected static void setIdValue(DtObject dto, FileInfoURI uri)
- Parameters:
dto
- DtObjectvalue
- Pk value
-
getEntityStoreManager
protected static EntityStoreManager getEntityStoreManager()
- Returns:
- StoreManager
-
-