use of org.apache.jackrabbit.core.persistence.PersistenceManager in project jackrabbit by apache.
the class TestHelper method checkConsistency.
/**
* Runs a consistency check on the workspace used by the specified session.
*
* @param session the Session accessing the workspace to be checked
* @param runFix whether to attempt fixup
* @param lostNFoundId node to which to attach orphaned nodes (or <code>null</code>)
* @throws RepositoryException if an error occurs while getting the
* workspace with the given name.
* @throws NotExecutableException if the {@link PersistenceManager} does
* not implement {@link ConsistencyChecker}, or if the associated
* {@link Repository} is not a {@link RepositoryImpl}.
*/
public static ConsistencyReport checkConsistency(Session session, boolean runFix, String lostNFoundId) throws NotExecutableException, RepositoryException {
Repository r = session.getRepository();
if (!(r instanceof RepositoryImpl)) {
throw new NotExecutableException();
} else {
RepositoryImpl ri = (RepositoryImpl) r;
PersistenceManager pm = ri.getWorkspaceInfo(session.getWorkspace().getName()).getPersistenceManager();
if (!(pm instanceof ConsistencyChecker)) {
throw new NotExecutableException();
} else {
return ((ConsistencyChecker) pm).check(null, true, runFix, lostNFoundId, null);
}
}
}
use of org.apache.jackrabbit.core.persistence.PersistenceManager in project jackrabbit by apache.
the class TestHelper method checkVersionStoreConsistency.
/**
* Runs a consistency check on the versioning store used by the specified session.
*
* @param session the Session accessing the workspace to be checked
* @param runFix whether to attempt fixup
* @param lostNFoundId node to which to attach orphaned nodes (or <code>null</code>)
* @throws RepositoryException
* @throws NotExecutableException if the {@link PersistenceManager} does
* not implement {@link ConsistencyChecker}, or if the associated
* {@link Repository} is not a {@link RepositoryImpl}.
*/
public static ConsistencyReport checkVersionStoreConsistency(Session session, boolean runFix, String lostNFoundId) throws NotExecutableException, RepositoryException {
Repository r = session.getRepository();
if (!(r instanceof RepositoryImpl)) {
throw new NotExecutableException();
} else {
RepositoryImpl ri = (RepositoryImpl) r;
PersistenceManager pm = ri.getRepositoryContext().getInternalVersionManager().getPersistenceManager();
if (!(pm instanceof ConsistencyChecker)) {
throw new NotExecutableException();
} else {
return ((ConsistencyChecker) pm).check(null, true, runFix, lostNFoundId, null);
}
}
}
Aggregations