-/*
- * Copyright (C) 2007-2012 Argeo GmbH
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
package org.argeo.jcr;
import java.lang.reflect.InvocationHandler;
/** Logs in to the repository using various strategies. */
protected synchronized Session login() {
if (!isActive())
- throw new ArgeoJcrException("Thread bound session factory inactive");
+ throw new IllegalStateException("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 ArgeoJcrException("Cannot log in to repository", e1);
+ throw new JcrException("Cannot log in to repository", e1);
}
// log using default username / password (useful for testing purposes)
SimpleCredentials sc = new SimpleCredentials(defaultUsername, defaultPassword.toCharArray());
newSession = repository().login(sc, workspace);
} catch (RepositoryException e) {
- throw new ArgeoJcrException("Cannot log in to repository", e);
+ throw new JcrException("Cannot log in to repository", e);
}
session.set(newSession);
}
/**
- * Called before a method is actually called, allowing to check the session
- * or re-login it (e.g. if authentication has changed). The default
- * implementation returns the session.
+ * Called before a method is actually called, allowing to check the session or
+ * re-login it (e.g. if authentication has changed). The default implementation
+ * returns the session.
*/
protected Session preCall(Session session) {
return session;
if (it.hasNext())
return it.next();
}
- throw new ArgeoJcrException("No repository injected");
+ throw new IllegalStateException("No repository injected");
}
// /** Useful for declarative registration of OSGi services (blueprint) */