KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > se > anatom > ejbca > util > DummyLocalHome


1 package se.anatom.ejbca.util;
2
3 import java.util.HashMap JavaDoc;
4
5 import javax.ejb.EJBException JavaDoc;
6 import javax.ejb.EJBLocalHome JavaDoc;
7 import javax.ejb.FinderException JavaDoc;
8 import javax.ejb.RemoveException JavaDoc;
9
10 /**
11  * @author tomasg
12  * @version $Id: DummyLocalHome.java,v 1.2 2006/06/20 13:06:43 anatom Exp $
13  */

14 public class DummyLocalHome implements EJBLocalHome JavaDoc{
15     private HashMap JavaDoc map;
16     public DummyLocalHome(HashMap JavaDoc map){
17         this.map = map;
18     }
19     public DummyLocalHome(){
20         this.map = null;
21     }
22     public Object JavaDoc findByPrimaryKey(Integer JavaDoc pk) throws FinderException JavaDoc {
23         if (map == null) {
24             return "";
25         }
26         Object JavaDoc o = map.get(pk);
27         if (o == null) throw new FinderException JavaDoc("thrown on purpose to simulate non existing object");
28         return o;
29     }
30     public void remove(Object JavaDoc o) throws RemoveException JavaDoc, EJBException JavaDoc {
31     }
32 }
33
Popular Tags