org.progeeks.repository
Class Repository.ReadLockedItem

java.lang.Object
  extended by org.progeeks.repository.Repository.ReadLockedItem
All Implemented Interfaces:
RepositoryItem, Identifiable
Direct Known Subclasses:
Repository.WriteLockedItem
Enclosing class:
Repository

protected class Repository.ReadLockedItem
extends java.lang.Object
implements RepositoryItem

Repository item implementation for items that are locked for reading only.


Constructor Summary
Repository.ReadLockedItem(java.lang.String itemId, java.io.File dataFile, java.io.File metaDataFile)
           
 
Method Summary
 void delete()
          Deletes the item and its meta-data from the repository.
 java.io.File getDataFile()
          Returns the file object for the item's data.
 java.lang.String getId()
          Returns the id string that unique identifies the item in the repository.
 Lock getLock()
          Returns the unique identifier for the lock that the repository item was obtained with.
 MetaObject getMetaData()
          Returns the meta-data for the file.
 void release()
          Releases the lock held on an item.
 void setMetaData(MetaObject metaData)
          Sets the meta-data for a file, replacing any existing meta-data it had.
 java.lang.String toString()
          Returns a string summary of the object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Repository.ReadLockedItem

public Repository.ReadLockedItem(java.lang.String itemId,
                                 java.io.File dataFile,
                                 java.io.File metaDataFile)
Method Detail

delete

public void delete()
Description copied from interface: RepositoryItem
Deletes the item and its meta-data from the repository. This can only be done if the item was obtained with a write lock.

Specified by:
delete in interface RepositoryItem

getDataFile

public java.io.File getDataFile()
Description copied from interface: RepositoryItem
Returns the file object for the item's data. It is up to the caller to not abuse this. No attempt is made to prevent changes to an item's data if the item was not obtained with a write lock.

Specified by:
getDataFile in interface RepositoryItem

getId

public java.lang.String getId()
Description copied from interface: RepositoryItem
Returns the id string that unique identifies the item in the repository.

Specified by:
getId in interface RepositoryItem
Specified by:
getId in interface Identifiable

getLock

public Lock getLock()
Description copied from interface: RepositoryItem
Returns the unique identifier for the lock that the repository item was obtained with.

Specified by:
getLock in interface RepositoryItem

getMetaData

public MetaObject getMetaData()
Description copied from interface: RepositoryItem
Returns the meta-data for the file.

Specified by:
getMetaData in interface RepositoryItem

setMetaData

public void setMetaData(MetaObject metaData)
Description copied from interface: RepositoryItem
Sets the meta-data for a file, replacing any existing meta-data it had. This can only be done if the item was obtained with a write lock.

Specified by:
setMetaData in interface RepositoryItem

release

public void release()
Description copied from interface: RepositoryItem
Releases the lock held on an item. After this is called, the repository item object will no longer be usable. It is up to the caller to ensure that no one is using any data file objects returned for this item.

Specified by:
release in interface RepositoryItem

toString

public java.lang.String toString()
Returns a string summary of the object.

Overrides:
toString in class java.lang.Object


Copyright © 2002-2003 Paul Speed. All Rights Reserved.