public class JSFileManager extends JSBaseScriptableObject
Modifier and Type | Field and Description |
---|---|
static java.util.List |
kBundleTypes
Trigger Event types.
|
Constructor and Description |
---|
JSFileManager() |
Modifier and Type | Method and Description |
---|---|
IFileObject |
jsFunction_compressFiles(org.mozilla.javascript.NativeArray theFiles,
java.lang.Object theDestinationFile,
int theCompressionType,
java.lang.Boolean theIsRemoveDirs,
java.lang.String theZipRootPath)
Compresses a list of files into a specified format of archive file.
|
Bundle |
jsFunction_createBundleFolder(java.lang.String theBundlePath,
BundleType theBundleFlag)
Creates a folder bundle.
|
org.mozilla.javascript.Scriptable |
jsFunction_decompressFiles(IFileObject theFile,
IFolderObject theOutputDir,
java.lang.String theEncoding,
boolean theSkipPreviews,
java.lang.String theUploadId,
boolean theDoNotImport)
Decompress a file.
|
IFileObject |
jsFunction_fileCopy(IFileObject theSrc,
IFolderObject theDest)
Copy a File.
|
void |
jsFunction_fileDelete(IFileObject theFile)
Delete a file.
|
ManagedFile |
jsFunction_fileDuplicate(ManagedFile theFile)
Duplicate a file.
|
ManagedFile |
jsFunction_fileImport(IFileObject theFile,
ImportParameters theParameters)
Imports or re-imports a file.
|
java.lang.String |
jsFunction_fileImportAsync(IFileObject theFile,
ImportParameters theParameters)
Imports or re-imports a file asynchronously.
|
IFileObject |
jsFunction_fileMove(IFileObject theSrc,
IFolderObject theDest,
java.lang.Boolean theOverwrite,
ImportParameters theParameters,
java.lang.Boolean theDoNotImport)
Move a file.
|
IFileObject |
jsFunction_fileNew(IFolderObject theDestinationFolder,
java.lang.String theNewName)
Create a new file.
|
IFileObject |
jsFunction_fileNewByPath(java.lang.String theFilePath)
Creates the new file by path.
|
IFileObject |
jsFunction_fileRename(IFileObject theFile,
java.lang.String theNewName)
Rename a file.
|
ManagedFile |
jsFunction_fileReplace(ManagedFile theSrc,
ManagedFile theDest)
Replace an asset with another asset, maintaining the replaced asset's metadata.
|
IFolderObject |
jsFunction_folderCopy(IFolderObject theSrc,
IFolderObject theDest,
java.lang.String theDestName)
Copy a folder.
|
void |
jsFunction_folderDelete(IFolderObject theFolder)
Delete a folder.
|
ManagedFolder |
jsFunction_folderImport(IFolderObject theFolder,
java.lang.Boolean theDoNotDescend)
Imports or re-imports a folder.
|
ManagedFolder |
jsFunction_folderImportWithParameters(IFolderObject theFolder,
ImportParameters theParameters)
Imports or re-imports a folder.
|
IFolderObject |
jsFunction_folderMove(IFolderObject theSrc,
IFolderObject theDest,
java.lang.String theFolderName)
Move a folder.
|
IFolderObject |
jsFunction_folderNew(IFolderObject theDestinationFolder,
java.lang.String theNewFolder)
Create a folder.
|
IFolderObject |
jsFunction_folderNewByPath(java.lang.String theFolderPath)
Creates the new folder by path.
|
IFolderObject |
jsFunction_folderRename(IFolderObject theFolder,
java.lang.String theNewName)
Rename a folder.
|
IFileObject |
jsFunction_getFile(IFolderObject theParentFolder,
java.lang.String theFileName)
Gets a reference the given file in the given path, if the file doesn't exist or isn't a regular file, return null.
|
int |
jsFunction_getFileActionStatus(java.lang.String theActionId)
Gets the status of the specified task.
|
ManagedFile |
jsFunction_getFileObjectById(int theNewAssetId)
Creates a new
IFileObject object for the given asset ID. |
java.util.List |
jsFunction_getFilePaths(IFolderObject theDir,
boolean theReturnAllFiles)
Deprecated.
use
ManagedFolder.jsFunction_getContents(int) or UnmanagedFolder.jsFunction_getContents(int) instead. This function
will fail for folders outside of the MediaBeacon asset root. |
ManagedFolder |
jsFunction_getFolderObjectById(int theFolderId)
Creates a new
ManagedFolder object for the given folder ID. |
java.lang.String |
jsFunction_getFormattedPassedSize(int theSize)
Get the formatted size of the bytes with units.
|
ManagedFile |
jsFunction_getManaged(UnmanagedFile theFile)
Get managed file reference to the given unmanaged file if it is managed by MediaBeacon.
|
PDF |
jsFunction_getPdfFromManagedFile(ManagedFile theFile)
Get a PDF object from a ManagedFile object
|
java.lang.String |
jsFunction_getRelativePath(IFileObject theFile)
Deprecated.
use
ManagedFile.jsGet_path() or UnmanagedFile.jsFunction_getRelativePath() instead. |
java.lang.String |
jsFunction_getTempDir()
Returns the absolute path of the temp directory
|
void |
jsFunction_invalidateBundleCache(java.lang.String theFolderPath)
Invalidates bundle cache.
|
boolean |
jsFunction_isExcluded(java.lang.String theFilePath)
is this an excluded file
|
boolean |
jsFunction_isFile(java.lang.String theRelativePath)
Check if there is a file located at a given relative path.
|
boolean |
jsFunction_isFolder(java.lang.String theRelativePath)
Check if there is a folder located at a given relative path.
|
boolean |
jsFunction_isFolderNameValid(java.lang.String theFolderName)
Method to check whether a folder name fits our naming standards.
|
boolean |
jsFunction_isManaged(org.mozilla.javascript.Scriptable theFile)
Check if the file or folder is managed by MediaBeacon.
|
boolean |
jsFunction_isManagedFilePath(java.lang.String theRelativePath)
Is the given path, relative to the MediaBeacon asset root, a path to a file currently managed by MediaBeacon.
|
boolean |
jsFunction_isManagedFolderPath(java.lang.String theRelativePath)
Is the given path, relative to the MediaBeacon asset root, a path to a folder currently managed by MediaBeacon.
|
IFileObject |
jsFunction_rawFileCopy(IFileObject theSrc,
IFolderObject theDest,
int theFork)
Copy a File without calling import on the destination file, optionally only data or only resource fork.
|
void |
jsFunction_removeBundleMetadata(java.lang.String theBundlePath)
Remove everything associated with a bundle, including the metadata asset.
|
ManagedFile |
jsFunction_replaceAsset(IFileObject theSrc,
ManagedFile theDest,
boolean theIsRename)
Replaces asset data with uploaded file that resides on the portal server.
|
ManagedFile |
jsFunction_replaceView(ManagedFile theAsset,
IFileObject theSourceFile,
java.lang.String theViewName,
java.lang.String theEncoding)
Replaces the specified view(s) for the asset, from the specified source asset and encoding.
|
void |
jsFunction_setPendingUploadFilesAvailable(IFolderObject theFolder,
java.lang.String thePendingUploadId,
java.lang.String theProgressId,
java.lang.String theTargetDir,
java.lang.String theReportLogUploadPrefix)
Notify MB that pending uploads are available
|
JSMap |
jsGet_bundleTypes() |
applyDescriptorToAttributeBitset, associateValue, avoidObjectDetection, buildDataDescriptor, callMethod, callMethod, checkPropertyChange, checkPropertyDefinition, defineClass, defineClass, defineClass, defineConst, defineConstProperty, defineFunctionProperties, defineOwnProperties, defineOwnProperty, defineOwnProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, delete, delete, delete, deleteProperty, deleteProperty, ensureScriptable, ensureScriptableObject, ensureSymbolScriptable, equivalentValues, get, get, get, get, getAllIds, getArrayPrototype, getAssociatedValue, getAttributes, getAttributes, getAttributes, getAttributes, getAttributes, getClassName, getClassPrototype, getDefaultValue, getDefaultValue, getExternalArrayData, getExternalArrayLength, getFunctionPrototype, getGeneratorFunctionPrototype, getGetterOrSetter, getIds, getObjectPrototype, getOwnPropertyDescriptor, getParentScope, getProperty, getProperty, getProperty, getPropertyIds, getPrototype, getSlot, getTopLevelScope, getTopScopeValue, getTypedProperty, getTypedProperty, getTypeOf, has, has, has, hasInstance, hasProperty, hasProperty, hasProperty, isAccessorDescriptor, isConst, isDataDescriptor, isEmpty, isExtensible, isFalse, isGenericDescriptor, isGetterOrSetter, isSealed, isTrue, preventExtensions, put, put, put, putConst, putConstProperty, putProperty, putProperty, putProperty, redefineProperty, sameValue, sealObject, setAttributes, setAttributes, setAttributes, setAttributes, setAttributes, setExternalArrayData, setGetterOrSetter, setParentScope, setPrototype, size
public boolean jsFunction_isFile(java.lang.String theRelativePath) throws java.lang.Exception
theRelativePath
- the path, relative to the MediaBeacon asset root, to a file.
This path should contain unix-style file separators regardless of what file system hosts the assets.java.lang.Exception
public boolean jsFunction_isFolder(java.lang.String theRelativePath) throws java.lang.Exception
theRelativePath
- the path, relative to the MediaBeacon asset root, to a folder.
This path should contain unix-style file separators regardless of what file system hosts the assets.java.lang.Exception
public boolean jsFunction_isManagedFilePath(java.lang.String theRelativePath)
theRelativePath
- The relative path to a file potentially managed by MediaBeacon.public boolean jsFunction_isManagedFolderPath(java.lang.String theRelativePath)
theRelativePath
- The relative path to a folder potentially managed by MediaBeacon.public boolean jsFunction_isManaged(org.mozilla.javascript.Scriptable theFile)
theFile
- the file or folder to check.true
if the given file or folder is managed by MediaBeacon, false
otherwise.public IFileObject jsFunction_getFile(IFolderObject theParentFolder, java.lang.String theFileName) throws java.lang.Exception
theParentFolder
- The folder that contains the file to get a reference to.theFileName
- The name of the potentially of extant file.null
.java.lang.Exception
- exception thrown during check.public ManagedFile jsFunction_getManaged(UnmanagedFile theFile)
theFile
- the unmanaged file to potentially get a managed reference to.public IFileObject jsFunction_fileNew(IFolderObject theDestinationFolder, java.lang.String theNewName) throws java.lang.Exception
theDestinationFolder
- the folder to put the new file in.theNewName
- the name of the new file.java.lang.Exception
- exception thrown if a problem occurs while creating the file.public IFileObject jsFunction_fileNewByPath(java.lang.String theFilePath) throws java.lang.Exception
theFilePath
- the path to the file to be created. This path can be absolute or relative to the MediaBeacon
asset root folder. Absolute paths should use a file separator that is matches the file system while relative paths
should always uses a unix-style file separator.java.lang.Exception
public IFolderObject jsFunction_folderNewByPath(java.lang.String theFolderPath) throws java.lang.Exception
theFolderPath
- the path to the folder to be created. This path can be absolute or relative to the MediaBeacon
asset root folder. Absolute paths should use a file separator that is matches the file system while relative paths
should always uses a unix-style file separator.java.lang.Exception
public ManagedFile jsFunction_getFileObjectById(int theNewAssetId)
IFileObject
object for the given asset ID.theNewAssetId
- the asset id.IFileObject
instance.public IFileObject jsFunction_fileRename(IFileObject theFile, java.lang.String theNewName) throws com.brightech.mb.web.fs.FileSystemException
theFile
- the file to rename.theNewName
- the new name of the file.com.brightech.mb.web.fs.FileSystemException
- exception thrown during file renaming.public boolean jsFunction_isFolderNameValid(java.lang.String theFolderName) throws com.brightech.mb.web.fs.FileSystemException
theFolderName
- the name to check validity ofcom.brightech.mb.web.fs.FileSystemException
public IFileObject jsFunction_rawFileCopy(IFileObject theSrc, IFolderObject theDest, int theFork) throws com.brightech.mb.web.fs.FileSystemException
theSrc
- the file to copy.theDest
- the destination of the copy.theFork
- copy resource only (1), data and resource (2), or data only (3)com.brightech.mb.web.fs.FileSystemException
- exception thrown during copy.public IFileObject jsFunction_fileCopy(IFileObject theSrc, IFolderObject theDest) throws com.brightech.mb.web.fs.FileSystemException
theSrc
- the file to copy.theDest
- the destination of the copy.com.brightech.mb.web.fs.FileSystemException
- exception thrown during copy.public void jsFunction_fileDelete(IFileObject theFile) throws com.brightech.mb.web.fs.FileSystemException
theFile
- the file to delete.com.brightech.mb.web.fs.FileSystemException
- exception thrown during delete.public ManagedFile jsFunction_fileDuplicate(ManagedFile theFile) throws com.brightech.mb.web.fs.FileSystemException
theFile
- the file to duplicate.com.brightech.mb.web.fs.FileSystemException
- exception thrown during duplicate.public IFileObject jsFunction_compressFiles(org.mozilla.javascript.NativeArray theFiles, java.lang.Object theDestinationFile, int theCompressionType, java.lang.Boolean theIsRemoveDirs, java.lang.String theZipRootPath) throws com.brightech.mb.web.fs.FileSystemException
theFiles
- an array of file paths or file objects to include in archivetheDestinationFile
- the archive file object or file paththeCompressionType
- the type of compression, kWinZip (1), kMacZip (2), kStuffitZip (3)theIsRemoveDirs
- if true, then removes a folder structure inside of archive (optional)theZipRootPath
- Remove all folders in this patch from each file to be compressed. default is MBAssets rootcom.brightech.mb.web.fs.FileSystemException
- if the operation cannot be completedpublic org.mozilla.javascript.Scriptable jsFunction_decompressFiles(IFileObject theFile, IFolderObject theOutputDir, java.lang.String theEncoding, boolean theSkipPreviews, java.lang.String theUploadId, boolean theDoNotImport) throws com.brightech.mb.web.fs.FileSystemException
theFile
- the archive to decompress.theOutputDir
- the directory to decompress to.theEncoding
- the encoding (optional)theSkipPreviews
- skip previewstheUploadId
- theDoNotImport
- should the unzipped files be importedcom.brightech.mb.web.fs.FileSystemException
- exception thrown during decompress.public IFileObject jsFunction_fileMove(IFileObject theSrc, IFolderObject theDest, java.lang.Boolean theOverwrite, ImportParameters theParameters, java.lang.Boolean theDoNotImport) throws com.brightech.mb.web.fs.FileSystemException
theSrc
- the file to move.theDest
- the destination of the file.theOverwrite
- overwrite (un-imported) destination if true. (optional)theParameters
- the import parameterstheDoNotImport
- should the file be importedcom.brightech.mb.web.fs.FileSystemException
- exception thrown during file move.public void jsFunction_setPendingUploadFilesAvailable(IFolderObject theFolder, java.lang.String thePendingUploadId, java.lang.String theProgressId, java.lang.String theTargetDir, java.lang.String theReportLogUploadPrefix) throws com.brightech.mb.web.fs.FileSystemException
theFolder
- the folder where the files are waitingcom.brightech.mb.web.fs.FileSystemException
public ManagedFile jsFunction_fileImport(IFileObject theFile, ImportParameters theParameters) throws com.brightech.mb.web.fs.FileSystemException
theFile
- The file to importtheParameters
- the import parameters (optional)com.brightech.mb.web.fs.FileSystemException
public java.lang.String jsFunction_fileImportAsync(IFileObject theFile, ImportParameters theParameters) throws com.brightech.mb.web.fs.FileSystemException
theFile
- The file to importtheParameters
- the import parameters (optional)com.brightech.mb.web.fs.FileSystemException
public ManagedFolder jsFunction_folderImportWithParameters(IFolderObject theFolder, ImportParameters theParameters) throws com.brightech.mb.web.fs.FileSystemException
theFolder
- The folder to import.theParameters
- the import parameterscom.brightech.mb.web.fs.FileSystemException
public ManagedFolder jsFunction_folderImport(IFolderObject theFolder, java.lang.Boolean theDoNotDescend) throws com.brightech.mb.web.fs.FileSystemException
theFolder
- The folder to import.theDoNotDescend
- When importing an unmanaged folder, set this flag to block import of internal files and folders.com.brightech.mb.web.fs.FileSystemException
public ManagedFile jsFunction_fileReplace(ManagedFile theSrc, ManagedFile theDest) throws com.brightech.mb.web.fs.FileSystemException
theSrc
- The asset to replace with.theDest
- The asset to replace.com.brightech.mb.web.fs.FileSystemException
- if the source or destination file doesn't exist, isn't imported or if an error occurs
during the replace.public ManagedFile jsFunction_replaceAsset(IFileObject theSrc, ManagedFile theDest, boolean theIsRename) throws com.brightech.mb.web.fs.FileSystemException
theSrc
- the source filetheDest
- the destination assettheIsRename
- should the file be renamed?com.brightech.mb.web.fs.FileSystemException
public ManagedFile jsFunction_replaceView(ManagedFile theAsset, IFileObject theSourceFile, java.lang.String theViewName, java.lang.String theEncoding) throws com.brightech.mb.web.fs.FileSystemException
theAsset
- the asset.theSourceFile
- the source file for the new view(s).theViewName
- the view(s) name, including "thumbnail", "viewex", "high", "all".theEncoding
- the file encoding.com.brightech.mb.web.fs.FileSystemException
- if any error occurs replacing the views.public IFolderObject jsFunction_folderCopy(IFolderObject theSrc, IFolderObject theDest, java.lang.String theDestName) throws com.brightech.mb.web.fs.FileSystemException
theSrc
- the folder to copy.theDest
- the folder to copy to.theDestName
- the name of the resulting foldercom.brightech.mb.web.fs.FileSystemException
- exception thrown during folder copy.public void jsFunction_folderDelete(IFolderObject theFolder) throws com.brightech.mb.web.fs.FileSystemException
theFolder
- the folder to delete.com.brightech.mb.web.fs.FileSystemException
- exception thrown during folder delete.public IFolderObject jsFunction_folderNew(IFolderObject theDestinationFolder, java.lang.String theNewFolder) throws com.brightech.mb.web.fs.FileSystemException
theDestinationFolder
- the folder to create in.theNewFolder
- the name of the folder to create.com.brightech.mb.web.fs.FileSystemException
- exception thrown during folder creation.public IFolderObject jsFunction_folderRename(IFolderObject theFolder, java.lang.String theNewName) throws com.brightech.mb.web.fs.FileSystemException
theFolder
- the folder to rename.theNewName
- the new name of the folder.com.brightech.mb.web.fs.FileSystemException
- exception thrown during folder renaming.public IFolderObject jsFunction_folderMove(IFolderObject theSrc, IFolderObject theDest, java.lang.String theFolderName) throws com.brightech.mb.web.fs.FileSystemException
theSrc
- the folder to move.theDest
- the folder to move to.theFolderName
- the name of the resulting folder.com.brightech.mb.web.fs.FileSystemException
- exception thrown during folder move.public ManagedFolder jsFunction_getFolderObjectById(int theFolderId)
ManagedFolder
object for the given folder ID.theFolderId
- the asset id.ManagedFolder
instance.@Deprecated public java.util.List jsFunction_getFilePaths(IFolderObject theDir, boolean theReturnAllFiles) throws java.lang.Exception
ManagedFolder.jsFunction_getContents(int)
or UnmanagedFolder.jsFunction_getContents(int)
instead. This function
will fail for folders outside of the MediaBeacon asset root.theDir
- the folder to find files in.theReturnAllFiles
- if true, return all files, not just droplets and scripts.java.lang.Exception
- exception thrown while finding files.@Deprecated public java.lang.String jsFunction_getRelativePath(IFileObject theFile) throws java.lang.Exception
ManagedFile.jsGet_path()
or UnmanagedFile.jsFunction_getRelativePath()
instead.theFile
- the file to get a relative path to.java.lang.Exception
public PDF jsFunction_getPdfFromManagedFile(ManagedFile theFile)
theFile
- the ManagedFilepublic Bundle jsFunction_createBundleFolder(java.lang.String theBundlePath, BundleType theBundleFlag)
theBundlePath
- The path to the new bundle.theBundleFlag
- The bundle type. One of 'transparent_bundle' or 'opaque_bundle'.BundleType
public void jsFunction_removeBundleMetadata(java.lang.String theBundlePath)
theBundlePath
- The relative path to the new bundle.public void jsFunction_invalidateBundleCache(java.lang.String theFolderPath)
theFolderPath
- the folder pathpublic java.lang.String jsFunction_getTempDir()
public boolean jsFunction_isExcluded(java.lang.String theFilePath)
theFilePath
- the relative pathpublic int jsFunction_getFileActionStatus(java.lang.String theActionId)
theActionId
- the action id of a specific taskpublic java.lang.String jsFunction_getFormattedPassedSize(int theSize)
public JSMap jsGet_bundleTypes()
Copyright © 2023 MediaBeacon, Inc. All Rights Reserved.