- Repository repository = getRepository(url, sp);
- if (repository == null)
- return null;
-
- String workspace = siteAuth.getSecurityWorkspace();
- session = repository.login(sp, workspace);
- Node userHome = JcrUtils.getUserHome(session);
- if (userHome == null || !userHome.hasNode(ArgeoNames.ARGEO_PROFILE))
- throw new ArgeoException("No profile for user "
- + siteAuth.getName() + " in security workspace "
- + siteAuth.getSecurityWorkspace() + " of "
- + siteAuth.getUrl());
- userProfile = userHome.getNode(ArgeoNames.ARGEO_PROFILE);
+ Repository repository = new RemoteJcrRepositoryWrapper(
+ repositoryFactory, url, sp);
+ if (bundleContext != null) {
+ Dictionary<String, String> serviceProperties = new Hashtable<String, String>();
+ serviceProperties.put(ArgeoJcrConstants.JCR_REPOSITORY_ALIAS,
+ ArgeoJcrConstants.ALIAS_NODE);
+ serviceProperties
+ .put(ArgeoJcrConstants.JCR_REPOSITORY_URI, url);
+ bundleContext.registerService(Repository.class.getName(),
+ repository, serviceProperties);
+ }
+ // Repository repository = ArgeoJcrUtils.getRepositoryByUri(
+ // repositoryFactory, url);
+ // if (repository == null)
+ // throw new ArgeoException("Cannot connect to " + url);
+
+ session = repository.login(sp, null);
+
+ userProfile = UserJcrUtils.getUserProfile(session, sp.getUserID());
+ JcrUserDetails.checkAccountStatus(userProfile);
+
+ // Node userHome = UserJcrUtils.getUserHome(session);
+ // if (userHome == null ||
+ // !userHome.hasNode(ArgeoNames.ARGEO_PROFILE))
+ // throw new ArgeoException("No profile for user "
+ // + siteAuth.getName() + " in security workspace "
+ // + siteAuth.getSecurityWorkspace() + " of "
+ // + siteAuth.getUrl());
+ // userProfile = userHome.getNode(ArgeoNames.ARGEO_PROFILE);