org.apache.ace.repository.ext
Interface CachedRepository

All Superinterfaces:
org.apache.ace.repository.Repository
All Known Implementing Classes:
CachedRepositoryImpl

public interface CachedRepository
extends org.apache.ace.repository.Repository

Provides a cached repository representation, allowing the storing of local changes, without committing them to the actual repository immediately.


Method Summary
 InputStream checkout(boolean fail)
          Checks our the most current version from the actual repository.
 boolean commit()
          Commits the most current version to the actual repository.
 InputStream getLocal(boolean fail)
          Gets the most recent version of the object.
 long getMostRecentVersion()
          Gets the most recent version of this repository, that is, the most recent version number that is either committed (successfully) or checked out.
 boolean isCurrent()
          Checks whether the version we have locally is current with respect to the version on the server.
 boolean revert()
          Undoes all changes made using writeLocal() since the last commit or checkout.
 void writeLocal(InputStream data)
          Writes the most recent version of the object.
 
Methods inherited from interface org.apache.ace.repository.Repository
checkout, commit, getRange
 

Method Detail

checkout

InputStream checkout(boolean fail)
                     throws IOException
Checks our the most current version from the actual repository.

Parameters:
fail - Indicates that this method should throw an IOException when no data is available. Setting it to false will make it return an empty stream in that case.
Returns:
An input stream representing the checked out object.
Throws:
IOException - Is thrown when the actual repository's commit does.

commit

boolean commit()
               throws IOException
Commits the most current version to the actual repository.

Returns:
true on success, false on failure (e.g. bad version number)
Throws:
IOException - Is thrown when the actual repository's commit does.

getLocal

InputStream getLocal(boolean fail)
                     throws IOException
Gets the most recent version of the object. If no current version is available, and empty stream will be returned.

Parameters:
fail - Indicates that this method should throw an IOException when no data is available. Setting it to false will make it return an empty stream in that case.
Returns:
An input stream representing the most recently written object.
Throws:
IOException - Thrown when there is a problem retrieving the data.

writeLocal

void writeLocal(InputStream data)
                throws IOException
Writes the most recent version of the object.

Throws:
IOException - Thrown when there is a problem storing the data.

revert

boolean revert()
               throws IOException
Undoes all changes made using writeLocal() since the last commit or checkout.

Throws:
IOException

getMostRecentVersion

long getMostRecentVersion()
Gets the most recent version of this repository, that is, the most recent version number that is either committed (successfully) or checked out.

Returns:
The most recent version of the underlying repository.

isCurrent

boolean isCurrent()
                  throws IOException
Checks whether the version we have locally is current with respect to the version on the server.

Returns:
whether the version we have locally is current with respect to the version on the server.
Throws:
IOException - Thrown when an error occurs communicating with the server.


Copyright © 2009-2011 The Apache Software Foundation. All Rights Reserved.