1 17 package org.apache.geronimo.naming.deployment.jsr88; 18 19 import org.apache.geronimo.xbeans.geronimo.naming.GerResourceRefType; 20 import org.apache.geronimo.xbeans.geronimo.naming.GerResourceEnvRefType; 21 22 34 public class ResourceEnvRef extends HasPattern { 35 public ResourceEnvRef() { 36 super(null); 37 } 38 39 public ResourceEnvRef(GerResourceEnvRefType xmlObject) { 40 super(xmlObject); 41 } 42 43 public void setRefName(String name) { 44 String old = getResourceRef().getRefName(); 45 getResourceRef().setRefName(name); 46 pcs.firePropertyChange("refName", old, name); 47 } 48 49 public String getRefName() { 50 return getResourceRef().getRefName(); 51 } 52 53 public String getAdminObjectLink() { 54 return getResourceRef().getAdminObjectLink(); 55 } 56 57 public void setAdminObjectLink(String link) { 58 GerResourceEnvRefType ref = getResourceRef(); 59 if(link != null && ref.isSetPattern()) { 60 clearPatternFromChoice(); 61 } 62 String old = getAdminObjectLink(); 63 ref.setAdminObjectLink(link); 64 pcs.firePropertyChange("adminObjectLink", old, link); 65 } 66 67 public String getAdminObjectModule() { 68 return getResourceRef().getAdminObjectModule(); 69 } 70 71 public void setAdminObjectModule(String module) { 72 GerResourceEnvRefType ref = getResourceRef(); 73 if(module != null && ref.isSetPattern()) { 74 clearPatternFromChoice(); 75 } 76 String old = getAdminObjectModule(); 77 ref.setAdminObjectModule(module); 78 pcs.firePropertyChange("adminObjectModule", old, module); 79 } 80 81 82 protected void clearNonPatternFromChoice() { 83 GerResourceEnvRefType ref = getResourceRef(); 84 if(ref.isSetAdminObjectLink()) { 85 String temp = ref.getAdminObjectLink(); 86 ref.unsetAdminObjectLink(); 87 pcs.firePropertyChange("adminObjectLink", temp, null); 88 } 89 if(ref.isSetAdminObjectModule()) { 90 String temp = ref.getAdminObjectModule(); 91 ref.unsetAdminObjectModule(); 92 pcs.firePropertyChange("adminObjectModule", temp, null); 93 } 94 } 95 96 protected GerResourceEnvRefType getResourceRef() { 97 return (GerResourceEnvRefType) getXmlObject(); 98 } 99 100 public void configure(GerResourceEnvRefType xml) { 101 setXmlObject(xml); 102 } 103 } 104 | Popular Tags |