Class AbstractS3Action
java.lang.Object
com.kingsrook.qqq.backend.module.filesystem.base.actions.AbstractBaseFilesystemAction<S3ObjectSummary>
com.kingsrook.qqq.backend.module.filesystem.s3.actions.AbstractS3Action
- Direct Known Subclasses:
S3CountAction,S3DeleteAction,S3InsertAction,S3QueryAction,S3StorageAction
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 software.amazon.awssdk.services.s3.S3ClientbuildS3ClientFromBackendMetaData(QBackendMetaData backendMetaData) Get the (shared, cached) S3 client for the backend's connection settings.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(S3ObjectSummary s3ObjectSummary) get the createDate of the specified file, null if not supported/availablegetFileModifyDate(S3ObjectSummary s3ObjectSummary) get the createDate of the specified file, null if not supported/availablegetFileSize(S3ObjectSummary s3ObjectSummary) get the size of the specified file, null if not supported/availablegetFullPathForFile(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.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(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, findAssociatedPrimaryKeys, getBackendMetaData, getFullBasePath, getTableBackendDetails, isPathEqualsCriteria, listFiles, lookupUniqueKey, postAction, readAssociationValues, stripDuplicatedSlashes, stripLeadingSlash, stripTrailingSlash
-
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<S3ObjectSummary>
-
getFileCreateDate
Description copied from class:AbstractBaseFilesystemActionget the createDate of the specified file, null if not supported/available- Specified by:
getFileCreateDatein classAbstractBaseFilesystemAction<S3ObjectSummary>
-
getFileModifyDate
Description copied from class:AbstractBaseFilesystemActionget the createDate of the specified file, null if not supported/available- Specified by:
getFileModifyDatein classAbstractBaseFilesystemAction<S3ObjectSummary>
-
preAction
Setup the s3 utils object to be used for this action.- Overrides:
preActionin classAbstractBaseFilesystemAction<S3ObjectSummary>- Throws:
QException
-
buildS3ClientFromBackendMetaData
protected software.amazon.awssdk.services.s3.S3Client buildS3ClientFromBackendMetaData(QBackendMetaData backendMetaData) Get the (shared, cached) S3 client for the backend's connection settings. Throws IllegalArgumentException if the backend is not an S3 backend. -
setS3Utils
Set the S3Utils object. -
getS3Utils
Internal accessor for the s3Utils object - should always use this, not the field. -
listFiles
public List<S3ObjectSummary> listFiles(QTableMetaData table, QBackendMetaData backendBase, String requestedPath) throws QException List the files for a table.- Specified by:
listFilesin classAbstractBaseFilesystemAction<S3ObjectSummary>- Throws:
QException
-
readFile
Read the contents of a file.- Specified by:
readFilein classAbstractBaseFilesystemAction<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<S3ObjectSummary>- Throws:
IOException
-
getFullPathForFile
Get a string that represents the full path to a file.- Specified by:
getFullPathForFilein classAbstractBaseFilesystemAction<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<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<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<S3ObjectSummary>- Parameters:
destination- assumed to be a file path - not a directory- Throws:
FilesystemException- if the move is known to have failed
-