okapi.util
Class OkapiStore

java.lang.Object
  extended by okapi.util.OkapiStore
All Implemented Interfaces:
java.io.Serializable

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

General file-like storage.

Use an OkapiStore much as you'd use a file. Create a new Store with OkapiStore(originalFilename, mimeType, user) or OkapiStore(originalFilename, mimeType), and record the ID of this store for future use. Use OkapiStoreOutputStream or OkapiStoreWriter to write to the new store.

We record the originalFilename string as an aid to users in recognizing the file, it has no other function. E.g., when a Store is used in a Content, it is wrapped in an Atom which has a name associated with it which is independent of the original file name.

Create new versions of the Store by calling its newVersion() method and record the returned versionKey, or access the available versions of the Store through the vector returned by getVersions.

To read the contents of a Store, use OkapiStore(storeID) and then use OkapiStoreInputStream or OkapiStoreReader. To access a particular version, use the getVersion() method with the versionKey of the version you want to use. Otherwise you'll get the latest version.

Version:
$Revision: 31044 $, $Date: 2008-09-02 17:08:01 -0400 (Tue, 02 Sep 2008) $
Author:
MIT Stellar team
See Also:
Serialized Form

Constructor Summary
protected OkapiStore()
           
  OkapiStore(java.lang.String id)
          Return latest version of the OkapiStore with this ID.
protected OkapiStore(java.lang.String id, OkapiStoreFactory factory)
           
  OkapiStore(java.lang.String filePath, java.lang.String mimeType)
          Create new Store, with original filePath, specified mime-type.
  OkapiStore(java.lang.String filePath, java.lang.String mimeType, java.lang.String userName)
          Create new Store, with original filePath, specified mime-type, for specified user (by name).
protected OkapiStore(java.lang.String filePath, java.lang.String mimeType, java.lang.String userName, OkapiStoreFactory factory)
           
 
Method Summary
protected  void finalize()
           
 java.lang.String getFilePath()
          Return filePathof this OkapiStore.
 java.lang.String getID()
          Return ID of this OkapiStore.
 java.util.jar.JarFile getJarFile()
          return store as a jar file
 void getLatestVersion()
          Set OkapiStore to latest version
 java.lang.String getMimeType()
          Return mime-type of this OkapiStore.
static java.util.Hashtable getStoredFilePaths()
          Deprecated.  
 boolean getVersion(java.lang.String versionKey)
          Set OkapiStore to particular version, or return false.
 java.util.List getVersions()
          Return Vector of available versions of this OkapiStore.
 long lastModified()
          long lastModified() Returns the time that the file denoted by this abstract pathname was last modified.
 long length()
          Returns the length of the Store
 java.lang.String newVersion(java.lang.String userName)
          Create a new version of this OkapiStore.
static void recoverState()
          Recover stores list from metadata stored with each file.
 void setDataSource(javax.sql.DataSource dataSource)
          Set the dataSource to be used for data access.
static void setFilingParameters(java.lang.String newOkiStorePrefix, java.lang.String serviceName, java.lang.String clientFactoryName, java.lang.String hostName, int hostPort)
          Method setFilingParameters
 void setMimeType(java.lang.String mimeType)
          Return mime-type of this OkapiStore.
static void setServerName(java.lang.String newServerName)
          Set the name of the server, to be used in file:// URIs.
 void setStaticOkapiStoreFactory(OkapiStoreFactory newFactory)
           
static void setStoresDirectory(java.lang.String directory)
          Set the directory to be used for the creation and retrieval of all future Stores.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OkapiStore

public OkapiStore(java.lang.String filePath,
                  java.lang.String mimeType,
                  java.lang.String userName)
Create new Store, with original filePath, specified mime-type, for specified user (by name). to be deprecated Use OkapiStoreFactory.


OkapiStore

protected OkapiStore(java.lang.String filePath,
                     java.lang.String mimeType,
                     java.lang.String userName,
                     OkapiStoreFactory factory)

OkapiStore

public OkapiStore(java.lang.String filePath,
                  java.lang.String mimeType)
Create new Store, with original filePath, specified mime-type. to be deprecated Use OkapiStoreFactory.


OkapiStore

public OkapiStore(java.lang.String id)
Return latest version of the OkapiStore with this ID. to be deprecated Use OkapiStoreFactory.


OkapiStore

protected OkapiStore(java.lang.String id,
                     OkapiStoreFactory factory)

OkapiStore

protected OkapiStore()
Method Detail

setStaticOkapiStoreFactory

public void setStaticOkapiStoreFactory(OkapiStoreFactory newFactory)

finalize

protected void finalize()
Overrides:
finalize in class java.lang.Object

setStoresDirectory

public static void setStoresDirectory(java.lang.String directory)
Set the directory to be used for the creation and retrieval of all future Stores. to be deprecated Use OkapiStoreFactory.


setServerName

public static void setServerName(java.lang.String newServerName)
Set the name of the server, to be used in file:// URIs. to be deprecated Use OkapiStoreFactory.


setFilingParameters

public static void setFilingParameters(java.lang.String newOkiStorePrefix,
                                       java.lang.String serviceName,
                                       java.lang.String clientFactoryName,
                                       java.lang.String hostName,
                                       int hostPort)
Method setFilingParameters

Parameters:
newOkiStorePrefix -
serviceName -
clientFactoryName -
hostName -
hostPort - to be deprecated Use OkapiStoreFactory.

getVersion

public boolean getVersion(java.lang.String versionKey)
Set OkapiStore to particular version, or return false.


getLatestVersion

public void getLatestVersion()
Set OkapiStore to latest version


getID

public java.lang.String getID()
Return ID of this OkapiStore.


getFilePath

public java.lang.String getFilePath()
Return filePathof this OkapiStore.


getMimeType

public java.lang.String getMimeType()
Return mime-type of this OkapiStore.


setMimeType

public void setMimeType(java.lang.String mimeType)
Return mime-type of this OkapiStore.


getVersions

public java.util.List getVersions()
Return Vector of available versions of this OkapiStore.


newVersion

public java.lang.String newVersion(java.lang.String userName)
Create a new version of this OkapiStore.


getStoredFilePaths

public static java.util.Hashtable getStoredFilePaths()
Deprecated. 

Return Hashtable of filePaths, storeIDs


recoverState

public static void recoverState()
Recover stores list from metadata stored with each file.


length

public long length()
Returns the length of the Store


lastModified

public long lastModified()
long lastModified() Returns the time that the file denoted by this abstract pathname was last modified.


getJarFile

public java.util.jar.JarFile getJarFile()
return store as a jar file


setDataSource

public void setDataSource(javax.sql.DataSource dataSource)
Set the dataSource to be used for data access.

Parameters:
dataSource -


Copyright ? 2001-2009 MIT. All Rights Reserved.