com.bigdata.bfs
Class RepositoryDocumentImpl

java.lang.Object
  extended by com.bigdata.bfs.RepositoryDocumentImpl
All Implemented Interfaces:
Document, DocumentHeader

public class RepositoryDocumentImpl
extends Object
implements DocumentHeader, Document

A read-only view of a Document that has been read from a BigdataFileSystem.

Version:
$Id: RepositoryDocumentImpl.java 3672 2010-09-28 23:39:42Z thompsonbry $
Author:
Bryan Thompson

Constructor Summary
RepositoryDocumentImpl(BigdataFileSystem repo, String id)
          Read the metadata for the current version of the file from the repository.
RepositoryDocumentImpl(BigdataFileSystem repo, String id, ITPS tps)
          Read the metadata for the current version of the file from the repository.
 
Method Summary
 Map<String,Object> asMap()
          Returns a read-only view of the document metadata.
protected  void assertExists()
          Assert that a version of the file existed when this view was constructed.
 boolean exists()
          Return true iff a version of the file existed at the time that this view was constructed.
 ITPV[] getAllVersionInfo()
          Return an array containing all non-eradicated values of the FileMetadataSchema.VERSION property for this file as of the time that this view was constructed.
 String getContentEncoding()
          The character set encoding that MUST be used to interpret the byte[] returned by Document#getContent().
 String getContentType()
          The MIME type for the document.
 long getEarliestVersionCreateTime()
          Note: This is obtained from the earliest available timestamp of the FileMetadataSchema.ID property.
 String getId()
          The unique identifier for the document within the IContentRepository.
 InputStream getInputStream()
          An input stream on the byte[] stored in the IContentRepository.
 long getMetadataUpdateTime()
          The time at which the metadata for the current version of this file was last updated.
 Object getProperty(String name)
          Get an arbitrary property value.
 Reader getReader()
          A reader on the byte[] stored in the IContentRepository where bytes are decoded to characters using the encoding identified by DocumentHeader.getContentEncoding().
 int getVersion()
          Return the version identifier.
 long getVersionCreateTime()
          The time at which the current version of this file was created.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RepositoryDocumentImpl

public RepositoryDocumentImpl(BigdataFileSystem repo,
                              String id,
                              ITPS tps)
Read the metadata for the current version of the file from the repository.

Parameters:
id - The file identifier.
tps - The logical row describing the metadata for some file in the repository.

RepositoryDocumentImpl

public RepositoryDocumentImpl(BigdataFileSystem repo,
                              String id)
Read the metadata for the current version of the file from the repository.

Parameters:
id - The file identifier.
Method Detail

assertExists

protected final void assertExists()
Assert that a version of the file existed when this view was constructed.

Throws:
IllegalStateException - unless a version of the file existed at the time that this view was constructed.

exists

public final boolean exists()
Description copied from interface: DocumentHeader
Return true iff a version of the file existed at the time that this view was constructed.

Specified by:
exists in interface DocumentHeader

getVersion

public final int getVersion()
Description copied from interface: DocumentHeader
Return the version identifier.

Specified by:
getVersion in interface DocumentHeader

getEarliestVersionCreateTime

public final long getEarliestVersionCreateTime()
Note: This is obtained from the earliest available timestamp of the FileMetadataSchema.ID property.

Specified by:
getEarliestVersionCreateTime in interface DocumentHeader

getVersionCreateTime

public final long getVersionCreateTime()
Description copied from interface: DocumentHeader
The time at which the current version of this file was created.

Specified by:
getVersionCreateTime in interface DocumentHeader

getMetadataUpdateTime

public final long getMetadataUpdateTime()
Description copied from interface: DocumentHeader
The time at which the metadata for the current version of this file was last updated.

Specified by:
getMetadataUpdateTime in interface DocumentHeader

getAllVersionInfo

public final ITPV[] getAllVersionInfo()
Return an array containing all non-eradicated values of the FileMetadataSchema.VERSION property for this file as of the time that this view was constructed.

See Also:
BigdataFileSystem.getAllVersionInfo(String)

getInputStream

public final InputStream getInputStream()
Description copied from interface: Document
An input stream on the byte[] stored in the IContentRepository.

Specified by:
getInputStream in interface Document

getReader

public final Reader getReader()
                       throws UnsupportedEncodingException
Description copied from interface: Document
A reader on the byte[] stored in the IContentRepository where bytes are decoded to characters using the encoding identified by DocumentHeader.getContentEncoding().

Specified by:
getReader in interface Document
Throws:
UnsupportedEncodingException

getContentEncoding

public final String getContentEncoding()
Description copied from interface: DocumentHeader
The character set encoding that MUST be used to interpret the byte[] returned by Document#getContent().

Specified by:
getContentEncoding in interface DocumentHeader

getContentType

public final String getContentType()
Description copied from interface: DocumentHeader
The MIME type for the document.

Specified by:
getContentType in interface DocumentHeader

getId

public final String getId()
Description copied from interface: DocumentHeader
The unique identifier for the document within the IContentRepository.

Specified by:
getId in interface DocumentHeader

getProperty

public final Object getProperty(String name)
Description copied from interface: DocumentHeader
Get an arbitrary property value.

Specified by:
getProperty in interface DocumentHeader
Returns:
The value.

asMap

public final Map<String,Object> asMap()
Description copied from interface: DocumentHeader
Returns a read-only view of the document metadata.

Specified by:
asMap in interface DocumentHeader


Copyright © 2006-2011 SYSTAP, LLC. All Rights Reserved.