Search in sources :

Example 1 with MemoryFileSystem

use of org.apache.jackrabbit.core.fs.mem.MemoryFileSystem in project jackrabbit by apache.

the class RetentionRegistryImplTest method createFileSystem.

private FileSystem createFileSystem() {
    FileSystem fs = new MemoryFileSystem();
    BufferedWriter writer = null;
    try {
        fs.createFolder("/");
        FileSystemResource file = new FileSystemResource(fs, "/retention");
        writer = new BufferedWriter(new OutputStreamWriter(file.getOutputStream()));
        writer.write(((NodeImpl) childN).getNodeId().toString());
    } catch (FileSystemException e) {
        log.error(e.getMessage());
    } catch (IOException e) {
        log.error(e.getMessage());
    } finally {
        IOUtils.closeQuietly(writer);
    }
    return fs;
}
Also used : FileSystemException(org.apache.jackrabbit.core.fs.FileSystemException) MemoryFileSystem(org.apache.jackrabbit.core.fs.mem.MemoryFileSystem) FileSystem(org.apache.jackrabbit.core.fs.FileSystem) MemoryFileSystem(org.apache.jackrabbit.core.fs.mem.MemoryFileSystem) OutputStreamWriter(java.io.OutputStreamWriter) FileSystemResource(org.apache.jackrabbit.core.fs.FileSystemResource) IOException(java.io.IOException) BufferedWriter(java.io.BufferedWriter)

Example 2 with MemoryFileSystem

use of org.apache.jackrabbit.core.fs.mem.MemoryFileSystem in project jackrabbit by apache.

the class PersistenceManagerTest method assertPersistenceManager.

private void assertPersistenceManager(PersistenceManager manager) throws Exception {
    manager.init(new PMContext(directory, new MemoryFileSystem(), RepositoryImpl.ROOT_NODE_ID, new NamespaceRegistryImpl(new MemoryFileSystem()), null, null, new RepositoryStatisticsImpl()));
    try {
        assertCreateNewNode(manager);
        assertCreateNewProperty(manager);
        assertMissingItemStates(manager);
        assertCreateUpdateDelete(manager);
    } finally {
        manager.close();
    }
}
Also used : MemoryFileSystem(org.apache.jackrabbit.core.fs.mem.MemoryFileSystem) RepositoryStatisticsImpl(org.apache.jackrabbit.stats.RepositoryStatisticsImpl) NamespaceRegistryImpl(org.apache.jackrabbit.core.NamespaceRegistryImpl)

Example 3 with MemoryFileSystem

use of org.apache.jackrabbit.core.fs.mem.MemoryFileSystem in project jackrabbit by apache.

the class InMemPersistenceManager method init.

//---------------------------------------------------< PersistenceManager >
/**
     * {@inheritDoc}
     */
public void init(PMContext context) throws Exception {
    if (initialized) {
        throw new IllegalStateException("already initialized");
    }
    stateStore = new HashMap<ItemId, byte[]>(initialCapacity, loadFactor);
    refsStore = new HashMap<NodeId, byte[]>(initialCapacity, loadFactor);
    wspFS = context.getFileSystem();
    // Choose a FileSystem for the BlobStore based on whether data is persistent or not 
    if (persistent) {
        blobFS = new LocalFileSystem();
        ((LocalFileSystem) blobFS).setRoot(new File(context.getHomeDir(), "blobs"));
    } else {
        blobFS = new MemoryFileSystem();
    }
    blobFS.init();
    blobStore = new FileSystemBLOBStore(blobFS);
    if (persistent) {
        // deserialize contents of state and refs stores
        loadContents();
    }
    initialized = true;
}
Also used : MemoryFileSystem(org.apache.jackrabbit.core.fs.mem.MemoryFileSystem) LocalFileSystem(org.apache.jackrabbit.core.fs.local.LocalFileSystem) NodeId(org.apache.jackrabbit.core.id.NodeId) ItemId(org.apache.jackrabbit.core.id.ItemId) File(java.io.File) FileSystemBLOBStore(org.apache.jackrabbit.core.persistence.util.FileSystemBLOBStore)

Aggregations

MemoryFileSystem (org.apache.jackrabbit.core.fs.mem.MemoryFileSystem)3 BufferedWriter (java.io.BufferedWriter)1 File (java.io.File)1 IOException (java.io.IOException)1 OutputStreamWriter (java.io.OutputStreamWriter)1 NamespaceRegistryImpl (org.apache.jackrabbit.core.NamespaceRegistryImpl)1 FileSystem (org.apache.jackrabbit.core.fs.FileSystem)1 FileSystemException (org.apache.jackrabbit.core.fs.FileSystemException)1 FileSystemResource (org.apache.jackrabbit.core.fs.FileSystemResource)1 LocalFileSystem (org.apache.jackrabbit.core.fs.local.LocalFileSystem)1 ItemId (org.apache.jackrabbit.core.id.ItemId)1 NodeId (org.apache.jackrabbit.core.id.NodeId)1 FileSystemBLOBStore (org.apache.jackrabbit.core.persistence.util.FileSystemBLOBStore)1 RepositoryStatisticsImpl (org.apache.jackrabbit.stats.RepositoryStatisticsImpl)1