1 18 19 package org.objectweb.kilim.model.services; 20 21 import java.util.LinkedHashMap ; 22 import java.util.Iterator ; 23 24 import org.objectweb.kilim.KilimException; 25 import org.objectweb.kilim.description.KILIM; 26 27 32 33 public class ExternalValueReferences { 34 private LinkedHashMap externalReferences; 35 36 39 public ExternalValueReferences() { } 40 41 47 public void addExternalValueReference(String aName, Object aObject) throws KilimException { 48 if (aName == null) { 49 throw new KilimException("attempt to add an external reference with a null name in the external value mapper"); 50 } 51 52 if (aObject == null) { 53 throw new KilimException("attempt to add an null external reference in the external value mapper"); 54 } 55 if (externalReferences == null) { 56 externalReferences = new LinkedHashMap (); 57 } 58 externalReferences.put(aName, aObject); 59 } 60 61 66 public void removeExternalValueReference(String aName) throws KilimException { 67 if (aName == null) { 68 throw new KilimException("attempt to add an external reference with a null name in the external value mapper"); 69 } 70 if (externalReferences == null) { 71 return; 72 } 73 externalReferences.remove(aName); 74 } 75 76 82 public Object getExternalValueReference(String aName) throws KilimException { 83 if (aName == null) { 84 throw new KilimException("attempt to add an external reference with a null name in the iexternal value mapper"); 85 } 86 if (externalReferences == null) { 87 return null; 88 } 89 return externalReferences.get(aName); 90 } 91 92 96 public Iterator getExternalReferenceNames() { 97 if (externalReferences == null) { 98 return KILIM.EMPTY_ITERATOR; 99 } 100 return externalReferences.keySet().iterator(); 101 } 102 } 103 | Popular Tags |