001: /*
002: * Copyright (c) JForum Team
003: * All rights reserved.
004: *
005: * Redistribution and use in source and binary forms,
006: * with or without modification, are permitted provided
007: * that the following conditions are met:
008: *
009: * 1) Redistributions of source code must retain the above
010: * copyright notice, this list of conditions and the
011: * following disclaimer.
012: * 2) Redistributions in binary form must reproduce the
013: * above copyright notice, this list of conditions and
014: * the following disclaimer in the documentation and/or
015: * other materials provided with the distribution.
016: * 3) Neither the name of "Rafael Steil" nor
017: * the names of its contributors may be used to endorse
018: * or promote products derived from this software without
019: * specific prior written permission.
020: *
021: * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
022: * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
023: * EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
024: * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
025: * MERCHANTABILITY AND FITNESS FOR A PARTICULAR
026: * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
027: * THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
028: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
029: * EXEMPLARY, OR CONSEQUENTIAL DAMAGES
030: * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
031: * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
032: * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
033: * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
034: * IN CONTRACT, STRICT LIABILITY, OR TORT
035: * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
036: * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
037: * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
038: *
039: * Created on 30/05/2004 13:12:34
040: * The JForum Project
041: * http://www.jforum.net
042: */
043: package net.jforum.dao;
044:
045: import java.sql.Connection;
046:
047: import net.jforum.entities.UserSession;
048:
049: /**
050: * @author Rafael Steil
051: * @version $Id: UserSessionDAO.java,v 1.6 2006/08/23 02:13:34 rafaelsteil Exp $
052: */
053: public interface UserSessionDAO {
054: /**
055: * Writes a new <code>UserSession</code> to the database.
056: *
057: * @param us The <code>UserSession</code> to store
058: * @param conn The {@link java.sql.Connection} object to use.
059: * As many times user session management will be done in places where
060: * a valid request is not available, we cannot try to retrieve the
061: * conneciton from the thread local implementation. <br>
062: * If any driver implementation of this method will not use a database
063: * ( eg, where a <code>Connection</code> is not required ), when just
064: * pass <code>null</code> as argument.
065: */
066: public void add(UserSession us, Connection conn);
067:
068: /**
069: * Updates an <code>UserSession</code>
070: *
071: * @param us The <code>UserSession</code> to update
072: * @param conn The {@link java.sql.Connection} object to use.
073: * As many times user session management will be done in places where
074: * a valid request is not available, we cannot try to retrieve the
075: * conneciton from the thread local implementation. <br>
076: * If any driver implementation of this method will not use a database
077: * ( eg, where a <code>Connection</code> is not required ), when just
078: * pass <code>null</code> as argument.
079:
080: */
081: public void update(UserSession us, Connection conn);
082:
083: /**
084: * Gets an <code>UserSession</code> from the database.
085: * The object passed as argument should at least have the user id
086: * in order to find the correct register.
087: *
088: * @param us The complete <code>UserSession</code> object data
089: * @param conn The {@link java.sql.Connection} object to use.
090: * As many times user session management will be done in places where
091: * a valid request is not available, we cannot try to retrieve the
092: * conneciton from the thread local implementation. <br>
093: * If any driver implementation of this method will not use a database
094: * ( eg, where a <code>Connection</code> is not required ), when just
095: * pass <code>null</code> as argument.
096: *
097: * @return UserSession
098: */
099: public UserSession selectById(UserSession us, Connection conn);
100: }
|