public class ManagedFile extends FileBase
Modifier and Type | Field and Description |
---|---|
protected int |
myAssetId
Asset ID.
|
myBufferedReader, myBufferedWriter, myErrorMessage, myFile, myFileOutputStream, myXmp
CONST, DONTENUM, EMPTY, PERMANENT, READONLY, UNINITIALIZED_CONST
kServerTypeAttribute
Constructor and Description |
---|
ManagedFile() |
Modifier and Type | Method and Description |
---|---|
void |
jsConstructor(java.lang.String theRelativePath)
Creates a managed file instance.
|
boolean |
jsFunction_applyStampXml(java.lang.String theXml)
Apply XML from XMP Stamp panel to the asset.
|
java.lang.String |
jsFunction_getAbsolutePath()
Get the file's absolute path.
|
BufferedReader |
jsFunction_getBufferedReader(java.lang.String theEncoding)
Returns a BufferedReader for reading the file contents.
|
BufferedWriter |
jsFunction_getBufferedWriter(boolean theAppend,
java.lang.String theEncoding)
Returns a BufferedWriter for writing the file contents.
|
java.lang.String |
jsFunction_getDatabaseField(java.lang.String theField)
Allow fetching database field from editorial (long_name, rotate, file_name, file_size, mac_type, mac_creator,
file_type2, record_id, file_date_modified, viewex_x, viewex_y, orig_x, orig_y,zoom,checkout, page_count, xmp,
video_status, version_of, version_name, stored_state, graphic_description, dimensions, date_entered)
|
FileOutputStream |
jsFunction_getFileOutputStream()
Gets a FileOutputStream for writing the file contents.
|
java.lang.String |
jsFunction_getFormattedSize()
Get the size of the file with units.
|
java.lang.String |
jsFunction_getImageURL(java.lang.String theViewType)
Returns the image URL for the specified view type ("thumbnails" or "viewex").
|
JSMap |
jsFunction_getMetricsData()
Gets the metrics data.
|
boolean |
jsFunction_isXmpModified()
Has metadata been modified on this asset?
|
void |
jsFunction_lock()
Creates a MediaBeacon-managed lock on this ManagedFile.
|
void |
jsFunction_normalizeXmp()
Synchronizes XMP and moves resource / sidecar into data fork of file.
|
void |
jsFunction_releaseXmp()
Releases the fetched XMP object (if it's been fetched) so its memory can be reclaimed.
|
java.lang.String |
jsFunction_toString()
Returns the filepath/asset id of this ManagedFile.
|
void |
jsFunction_unlock()
Unlocks this managed file.
|
boolean |
jsFunction_writeXmp()
Saves xmp changes to the asset (db and file system).
|
int |
jsGet_assetId()
Returns the asset ID.
|
java.lang.String |
jsGet_base64()
Gets the bytes for this file and encodes it as a base64 string
|
java.lang.String |
jsGet_colorprofile()
Returns the image colorprofile
|
java.lang.String |
jsGet_colorspace()
Returns the image colorspace
|
java.lang.String |
jsGet_encodedAssetId()
Returns the encoded asset ID.
|
org.mozilla.javascript.IdScriptableObject |
jsGet_errorMessage()
Gets error message that occurred during xmp writing.
|
boolean |
jsGet_exists()
Checks if this file exists on the server's file system.
|
IFileObject |
jsGet_file()
Returns itself, needed for backwards-compatability.
|
java.lang.String |
jsGet_fileNameExtension()
Returns the file name extension by parsing the file's name.
|
long |
jsGet_fileSizeIncludingMetadata()
Get the summed size of the file's resource forks and data fork.
|
java.lang.String |
jsGet_format()
Returns the image format
|
java.lang.String |
jsGet_getFileContents()
Deprecated.
Use
ManagedFile.jsFunction_getBufferedReader(String) instead. |
java.lang.String |
jsGet_getXmlFileContents()
Get the file contents as a string, stripping away invalid Xml characters.
|
int |
jsGet_height()
Returns the image height
|
long |
jsGet_lastModified()
Return file modified timestamp in milliseconds.
|
long |
jsGet_length()
Get the file's content length.
|
java.lang.String |
jsGet_name()
Returns the name of the file or directory.
|
IFolderObject |
jsGet_parent()
Returns the parent file o directory.
|
java.lang.String |
jsGet_path()
Get the file's path relative to the MediaBeacon asset root.
|
long |
jsGet_rawLength()
Get the raw file size, without metadata.
|
int |
jsGet_record_id()
Returns the asset ID.
|
java.lang.Double |
jsGet_resolution()
Get image resolution.
|
int |
jsGet_width()
Returns the image width
|
Xmp |
jsGet_xmp()
Gets XMP object.
|
void |
jsSet_xmp(java.lang.Object theXmp)
Writes the given XMP object or xmp string to the file.
|
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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public int jsGet_assetId()
public int jsGet_record_id()
public java.lang.String jsGet_encodedAssetId()
public IFileObject jsGet_file()
IFileObject
.IFileObject
public void jsConstructor(java.lang.String theRelativePath) throws InvalidManagedFilePathException
theRelativePath
- The path, relative to the MediaBeacon asset root, to a file currently managed by MediaBeacon.
This path should contain unix-style file separators regardless of what file system hosts the assets.InvalidManagedFilePathException
- if the file does not exist or isn't managed by MediaBeacon.public void jsFunction_lock() throws com.brightech.mb.web.fs.ConcurentActionsException, java.lang.InterruptedException
com.brightech.mb.web.fs.ConcurentActionsException
- if unable to obtain a lock within the system property-configurable amount of time.
Also thrown if this ManagedFile object is stale and the file it references has been deleted, renamed or moved since
this ManagedFile object was constructed.java.lang.InterruptedException
- if the thread was interrupted while waiting for the lock.public void jsFunction_unlock()
public boolean jsGet_exists()
true
if the file or directory exists.public long jsGet_lastModified()
Should not be used on C3ntrifuge nodes, as it requires filesystem access.
public java.lang.String jsGet_name()
IFileObject
public java.lang.String jsGet_fileNameExtension()
public java.lang.String jsGet_path()
public java.lang.String jsFunction_getAbsolutePath()
public IFolderObject jsGet_parent()
IFileObject
IFileObject
represents parent file or directory.public java.lang.String jsFunction_getFormattedSize()
public long jsGet_length()
0L
if the file does not exist.public long jsGet_rawLength()
public long jsGet_fileSizeIncludingMetadata()
@Deprecated public java.lang.String jsGet_getFileContents()
ManagedFile.jsFunction_getBufferedReader(String)
instead.public java.lang.String jsGet_base64()
public BufferedReader jsFunction_getBufferedReader(java.lang.String theEncoding) throws java.io.IOException
theEncoding
- default is UTF-8, can pass others (like UTF-16)java.io.IOException
BufferedReader
public BufferedWriter jsFunction_getBufferedWriter(boolean theAppend, java.lang.String theEncoding) throws java.io.IOException
theAppend
- true if file should be opened for appendtheEncoding
- default is UTF-8, can pass others (like UTF-16)java.io.IOException
BufferedWriter
public FileOutputStream jsFunction_getFileOutputStream() throws java.io.IOException
java.io.IOException
public java.lang.String jsGet_getXmlFileContents()
public boolean jsFunction_applyStampXml(java.lang.String theXml)
theXml
- the stamper XMLpublic Xmp jsGet_xmp()
Xmp
public void jsSet_xmp(java.lang.Object theXmp)
theXmp
- the new XMP, either an XML string or Xmp object.public void jsFunction_normalizeXmp()
public org.mozilla.javascript.IdScriptableObject jsGet_errorMessage()
public boolean jsFunction_writeXmp()
ManagedFile.kIgnoredVerificationFields
public boolean jsFunction_isXmpModified()
public void jsFunction_releaseXmp()
public int jsGet_width()
public java.lang.String jsFunction_getDatabaseField(java.lang.String theField)
theField
- field name to fetchpublic int jsGet_height()
public java.lang.String jsGet_format()
public java.lang.String jsGet_colorspace()
public java.lang.String jsGet_colorprofile()
public java.lang.Double jsGet_resolution()
public JSMap jsFunction_getMetricsData()
public java.lang.String jsFunction_getImageURL(java.lang.String theViewType)
theViewType
- the view type ("thumbnails" or "viewex").public java.lang.String jsFunction_toString()
Copyright © 2023 MediaBeacon, Inc. All Rights Reserved.