org.okiproject.serviceapi.file
Class ByteStore

java.lang.Object
  |
  +--org.okiproject.serviceapi.file.ByteStore
All Implemented Interfaces:
java.io.Serializable

public class ByteStore
extends java.lang.Object
implements java.io.Serializable

Copyright (c) 2001 Massachusetts Institute of Technology

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


The ByteStore is the key interface. It is a set of bytes with associated physical metadata.

If the Cabinet implementation supports it, each ByteStore may be stored redundantly on multiple servers for protection against data loss.

If the Cabinet implementation supports versioning, it may have several versions of arbitrary depth.

For ease of use, the ByteStore interface parallels when appropriate the java.io.File class.

Versioning may be supported in the Cabinet. The default is to return the latest version of a ByteStore. Other versions may be accessed by a key string. Each version is itself a ByteStore, and may have versions of its own, permitting branching. The underlying principle is that all versions should serve the same basic purpose, have the same mime-type, be functionally equivalent. If idiosyncrasies of a particular version are significant, that version key may be specified. When a version key is specified, the base version rather than any latest sub-version is returned. Sub versions may then be obtained if desired. Different versions will only differ in bytes of content and therefore length, lastModified time, and digest/checksum. A particular version may be given a GUID only by creating a new ByteStore in the Cabinet.


$Source: /cvs/oki/org/okiproject/serviceapi/doc/file/org/okiproject/serviceapi/file/ByteStore.html,v $

See Also:
Serialized Form

Constructor Summary
ByteStore()
           
 
Method Summary
 boolean canRead()
          Method canRead
 boolean canWrite()
          Method canWrite
 int compareTo(java.lang.Object o)
          Method compareTo
 void deleteOnExit()
          Method deleteOnExit
 boolean equals(java.lang.Object obj)
          Method equals
 java.util.jar.Attributes getAttributes()
          Method getAttributes
 ByteStore getBaseVersion()
          Method getBaseVersion
 java.lang.String getByteStoreName()
          Method getByteStoreName
 java.lang.String getDigest(java.lang.String digestAlgorithm)
          Method getDigest
 org.okiproject.serviceapi.guid.GUID getGUID()
          Method getGUID
 java.io.InputStream getInputStream()
          Method getInputStream
 ByteStore getLatestVersion()
          Method getLatestVersion
 java.lang.String getMimeType()
          Method getMimeType
 java.io.OutputStream getOutputStream()
          Method getOutputStream
 org.okiproject.serviceapi.common.Agent getOwner()
          Method getOwner
 java.io.Reader getReader()
          Method getReader
 ByteStore getVersion(java.lang.String versionKey)
          Method getVersion
 ByteStore[] getVersions()
          Method getVersions
 java.io.Writer getWriter()
          Method getWriter
 int hashCode()
          Method hashCode
 boolean hasVersions()
          Method hasVersions
 long lastModified()
          Method lastModified
 long length()
          Method length
 ByteStore newVersion(org.okiproject.serviceapi.common.Agent a, java.lang.String versionKey)
          Method newVersion
 boolean renameTo(java.lang.String newName)
          Method renameTo
 boolean setLastModified(long time)
          Method setLastModified
 void setMimeType(java.lang.String mimeType)
          Method setMimeType
 void setOwner(org.okiproject.serviceapi.common.Agent owner)
          Method setOwner
 boolean setReadOnly()
          Method setReadOnly
 boolean setWritable()
          Method setWritable
 java.lang.String toString()
          Method toString
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ByteStore

public ByteStore()
Method Detail

length

public long length()
Method length
Returns:
 

lastModified

public long lastModified()
Method lastModified
Returns:
 

setLastModified

public boolean setLastModified(long time)
Method setLastModified
Parameters:
time -  
Returns:
 

deleteOnExit

public void deleteOnExit()
Method deleteOnExit

toString

public java.lang.String toString()
Method toString
Overrides:
toString in class java.lang.Object
Returns:
 

canRead

public boolean canRead()
Method canRead
Returns:
 

canWrite

public boolean canWrite()
Method canWrite
Returns:
 

setReadOnly

public boolean setReadOnly()
Method setReadOnly
Returns:
 

setWritable

public boolean setWritable()
Method setWritable
Returns:
 

compareTo

public int compareTo(java.lang.Object o)
Method compareTo
Parameters:
o -  
Returns:
 

equals

public boolean equals(java.lang.Object obj)
Method equals
Overrides:
equals in class java.lang.Object
Parameters:
obj -  
Returns:
 

hashCode

public int hashCode()
Method hashCode
Overrides:
hashCode in class java.lang.Object
Returns:
 

getGUID

public org.okiproject.serviceapi.guid.GUID getGUID()
Method getGUID
Returns:
 

getByteStoreName

public java.lang.String getByteStoreName()
Method getByteStoreName
Returns:
 

renameTo

public boolean renameTo(java.lang.String newName)
Method renameTo
Parameters:
newName -  
Returns:
 

getMimeType

public java.lang.String getMimeType()
Method getMimeType
Returns:
 

setMimeType

public void setMimeType(java.lang.String mimeType)
Method setMimeType
Parameters:
mimeType -  

getDigest

public java.lang.String getDigest(java.lang.String digestAlgorithm)
Method getDigest
Parameters:
digestAlgorithm -  
Returns:
 

getAttributes

public java.util.jar.Attributes getAttributes()
Method getAttributes
Returns:
 

getOwner

public org.okiproject.serviceapi.common.Agent getOwner()
Method getOwner
Returns:
 

setOwner

public void setOwner(org.okiproject.serviceapi.common.Agent owner)
Method setOwner
Parameters:
owner -  

getInputStream

public java.io.InputStream getInputStream()
Method getInputStream
Returns:
 

getOutputStream

public java.io.OutputStream getOutputStream()
Method getOutputStream
Returns:
 

getReader

public java.io.Reader getReader()
Method getReader
Returns:
 

getWriter

public java.io.Writer getWriter()
Method getWriter
Returns:
 

hasVersions

public boolean hasVersions()
Method hasVersions
Returns:
 

getLatestVersion

public ByteStore getLatestVersion()
Method getLatestVersion
Returns:
 

getBaseVersion

public ByteStore getBaseVersion()
Method getBaseVersion
Returns:
 

getVersion

public ByteStore getVersion(java.lang.String versionKey)
Method getVersion
Parameters:
versionKey -  
Returns:
 

getVersions

public ByteStore[] getVersions()
Method getVersions
Returns:
 

newVersion

public ByteStore newVersion(org.okiproject.serviceapi.common.Agent a,
                            java.lang.String versionKey)
Method newVersion
Parameters:
a -  
versionKey -  
Returns: