org.apache.ace.repository.impl
Class RepositoryImpl
java.lang.Object
org.apache.ace.repository.impl.RepositoryImpl
- All Implemented Interfaces:
- org.apache.ace.repository.Repository, org.apache.ace.repository.RepositoryReplication
public class RepositoryImpl
- extends Object
- implements org.apache.ace.repository.RepositoryReplication, org.apache.ace.repository.Repository
Implementation of an object repository. The object repository holds (big) chunks of data identified by
a version. To interact with the repository two interfaces are implemented:
Repository
- a read-write interface to the repository, you can commit and checkout versions
RepositoryReplication
- interface used only for replication of the repository, you can get and put versions
A repository can be either a master or a slave repository. Committing a new version is only possible on a master repository.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
RepositoryImpl
public RepositoryImpl(File dir,
File temp,
boolean isMaster)
- Creates a new repository.
- Parameters:
dir
- Directory to be used for storage of the repository data, will be created if needed.temp
- Directory to be used as temp directory, will be created if needed.isMaster
- True if this repository is a master repository, false otherwise.
- Throws:
IllegalArgumentException
- If dir
and/or temp
could not be created or is not a directory.
get
public InputStream get(long version)
throws IOException,
IllegalArgumentException
- Specified by:
get
in interface org.apache.ace.repository.RepositoryReplication
- Throws:
IOException
IllegalArgumentException
put
public boolean put(InputStream data,
long version)
throws IOException,
IllegalArgumentException
- Specified by:
put
in interface org.apache.ace.repository.RepositoryReplication
- Throws:
IOException
IllegalArgumentException
checkout
public InputStream checkout(long version)
throws IOException,
IllegalArgumentException
- Specified by:
checkout
in interface org.apache.ace.repository.Repository
- Throws:
IOException
IllegalArgumentException
commit
public boolean commit(InputStream data,
long fromVersion)
throws IOException,
IllegalArgumentException
- Specified by:
commit
in interface org.apache.ace.repository.Repository
- Throws:
IOException
IllegalArgumentException
getRange
public org.apache.ace.range.SortedRangeSet getRange()
throws IOException
- Specified by:
getRange
in interface org.apache.ace.repository.Repository
- Specified by:
getRange
in interface org.apache.ace.repository.RepositoryReplication
- Throws:
IOException
updated
public void updated(boolean isMaster)
throws org.osgi.service.cm.ConfigurationException
- Updates the repository configuration.
- Parameters:
isMaster
- True if the repository is a master repository, false otherwise.
- Throws:
org.osgi.service.cm.ConfigurationException
- If it was impossible to use the new configuration.
Copyright © 2009-2011 The Apache Software Foundation. All Rights Reserved.