Class AbstractBaseFilesystemAction<FILE>
java.lang.Object
com.kingsrook.qqq.backend.module.filesystem.base.actions.AbstractBaseFilesystemAction<FILE>
- Record Components:
FILE
- The class that represents a file in the sub-module. e.g., a java.io.File, or an S3Object.
- Direct Known Subclasses:
AbstractFilesystemAction
,AbstractS3Action
,AbstractSFTPAction
Base class for all Filesystem actions across all modules.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
addBackendDetailsToRecord
(QRecord record, FILE file) Add backend details to a record about the file that it is in.protected void
addBackendDetailsToRecords
(List<QRecord> recordsInFile, FILE file) Add backend details to records about the file that they are in.abstract void
deleteFile
(QTableMetaData table, String fileReference) In contrast with the DeleteAction, which deletes RECORDS - this is a filesystem-(or s3, sftp, etc)-specific extension to delete an entire FILE e.g., for post-ETL.executeCount
(CountInput countInput) protected DeleteOutput
executeDelete
(DeleteInput deleteInput) protected InsertOutput
executeInsert
(InsertInput insertInput) executeQuery
(QueryInput queryInput) Generic implementation of the execute method from the QueryInterfaceprotected <T extends AbstractFilesystemBackendMetaData>
TgetBackendMetaData
(Class<T> outputClass, QBackendMetaData metaData) Get the backend metaData, type-checked as the requested type.abstract Instant
getFileCreateDate
(FILE file) get the createDate of the specified file, null if not supported/availableabstract Instant
getFileModifyDate
(FILE file) get the createDate of the specified file, null if not supported/availableabstract Long
getFileSize
(FILE file) get the size of the specified file, null if not supported/availablegetFullBasePath
(QTableMetaData table, QBackendMetaData backendBase) Append together the backend's base path (if present), with a table's base path (again, if present).abstract String
getFullPathForFile
(FILE file) Get a string that represents the full path to a file.protected <T extends AbstractFilesystemTableBackendDetails>
TgetTableBackendDetails
(Class<T> outputClass, QTableMetaData tableMetaData) Get the backendDetails out of a table, type-checked as the requested typeprotected static boolean
isPathEqualsCriteria
(QFilterCriteria criteria) listFiles
(QTableMetaData table, QBackendMetaData backendBase) List the files for a table - to be implemented in module-specific subclasses.listFiles
(QTableMetaData table, QBackendMetaData backendBase, String requestedSingleFileName) List the files for a table - or optionally, just a single file name - to be implemented in module-specific subclasses.abstract void
moveFile
(QInstance instance, QTableMetaData table, String source, String destination) Move a file from a source path, to a destination path.void
Method that subclasses can override to add post-action things (e.g., closing resources)void
preAction
(QBackendMetaData backendMetaData) Method that subclasses can override to add pre-action things (e.g., setting up s3 client).abstract InputStream
Read the contents of a file - to be implemented in module-specific subclasses.stripBackendAndTableBasePathsFromFileName
(String filePath, QBackendMetaData backend, QTableMetaData table) e.g., with a base path of /foo/ and a table path of /bar/ and a file at /foo/bar/baz.txt give us just the baz.txt part.static String
stripDuplicatedSlashes
(String path) static String
stripLeadingSlash
(String path) static String
stripTrailingSlash
(String path) abstract void
writeFile
(QBackendMetaData backend, QTableMetaData table, QRecord record, String path, byte[] contents) Write a file - to be implemented in module-specific subclasses.void
writeFile
(QBackendMetaData backend, String path, byte[] contents) Deprecated.
-
Field Details
-
backendVariantRecord
-
-
Constructor Details
-
AbstractBaseFilesystemAction
public AbstractBaseFilesystemAction()
-
-
Method Details
-
listFiles
List the files for a table - to be implemented in module-specific subclasses.- Throws:
QException
-
getFileSize
-
getFileCreateDate
-
getFileModifyDate
-
listFiles
public abstract List<FILE> listFiles(QTableMetaData table, QBackendMetaData backendBase, String requestedSingleFileName) throws QException List the files for a table - or optionally, just a single file name - to be implemented in module-specific subclasses.- Throws:
QException
-
readFile
Read the contents of a file - to be implemented in module-specific subclasses.- Throws:
IOException
-
writeFile
@Deprecated(since="call the overload that takes table and record") public void writeFile(QBackendMetaData backend, String path, byte[] contents) throws IOException Deprecated.Legacy signature for this method - before table invalid input: '&' record params were added.- Throws:
IOException
-
writeFile
public abstract void writeFile(QBackendMetaData backend, QTableMetaData table, QRecord record, String path, byte[] contents) throws IOException Write a file - to be implemented in module-specific subclasses.- Throws:
IOException
-
getFullPathForFile
-
deleteFile
public abstract void deleteFile(QTableMetaData table, String fileReference) throws FilesystemException In contrast with the DeleteAction, which deletes RECORDS - this is a filesystem-(or s3, sftp, etc)-specific extension to delete an entire FILE e.g., for post-ETL.- Throws:
FilesystemException
- if the delete is known to have failed, and the file is thought to still exit
-
moveFile
public abstract void moveFile(QInstance instance, QTableMetaData table, String source, String destination) throws FilesystemException Move a file from a source path, to a destination path.- Throws:
FilesystemException
- if the move is known to have failed
-
stripBackendAndTableBasePathsFromFileName
public String stripBackendAndTableBasePathsFromFileName(String filePath, QBackendMetaData backend, QTableMetaData table) e.g., with a base path of /foo/ and a table path of /bar/ and a file at /foo/bar/baz.txt give us just the baz.txt part. -
getFullBasePath
Append together the backend's base path (if present), with a table's base path (again, if present). -
stripDuplicatedSlashes
-
stripLeadingSlash
-
stripTrailingSlash
-
getBackendMetaData
protected <T extends AbstractFilesystemBackendMetaData> T getBackendMetaData(Class<T> outputClass, QBackendMetaData metaData) Get the backend metaData, type-checked as the requested type. -
getTableBackendDetails
protected <T extends AbstractFilesystemTableBackendDetails> T getTableBackendDetails(Class<T> outputClass, QTableMetaData tableMetaData) Get the backendDetails out of a table, type-checked as the requested type -
executeQuery
Generic implementation of the execute method from the QueryInterface- Throws:
QException
-
isPathEqualsCriteria
-
executeCount
- Throws:
QException
-
addBackendDetailsToRecords
-
addBackendDetailsToRecord
-
preAction
Method that subclasses can override to add pre-action things (e.g., setting up s3 client).- Throws:
QException
-
postAction
public void postAction()Method that subclasses can override to add post-action things (e.g., closing resources) -
executeInsert
- Throws:
QException
-
executeDelete
- Throws:
QException
-