Search in sources :

Example 1 with BundleBinding

use of org.apache.jackrabbit.core.persistence.util.BundleBinding in project jackrabbit by apache.

the class InMemBundlePersistenceManager method init.

//---------------------------------------------------< PersistenceManager >
/**
     * {@inheritDoc}
     */
public void init(PMContext context) throws Exception {
    if (initialized) {
        throw new IllegalStateException("already initialized");
    }
    super.init(context);
    // initialize mem stores
    bundleStore = new LinkedHashMap<NodeId, byte[]>(initialCapacity, loadFactor);
    refsStore = new HashMap<NodeId, byte[]>(initialCapacity, loadFactor);
    // Choose a FileSystem for the BlobStore based on whether data is persistent or not 
    if (useFileBlobStore) {
        blobFS = new LocalFileSystem();
        ((LocalFileSystem) blobFS).setRoot(new File(context.getHomeDir(), "blobs"));
        blobFS.init();
        blobStore = new FileSystemBLOBStore(blobFS);
    } else {
        blobStore = new InMemBLOBStore();
    }
    wspFS = context.getFileSystem();
    // load namespaces
    binding = new BundleBinding(errorHandling, blobStore, getNsIndex(), getNameIndex(), context.getDataStore());
    binding.setMinBlobSize(minBlobSize);
    if (persistent) {
        // deserialize contents of the stores
        loadContents();
    }
    initialized = true;
}
Also used : LocalFileSystem(org.apache.jackrabbit.core.fs.local.LocalFileSystem) NodeId(org.apache.jackrabbit.core.id.NodeId) BundleBinding(org.apache.jackrabbit.core.persistence.util.BundleBinding) File(java.io.File) FileSystemBLOBStore(org.apache.jackrabbit.core.persistence.util.FileSystemBLOBStore)

Example 2 with BundleBinding

use of org.apache.jackrabbit.core.persistence.util.BundleBinding in project jackrabbit by apache.

the class BundleFsPersistenceManager method init.

/**
     * {@inheritDoc}
     */
public void init(PMContext context) throws Exception {
    if (initialized) {
        throw new IllegalStateException("already initialized");
    }
    super.init(context);
    this.name = context.getHomeDir().getName();
    // create item fs
    itemFs = new BasedFileSystem(context.getFileSystem(), "items");
    // create correct blob store
    if (useLocalFsBlobStore()) {
        LocalFileSystem blobFS = new LocalFileSystem();
        blobFS.setRoot(new File(context.getHomeDir(), "blobs"));
        blobFS.init();
        blobStore = new BundleFsPersistenceManager.FSBlobStore(blobFS);
    } else {
        blobStore = new BundleFsPersistenceManager.FSBlobStore(itemFs);
    }
    // load namespaces
    binding = new BundleBinding(errorHandling, blobStore, getNsIndex(), getNameIndex(), context.getDataStore());
    binding.setMinBlobSize(minBlobSize);
    initialized = true;
}
Also used : BasedFileSystem(org.apache.jackrabbit.core.fs.BasedFileSystem) LocalFileSystem(org.apache.jackrabbit.core.fs.local.LocalFileSystem) BundleBinding(org.apache.jackrabbit.core.persistence.util.BundleBinding) File(java.io.File)

Example 3 with BundleBinding

use of org.apache.jackrabbit.core.persistence.util.BundleBinding in project jackrabbit by apache.

the class BundleDbPersistenceManager method init.

/**
     * {@inheritDoc}
     */
public void init(PMContext context) throws Exception {
    if (initialized) {
        throw new IllegalStateException("already initialized");
    }
    super.init(context);
    conHelper = createConnectionHelper(getDataSource());
    this.name = context.getHomeDir().getName();
    // make sure schemaObjectPrefix consists of legal name characters only
    schemaObjectPrefix = conHelper.prepareDbIdentifier(schemaObjectPrefix);
    // check if schema objects exist and create them if necessary
    if (isSchemaCheckEnabled()) {
        createCheckSchemaOperation().run();
    }
    // create correct blob store
    blobStore = createBlobStore();
    buildSQLStatements();
    // load namespaces
    binding = new BundleBinding(errorHandling, blobStore, getNsIndex(), getNameIndex(), context.getDataStore());
    binding.setMinBlobSize(minBlobSize);
    initialized = true;
    if (consistencyCheck) {
        // check all bundles
        checkConsistency(null, true, consistencyFix);
    }
}
Also used : BundleBinding(org.apache.jackrabbit.core.persistence.util.BundleBinding)

Aggregations

BundleBinding (org.apache.jackrabbit.core.persistence.util.BundleBinding)3 File (java.io.File)2 LocalFileSystem (org.apache.jackrabbit.core.fs.local.LocalFileSystem)2 BasedFileSystem (org.apache.jackrabbit.core.fs.BasedFileSystem)1 NodeId (org.apache.jackrabbit.core.id.NodeId)1 FileSystemBLOBStore (org.apache.jackrabbit.core.persistence.util.FileSystemBLOBStore)1