01: /**
02: * $Id: NetFileSession.java,v 1.11 2005/11/30 11:26:43 ss150821 Exp $
03: * Copyright 2002 Sun Microsystems, Inc. All
04: * rights reserved. Use of this product is subject
05: * to license terms. Federal Acquisitions:
06: * Commercial Software -- Government Users
07: * Subject to Standard License Terms and
08: * Conditions.
09: *
10: * Sun, Sun Microsystems, the Sun logo, and Sun ONE
11: * are trademarks or registered trademarks of Sun Microsystems,
12: * Inc. in the United States and other countries.
13: */
14:
15: /**
16: * This class encapsulates the information of a user session.
17: *
18: * This is used on startup to populate the NetFile user-interface with data from server.
19: * On exit from a NetFile session, this object is used to send data to server for persistence.
20: *
21: * @author Suresh Yellamaraju
22: * @release Lihue
23: */package com.sun.portal.netfile.transport;
24:
25: import java.io.Serializable;
26: import com.sun.portal.log.common.PortalLogger;
27: import java.util.Enumeration;
28: import java.util.Hashtable;
29: import java.util.StringTokenizer;
30: import java.util.Vector;
31: import java.util.HashMap;
32: import java.util.Set;
33: import java.util.Iterator;
34:
35: public class NetFileSession implements Serializable {
36: private final String sessionId;
37: private final HashMap i18nBucket;
38: private final Hashtable nfSessionParams;
39: private final HashMap encodingList;
40:
41: public NetFileSession(String sessionId, HashMap i18nBucket,
42: Hashtable sessionParams) {
43: this .sessionId = sessionId;
44: this .i18nBucket = i18nBucket;
45: this .nfSessionParams = sessionParams;
46: this .encodingList = this .extractEncodingList(i18nBucket);
47:
48: }
49:
50: public String getI18nBucketVal(String key) {
51: return (String) i18nBucket.get(key);
52: }
53:
54: public String getSessionID() {
55: return sessionId;
56: }
57:
58: public Object getSessionParam(Object key) {
59: return nfSessionParams.get(key);
60: }
61:
62: public HashMap getEncodingList() {
63: return this .encodingList;
64: }
65:
66: private HashMap extractEncodingList(HashMap i18nBucket) {
67:
68: Set keys = i18nBucket.keySet();
69: HashMap encodingMap = new HashMap(keys.size());
70: for (Iterator keyIt = keys.iterator(); keyIt.hasNext();) {
71: String key = (String) keyIt.next();
72: if (key.startsWith("encoding_")) {
73: String value = (String) i18nBucket.get(key);
74: encodingMap.put(key, value);
75: }
76: }
77: return encodingMap;
78:
79: }
80: }
|