1 17 package org.apache.geronimo.naming.deployment.jsr88; 18 19 import org.apache.geronimo.xbeans.geronimo.naming.GerResourceRefType; 20 21 33 public class ResourceRef extends HasPattern { 34 public ResourceRef() { 35 super(null); 36 } 37 38 public ResourceRef(GerResourceRefType xmlObject) { 39 super(xmlObject); 40 } 41 42 public void setRefName(String name) { 43 String old = getResourceRef().getRefName(); 44 getResourceRef().setRefName(name); 45 pcs.firePropertyChange("refName", old, name); 46 } 47 48 public String getRefName() { 49 return getResourceRef().getRefName(); 50 } 51 52 public String getResourceLink() { 53 return getResourceRef().getResourceLink(); 54 } 55 56 public void setResourceLink(String link) { 57 GerResourceRefType ref = getResourceRef(); 58 if(link != null) { 59 if(ref.isSetPattern()) { 60 clearPatternFromChoice(); 61 } 62 if(ref.isSetUrl()) { 63 String old = getUrl(); 64 ref.unsetUrl(); 65 pcs.firePropertyChange("url", old, null); 66 } 67 } 68 String old = getResourceLink(); 69 ref.setResourceLink(link); 70 pcs.firePropertyChange("resourceLink", old, link); 71 } 72 73 public String getUrl() { 74 return getResourceRef().getResourceLink(); 75 } 76 77 public void setUrl(String link) { 78 GerResourceRefType ref = getResourceRef(); 79 if(link != null) { 80 if(ref.isSetPattern()) { 81 clearPatternFromChoice(); 82 } 83 if(ref.isSetResourceLink()) { 84 String old = getResourceLink(); 85 ref.unsetResourceLink(); 86 pcs.firePropertyChange("resourceLink", old, null); 87 } 88 } 89 String old = getUrl(); 90 ref.setUrl(link); 91 pcs.firePropertyChange("url", old, link); 92 } 93 94 95 protected void clearNonPatternFromChoice() { 96 GerResourceRefType ref = getResourceRef(); 97 if(ref.isSetResourceLink()) { 98 String temp = ref.getResourceLink(); 99 ref.unsetResourceLink(); 100 pcs.firePropertyChange("resourceLink", temp, null); 101 } 102 if(ref.isSetUrl()) { 103 String temp = ref.getUrl(); 104 ref.unsetUrl(); 105 pcs.firePropertyChange("url", temp, null); 106 } 107 } 108 109 protected GerResourceRefType getResourceRef() { 110 return (GerResourceRefType) getXmlObject(); 111 } 112 113 public void configure(GerResourceRefType xml) { 114 setXmlObject(xml); 115 } 116 } 117 | Popular Tags |