001/*
002 * (C) Copyright 2006-2007 Nuxeo SAS (http://nuxeo.com/) and contributors.
003 *
004 * All rights reserved. This program and the accompanying materials
005 * are made available under the terms of the GNU Lesser General Public License
006 * (LGPL) version 2.1 which accompanies this distribution, and is available at
007 * http://www.gnu.org/licenses/lgpl.html
008 *
009 * This library is distributed in the hope that it will be useful,
010 * but WITHOUT ANY WARRANTY; without even the implied warranty of
011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
012 * Lesser General Public License for more details.
013 *
014 * Contributors:
015 *     anguenot
016 *
017 * $Id: WSRemotingSessionManager.java 19483 2007-05-27 10:52:56Z sfermigier $
018 */
019
020package org.nuxeo.ecm.platform.api.ws.session;
021
022import org.nuxeo.ecm.core.api.CoreSession;
023import org.nuxeo.ecm.platform.usermanager.UserManager;
024
025/**
026 * Web service remoting session manager.
027 *
028 * @author <a href="mailto:ja@nuxeo.com">Julien Anguenot</a>
029 */
030public interface WSRemotingSessionManager {
031
032    /**
033     * Creates a new remoting session.
034     *
035     * @param username the user name.
036     * @param password the user password
037     * @param repository the repository name
038     * @param um the user manager
039     * @param session the Nuxeo Core session
040     * @return an intialized <code>WSRemotingSession</code> instance.
041     */
042    WSRemotingSession createSession(String username, String password, String repository, UserManager um,
043            CoreSession session);
044
045    /**
046     * Adds a new session.
047     *
048     * @param sid the nuxeo core session id.
049     * @param session the web service remoting session.
050     */
051    void addSession(String sid, WSRemotingSession session);
052
053    /**
054     * Deletes a session if it exists.
055     *
056     * @param sid the Nuxeo Core session id.
057     */
058    void delSession(String sid);
059
060    /**
061     * Return a session given its Nuxeo Core session id if exists.
062     *
063     * @param sid the Nuxeo Core session id.
064     * @return a <code>WSRemotingSession</code> instance.
065     */
066    WSRemotingSession getSession(String sid);
067
068}