}
private Session getSessionByURL(ConnectionInfo connectionInfo) {
Session session = null;
try {
Repository repository = new URLRemoteRepository(connectionInfo.getRepositoryURL());
String workspaceName = connectionInfo.getWorkspaceName();
String username = connectionInfo.getUsername();
String password = connectionInfo.getPassword();
if (workspaceName == null || workspaceName.equals("") || workspaceName.equals("default")) {
session = repository.login(new SimpleCredentials(username, password.toCharArray()));
} else {
session = repository.login(new SimpleCredentials(username, password.toCharArray()),
workspaceName);
}
} catch (LoginException e) {
log.debug("Failed to get JCR session by URLRemoteRepository");