import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.argeo.ArgeoException;
/** Proxy JCR sessions and attach them to calling threads. */
+@Deprecated
public abstract class ThreadBoundJcrSessionFactory {
private final static Log log = LogFactory
.getLog(ThreadBoundJcrSessionFactory.class);
/** Logs in to the repository using various strategies. */
protected synchronized Session login() {
if (!isActive())
- throw new ArgeoException("Thread bound session factory inactive");
+ throw new ArgeoJcrException("Thread bound session factory inactive");
// discard session previously attached to this thread
Thread thread = Thread.currentThread();
// invalid credentials, go to the next step
} catch (RepositoryException e1) {
// other kind of exception, fail
- throw new ArgeoException("Cannot log in to repository", e1);
+ throw new ArgeoJcrException("Cannot log in to repository", e1);
}
// log using default username / password (useful for testing purposes)
defaultPassword.toCharArray());
newSession = repository().login(sc, workspace);
} catch (RepositoryException e) {
- throw new ArgeoException("Cannot log in to repository", e);
+ throw new ArgeoJcrException("Cannot log in to repository", e);
}
session.set(newSession);
}
public void init() throws Exception {
+ log.error("SHOULD NOT BE USED ANYMORE");
monitoringThread = new MonitoringThread();
monitoringThread.start();
}
- public synchronized void dispose() throws Exception {
- if (activeSessions.size() == 0)
- return;
+ public void dispose() throws Exception {
+ // if (activeSessions.size() == 0)
+ // return;
if (log.isTraceEnabled())
log.trace("Cleaning up " + activeSessions.size()
if (it.hasNext())
return it.next();
}
- throw new ArgeoException("No repository injected");
+ throw new ArgeoJcrException("No repository injected");
}
// /** Useful for declarative registration of OSGi services (blueprint) */