Remove legacy Argeo Suite based on Eclipse 4.
[gpl/argeo-suite.git] / org.argeo.suite.e4.rap / src / org / argeo / suite / e4 / rap / ArgeoSuiteLoginLifecycle.java
diff --git a/org.argeo.suite.e4.rap/src/org/argeo/suite/e4/rap/ArgeoSuiteLoginLifecycle.java b/org.argeo.suite.e4.rap/src/org/argeo/suite/e4/rap/ArgeoSuiteLoginLifecycle.java
deleted file mode 100644 (file)
index 91837d8..0000000
+++ /dev/null
@@ -1,87 +0,0 @@
-package org.argeo.suite.e4.rap;
-
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
-
-import javax.inject.Inject;
-import javax.jcr.Node;
-import javax.jcr.Repository;
-import javax.jcr.RepositoryException;
-import javax.jcr.Session;
-import javax.security.auth.Subject;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.argeo.cms.e4.rap.CmsLoginLifecycle;
-import org.argeo.connect.ui.SystemWorkbenchService;
-import org.argeo.jcr.JcrUtils;
-
-/** Extends the CMS login lifecycle by managing the state of the current context. */
-public class ArgeoSuiteLoginLifecycle extends CmsLoginLifecycle {
-       private final static Log log = LogFactory.getLog(ArgeoSuiteLoginLifecycle.class);
-       @Inject
-       SystemWorkbenchService systemWorkbenchService;
-
-       @Inject
-       Repository repository;
-
-       @Override
-       protected void startupComplete() {
-               loadState();
-       }
-
-       @Override
-       protected void stateChanged() {
-               loadState();
-       }
-
-       private void loadState() {
-               String state = getState();
-               // for the time being we systematically open a session, in order to make sure
-               // that home is initialised
-               Session session = null;
-               try {
-                       if (state != null && state.startsWith("/")) {
-                               String path = state.substring(1);
-                               String workspace;
-                               if (path.equals("")) {
-                                       workspace = null;
-                                       path = "/";
-                               } else {
-                                       int index = path.indexOf('/');
-                                       if (index == 0) {
-                                               log.error("Cannot interpret // " + state);
-                                               getBrowserNavigation().pushState("~", null);
-                                               return;
-                                       } else if (index > 0) {
-                                               workspace = path.substring(0, index);
-                                               path = path.substring(index);
-                                       } else {// index<0, assuming root node
-                                               workspace = path;
-                                               path = "/";
-                                       }
-                               }
-                               Subject subject = getSubject();
-                               session = Subject.doAs(subject, new PrivilegedExceptionAction<Session>() {
-
-                                       @Override
-                                       public Session run() throws PrivilegedActionException {
-                                               try {
-                                                       return repository.login(workspace);
-                                               } catch (RepositoryException e) {
-                                                       throw new PrivilegedActionException(e);
-                                               }
-                                       }
-
-                               });
-                               Node node = session.getNode(path);
-                               systemWorkbenchService.openEntityEditor(node);
-                       }
-               } catch (RepositoryException | PrivilegedActionException e) {
-                       log.error("Cannot load state " + state, e);
-                       getBrowserNavigation().pushState("~", null);
-               } finally {
-                       JcrUtils.logoutQuietly(session);
-               }
-       }
-}