1 23 package org.objectweb.clif.scenario.util.isac.util; 24 25 import java.util.Enumeration ; 26 import java.util.Hashtable ; 27 28 import org.objectweb.clif.scenario.util.isac.exception.IsacRuntimeException; 29 30 39 public class SessionObjectHashtable extends Hashtable { 40 44 public SessionObjectHashtable() { 45 super(); 46 } 47 48 51 public synchronized Object clone() { 52 try { 53 SessionObjectHashtable clone = new SessionObjectHashtable(); 54 Enumeration keys = this.keys(); 55 Enumeration elems = this.elements(); 56 while (keys.hasMoreElements()) { 57 Object key = keys.nextElement(); 58 Object cloneableValue = ((SessionObjectAction) elems 59 .nextElement()).createNewSessionObject(); 60 clone.put(key, cloneableValue); 62 } 63 return clone; 64 } catch (ClassCastException cce) { 65 throw new IsacRuntimeException( 66 "This hashtable must only contains object which implements SessionObjectAction interface", cce); 67 } 68 } 69 70 73 public void reset() { 74 try { 75 Enumeration e = this.elements(); 76 while (e.hasMoreElements()) { 77 ((SessionObjectAction) e.nextElement()).reset(); 78 } 79 } catch (ClassCastException cce) { 80 throw new IsacRuntimeException( 81 "This hashtable must only contains object which implements SessionObjectAction interface",cce); 82 } 83 } 84 85 88 public void close() { 89 try { 90 Enumeration e = this.elements(); 91 while (e.hasMoreElements()) { 92 ((SessionObjectAction) e.nextElement()).close(); 93 } 94 } catch (ClassCastException cce) { 95 throw new IsacRuntimeException( 96 "This hashtable must only contains object which implements SessionObjectAction interface",cce); 97 } 98 } 99 } | Popular Tags |