Package org.apache.ace.client.workspace

Examples of org.apache.ace.client.workspace.Workspace


            return;
        }

        final String id = pathElements[1];

        Workspace workspace = m_workspaceManager.getWorkspace(id);
        if (workspace == null) {
            resp.sendError(HttpServletResponse.SC_NOT_FOUND, "Could not find workspace: " + id);
            return;
        }

        if (pathElements.length == 2) {
          try {
              Set<String> workspaces = (Set<String>) session.getAttribute(SESSION_KEY_WORKSPACES);
              if (workspaces != null) {
                workspaces.remove(workspace.getSessionID());
                  session.setAttribute(SESSION_KEY_WORKSPACES, workspaces);
              }
            m_workspaceManager.removeWorkspace(id);
          }
          catch (IOException ioe) {
View Full Code Here


        }
        else {
            // path elements of length > 1...
            final String id = pathElements[1];

            Workspace workspace = m_workspaceManager.getWorkspace(id);
            if (workspace == null) {
                resp.sendError(HttpServletResponse.SC_NOT_FOUND, "Could not find workspace: " + id);
                return;
            }
View Full Code Here

            resp.sendError(HttpServletResponse.SC_NOT_FOUND);
            return;
        }

        if (pathElements.length == 1) {
            Workspace workspace = m_workspaceManager.createWorkspace(req.getParameterMap(), req);
            if (workspace == null) {
                resp.sendError(HttpServletResponse.SC_UNAUTHORIZED);
            }
            else {
              Set<String> workspaces = (Set<String>) session.getAttribute(SESSION_KEY_WORKSPACES);
              if (workspaces == null) {
                workspaces = new HashSet<>();
              }
              workspaces.add(workspace.getSessionID());
              session.setAttribute(SESSION_KEY_WORKSPACES, workspaces);
                resp.sendRedirect(req.getServletPath() + "/" + buildPathFromElements(WORK_FOLDER, workspace.getSessionID()));
            }
        }
        else {
            // more than one path elements...
            Workspace workspace = m_workspaceManager.getWorkspace(pathElements[1]);
            if (workspace == null) {
                resp.sendError(HttpServletResponse.SC_NOT_FOUND, "Could not find workspace: " + pathElements[1]);
                return;
            }
View Full Code Here

        if (pathElements == null || pathElements.length != 4 || !WORK_FOLDER.equals(pathElements[0])) {
            resp.sendError(HttpServletResponse.SC_NOT_FOUND);
            return;
        }

        Workspace workspace = m_workspaceManager.getWorkspace(pathElements[1]);
        if (workspace == null) {
            resp.sendError(HttpServletResponse.SC_NOT_FOUND, "Could not find workspace: " + pathElements[1]);
            return;
        }
View Full Code Here

    @Override
    public Workspace createWorkspace(Map sessionConfiguration, Object... authenticationContext) throws IOException {
        // TODO get data from post body (if no data, assume latest??) -> for now
        // always assume latest
        final String sessionID;
        final Workspace workspace;
        final Component component;

        synchronized (m_workspaces) {
            sessionID = "rest-" + m_sessionID++;
            workspace = new WorkspaceImpl(sessionID, m_repositoryURL, m_customerName, m_storeRepositoryName,
                    m_targetRepositoryName, m_deploymentRepositoryName);
            m_workspaces.put(sessionID, workspace);

            component = m_dm.createComponent().setImplementation(workspace);
            m_workspaceComponents.put(sessionID, component);
        }
        // any parameters supplied in this call are passed on to the session
        // factory, so you can use these to configure your session
        m_sessionFactory.createSession(sessionID, sessionConfiguration);
        m_dm.add(component);

        User user;
        if (m_useAuthentication) {
            // Use the authentication service to authenticate the given
            // request...
            user = m_authenticationService.authenticate(authenticationContext);
        }
        else {
            // Use the "hardcoded" user to login with...
            user = m_userAdmin.getUser("username", m_serverUser);
        }

        if (user == null || !workspace.login(user)) {
            return null;
        }
        else {
            return workspace;
        }
View Full Code Here

        }
    }

    @Override
    public Workspace getWorkspace(String id) {
        Workspace workspace;
        synchronized (m_workspaces) {
            workspace = m_workspaces.get(id);
        }
        return workspace;
    }
View Full Code Here

        return workspace;
    }

    @Override
    public void removeWorkspace(final String id) throws IOException {
        final Workspace workspace;
        final Component component;

        synchronized (m_workspaces) {
            workspace = m_workspaces.remove(id);
            component = m_workspaceComponents.remove(id);
        }

        if ((workspace != null) && (component != null)) {
            try {
                workspace.logout();
            }
            finally {
                m_dm.remove(component);
                m_sessionFactory.destroySession(id);
            }
View Full Code Here

    @Override
    public Workspace cw(String storeCustomerName, String targetCustomerName, String deploymentCustomerName,
            Map sessionConfiguration) throws IOException {
        final String sessionID;
        final Workspace workspace;
        final Component component;

        synchronized (m_workspaces) {
            sessionID = "shell-" + m_sessionID++;
            workspace = new WorkspaceImpl(sessionID, m_repositoryURL, storeCustomerName, m_storeRepositoryName,
                    targetCustomerName, m_targetRepositoryName, deploymentCustomerName, m_deploymentRepositoryName);
            m_workspaces.put(sessionID, workspace);

            component = m_dm.createComponent().setImplementation(workspace);
            m_workspaceComponents.put(sessionID, component);
        }
        m_sessionFactory.createSession(sessionID, sessionConfiguration);
        m_dm.add(component);

        // Use the "hardcoded" user to login with...
        User user = m_userAdmin.getUser("username", m_serverUser);
        if (user == null || !workspace.login(user)) {
            return null;
        }
        else {
            return workspace;
        }
View Full Code Here

TOP

Related Classes of org.apache.ace.client.workspace.Workspace

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.