- Repository repository = bc.getService(
- bc.getServiceReferences(Repository.class, "(cn=" + NodeConstants.HOME + ")").iterator().next());
- Session session = repository.login();
- JcrFileSystem fileSystem = new JcrFileSystem(this, session);
- fileSystems.put(username, fileSystem);
- return fileSystem;
- } catch (Exception e) {
- throw new CmsException("Cannot open file system " + uri + " for user " + username, e);
+ String host = uri.getHost();
+ if (host != null && !host.trim().equals("")) {
+ URI repoUri = new URI("http", uri.getUserInfo(), uri.getHost(), uri.getPort(), "/jcr/node", null, null);
+ RepositoryFactory repositoryFactory = bc.getService(bc.getServiceReference(RepositoryFactory.class));
+ Repository repository = NodeUtils.getRepositoryByUri(repositoryFactory, repoUri.toString());
+ CmsFileSystem fileSystem = new CmsFileSystem(this, repository);
+ fileSystems.put(username, fileSystem);
+ return fileSystem;
+ } else {
+ Repository repository = bc.getService(
+ bc.getServiceReferences(Repository.class, "(cn=" + NodeConstants.EGO_REPOSITORY + ")")
+ .iterator().next());
+// Session session = repository.login();
+ CmsFileSystem fileSystem = new CmsFileSystem(this, repository);
+ fileSystems.put(username, fileSystem);
+ return fileSystem;
+ }
+ } catch (InvalidSyntaxException | URISyntaxException e) {
+ throw new IllegalArgumentException("Cannot open file system " + uri + " for user " + username, e);