|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.tranche.meta.MetaData
public class MetaData
Object that represents a meta data chunk on the Tranche network.
| Field Summary | |
|---|---|
static int |
GZIP_COMPRESSED_BIT
Flag meaning this meta data is GZIP compressed. |
static int |
LIMITED_LIFE_BIT
Deprecated. Use the property for expiration timestamp to denote when a file should expire. |
static int |
MIME_TYPE_BIT
Deprecated. Of no purpose since the mime type was moved into the properties structure and now depends on the uploader. |
static int |
PROJECT_FILE_BIT
Flag meaning this meta data represents a directory/project. |
static java.lang.String |
PROP_DATA_SET_DESCRIPTION
|
static java.lang.String |
PROP_DATA_SET_FILES
|
static java.lang.String |
PROP_DATA_SET_NAME
|
static java.lang.String |
PROP_DATA_SET_SIZE
|
static java.lang.String |
PROP_HIDDEN
|
static java.lang.String |
PROP_MIME_TYPE
|
static java.lang.String |
PROP_NAME
The name of the file. |
static java.lang.String |
PROP_PATH_IN_DATA_SET
The relative name of the file in the data set (includes the file name.) |
static java.lang.String |
PROP_SHARE_INFO_IF_ENCRYPTED
|
static java.lang.String |
PROP_TIMESTAMP_FILE
The last modified timestamp of the file as it existed on the uploader's system. |
static java.lang.String |
PROP_TIMESTAMP_UPLOADED
|
static java.lang.String |
PROP_VERSION_NEXT
The hash of the newer version of this file or data set. |
static java.lang.String |
PROP_VERSION_PREVIOUS
The hash of the older version of this file or data set. |
static long |
SIZE_MAX
Maximum size. |
static int |
STICKY_DATA_BIT
Deprecated. Making a file sticky is now done by adding a Meta Data Annotation of a server to which it should be stuck. |
static int |
STICKY_META_DATA_BIT
Deprecated. making a file sticky is now done by adding a Meta Data Annotation of a server to which it should be stuck. |
static java.lang.String |
VERSION_FOUR
Identifies the fourth meta data version -- allows for multiple uploaders and distinguishes the overlap. |
static java.lang.String |
VERSION_LATEST
Identifies the latest meta data version. |
static java.lang.String |
VERSION_ONE
Identifies the first meta data version. |
static int |
VERSION_ONE_BIT
Flag meaning this meta data is version 1.0 |
static java.lang.String |
VERSION_THREE
Identifies the third meta data version -- added properties (project files, project size, project name, and project description.) |
static java.lang.String |
VERSION_TWO
Identifies the second meta data version -- added last modified timestamp and version. |
| Constructor Summary | |
|---|---|
MetaData()
|
|
| Method Summary | |
|---|---|
void |
addAnnotation(java.lang.String annotationName,
java.lang.String annotationValue)
|
void |
addPart(BigHash partHash)
Adds the given hash to the list of part hashes for the final encoding of the currently selected uploader. |
void |
addStickyServer(java.lang.String host)
|
void |
addUploader(Signature signature,
java.util.ArrayList<FileEncoding> encodings,
java.util.Map<java.lang.String,java.lang.String> properties,
java.util.ArrayList<MetaDataAnnotation> annotations)
In the given properties, the PROP_TIMESTAMP_UPLOADED value is overwritten by the given uploadTimestamp, and the PROP_PATH_IN_DATA_SET value is overwritten by the given fullPathInDataSet. |
void |
clearAnnotations()
|
void |
clearPublicPassphrase()
Clears the published passphrase. |
MetaData |
clone()
|
boolean |
containsUploader(java.lang.String targetUploaderName,
java.lang.Long targetUploadTimestamp,
java.lang.String fullPathInDataSet)
|
static MetaData |
createFromBytes(byte[] bytes)
|
java.util.Map<BigHash,java.util.List<BigHash>> |
getAllParts()
|
java.util.Collection<java.lang.String> |
getAllStickyServers()
Returns the host names for all the servers to which uploaders have designated that the file be stuck. |
java.util.List<MetaDataAnnotation> |
getAnnotations()
|
java.util.Collection<MetaDataAnnotation> |
getAnnotationsWithName(java.lang.String name)
|
java.util.Collection<java.lang.String> |
getAnnotationValuesWithName(java.lang.String name)
|
java.lang.String |
getDataSetDescription()
|
long |
getDataSetFiles()
|
java.lang.String |
getDataSetName()
|
long |
getDataSetSize()
|
java.util.List<FileEncoding> |
getEncodings()
|
int |
getFlags()
Gets the flags. |
BigHash |
getHash()
|
long |
getLastModifiedTimestamp()
Returns the UNIX timestamp of when the meta data was last modified. |
java.lang.String |
getMimeType()
|
java.lang.String |
getName()
|
BigHash |
getNextVersion()
|
java.util.List<BigHash> |
getParts()
Returns the parts associated with the final encoding for the selected uploader. |
BigHash |
getPreviousVersion()
|
java.util.Map<java.lang.String,java.lang.String> |
getProperties()
|
java.lang.String |
getPublicPassphrase()
Gets the published passphrase. |
java.lang.String |
getRelativePathInDataSet()
|
int |
getSelectedUploader()
|
Signature |
getSignature()
|
java.util.Collection<java.lang.String> |
getStickyServers()
Returns the host names for servers to which this uploader has designated that the file be stuck. |
long |
getTimestampFileModified()
|
long |
getTimestampUploaded()
|
int |
getUploaderCount()
|
java.lang.String |
getVersion()
Returns the version of this meta data. |
boolean |
isEncrypted()
Helper method that will inspect the encodings and check that all encryptions have a passphrase. |
boolean |
isGZIPCompressed()
Returns the flag for whether this meta data is GZIP compressed. |
boolean |
isHidden()
Whether the file this meta data represents should be visible in searches. |
boolean |
isLimitedLife()
Deprecated. No longer support expiration timestamps. |
protected boolean |
isMimeType()
|
boolean |
isProjectFile()
Returns the flag for whether this meta data is for a project file. |
boolean |
isPublicPassphraseSet()
Returns whether the public passphrase is set. |
boolean |
isVersionOne()
Returns the flag for whether this meta data is version 1.0. |
void |
removeAnnotation(MetaDataAnnotation annotation)
|
void |
removeAnnotation(java.lang.String name,
java.lang.String value)
|
void |
removeStickyServer(java.lang.String host)
|
void |
removeUploader(java.lang.String uploaderName,
long uploadTimestamp,
java.lang.String fullPathInDataSet)
|
void |
selectUploader(int selectedUploader)
|
void |
selectUploader(java.lang.String targetUploaderName,
java.lang.Long targetUploadTimestamp,
java.lang.String fullPathInDataSet)
|
void |
setDataSetDescription(java.lang.String description)
|
void |
setDataSetFiles(long files)
|
void |
setDataSetName(java.lang.String name)
|
void |
setDataSetSize(long size)
|
protected void |
setFlags(int flags)
Sets the flags. |
void |
setGZIPCompress(boolean GZIPcompress)
Sets whether to GZIP compress the meta data file upon writing. |
void |
setHidden(boolean isHidden)
Sets the data this meta data represents as hidden. |
protected void |
setIsLimitedLife(boolean isLimitedLife)
Deprecated. No longer support expiration timestamps. |
protected void |
setIsMimeType(boolean isMimeType)
|
void |
setIsProjectFile(boolean isProjectFile)
|
protected void |
setLastModifiedTimestamp(long timestamp)
DO NOT USE THIS METHOD. |
void |
setMimeType(java.lang.String mimeType)
|
void |
setNextVersion(BigHash hash)
|
void |
setParts(java.util.ArrayList<BigHash> parts)
|
protected void |
setParts(BigHash finalEncodingHash,
java.util.ArrayList<BigHash> parts)
|
void |
setPreviousVersion(BigHash hash)
|
protected void |
setProperty(java.lang.String name,
java.lang.String value)
|
void |
setPublicPassphrase(java.lang.String passphrase)
Publish a passphrase to this meta data. |
void |
setShareMetaDataIfEncrypted(boolean shareMetaDataIfEncrypted)
|
void |
setTimestampFileModified(long timestamp)
|
void |
setVersion(java.lang.String version)
Sets the version of this meta data. |
boolean |
shareMetaData()
Whether the meta information should be shared with persons that do not have the passphrase. |
boolean |
shareMetaDataIfEncrypted()
|
byte[] |
toByteArray()
|
byte[] |
toByteArray(java.lang.String version)
|
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String VERSION_ONE
Identifies the first meta data version.
public static final java.lang.String VERSION_TWO
Identifies the second meta data version -- added last modified timestamp and version.
public static final java.lang.String VERSION_THREE
Identifies the third meta data version -- added properties (project files, project size, project name, and project description.)
public static final java.lang.String VERSION_FOUR
Identifies the fourth meta data version -- allows for multiple uploaders and distinguishes the overlap.
public static final java.lang.String VERSION_LATEST
Identifies the latest meta data version.
public static final int VERSION_ONE_BIT
Flag meaning this meta data is version 1.0
Not useful past the first version.
public static final int PROJECT_FILE_BIT
Flag meaning this meta data represents a directory/project.
public static final int STICKY_DATA_BIT
Flag meaning this meta data represents sticky data.
public static final int STICKY_META_DATA_BIT
Flag meaning this meta data represents stick meta data.
public static final int GZIP_COMPRESSED_BIT
Flag meaning this meta data is GZIP compressed.
public static final int LIMITED_LIFE_BIT
Flag meaning this meta data is limited life.
public static final int MIME_TYPE_BIT
Flag meaning this meta data has a mime type.
public static final java.lang.String PROP_DATA_SET_SIZE
public static final java.lang.String PROP_DATA_SET_FILES
public static final java.lang.String PROP_DATA_SET_NAME
public static final java.lang.String PROP_DATA_SET_DESCRIPTION
public static final java.lang.String PROP_TIMESTAMP_UPLOADED
public static final java.lang.String PROP_TIMESTAMP_FILE
The last modified timestamp of the file as it existed on the uploader's system.
public static final java.lang.String PROP_NAME
The name of the file.
public static final java.lang.String PROP_PATH_IN_DATA_SET
The relative name of the file in the data set (includes the file name.)
public static final java.lang.String PROP_MIME_TYPE
public static final java.lang.String PROP_VERSION_NEXT
The hash of the newer version of this file or data set.
public static final java.lang.String PROP_VERSION_PREVIOUS
The hash of the older version of this file or data set.
public static final java.lang.String PROP_HIDDEN
public static final java.lang.String PROP_SHARE_INFO_IF_ENCRYPTED
public static final long SIZE_MAX
Maximum size.
| Constructor Detail |
|---|
public MetaData()
| Method Detail |
|---|
public final java.lang.String getVersion()
Returns the version of this meta data.
public final void setVersion(java.lang.String version)
Sets the version of this meta data.
version - public final int getFlags()
Gets the flags.
protected final void setFlags(int flags)
Sets the flags.
flags - public final boolean isVersionOne()
Returns the flag for whether this meta data is version 1.0.
public final boolean isGZIPCompressed()
Returns the flag for whether this meta data is GZIP compressed.
public final void setGZIPCompress(boolean GZIPcompress)
Sets whether to GZIP compress the meta data file upon writing.
GZIPcompress - public final boolean isProjectFile()
Returns the flag for whether this meta data is for a project file.
public final void setIsProjectFile(boolean isProjectFile)
isProjectFile - public final boolean isLimitedLife()
protected final void setIsLimitedLife(boolean isLimitedLife)
isLimitedLife - protected final boolean isMimeType()
protected final void setIsMimeType(boolean isMimeType)
isMimeType - public final long getLastModifiedTimestamp()
Returns the UNIX timestamp of when the meta data was last modified.
protected final void setLastModifiedTimestamp(long timestamp)
DO NOT USE THIS METHOD. It is only meant to be used by MetaDataUtil.
Sets the UNIX timestamp of when the meta data was last modified.
timestamp -
public final boolean containsUploader(java.lang.String targetUploaderName,
java.lang.Long targetUploadTimestamp,
java.lang.String fullPathInDataSet)
throws AmbiguousFileSelectionException
targetUploaderName - targetUploadTimestamp - fullPathInDataSet -
AmbiguousFileSelectionException
public final void selectUploader(java.lang.String targetUploaderName,
java.lang.Long targetUploadTimestamp,
java.lang.String fullPathInDataSet)
throws java.lang.Exception
targetUploaderName - targetUploadTimestamp - fullPathInDataSet -
java.lang.Exceptionpublic final void selectUploader(int selectedUploader)
selectedUploader - public final int getSelectedUploader()
public final int getUploaderCount()
public final void addUploader(Signature signature,
java.util.ArrayList<FileEncoding> encodings,
java.util.Map<java.lang.String,java.lang.String> properties,
java.util.ArrayList<MetaDataAnnotation> annotations)
throws java.lang.Exception
In the given properties, the PROP_TIMESTAMP_UPLOADED value is overwritten by the given uploadTimestamp, and the PROP_PATH_IN_DATA_SET value is overwritten by the given fullPathInDataSet.
Selects the added uploader.
signature - encodings - properties - annotations -
java.lang.Exception
public final void removeUploader(java.lang.String uploaderName,
long uploadTimestamp,
java.lang.String fullPathInDataSet)
throws java.lang.Exception
uploaderName - uploadTimestamp - fullPathInDataSet -
java.lang.Exceptionpublic final Signature getSignature()
public final java.util.List<FileEncoding> getEncodings()
public final BigHash getHash()
public final java.util.List<BigHash> getParts()
Returns the parts associated with the final encoding for the selected uploader.
protected final void setParts(BigHash finalEncodingHash,
java.util.ArrayList<BigHash> parts)
finalEncodingHash - parts - public final void addPart(BigHash partHash)
Adds the given hash to the list of part hashes for the final encoding of the currently selected uploader.
partHash - public final void setParts(java.util.ArrayList<BigHash> parts)
parts - public final java.util.Map<BigHash,java.util.List<BigHash>> getAllParts()
public final java.util.Map<java.lang.String,java.lang.String> getProperties()
protected final void setProperty(java.lang.String name,
java.lang.String value)
name - value - public final java.util.List<MetaDataAnnotation> getAnnotations()
public final java.util.Collection<MetaDataAnnotation> getAnnotationsWithName(java.lang.String name)
name -
public final java.util.Collection<java.lang.String> getAnnotationValuesWithName(java.lang.String name)
name -
public final void addAnnotation(java.lang.String annotationName,
java.lang.String annotationValue)
annotationName - annotationValue - public final void removeAnnotation(MetaDataAnnotation annotation)
annotation -
public final void removeAnnotation(java.lang.String name,
java.lang.String value)
name - value - public final void clearAnnotations()
public final boolean isEncrypted()
Helper method that will inspect the encodings and check that all encryptions have a passphrase.
public final void setPublicPassphrase(java.lang.String passphrase)
throws java.lang.Exception
Publish a passphrase to this meta data.
passphrase -
java.lang.Exception
public final void clearPublicPassphrase()
throws java.lang.Exception
Clears the published passphrase.
java.lang.Exception
public final java.lang.String getPublicPassphrase()
throws java.lang.Exception
Gets the published passphrase.
java.lang.Exceptionpublic final boolean isPublicPassphraseSet()
Returns whether the public passphrase is set.
public final java.lang.String getName()
public final long getTimestampUploaded()
public final java.lang.String getRelativePathInDataSet()
public final java.lang.String getMimeType()
public final void setMimeType(java.lang.String mimeType)
mimeType - public final long getTimestampFileModified()
public final void setTimestampFileModified(long timestamp)
timestamp - public final BigHash getNextVersion()
public final void setNextVersion(BigHash hash)
hash - public final BigHash getPreviousVersion()
public final void setPreviousVersion(BigHash hash)
hash - public final long getDataSetFiles()
public final void setDataSetFiles(long files)
files - public final long getDataSetSize()
public final void setDataSetSize(long size)
size - public final java.lang.String getDataSetName()
public final void setDataSetName(java.lang.String name)
name - public final java.lang.String getDataSetDescription()
public final void setDataSetDescription(java.lang.String description)
description - public final boolean shareMetaDataIfEncrypted()
public final void setShareMetaDataIfEncrypted(boolean shareMetaDataIfEncrypted)
shareMetaDataIfEncrypted - public final boolean shareMetaData()
Whether the meta information should be shared with persons that do not have the passphrase.
public final boolean isHidden()
Whether the file this meta data represents should be visible in searches.
public void setHidden(boolean isHidden)
Sets the data this meta data represents as hidden.
isHidden - public final java.util.Collection<java.lang.String> getAllStickyServers()
Returns the host names for all the servers to which uploaders have designated that the file be stuck.
public final java.util.Collection<java.lang.String> getStickyServers()
Returns the host names for servers to which this uploader has designated that the file be stuck.
public final void addStickyServer(java.lang.String host)
host - public final void removeStickyServer(java.lang.String host)
host - public final MetaData clone()
clone in class java.lang.Object
public final byte[] toByteArray()
throws java.lang.Exception
java.lang.Exception
public final byte[] toByteArray(java.lang.String version)
throws java.lang.Exception
version -
java.lang.Exception
public static final MetaData createFromBytes(byte[] bytes)
throws java.lang.Exception
bytes -
java.lang.Exception
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||