001/*
002 * (C) Copyright 2006-2007 Nuxeo SA (http://nuxeo.com/) and others.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *     http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 *
016 * Contributors:
017 *     anguenot
018 *
019 * $Id: WSRemotingSessionManager.java 19483 2007-05-27 10:52:56Z sfermigier $
020 */
021
022package org.nuxeo.ecm.platform.api.ws.session;
023
024import org.nuxeo.ecm.core.api.CoreSession;
025import org.nuxeo.ecm.platform.usermanager.UserManager;
026
027/**
028 * Web service remoting session manager.
029 *
030 * @author <a href="mailto:ja@nuxeo.com">Julien Anguenot</a>
031 */
032public interface WSRemotingSessionManager {
033
034    /**
035     * Creates a new remoting session.
036     *
037     * @param username the user name.
038     * @param password the user password
039     * @param repository the repository name
040     * @param um the user manager
041     * @param session the Nuxeo Core session
042     * @return an intialized <code>WSRemotingSession</code> instance.
043     */
044    WSRemotingSession createSession(String username, String password, String repository, UserManager um,
045            CoreSession session);
046
047    /**
048     * Adds a new session.
049     *
050     * @param sid the nuxeo core session id.
051     * @param session the web service remoting session.
052     */
053    void addSession(String sid, WSRemotingSession session);
054
055    /**
056     * Deletes a session if it exists.
057     *
058     * @param sid the Nuxeo Core session id.
059     */
060    void delSession(String sid);
061
062    /**
063     * Return a session given its Nuxeo Core session id if exists.
064     *
065     * @param sid the Nuxeo Core session id.
066     * @return a <code>WSRemotingSession</code> instance.
067     */
068    WSRemotingSession getSession(String sid);
069
070}