public interface AdminFileMgrIf
Modifier and Type | Method and Description |
---|---|
void |
addImage(AdminImageOptions options)
Add the image to the object defined in the AdminImageOptions object.
|
void |
checkFileAccess(java.lang.String fileName)
Check that we allow access to this location according to the permitted locations as specified
in the konakartadmin.properties file
|
void |
checkFileAccess(java.lang.String fileName,
java.util.Set<java.lang.String> permittedLocations)
Check that we allow access to this location
|
boolean |
copyFile(java.lang.String srcFileName,
java.lang.String dstFileName)
Copy the source file to the destination file.
|
boolean |
copyFiles(java.lang.String[] srcFileNames,
java.lang.String[] dstFileNames)
Copy the source files to the destination files.
|
boolean |
deleteFile(java.lang.String fileName)
Delete the file.
|
AdminFile[] |
getConfigFiles()
Returns an array containing the configuration files.
|
java.lang.String |
getFileContents(java.lang.String fileName)
Get the file contents.
|
java.lang.String |
getFileContents(java.lang.String fileName,
int offset)
Get the file contents from the specified byte offset.
|
byte[] |
getFileContentsAsByteArray(java.lang.String fileName)
Get the file contents as a byte array.
|
AdminFile[] |
getFiles(java.lang.String directory,
java.lang.String extension)
Returns an array of files found in the directory.
|
void |
refreshConfigs()
Refresh the configuration of the Admin File Manager
|
void |
removeImage(AdminImageOptions options)
Remove the image (or images) from the object defined in the AdminImageOptions object.
|
boolean |
renameFile(java.lang.String srcFileName,
java.lang.String dstFileName)
Rename the source file to the destination file.
|
boolean |
renameFiles(java.lang.String[] srcFileNames,
java.lang.String[] dstFileNames)
Rename the source files to the destination files.
|
int |
rsyncDirectory(java.lang.String remoteSessionId,
KKAdminIf remoteEng,
java.lang.String localSessionId,
KKAdminIf localEng,
java.lang.String remoteDir,
java.lang.String localDir)
Sync the files in the specified directory using a local and a remote engine.
|
void |
saveFileContents(java.lang.String fileName,
java.lang.String fileContents)
Writes the specified file contents into the specified file.
|
boolean |
scaleImage(AdminScaleOptions scaleOptions)
Scale the specified image to the specified name and dimensions.
|
void checkFileAccess(java.lang.String fileName) throws KKAdminException
fileName
- the file to be accessed (read or written)KKAdminException
- if access to the filepath isn't permitted a KKAdminException is thrown otherwise
the method returns successfully.void checkFileAccess(java.lang.String fileName, java.util.Set<java.lang.String> permittedLocations) throws KKAdminException
fileName
- the file to be accessed (read or written)permittedLocations
- a set of Strings that are sub-strings of filepaths of permitted locations. A
normalised filepath is permitted if it contains one of the permitted location
substrings.KKAdminException
- if access to the filepath isn't permitted a KKAdminException is thrown otherwise
the method returns successfully.java.lang.String getFileContents(java.lang.String fileName) throws KKAdminException
fileName
- the filename in the server's contextKKAdminException
- if the file's not present or can't be read, or it's not a text filejava.lang.String getFileContents(java.lang.String fileName, int offset) throws KKAdminException
fileName
- the filename in the server's contextoffset
- the offset from the start of the file in bytesKKAdminException
- if the file's not present or can't be read, or it's not a text filebyte[] getFileContentsAsByteArray(java.lang.String fileName) throws KKAdminException
fileName
- the filename in the server's contextKKAdminException
- if the file's not present or can't be readvoid saveFileContents(java.lang.String fileName, java.lang.String fileContents) throws KKAdminException
fileName
- the filename in the server's contextfileContents
- the file contents to writeKKAdminException
- on any Security or IO problems that prevent us from saving the data to the file
or if the API call is disabled.boolean deleteFile(java.lang.String fileName) throws KKAdminException
fileName
- the filename in the server's contextKKAdminException
- if the file's not present or can't be deleted or if the API call is disabled.boolean copyFiles(java.lang.String[] srcFileNames, java.lang.String[] dstFileNames) throws KKAdminException
srcFileNames
- an array of filenames in the server's context to copy fromdstFileNames
- an array of filenames in the server's context to copy toKKAdminException
- if any of the source file are not present or can't be copiedboolean copyFile(java.lang.String srcFileName, java.lang.String dstFileName) throws KKAdminException
srcFileName
- the filename in the server's context to copy fromdstFileName
- the filename in the server's context to copy toKKAdminException
- if the source file's not present or can't be copied or if the API call is
disabled.boolean renameFile(java.lang.String srcFileName, java.lang.String dstFileName) throws KKAdminException
srcFileName
- the filename in the server's context to rename fromdstFileName
- the filename in the server's context to rename toKKAdminException
- if the source file's not present or can't be renamedboolean renameFiles(java.lang.String[] srcFileNames, java.lang.String[] dstFileNames) throws KKAdminException
srcFileNames
- an array of filenames in the server's context to rename fromdstFileNames
- an array of filenames in the server's context to rename toKKAdminException
- if any of the source file are not present or can't be renamedAdminFile[] getConfigFiles() throws KKAdminException
KKAdminException
- an unexpected KKAdminException exceptionAdminFile[] getFiles(java.lang.String directory, java.lang.String extension) throws KKAdminException
directory
- The directory containing the filesextension
- The extension of the files. If null, all files are returned.KKAdminException
- an unexpected KKAdminException exceptionboolean scaleImage(AdminScaleOptions scaleOptions) throws KKAdminException
scaleOptions
- The scaling optionsKKAdminException
- throws an exception of the scaling operation was unsuccessfulvoid addImage(AdminImageOptions options) throws KKAdminException
When adding product images it uses the same conventions as used in the Admin Application and gets these definitions from the konakartadmin_gwt.properties file. Once an image is added to a product using this API the image will appear for the product in the Admin Application just as if it had been added via an image upload in the Admin application.
options
- The options that define which object the image should be added toKKAdminException
- if the image was not added successfullyvoid removeImage(AdminImageOptions options) throws KKAdminException
options
- The options that define which images should be removedKKAdminException
- for any unexpected problemsvoid refreshConfigs() throws java.lang.Exception
java.lang.Exception
- an unexpected exceptionint rsyncDirectory(java.lang.String remoteSessionId, KKAdminIf remoteEng, java.lang.String localSessionId, KKAdminIf localEng, java.lang.String remoteDir, java.lang.String localDir) throws KKAdminException
remoteSessionId
- sessionId for the remote engineremoteEng
- the remote engine (probably a KKJSONAdminEng)localSessionId
- the local sessionId (could be the same as the remote sessionId for systems sharing
the same database)localEng
- the local engineremoteDir
- remote base directorylocalDir
- local base directory (often the same as the remote base directory)KKAdminException
- an unexpected exception in the KKAdmin engineCopyright © 2018 DS Data Systems UK Ltd.