1 23 package com.sun.enterprise.deployment; 24 25 import java.util.*; 26 27 34 public class ExtensionElementDescriptor extends Descriptor implements Observer { 35 36 private List elementNames; 37 private Map elementValues; 38 private DynamicAttributesDescriptor attributes; 39 40 44 public Iterator getElementNames() { 45 if (elementNames!=null) { 46 return elementNames.iterator(); 47 } 48 return null; 49 } 50 51 public void addElement(String elementName, Object value) { 52 if (elementNames==null) { 53 elementNames = new LinkedList(); 54 elementValues = new HashMap(); 55 } 56 elementNames.add(elementName); 57 elementValues.put(elementName, value); 58 changed(); 59 } 60 61 public Object getElement(String elementName) { 62 if (elementValues!=null) { 63 return elementValues.get(elementName); 64 } 65 return null; 66 } 67 68 72 public DynamicAttributesDescriptor getAttributes() { 73 if (attributes==null) { 74 attributes = new DynamicAttributesDescriptor(); 75 attributes.addObserver(this); 76 } 77 return attributes; 78 } 79 80 83 public boolean hasAttributes() { 84 return attributes!=null; 85 } 86 87 91 public void update(Observable o, Object arg) { 92 setChanged(); 93 notifyObservers(); 94 } 95 96 99 public void print(StringBuffer toStringBuffer) { 100 toStringBuffer.append("ExtensionElementDescriptor"); 101 toStringBuffer.append("\n"); 102 super.print(toStringBuffer); 103 for (Iterator itr = getElementNames();itr.hasNext();) { 104 toStringBuffer.append("\n Element=").append(getElement((String ) itr.next())); 105 } 106 if (hasAttributes()) { 107 toStringBuffer.append("\n Attributes = ").append(getAttributes()); 108 } 109 } 110 } 111 | Popular Tags |