use of org.apache.jackrabbit.core.version.InternalVersionManagerImpl in project jackrabbit by apache.
the class RepositoryImpl method createVersionManager.
/**
* Creates the version manager.
*
* @param vConfig the versioning config
* @return the newly created version manager
* @throws RepositoryException if an error occurs
*/
protected InternalVersionManagerImpl createVersionManager(VersioningConfig vConfig, DelegatingObservationDispatcher delegatingDispatcher) throws RepositoryException {
FileSystem fs = vConfig.getFileSystem();
PersistenceManager pm = createPersistenceManager(vConfig.getHomeDir(), fs, vConfig.getPersistenceManagerConfig());
ISMLocking ismLocking = vConfig.getISMLocking();
return new InternalVersionManagerImpl(pm, fs, context.getNodeTypeRegistry(), delegatingDispatcher, SYSTEM_ROOT_NODE_ID, VERSION_STORAGE_NODE_ID, ACTIVITIES_NODE_ID, context.getItemStateCacheFactory(), ismLocking, context.getNodeIdFactory());
}
use of org.apache.jackrabbit.core.version.InternalVersionManagerImpl in project jackrabbit by apache.
the class RepositoryImpl method createDataStoreGarbageCollector.
/**
* Creates a data store garbage collector for this repository.
* <p>
* Note that you should use the {@link RepositoryManager} interface
* to access this functionality. This RepositoryImpl method may be
* removed in future Jackrabbit versions.
*/
public GarbageCollector createDataStoreGarbageCollector() throws RepositoryException {
ArrayList<PersistenceManager> pmList = new ArrayList<PersistenceManager>();
InternalVersionManagerImpl vm = context.getInternalVersionManager();
PersistenceManager pm = vm.getPersistenceManager();
pmList.add(pm);
String[] wspNames = getWorkspaceNames();
SessionImpl[] sessions = new SessionImpl[wspNames.length];
for (int i = 0; i < wspNames.length; i++) {
String wspName = wspNames[i];
WorkspaceInfo wspInfo = getWorkspaceInfo(wspName);
// this will initialize the workspace if required
SessionImpl systemSession = SystemSession.create(context, wspInfo.getConfig());
// mark the workspace as 'active' so it does not get disposed by
// the workspace-janitor until the garbage collector is done
wspInfo.setActive(true);
// the workspace could be disposed, so re-initialize if required
// afterwards it will not be disposed because it was marked active
wspInfo.initialize();
sessions[i] = systemSession;
pm = wspInfo.getPersistenceManager();
pmList.add(pm);
}
IterablePersistenceManager[] ipmList = new IterablePersistenceManager[pmList.size()];
for (int i = 0; i < pmList.size(); i++) {
pm = pmList.get(i);
if (!(pm instanceof IterablePersistenceManager)) {
ipmList = null;
break;
}
ipmList[i] = (IterablePersistenceManager) pm;
}
GarbageCollector gc = new GarbageCollector(context, context.getDataStore(), ipmList, sessions);
synchronized (this) {
if (context.isGcRunning()) {
throw new RepositoryException("Cannot create GC. GC already running");
}
context.setGcRunning(true);
}
return gc;
}
Aggregations