1 /* 2 * Copyright 2004 The Apache Software Foundation. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 * 16 */ 17 package org.apache.kandula.storage; 18 19 import java.util.HashMap; 20 21 import org.apache.kandula.context.AbstractContext; 22 23 /*** 24 * @author <a href="mailto:thilina@opensource.lk"> Thilina Gunarathne </a> 25 */ 26 public class SimpleStore implements Store { 27 28 private HashMap contextMap; 29 30 /* 31 * (non-Javadoc) 32 * 33 * @see org.apache.kandula.storage.Store#putContext(java.lang.String, 34 * org.apache.kandula.context.ActivityContext) 35 */ 36 public SimpleStore() { 37 contextMap = new HashMap(); 38 } 39 40 public void put(Object id, Object context) { 41 contextMap.put(id, context); 42 } 43 44 /* 45 * (non-Javadoc) 46 * 47 * @see org.apache.kandula.storage.Store#getContext(java.lang.String) 48 */ 49 public Object get(Object id) { 50 return (AbstractContext) contextMap.get(id); 51 } 52 53 /* 54 * (non-Javadoc) 55 * 56 * @see org.apache.kandula.storage.Store#forgetContext(java.lang.String) 57 */ 58 public void forget(Object id) { 59 contextMap.remove(id); 60 } 61 62 }