001: /*
002: * $Id: ISessionStore.java 3777 2006-01-14 14:49:01 -0800 (Sat, 14 Jan 2006)
003: * jonathanlocke $ $Revision: 3777 $ $Date: 2006-01-14 14:49:01 -0800 (Sat, 14
004: * Jan 2006) $
005: *
006: * ==============================================================================
007: * Licensed under the Apache License, Version 2.0 (the "License"); you may not
008: * use this file except in compliance with the License. You may obtain a copy of
009: * the License at
010: *
011: * http://www.apache.org/licenses/LICENSE-2.0
012: *
013: * Unless required by applicable law or agreed to in writing, software
014: * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
015: * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
016: * License for the specific language governing permissions and limitations under
017: * the License.
018: */
019: package wicket.session;
020:
021: import java.util.List;
022:
023: import wicket.Request;
024: import wicket.Session;
025:
026: /**
027: * The actual store that is used by {@link wicket.Session} to store its
028: * attributes.
029: *
030: * @author Eelco Hillenius
031: * @author Johan Compagner
032: */
033: public interface ISessionStore {
034: /**
035: * Gets the attribute value with the given name
036: *
037: * @param request
038: * the current request
039: * @param name
040: * The name of the attribute to store
041: * @return The value of the attribute
042: */
043: Object getAttribute(Request request, final String name);
044:
045: /**
046: * @param request
047: * the current request
048: *
049: * @return List of attributes for this session
050: */
051: List getAttributeNames(Request request);
052:
053: /**
054: * Invalidates the session.
055: *
056: * @param request
057: * the current request
058: */
059: void invalidate(Request request);
060:
061: /**
062: * Removes the attribute with the given name.
063: *
064: * @param request
065: * the current request
066: * @param name
067: * the name of the attribute to remove
068: */
069: void removeAttribute(Request request, String name);
070:
071: /**
072: * Adds or replaces the attribute with the given name and value.
073: *
074: * @param request
075: * the current request
076: * @param name
077: * the name of the attribute
078: * @param value
079: * the value of the attribute
080: */
081: void setAttribute(Request request, String name, Object value);
082:
083: /**
084: * Get the session id for the provided request.
085: *
086: * @param request
087: * The request
088: * @return The session id for the provided request
089: */
090: String getSessionId(Request request);
091:
092: /**
093: * Retrieves the session for the provided request from this facade.
094: * <p>
095: * This method should return null if it is not bound yet, so that Wicket can
096: * recognize that it should create a session and call
097: * {@link #bind(Request, Session)} right after that.
098: * </p>
099: *
100: * @param request
101: * The current request
102: * @return The session for the provided request or null if the session was
103: * not bound
104: */
105: Session lookup(Request request);
106:
107: /**
108: * Adds the provided new session to this facade using the provided request.
109: *
110: * @param request
111: * The request that triggered making a new sesion
112: * @param newSession
113: * The new session
114: */
115: void bind(Request request, Session newSession);
116:
117: /**
118: * Adds the provided new session to this facade using the provided request.
119: *
120: * @param sessionId
121: * The SessionId that must be unbinded.
122: */
123: void unbind(String sessionId);
124: }
|