use of org.apache.jackrabbit.core.fs.local.LocalFileSystem in project jackrabbit by apache.
the class SearchIndex method createSynonymProviderConfigResource.
/**
* Creates a file system resource to the synonym provider configuration.
*
* @return a file system resource or <code>null</code> if no path was
* configured.
* @throws FileSystemException if an exception occurs accessing the file
* system.
* @throws IOException if another exception occurs.
*/
protected FileSystemResource createSynonymProviderConfigResource() throws FileSystemException, IOException {
if (synonymProviderConfigPath != null) {
FileSystemResource fsr;
// simple sanity check
if (synonymProviderConfigPath.endsWith(FileSystem.SEPARATOR)) {
throw new FileSystemException("Invalid synonymProviderConfigPath: " + synonymProviderConfigPath);
}
if (fs == null) {
fs = new LocalFileSystem();
int lastSeparator = synonymProviderConfigPath.lastIndexOf(FileSystem.SEPARATOR_CHAR);
if (lastSeparator != -1) {
File root = new File(path, synonymProviderConfigPath.substring(0, lastSeparator));
((LocalFileSystem) fs).setRoot(root.getCanonicalFile());
fs.init();
fsr = new FileSystemResource(fs, synonymProviderConfigPath.substring(lastSeparator + 1));
} else {
((LocalFileSystem) fs).setPath(path);
fs.init();
fsr = new FileSystemResource(fs, synonymProviderConfigPath);
}
synonymProviderConfigFs = fs;
} else {
fsr = new FileSystemResource(fs, synonymProviderConfigPath);
}
return fsr;
} else {
// path not configured
return null;
}
}
use of org.apache.jackrabbit.core.fs.local.LocalFileSystem 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.fs.local.LocalFileSystem 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;
}
use of org.apache.jackrabbit.core.fs.local.LocalFileSystem in project jackrabbit by apache.
the class MultiDataStore method init.
/**
* {@inheritDoc}
*/
public void init(String homeDir) throws RepositoryException {
if (delayedDelete) {
// First initialize the identifiersToDeleteFile
LocalFileSystem fileSystem = new LocalFileSystem();
fileSystem.setRoot(new File(homeDir));
identifiersToDeleteFile = new FileSystemResource(fileSystem, FileSystem.SEPARATOR + IDENTIFIERS_TO_DELETE_FILE_KEY);
}
moveDataTaskThread = new Thread(new MoveDataTask(), "Jackrabbit-MulitDataStore-MoveDataTaskThread");
moveDataTaskThread.setDaemon(true);
moveDataTaskThread.start();
log.info("MultiDataStore-MoveDataTask thread started; first run scheduled at " + moveDataTaskNextRun.getTime());
if (delayedDelete) {
try {
// delayedDeleteSleep timeout ...
if (identifiersToDeleteFile != null && identifiersToDeleteFile.exists() && (identifiersToDeleteFile.lastModified() + (delayedDeleteSleep * 1000)) < System.currentTimeMillis()) {
deleteDelayedIdentifiersTaskThread = new Thread(// Start immediately ...
new DeleteDelayedIdentifiersTask(0L), "Jackrabbit-MultiDataStore-DeleteDelayedIdentifiersTaskThread");
deleteDelayedIdentifiersTaskThread.setDaemon(true);
deleteDelayedIdentifiersTaskThread.start();
log.info("Old entries in the " + IDENTIFIERS_TO_DELETE_FILE_KEY + " File found. DeleteDelayedIdentifiersTask-Thread started now.");
}
} catch (FileSystemException e) {
throw new RepositoryException("I/O error while reading from '" + identifiersToDeleteFile.getPath() + "'", e);
}
}
}
Aggregations