Package org.apache.ace.repository

Examples of org.apache.ace.repository.Repository


        return m_context.getServiceReferences(Repository.class.getName(), filter);
    }

    @Override
    protected SortedRangeSet getRange(ServiceReference ref) throws IOException {
        Repository repository = (Repository) m_context.getService(ref);
        SortedRangeSet range = repository.getRange();
        m_context.ungetService(ref);
        return range;
    }
View Full Code Here


        return range;
    }

    @Override
    protected boolean doCommit(ServiceReference ref, long version, InputStream data) throws IllegalArgumentException, IOException {
        Repository r = (Repository) m_context.getService(ref);
        boolean result = r.commit(data, version);
        m_context.ungetService(ref);
        return result;
    }
View Full Code Here

        return result;
    }

    @Override
    protected InputStream doCheckout(ServiceReference ref, long version) throws IllegalArgumentException, IOException {
        Repository r = (Repository) m_context.getService(ref);
        InputStream result = r.checkout(version);
        m_context.ungetService(ref);
        return result;
    }
View Full Code Here

     * @return The newly created repository set.
     * @throws IOException
     */
    @SuppressWarnings("unchecked")
    public RepositorySet loadRepositorySet(User user, RepositorySetDescriptor rsd, ObjectRepositoryImpl[] repos) throws IOException {
        Repository repo = new RemoteRepository(rsd.m_location, rsd.m_customer, rsd.m_name);

        // Expose the repository itself as component so its dependencies get managed...
        m_manager.add(m_manager.createComponent()
            .setImplementation(repo)
            .add(m_manager.createServiceDependency()
View Full Code Here

     * @throws java.io.IOException if there is a problem communicating with the local or remote repository.
     */
    private InputStream getRepositoryStream(boolean fail) throws IOException {
        // cache the repositories, since we do not want them to change while we're in this method.
        CachedRepository cachedRepository = m_cachedRepository;
        Repository repository = m_directRepository;
        InputStream result;

        if (cachedRepository != null) {
            // we can use the cached repository
            if (cachedRepository.isCurrent()) {
                result = cachedRepository.getLocal(fail);
            }
            else {
                result = cachedRepository.checkout(fail);
            }
        }
        else {
            RangeIterator ri = repository.getRange().iterator();
            long resultVersion = 0;
            while (ri.hasNext()) {
                resultVersion = ri.next();
            }
            if (resultVersion != 0) {
                result = repository.checkout(resultVersion);
            }
            else {
                throw new IllegalArgumentException("There is no deployment information available.");
            }
        }
View Full Code Here

     * we make the cached repository do a checkout, and check whether all data arrives at the
     * right places: in getLocal, and in the backup repository.
     */
    @Test( groups = { TestUtils.UNIT } )
    public void testInitialCheckout() throws IllegalArgumentException, IOException {
        Repository m_repository = new MockRepository();
        byte[] testContent = new byte[] {'i', 'n', 'i', 't', 'i', 'a', 'l'};
        m_repository.commit(new ByteArrayInputStream(testContent), 0);
        BackupRepository m_backupRepository = new MockBackupRepository();

        CachedRepository m_cachedRepository = new CachedRepositoryImpl(m_repository, m_backupRepository, 0);

        InputStream input = m_cachedRepository.checkout(1);
View Full Code Here

     * After each commit, we should be able to renew the cached repository,
     * and checkout the data we put in before.
     */
    @Test( groups = { TestUtils.UNIT } )
    public void testCommit() throws IllegalArgumentException, IOException {
        Repository m_repository = new MockRepository();
        BackupRepository m_backupRepository = new MockBackupRepository();

        CachedRepository m_cachedRepository = new CachedRepositoryImpl(m_repository, m_backupRepository, 0);
        byte[] testContent = new byte[] {'i', 'n', 'i', 't', 'i', 'a', 'l'};

View Full Code Here

     * @throws IOException
     * @throws IllegalArgumentException
     */
    @Test( groups = { TestUtils.UNIT } )
    public void testRevert() throws IllegalArgumentException, IOException {
        Repository m_repository = new MockRepository();
        BackupRepository m_backupRepository = new MockBackupRepository();

        CachedRepository m_cachedRepository = new CachedRepositoryImpl(m_repository, m_backupRepository, 0);
        byte[] testContent = new byte[] {'i', 'n', 'i', 't', 'i', 'a', 'l'};

View Full Code Here

     */
    @BeforeMethod(alwaysRun = true)
    public void setUp() throws Exception {
        // setup mock repository
        String range = "1-100000";
        Repository mock = new MockDeploymentRepository(range, generateHugeTestXml());
        m_backend = new RepositoryBasedProvider();
        TestUtils.configureObject(m_backend, Repository.class, mock);
        TestUtils.configureObject(m_backend, LogService.class);
    }
View Full Code Here

        setupSampleData();
        String deploymentRepositoryXml = generateValidTestXml();
        String range = "1,2,3";

        // setup mock repository
        Repository mock = new MockDeploymentRepository(range, deploymentRepositoryXml);
        m_backend = new RepositoryBasedProvider();
        TestUtils.configureObject(m_backend, Repository.class, mock);
        TestUtils.configureObject(m_backend, LogService.class);
    }
View Full Code Here

TOP

Related Classes of org.apache.ace.repository.Repository

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.