org.apache.ace.repository.impl
Class RepositoryImpl

java.lang.Object
  extended by 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:

A repository can be either a master or a slave repository. Committing a new version is only possible on a master repository.


Constructor Summary
RepositoryImpl(File dir, File temp, boolean isMaster)
          Creates a new repository.
 
Method Summary
 InputStream checkout(long version)
           
 boolean commit(InputStream data, long fromVersion)
           
 InputStream get(long version)
           
 org.apache.ace.range.SortedRangeSet getRange()
           
 boolean put(InputStream data, long version)
           
 void updated(boolean isMaster)
          Updates the repository configuration.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

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.
Method Detail

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.