Class JDBCSequentialFileFactoryDriver
- java.lang.Object
-
- org.apache.activemq.artemis.jdbc.store.drivers.AbstractJDBCDriver
-
- org.apache.activemq.artemis.jdbc.store.file.JDBCSequentialFileFactoryDriver
-
- Direct Known Subclasses:
Db2SequentialFileDriver,PostgresSequentialSequentialFileDriver
public class JDBCSequentialFileFactoryDriver extends AbstractJDBCDriver
-
-
Field Summary
Fields Modifier and Type Field Description protected StringappendToLargeObjectprotected IntegerappendToLargeObjectResultSetConcurrencyprotected IntegerappendToLargeObjectResultSetTypeprotected StringcopyFileRecordprotected StringcreateFileprotected intcreateFileAutogeneratedKeysprotected String[]createFileColumnNamesprotected StringdeleteFileprotected StringreadLargeObjectprotected StringrenameFileprotected StringselectFileByFileNameprotected StringselectFileNamesByExtension-
Fields inherited from class org.apache.activemq.artemis.jdbc.store.drivers.AbstractJDBCDriver
connectionProvider, sqlProvider
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description longcalculateReadLength(long objectLength, int bufferSpace, long readPosition)voidcopyFileData(JDBCSequentialFile fileFrom, JDBCSequentialFile fileTo)Copy the data content of FileFrom to FileTovoidcreateFile(JDBCSequentialFile file)Creates a new database row representing the supplied file.protected voidcreateSchema()voiddeleteFile(JDBCSequentialFile file)Deletes the associated row in the database.voiddestroy()Drop all tables and datalonggetFileID(JDBCSequentialFile file)Checks to see if a file with filename and extension exists.longgetMaxSize()List<String>listFiles(String extension)voidloadFile(JDBCSequentialFile file)Loads an existing file.voidopenFile(JDBCSequentialFile file)Opens the supplied file.protected voidprepareStatements()intreadFromFile(JDBCSequentialFile file, ByteBuffer bytes)Reads data from the file (at file.readPosition) into the byteBuffer.voidrenameFile(JDBCSequentialFile file, String newFileName)Updates the fileName field to the new value.intwriteToFile(JDBCSequentialFile file, byte[] data, boolean append)Persists data to this files associated database mapping.-
Methods inherited from class org.apache.activemq.artemis.jdbc.store.drivers.AbstractJDBCDriver
createTable, getJdbcConnectionProvider, getSqlProvider, setJdbcConnectionProvider, setSqlProvider, start, stop
-
-
-
-
Field Detail
-
deleteFile
protected String deleteFile
-
createFile
protected String createFile
-
createFileColumnNames
protected String[] createFileColumnNames
-
createFileAutogeneratedKeys
protected int createFileAutogeneratedKeys
-
selectFileByFileName
protected String selectFileByFileName
-
copyFileRecord
protected String copyFileRecord
-
renameFile
protected String renameFile
-
readLargeObject
protected String readLargeObject
-
appendToLargeObject
protected String appendToLargeObject
-
appendToLargeObjectResultSetType
protected Integer appendToLargeObjectResultSetType
-
appendToLargeObjectResultSetConcurrency
protected Integer appendToLargeObjectResultSetConcurrency
-
selectFileNamesByExtension
protected String selectFileNamesByExtension
-
-
Method Detail
-
createSchema
protected void createSchema() throws SQLException- Specified by:
createSchemain classAbstractJDBCDriver- Throws:
SQLException
-
prepareStatements
protected void prepareStatements()
- Specified by:
prepareStatementsin classAbstractJDBCDriver
-
openFile
public void openFile(JDBCSequentialFile file) throws SQLException
Opens the supplied file. If the file does not exist in the database it will create a new one.- Parameters:
file-- Throws:
SQLException
-
getFileID
public long getFileID(JDBCSequentialFile file) throws SQLException
Checks to see if a file with filename and extension exists. If so returns the ID of the file or returns -1.- Parameters:
file-- Returns:
- Throws:
SQLException
-
loadFile
public void loadFile(JDBCSequentialFile file) throws SQLException
Loads an existing file.- Parameters:
file-- Throws:
SQLException
-
createFile
public void createFile(JDBCSequentialFile file) throws SQLException
Creates a new database row representing the supplied file.- Parameters:
file-- Throws:
SQLException
-
renameFile
public void renameFile(JDBCSequentialFile file, String newFileName) throws SQLException
Updates the fileName field to the new value.- Parameters:
file-newFileName-- Throws:
SQLException
-
deleteFile
public void deleteFile(JDBCSequentialFile file) throws SQLException
Deletes the associated row in the database.- Parameters:
file-- Throws:
SQLException
-
writeToFile
public int writeToFile(JDBCSequentialFile file, byte[] data, boolean append) throws SQLException
Persists data to this files associated database mapping.- Parameters:
file-data-- Returns:
- Throws:
SQLException
-
readFromFile
public int readFromFile(JDBCSequentialFile file, ByteBuffer bytes) throws SQLException
Reads data from the file (at file.readPosition) into the byteBuffer.- Parameters:
file-bytes-- Returns:
- Throws:
SQLException
-
copyFileData
public void copyFileData(JDBCSequentialFile fileFrom, JDBCSequentialFile fileTo) throws SQLException
Copy the data content of FileFrom to FileTo- Parameters:
fileFrom-fileTo-- Throws:
SQLException
-
destroy
public void destroy() throws SQLExceptionDrop all tables and data- Overrides:
destroyin classAbstractJDBCDriver- Throws:
SQLException
-
calculateReadLength
public long calculateReadLength(long objectLength, int bufferSpace, long readPosition)
-
getMaxSize
public long getMaxSize()
-
-