1 6 package org.jfox.ejb.meta; 7 8 import org.jfox.ioc.util.XMLUtils; 9 import org.w3c.dom.Node ; 10 11 14 15 public class ResourceRefDescriptor extends Descriptor { 16 17 public static final String APPLICATION_AUTHORIZATION = "Application"; 18 public static final String CONTAINER_AUTHORIZATION = "Container"; 19 private String refName; 20 private String type; 21 private String auth; 22 24 public ResourceRefDescriptor() { 25 26 } 27 28 public void processXML(Node node) throws EJBDescriptionException { 29 super.processXML(node); 30 setRefName(XMLUtils.getChildNodeValueOf(node, "res-ref-name")); 31 setType(XMLUtils.getChildNodeValueOf(node, "res-type")); 32 setAuthorization(XMLUtils.getChildNodeValueOf(node, "res-auth")); 33 } 34 35 public boolean equals(Object obj) { 36 if(obj instanceof ResourceRefDescriptor) 37 return refName.equals(((ResourceRefDescriptor) obj).refName); 38 else 39 return false; 40 } 41 42 public String getAuthorization() { 43 return auth; 44 } 45 46 51 public String getJndiName() { 52 57 return refName; 58 } 59 60 public String getRefName() { 61 return refName; 62 } 63 64 public String getType() { 65 return type; 66 } 67 68 public int hashCode() { 69 return refName.hashCode(); 70 } 71 72 public boolean isResolved() { 73 return refName != null && !"".equals(refName); 75 } 76 77 public void setAuthorization(String s) { 78 if(!"Application".equals(s) && !"Container".equals(s)) { 79 throw new IllegalArgumentException ("res-auth must be one of \"Application\" and \"Container\""); 80 } 81 else { 82 auth = s; 83 return; 84 } 85 } 86 87 92 93 public void setRefName(String s) { 94 refName = s; 95 } 96 97 public void setType(String s) { 98 type = s; 99 } 100 101 public String toString() { 102 return "res-ref-name: " + getRefName() + "\n" + "res-type: " + getType() + "\n" + "jndi-name: " + getJndiName() + "\n"; 103 } 104 105 public static void main(String [] args) { 106 107 } 108 } 109 110 | Popular Tags |