KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > axis2 > storage > impl > AxisMemoryStorage


1 package org.apache.axis2.storage.impl;
2 import java.util.HashMap JavaDoc;
3
4 /*
5 * Copyright 2004,2005 The Apache Software Foundation.
6 *
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 *
19 *
20 */

21 public class AxisMemoryStorage extends AbstractStorage{
22
23     private HashMap JavaDoc objectMap;
24
25
26     public AxisMemoryStorage() {
27         objectMap = new HashMap JavaDoc();
28     }
29
30     public Object JavaDoc put(Object JavaDoc value) {
31         String JavaDoc key = getUniqueKey();
32         objectMap.put(key,value);
33         return key;
34
35     }
36
37     public Object JavaDoc get(Object JavaDoc key) {
38         return objectMap.get(key);
39     }
40
41     public Object JavaDoc remove(Object JavaDoc key) {
42         return objectMap.remove(key);
43     }
44
45     public boolean clean() {
46         boolean returnValue = false;
47         try {
48             objectMap.clear();
49             returnValue = true;
50         }catch(Exception JavaDoc e){
51             returnValue = false;
52         }
53         return returnValue;
54     }
55
56
57
58 }
59
Popular Tags