KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > albel > tags > table > utils > HttpSessionAttributesMap


1 /*
2  * HttpSessionAttributesMap.java
3  *
4  * Created on Ketvirtadienis, 2004, Rugsėjo 9, 11.56
5  */

6
7 package albel.tags.table.utils;
8
9 /**
10  *
11  * @author alblau
12  */

13 public class HttpSessionAttributesMap implements java.util.Map JavaDoc
14 {
15     private javax.servlet.http.HttpSession JavaDoc ses;
16     
17     /** Creates a new instance of HttpSessionAttributesMap */
18     private HttpSessionAttributesMap()
19     {
20     }
21     public HttpSessionAttributesMap(javax.servlet.http.HttpSession JavaDoc ses)
22     {
23         this.ses=ses;
24     }
25     
26     /**
27      *Operation can not be supported in this implementation
28      */

29     public void clear()
30     {
31     }
32     
33     public boolean containsKey(Object JavaDoc key)
34     {
35         return this.ses.getAttribute(key.toString())!=null;
36     }
37     /**
38      *Operation can not be supported in this implementation
39      */

40     public boolean containsValue(Object JavaDoc value)
41     {
42         return false;
43     }
44     
45     /**
46      *Operation can not be supported in this implementation
47      */

48     public java.util.Set JavaDoc entrySet()
49     {
50         return null;
51     }
52     
53     public Object JavaDoc get(Object JavaDoc key)
54     {
55         return this.ses.getAttribute(key.toString());
56     }
57     
58     public boolean isEmpty()
59     {
60         return ses.getAttributeNames().hasMoreElements();
61     }
62     
63     /**
64      *Operation can not be supported in this implementation
65      */

66     public java.util.Set JavaDoc keySet()
67     {
68         return null;
69     }
70     
71     public Object JavaDoc put(Object JavaDoc key, Object JavaDoc value)
72     {
73         ses.setAttribute(key.toString(), value);
74         return value;
75     }
76     
77     public void putAll(java.util.Map JavaDoc t)
78     {
79         java.util.Iterator JavaDoc i=t.keySet().iterator();
80         while (i.hasNext())
81         {
82             Object JavaDoc o=i.next();
83             put(o,t.get(o));
84         }
85     }
86     
87     public Object JavaDoc remove(Object JavaDoc key)
88     {
89         Object JavaDoc o=get(key);
90         ses.removeAttribute(key.toString());
91         return o;
92     }
93     
94     /**
95      *Operation can not be supported in this implementation
96      */

97     public int size()
98     {
99         return -1;
100     }
101     
102     /**
103      *Operation can not be supported in this implementation
104      */

105     public java.util.Collection JavaDoc values()
106     {
107         return null;
108     }
109     
110 }
111
Popular Tags