use of org.apache.jackrabbit.core.persistence.util.FileSystemBLOBStore in project jackrabbit by apache.
the class DatabasePersistenceManager method init.
// ---------------------------------------------------< PersistenceManager >
/**
* {@inheritDoc}
*/
public void init(PMContext context) throws Exception {
if (initialized) {
throw new IllegalStateException("already initialized");
}
// setup jdbc connection
initConnection();
DatabaseMetaData meta = con.getMetaData();
try {
log.info("Database: " + meta.getDatabaseProductName() + " / " + meta.getDatabaseProductVersion());
log.info("Driver: " + meta.getDriverName() + " / " + meta.getDriverVersion());
} catch (SQLException e) {
log.warn("Can not retrieve database and driver name / version", e);
}
// make sure schemaObjectPrefix consists of legal name characters only
prepareSchemaObjectPrefix();
// check if schema objects exist and create them if necessary
if (isSchemaCheckEnabled()) {
checkSchema();
}
// build sql statements
buildSQLStatements();
// prepare statements
initPreparedStatements();
if (externalBLOBs) {
/**
* store BLOBs in local file system in a sub directory
* of the workspace home directory
*/
LocalFileSystem blobFS = new LocalFileSystem();
blobFS.setRoot(new File(context.getHomeDir(), "blobs"));
blobFS.init();
this.blobFS = blobFS;
blobStore = new FileSystemBLOBStore(blobFS);
} else {
/**
* store BLOBs in db
*/
blobStore = new DbBLOBStore();
}
initialized = true;
}
use of org.apache.jackrabbit.core.persistence.util.FileSystemBLOBStore 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;
}
use of org.apache.jackrabbit.core.persistence.util.FileSystemBLOBStore in project jackrabbit by apache.
the class ObjectPersistenceManager method init.
// ---------------------------------------------------< PersistenceManager >
/**
* {@inheritDoc}
*/
public void init(PMContext context) throws Exception {
if (initialized) {
throw new IllegalStateException("already initialized");
}
FileSystem wspFS = context.getFileSystem();
itemStateFS = new BasedFileSystem(wspFS, "/data");
/**
* store BLOB data in local file system in a sub directory
* of the workspace home directory
*/
LocalFileSystem blobFS = new LocalFileSystem();
blobFS.setRoot(new File(context.getHomeDir(), "blobs"));
blobFS.init();
this.blobFS = blobFS;
blobStore = new FileSystemBLOBStore(blobFS);
initialized = true;
}
use of org.apache.jackrabbit.core.persistence.util.FileSystemBLOBStore in project jackrabbit by apache.
the class XMLPersistenceManager method init.
// ---------------------------------------------------< PersistenceManager >
/**
* {@inheritDoc}
*/
public void init(PMContext context) throws Exception {
if (initialized) {
throw new IllegalStateException("already initialized");
}
itemStateFS = new BasedFileSystem(context.getFileSystem(), "/data");
/**
* store BLOB data in local file system in a sub directory
* of the workspace home directory
*/
LocalFileSystem blobFS = new LocalFileSystem();
blobFS.setRoot(new File(context.getHomeDir(), "blobs"));
blobFS.init();
this.blobFS = blobFS;
blobStore = new FileSystemBLOBStore(blobFS);
initialized = true;
}
use of org.apache.jackrabbit.core.persistence.util.FileSystemBLOBStore 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;
}
Aggregations