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.AmazonS3buildAmazonS3ClientFromBackendMetaData(QBackendMetaData backendMetaData) voiddeleteFile(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 S3UtilsInternal 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.voidmoveFile(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.voidpreAction(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.voidsetS3Utils(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.voidwriteFile(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:AbstractBaseFilesystemActionget the size of the specified file, null if not supported/available- Specified by:
getFileSizein classAbstractBaseFilesystemAction<com.amazonaws.services.s3.model.S3ObjectSummary>
-
getFileCreateDate
Description copied from class:AbstractBaseFilesystemActionget the createDate of the specified file, null if not supported/available- Specified by:
getFileCreateDatein classAbstractBaseFilesystemAction<com.amazonaws.services.s3.model.S3ObjectSummary>
-
getFileModifyDate
Description copied from class:AbstractBaseFilesystemActionget the createDate of the specified file, null if not supported/available- Specified by:
getFileModifyDatein classAbstractBaseFilesystemAction<com.amazonaws.services.s3.model.S3ObjectSummary>
-
preAction
Setup the s3 utils object to be used for this action.- Overrides:
preActionin 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:
listFilesin 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:
readFilein 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:
writeFilein classAbstractBaseFilesystemAction<com.amazonaws.services.s3.model.S3ObjectSummary>- Throws:
IOException
-
getFullPathForFile
Get a string that represents the full path to a file.- Specified by:
getFullPathForFilein 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:
stripBackendAndTableBasePathsFromFileNamein 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:
deleteFilein 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:
moveFilein 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
-