Package org.opencms.db.generic
Class CmsStorageVfsDriver
java.lang.Object
org.opencms.db.generic.CmsVfsDriver
org.opencms.db.generic.CmsStorageVfsDriver
- All Implemented Interfaces:
I_CmsDriver,I_CmsVfsDriver
- Direct Known Subclasses:
CmsStorageVfsDriver,CmsStorageVfsDriver,CmsStorageVfsDriver,CmsStorageVfsDriver,CmsStorageVfsDriver,CmsStorageVfsDriver,CmsStorageVfsDriver
Integrates the OpenCms deduplicating media storage engine (DMSE) with VFS content operations.
This driver reads and writes storage identifiers and content hashes alongside VFS content rows. It delegates backend access to the storage manager and supports content in both the regular VFS content columns and storage backends.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.opencms.db.generic.CmsVfsDriver
CmsVfsDriver.RelationConditionMode -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected CmsStorageManagerprotected I_CmsStoredContentInfoCacheThe stored content info cache.Fields inherited from class org.opencms.db.generic.CmsVfsDriver
m_driverManager, m_resOp, m_sqlManager, OFFLINE, ONLINEFields inherited from interface org.opencms.db.I_CmsDriver
AND_CONDITION, BEGIN_CONDITION, BEGIN_EXCLUDE_CONDITION, BEGIN_INCLUDE_CONDITION, END_CONDITION, OR_CONDITIONFields inherited from interface org.opencms.db.I_CmsVfsDriver
DRIVER_TYPE_ID, REQ_ATTR_CHECK_PERMISSIONS, REQ_ATTR_RESOURCE_OUS -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcreateContent(CmsDbContext dbc, CmsUUID projectId, CmsResource resource, byte[] content) Creates a content entry for the specified resource.createFile(CmsDbContext dbc, ResultSet res, CmsUUID projectId) Creates aCmsFileinstance from a JDBC ResultSet.createFile(CmsDbContext dbc, ResultSet res, CmsUUID projectId, boolean hasFileContentInResultSet) Creates aCmsFileinstance from a JDBC ResultSet.voidcreateOnlineContent(CmsDbContext dbc, CmsUUID resourceId, byte[] contents, int publishTag, boolean keepOnline, boolean needToUpdateContent) Creates a new content in the offline project.protected I_CmsStoredContentInfoCacheCreates the stored content info cache.voiddeleteHistoryContent(CmsDbContext dbc, CmsUUID resourceId, int publishTagToKeep) Deletes historical content entries for a resource older than the given publish tag.voiddestroy()Destroys this driver.getAdditionalSqlQueryProperties(CmsParameterConfiguration configuration) Returns additional SQL query property files to load between the generic and database-specific queries.getStoredContentDelivery(CmsDbContext dbc, String storage) Returns a delivery-capable storage backend by its stable storage identifier.voidinit(CmsDbContext dbc, CmsConfigurationManager configurationManager, List<String> successiveDrivers, CmsDriverManager driverManager) Initializes the driver.initSqlManager(String classname) Initializes the SQL manager for this driver.initSqlManager(String classname, List<String> additionalQueryProperties) Initializes the SQL manager for this driver and loads additional SQL query property files.byte[]readContent(CmsDbContext dbc, CmsUUID projectId, CmsUUID resourceId) Reads the content of a file specified by it's resource ID.voidreadContentFrom(CmsDbContext dbc, CmsUUID projectId, CmsUUID resourceId, I_CmsFileContentStreamHandler handler) Reads the content of a file specified by it's resource ID and passes it to an input stream handler.voidreadContentTo(CmsDbContext dbc, CmsUUID projectId, CmsUUID resourceId, OutputStream out) Reads the content of a file specified by it's resource ID and writes it to an output stream.byte[]readHistoryContent(CmsDbContext dbc, CmsUUID resourceId, int publishTag) Reads the historical content of a file specified by its resource ID and publish tag.readStoredContentInfo(CmsDbContext dbc, CmsUUID projectId, CmsResource resource) Reads information about where the content for a file resource is stored without loading the content bytes.voidremoveFile(CmsDbContext dbc, CmsUUID projectId, CmsResource resource) Removes a file physically in the database.voidwriteContent(CmsDbContext dbc, CmsResource resource, byte[] content) Writes the resource content for the specified resource.Methods inherited from class org.opencms.db.generic.CmsVfsDriver
addUrlNameMappingEntry, checkWritePermissionsInFolder, countSiblings, createFolder, createPropertyDefinition, createRelation, createResource, createResource, createSibling, deleteAliases, deletePropertyDefinition, deletePropertyObjects, deleteRelations, deleteRewriteAliases, deleteUrlNameMappingEntries, escapeDbWildcard, getResourceOus, getSqlManager, incrementCounter, insertAlias, insertRewriteAliases, internalCountProperties, internalCreateCounter, internalCreateUrlNameMappingEntry, internalIncrementCounter, internalReadAlias, internalReadCounter, internalReadParentId, internalReadRelation, internalReadResourceState, internalReadStructureState, internalRemoveFolder, internalUpdateVersions, internalValidateResourceLength, moveRelations, moveResource, prepareExpiredTimeRangeCondition, preparePathCondition, prepareProjectCondition, prepareRelationConditions, prepareReleasedTimeRangeCondition, prepareResourceCondition, prepareStateCondition, prepareTimeRangeCondition, prepareTypeCondition, prepareTypesCondition, prepareUrlNameMappingConditions, publishResource, publishVersions, readAliases, readChildResources, readFolder, readFolder, readFolderSizeStats, readParentFolder, readPropertyDefinition, readPropertyDefinitions, readPropertyObject, readPropertyObjects, readRelations, readResource, readResource, readResources, readResourcesForPrincipalACE, readResourcesForPrincipalAttr, readResourcesWithProperty, readResourceTree, readRewriteAliases, readSiblings, readTypesInResourceTree, readUrlNameMappingEntries, readVersions, removeFolder, repairBrokenRelations, replaceResource, setDriverManager, setSqlManager, transferResource, updateBrokenRelations, updateRelations, validateResourceIdExists, validateStructureIdExists, wrapException, writeLastModifiedProjectId, writePropertyObject, writePropertyObjects, writeResource, writeResourceStateMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.opencms.db.I_CmsDriver
toString
-
Field Details
-
m_storageManager
-
m_storedContentInfoCache
The stored content info cache.
-
-
Constructor Details
-
CmsStorageVfsDriver
public CmsStorageVfsDriver()
-
-
Method Details
-
createContent
public void createContent(CmsDbContext dbc, CmsUUID projectId, CmsResource resource, byte[] content) throws CmsDataAccessException Description copied from interface:I_CmsVfsDriverCreates a content entry for the specified resource.- Specified by:
createContentin interfaceI_CmsVfsDriver- Overrides:
createContentin classCmsVfsDriver- Parameters:
dbc- the current database contextprojectId- the id of the current projectresource- the resource to create the content forcontent- the content to write- Throws:
CmsDataAccessException- if something goes wrong- See Also:
-
createFile
public CmsFile createFile(CmsDbContext dbc, ResultSet res, CmsUUID projectId) throws CmsDataAccessException, SQLException Description copied from interface:I_CmsVfsDriverCreates aCmsFileinstance from a JDBC ResultSet.- Specified by:
createFilein interfaceI_CmsVfsDriver- Overrides:
createFilein classCmsVfsDriver- Parameters:
dbc- the current database contextres- the JDBC ResultSetprojectId- the project id- Returns:
- the created file
- Throws:
CmsDataAccessException- if something goes wrongSQLException- in case the result set does not include a requested table attribute- See Also:
-
createFile
public CmsFile createFile(CmsDbContext dbc, ResultSet res, CmsUUID projectId, boolean hasFileContentInResultSet) throws CmsDataAccessException, SQLException Description copied from interface:I_CmsVfsDriverCreates aCmsFileinstance from a JDBC ResultSet.- Specified by:
createFilein interfaceI_CmsVfsDriver- Overrides:
createFilein classCmsVfsDriver- Parameters:
dbc- the current database contextres- the JDBC ResultSetprojectId- the project idhasFileContentInResultSet- flag to include the file content- Returns:
- the created file
- Throws:
CmsDataAccessException- if something goes wrongSQLException- in case the result set does not include a requested table attribute- See Also:
-
createOnlineContent
public void createOnlineContent(CmsDbContext dbc, CmsUUID resourceId, byte[] contents, int publishTag, boolean keepOnline, boolean needToUpdateContent) throws CmsDataAccessException Description copied from interface:I_CmsVfsDriverCreates a new content in the offline project.- Specified by:
createOnlineContentin interfaceI_CmsVfsDriver- Overrides:
createOnlineContentin classCmsVfsDriver- Parameters:
dbc- the current database contextresourceId- the resource id of the content to writecontents- the content to publishpublishTag- the publish tagkeepOnline- if the content is online or has to be put in the historyneedToUpdateContent- if the content blob has to be updated- Throws:
CmsDataAccessException- if something goes wrong- See Also:
-
deleteHistoryContent
public void deleteHistoryContent(CmsDbContext dbc, CmsUUID resourceId, int publishTagToKeep) throws CmsDataAccessException Description copied from interface:I_CmsVfsDriverDeletes historical content entries for a resource older than the given publish tag.- Specified by:
deleteHistoryContentin interfaceI_CmsVfsDriver- Overrides:
deleteHistoryContentin classCmsVfsDriver- Parameters:
dbc- the current database contextresourceId- the id of the resourcepublishTagToKeep- the minimal publish tag to keep- Throws:
CmsDataAccessException- if something goes wrong- See Also:
-
destroy
Description copied from interface:I_CmsVfsDriverDestroys this driver.- Specified by:
destroyin interfaceI_CmsVfsDriver- Overrides:
destroyin classCmsVfsDriver- Throws:
Throwable- if something goes wrong- See Also:
-
getStoredContentDelivery
public I_CmsStorageDelivery getStoredContentDelivery(CmsDbContext dbc, String storage) throws CmsDataAccessException Description copied from interface:I_CmsVfsDriverReturns a delivery-capable storage backend by its stable storage identifier.- Parameters:
dbc- the current database contextstorage- the stable storage identifier- Returns:
- the delivery-capable storage backend, or
nullif not supported by the VFS driver - Throws:
CmsDataAccessException- if something goes wrong- See Also:
-
init
public void init(CmsDbContext dbc, CmsConfigurationManager configurationManager, List<String> successiveDrivers, CmsDriverManager driverManager) Description copied from interface:I_CmsDriverInitializes the driver.- Specified by:
initin interfaceI_CmsDriver- Overrides:
initin classCmsVfsDriver- Parameters:
dbc- the current database contextconfigurationManager- the configuration managersuccessiveDrivers- a list of successive drivers to be initializeddriverManager- the initialized OpenCms driver manager- See Also:
-
initSqlManager
Description copied from interface:I_CmsVfsDriverInitializes the SQL manager for this driver.To obtain JDBC connections from different pools, further {online|offline|history} pool Urls have to be specified.
- Specified by:
initSqlManagerin interfaceI_CmsVfsDriver- Overrides:
initSqlManagerin classCmsVfsDriver- Parameters:
classname- the class name of the SQL manager- Returns:
- the SQL manager for this driver
- See Also:
-
initSqlManager
Description copied from class:CmsVfsDriverInitializes the SQL manager for this driver and loads additional SQL query property files.- Overrides:
initSqlManagerin classCmsVfsDriver- Parameters:
classname- the class name of the SQL manageradditionalQueryProperties- the additional SQL query property files to load- Returns:
- the SQL manager for this driver
- See Also:
-
readContent
public byte[] readContent(CmsDbContext dbc, CmsUUID projectId, CmsUUID resourceId) throws CmsDataAccessException Description copied from interface:I_CmsVfsDriverReads the content of a file specified by it's resource ID.- Specified by:
readContentin interfaceI_CmsVfsDriver- Overrides:
readContentin classCmsVfsDriver- Parameters:
dbc- the current database contextprojectId- the ID of the current projectresourceId- the id of the resource- Returns:
- the file content
- Throws:
CmsDataAccessException- if something goes wrong- See Also:
-
readContentFrom
public void readContentFrom(CmsDbContext dbc, CmsUUID projectId, CmsUUID resourceId, I_CmsFileContentStreamHandler handler) throws CmsDataAccessException Description copied from interface:I_CmsVfsDriverReads the content of a file specified by it's resource ID and passes it to an input stream handler.- Parameters:
dbc- the current database contextprojectId- the ID of the current projectresourceId- the id of the resourcehandler- the stream handler- Throws:
CmsDataAccessException- if something goes wrong- See Also:
-
readContentTo
public void readContentTo(CmsDbContext dbc, CmsUUID projectId, CmsUUID resourceId, OutputStream out) throws CmsDataAccessException Description copied from interface:I_CmsVfsDriverReads the content of a file specified by it's resource ID and writes it to an output stream.- Parameters:
dbc- the current database contextprojectId- the ID of the current projectresourceId- the id of the resourceout- the output stream to write to- Throws:
CmsDataAccessException- if something goes wrong- See Also:
-
readHistoryContent
public byte[] readHistoryContent(CmsDbContext dbc, CmsUUID resourceId, int publishTag) throws CmsDataAccessException Description copied from interface:I_CmsVfsDriverReads the historical content of a file specified by its resource ID and publish tag.- Specified by:
readHistoryContentin interfaceI_CmsVfsDriver- Overrides:
readHistoryContentin classCmsVfsDriver- Parameters:
dbc- the current database contextresourceId- the id of the resourcepublishTag- the publish tag of the historical content- Returns:
- the historical file content
- Throws:
CmsDataAccessException- if something goes wrong- See Also:
-
readStoredContentInfo
public CmsStoredContentInfo readStoredContentInfo(CmsDbContext dbc, CmsUUID projectId, CmsResource resource) throws CmsDataAccessException Description copied from interface:I_CmsVfsDriverReads information about where the content for a file resource is stored without loading the content bytes.- Parameters:
dbc- the current database contextprojectId- the ID of the current projectresource- the resource- Returns:
- the stored content info
- Throws:
CmsDataAccessException- if something goes wrong- See Also:
-
removeFile
public void removeFile(CmsDbContext dbc, CmsUUID projectId, CmsResource resource) throws CmsDataAccessException Description copied from interface:I_CmsVfsDriverRemoves a file physically in the database.- Specified by:
removeFilein interfaceI_CmsVfsDriver- Overrides:
removeFilein classCmsVfsDriver- Parameters:
dbc- the current database contextprojectId- the id of the current projectresource- the resource- Throws:
CmsDataAccessException- if something goes wrong- See Also:
-
writeContent
public void writeContent(CmsDbContext dbc, CmsResource resource, byte[] content) throws CmsDataAccessException Description copied from interface:I_CmsVfsDriverWrites the resource content for the specified resource.- Specified by:
writeContentin interfaceI_CmsVfsDriver- Overrides:
writeContentin classCmsVfsDriver- Parameters:
dbc- the current database contextresource- the resource used to identify the content to updatecontent- the new content of the file- Throws:
CmsDataAccessException- if something goes wrong- See Also:
-
createStoredContentInfoCache
protected I_CmsStoredContentInfoCache createStoredContentInfoCache(CmsStoredContentInfoCacheConfiguration configuration) throws Exception Creates the stored content info cache.- Parameters:
configuration- the cache configuration- Returns:
- the cache
- Throws:
Exception- if the configured factory can not be created
-
getAdditionalSqlQueryProperties
Description copied from class:CmsVfsDriverReturns additional SQL query property files to load between the generic and database-specific queries.- Overrides:
getAdditionalSqlQueryPropertiesin classCmsVfsDriver- Parameters:
configuration- the OpenCms parameter configuration- Returns:
- the additional SQL query property files
- See Also:
-