001: /*
002: * Copyright (C) 2001, 2002 Robert MacGrogan
003: *
004: * This library is free software; you can redistribute it and/or
005: * modify it under the terms of the GNU Lesser General Public
006: * License as published by the Free Software Foundation; either
007: * version 2.1 of the License, or (at your option) any later version.
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: * You should have received a copy of the GNU Lesser General Public
015: * License along with this library; if not, write to the Free Software
016: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
017: *
018: *
019: * $Archive: SourceJammer$
020: * $FileName: SJRequest.java$
021: * $FileID: 4347$
022: *
023: * Last change:
024: * $AuthorName: Rob MacGrogan$
025: * $Date: 8/12/03 12:10 AM$
026: * $Comment: Allow removal of params.$
027: */
028:
029: package org.sourcejammer.project.view;
030:
031: import java.util.Hashtable;
032:
033: /**
034: * Title: $FileName: SJRequest.java$
035: * @author $AuthorName: Rob MacGrogan$
036: * @version $VerNum: 3$
037: * $KeyWordsOff: $<br><br>
038: *
039: *
040: * Acts as a wrapper around client requests. Includes session ID and
041: * user name and password (in case session is expired or user is just logging
042: * in.
043: */
044: public class SJRequest {
045:
046: private String msUserName = null;
047: private String msPassword = null;
048: private long mlSessionID = -1;
049: private String msArchiveName = null;
050:
051: private Hashtable params = new Hashtable();
052:
053: public SJRequest() {
054: }
055:
056: public void setParams(Hashtable params) {
057: this .params = params;
058: }
059:
060: public Hashtable getParams() {
061: return params;
062: }
063:
064: public void putString(String key, String value) {
065: params.put(key, value);
066: }
067:
068: public String stringValue(String key) {
069: return (String) params.get(key);
070: }
071:
072: public void putObject(String key, Object o) {
073: params.put(key, o);
074: }
075:
076: public Object objectValue(String key) {
077: return params.get(key);
078: }
079:
080: public void putInt(String key, int value) {
081: params.put(key, new Integer(value));
082: }
083:
084: public int intValue(String key) {
085: Integer in = (Integer) params.get(key);
086: if (in == null)
087: return -1;
088: else
089: return in.intValue();
090: }
091:
092: public void putLong(String key, long value) {
093: params.put(key, new Long(value));
094: }
095:
096: public long longValue(String key) {
097: Long ln = (Long) params.get(key);
098: if (ln == null)
099: return -1;
100: else
101: return ln.longValue();
102: }
103:
104: public void putBoolean(String key, boolean value) {
105: params.put(key, new Boolean(value));
106: }
107:
108: public boolean booleanValue(String key) {
109: Boolean bl = (Boolean) params.get(key);
110: if (bl == null)
111: return false;
112: else
113: return bl.booleanValue();
114: }
115:
116: public void setUserName(String s) {
117: msUserName = s;
118: }
119:
120: public String getUserName() {
121: return msUserName;
122: }
123:
124: public void setPassword(String s) {
125: msPassword = s;
126: }
127:
128: public String getPassword() {
129: return msPassword;
130: }
131:
132: public void setSessionID(long l) {
133: mlSessionID = l;
134: }
135:
136: public long getSessionID() {
137: return mlSessionID;
138: }
139:
140: public void setArchiveName(String s) {
141: msArchiveName = s;
142: }
143:
144: public String getArchiveName() {
145: return msArchiveName;
146: }
147:
148: public void removeValue(String key) {
149: params.remove(key);
150: }
151:
152: }
|