Class AbstractS3Action
java.lang.Object
com.kingsrook.qqq.backend.module.filesystem.base.actions.AbstractBaseFilesystemAction<com.amazonaws.services.s3.model.S3ObjectSummary>
com.kingsrook.qqq.backend.module.filesystem.s3.actions.AbstractS3Action
- Direct Known Subclasses:
S3CountAction
,S3DeleteAction
,S3InsertAction
,S3QueryAction
,S3StorageAction
public class AbstractS3Action
extends AbstractBaseFilesystemAction<com.amazonaws.services.s3.model.S3ObjectSummary>
Base class for all S3 filesystem actions
-
Field Summary
Fields inherited from class com.kingsrook.qqq.backend.module.filesystem.base.actions.AbstractBaseFilesystemAction
backendVariantRecord
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected com.amazonaws.services.s3.AmazonS3
buildAmazonS3ClientFromBackendMetaData
(QBackendMetaData backendMetaData) 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.getFileCreateDate
(com.amazonaws.services.s3.model.S3ObjectSummary s3ObjectSummary) get the createDate of the specified file, null if not supported/availablegetFileModifyDate
(com.amazonaws.services.s3.model.S3ObjectSummary s3ObjectSummary) get the createDate of the specified file, null if not supported/availablegetFileSize
(com.amazonaws.services.s3.model.S3ObjectSummary s3ObjectSummary) get the size of the specified file, null if not supported/availablegetFullPathForFile
(com.amazonaws.services.s3.model.S3ObjectSummary s3ObjectSummary) Get a string that represents the full path to a file.protected S3Utils
Internal accessor for the s3Utils object - should always use this, not the field.List
<com.amazonaws.services.s3.model.S3ObjectSummary> listFiles
(QTableMetaData table, QBackendMetaData backendBase, String requestedPath) List the files for a table.void
moveFile
(QInstance instance, QTableMetaData table, String source, String destination) 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.void
preAction
(QBackendMetaData backendMetaData) Setup the s3 utils object to be used for this action.readFile
(com.amazonaws.services.s3.model.S3ObjectSummary s3ObjectSummary) Read the contents of a file.void
setS3Utils
(S3Utils s3Utils) Set the S3Utils object.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.void
writeFile
(QBackendMetaData backendMetaData, QTableMetaData table, QRecord record, String path, byte[] contents) Write a file - to be implemented in module-specific subclasses.Methods inherited from class com.kingsrook.qqq.backend.module.filesystem.base.actions.AbstractBaseFilesystemAction
addBackendDetailsToRecord, addBackendDetailsToRecords, executeCount, executeDelete, executeInsert, executeQuery, getBackendMetaData, getFullBasePath, getTableBackendDetails, isPathEqualsCriteria, listFiles, postAction, stripDuplicatedSlashes, stripLeadingSlash, stripTrailingSlash, writeFile
-
Constructor Details
-
AbstractS3Action
public AbstractS3Action()
-
-
Method Details
-
getFileSize
Description copied from class:AbstractBaseFilesystemAction
get the size of the specified file, null if not supported/available- Specified by:
getFileSize
in classAbstractBaseFilesystemAction<com.amazonaws.services.s3.model.S3ObjectSummary>
-
getFileCreateDate
Description copied from class:AbstractBaseFilesystemAction
get the createDate of the specified file, null if not supported/available- Specified by:
getFileCreateDate
in classAbstractBaseFilesystemAction<com.amazonaws.services.s3.model.S3ObjectSummary>
-
getFileModifyDate
Description copied from class:AbstractBaseFilesystemAction
get the createDate of the specified file, null if not supported/available- Specified by:
getFileModifyDate
in classAbstractBaseFilesystemAction<com.amazonaws.services.s3.model.S3ObjectSummary>
-
preAction
Setup the s3 utils object to be used for this action.- Overrides:
preAction
in classAbstractBaseFilesystemAction<com.amazonaws.services.s3.model.S3ObjectSummary>
- Throws:
QException
-
buildAmazonS3ClientFromBackendMetaData
protected com.amazonaws.services.s3.AmazonS3 buildAmazonS3ClientFromBackendMetaData(QBackendMetaData backendMetaData) -
setS3Utils
Set the S3Utils object. -
getS3Utils
Internal accessor for the s3Utils object - should always use this, not the field. -
listFiles
public List<com.amazonaws.services.s3.model.S3ObjectSummary> listFiles(QTableMetaData table, QBackendMetaData backendBase, String requestedPath) throws QException List the files for a table.- Specified by:
listFiles
in classAbstractBaseFilesystemAction<com.amazonaws.services.s3.model.S3ObjectSummary>
- Throws:
QException
-
readFile
public InputStream readFile(com.amazonaws.services.s3.model.S3ObjectSummary s3ObjectSummary) throws IOException Read the contents of a file.- Specified by:
readFile
in classAbstractBaseFilesystemAction<com.amazonaws.services.s3.model.S3ObjectSummary>
- Throws:
IOException
-
writeFile
public void writeFile(QBackendMetaData backendMetaData, QTableMetaData table, QRecord record, String path, byte[] contents) throws IOException Write a file - to be implemented in module-specific subclasses.- Specified by:
writeFile
in classAbstractBaseFilesystemAction<com.amazonaws.services.s3.model.S3ObjectSummary>
- Throws:
IOException
-
getFullPathForFile
Get a string that represents the full path to a file.- Specified by:
getFullPathForFile
in classAbstractBaseFilesystemAction<com.amazonaws.services.s3.model.S3ObjectSummary>
-
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.- Overrides:
stripBackendAndTableBasePathsFromFileName
in classAbstractBaseFilesystemAction<com.amazonaws.services.s3.model.S3ObjectSummary>
-
deleteFile
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.- Specified by:
deleteFile
in classAbstractBaseFilesystemAction<com.amazonaws.services.s3.model.S3ObjectSummary>
- Throws:
FilesystemException
- if the delete is known to have failed, and the file is thought to still exit
-
moveFile
public void moveFile(QInstance instance, QTableMetaData table, String source, String destination) 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.- Specified by:
moveFile
in classAbstractBaseFilesystemAction<com.amazonaws.services.s3.model.S3ObjectSummary>
- Parameters:
destination
- assumed to be a file path - not a directory- Throws:
FilesystemException
- if the move is known to have failed
-