in src/main/java/org/apache/sling/jcr/base/AbstractSlingRepository2.java [328:355]
public Session login(Credentials credentials, String workspace)
throws LoginException, NoSuchWorkspaceException, RepositoryException {
if (credentials == null) {
credentials = new GuestCredentials();
}
// check the workspace
if (workspace == null) {
workspace = this.getDefaultWorkspace();
}
try {
logger.debug("login: Logging in to workspace '" + workspace + "'");
final Repository repository = this.getRepository();
if (this.getRepository() == null) {
throw new RepositoryException("Sling Repository not ready");
}
final Session session = repository.login(credentials, workspace);
return session;
} catch (final RuntimeException re) {
// SLING-702: Jackrabbit throws IllegalStateException if the
// repository has already been shut down ...
throw new RepositoryException(re.getMessage(), re);
}
}