Package org.apache.ace.repository.ext.impl

Examples of org.apache.ace.repository.ext.impl.FilebasedBackupRepository


     */
    private CachedRepository getCachedRepositoryFromPreferences(User user, Repository repository) throws IOException {
        long mostRecentVersion = m_repositoryPrefs.getLong("version", CachedRepositoryImpl.UNCOMMITTED_VERSION);
        File current = getFileFromPreferences(PREFS_LOCAL_FILE_CURRENT);
        File backup = getFileFromPreferences(PREFS_LOCAL_FILE_BACKUP);
        return new CachedRepositoryImpl(user, repository, new FilebasedBackupRepository(current, backup), mostRecentVersion);
    }
View Full Code Here


            String fileRoot = FILE_ROOT + File.separator + customer + File.separator + name + File.separator;

            File local = getFile(fileRoot + "local");
            File backup = getFile(fileRoot + "backup");
            m_backup = new FilebasedBackupRepository(local, backup);
           
            m_properties = getFile(fileRoot + "properties");
           
            m_repoFilter = "(&(customer=" + customer + ")(name=" + name + "))";
        }
View Full Code Here

     * @throws IOException
     */
    private BackupRepository getBackupFromPreferences(Preferences repositoryPrefs) throws IOException {
        File current = getFileFromPreferences(repositoryPrefs, PREFS_LOCAL_FILE_CURRENT);
        File backup = getFileFromPreferences(repositoryPrefs, PREFS_LOCAL_FILE_BACKUP);
        return new FilebasedBackupRepository(current, backup);
    }
View Full Code Here

        File current = File.createTempFile("testFilebasedBackupRepository", null);
        File backup = File.createTempFile("testFilebasedBackupRepository", null);
        current.deleteOnExit();
        backup.deleteOnExit();

        FilebasedBackupRepository rep = new FilebasedBackupRepository(current, backup);

        byte[] testContent = new byte[] {'i', 'n', 'i', 't', 'i', 'a', 'l'};

        // write initial content
        rep.write(new ByteArrayInputStream(testContent));

        // read initial content
        InputStream input = rep.read();
        byte[] inputBytes = AdminTestUtil.copy(input);
        assert AdminTestUtil.byteArraysEqual(inputBytes, testContent) : "We got something different than 'initial' from read: " + new String(inputBytes);

        // backup what's in the repository
        rep.backup();

        // write new content
        byte[] newTestContent = new byte[] {'n', 'e', 'w'};
        rep.write(new ByteArrayInputStream(newTestContent));

        // read current content
        input = rep.read();
        inputBytes = AdminTestUtil.copy(input);
        assert AdminTestUtil.byteArraysEqual(inputBytes, newTestContent) : "We got something different than 'new' from read: " + new String(inputBytes);

        // revert to previous (initial) content
        rep.restore();

        // read current content
        input = rep.read();
        inputBytes = AdminTestUtil.copy(input);
        assert AdminTestUtil.byteArraysEqual(inputBytes, testContent) : "We got something different than 'initial' from read: " + new String(inputBytes);
    }
View Full Code Here

            String name = getNotNull(settings, NAME, "RepositoryName not configured.");
            String customer = getNotNull(settings, CUSTOMER, "RepositoryCustomer not configured.");

            // create the remote repository and set it.
            try {
                BackupRepository backup = new FilebasedBackupRepository(File.createTempFile("currentrepository", null), File.createTempFile("backuprepository", null));

                // We always create the remote repository. If we can create a backup repository, we will wrap a CachedRepository
                // around it.
                m_directRepository = new RemoteRepository(new URL(url), customer, name);
View Full Code Here

            String fileRoot = FILE_ROOT + File.separator + customer + File.separator + name + File.separator;

            File local = getFile(fileRoot + "local");
            File backup = getFile(fileRoot + "backup");
            m_backup = new FilebasedBackupRepository(local, backup);

            m_properties = getFile(fileRoot + "properties");

            m_repoFilter = "(&(customer=" + customer + ")(name=" + name + "))";
        }
View Full Code Here

     * @throws IOException
     */
    private BackupRepository getBackupFromPreferences(Preferences repositoryPrefs) throws IOException {
        File current = getFileFromPreferences(repositoryPrefs, PREFS_LOCAL_FILE_CURRENT);
        File backup = getFileFromPreferences(repositoryPrefs, PREFS_LOCAL_FILE_BACKUP);
        return new FilebasedBackupRepository(current, backup);
    }
View Full Code Here

                }
            }
           
            // create the remote repository and set it.
            try {
                BackupRepository backup = new FilebasedBackupRepository(File.createTempFile("currentrepository", null), File.createTempFile("backuprepository", null));

                // We always create the remote repository. If we can create a backup repository, we will wrap a CachedRepository
                // around it.
                m_directRepository = new RemoteRepository(new URL(url), customer, name);
View Full Code Here

            //create the remote repository and set it.
            try {
                BackupRepository backup = null;
                try {
                    backup = new FilebasedBackupRepository(File.createTempFile("currentrepository", null), File.createTempFile("backuprepository", null));
                }
                catch (Exception e) {
                    m_log.log(LogService.LOG_WARNING, "Unable to create temporary files for FilebasedBackupRepository");
                }
View Full Code Here

     * @throws IOException
     */
    private BackupRepository getBackupFromPreferences(Preferences repositoryPrefs) throws IOException {
        File current = getFileFromPreferences(repositoryPrefs, PREFS_LOCAL_FILE_CURRENT);
        File backup = getFileFromPreferences(repositoryPrefs, PREFS_LOCAL_FILE_BACKUP);
        return new FilebasedBackupRepository(current, backup);
    }
View Full Code Here

TOP

Related Classes of org.apache.ace.repository.ext.impl.FilebasedBackupRepository

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.