1 package com.sun.org.apache.bcel.internal.verifier; 2 3 56 57 import java.util.HashMap ; 58 import java.util.Iterator ; 59 import java.util.Vector ; 60 61 70 public class VerifierFactory{ 71 72 75 private static HashMap hashMap = new HashMap (); 76 77 80 private static Vector observers = new Vector (); 81 82 85 private VerifierFactory(){} 86 87 92 public static Verifier getVerifier(String fully_qualified_classname){ 93 fully_qualified_classname = fully_qualified_classname; 94 95 Verifier v = (Verifier) (hashMap.get(fully_qualified_classname)); 96 if (v==null){ 97 v = new Verifier(fully_qualified_classname); 98 hashMap.put(fully_qualified_classname, v); 99 notify(fully_qualified_classname); 100 } 101 102 return v; 103 } 104 105 108 private static void notify(String fully_qualified_classname){ 109 Iterator i = observers.iterator(); 111 while (i.hasNext()){ 112 VerifierFactoryObserver vfo = (VerifierFactoryObserver) i.next(); 113 vfo.update(fully_qualified_classname); 114 } 115 } 116 117 124 public static Verifier[] getVerifiers(){ 125 Verifier[] vs = new Verifier[hashMap.values().size()]; 126 return (Verifier[]) (hashMap.values().toArray(vs)); } 128 129 132 public static void attach(VerifierFactoryObserver o){ 133 observers.addElement(o); 134 } 135 136 139 public static void detach(VerifierFactoryObserver o){ 140 observers.removeElement(o); 141 } 142 } 143 | Popular Tags |