1 26 27 package org.objectweb.jonas_lib.deployment.api; 28 29 import org.objectweb.jonas_lib.deployment.xml.ResourceRef; 30 import org.objectweb.jonas_lib.deployment.xml.JonasResource; 31 32 33 38 public class ResourceRefDesc { 39 40 43 public static final int APPLICATION_AUTH = 0; 44 45 48 public static final int CONTAINER_AUTH = 1; 49 50 53 private static final String [] AUTH = {"APPLICATION_AUTH", "CONTAINER_AUTH"}; 54 55 58 private String name; 59 60 63 private String typeName; 64 65 68 private int authentication; 69 70 73 private String jndiName; 74 75 83 public ResourceRefDesc(ClassLoader classLoader, 84 ResourceRef res, JonasResource jRes) 85 throws DeploymentDescException { 86 name = res.getResRefName(); 87 typeName = new String (res.getResType()); 88 String auth = res.getResAuth(); 89 90 if (auth.equals("Application")) { 91 authentication = APPLICATION_AUTH; 92 } else if (auth.equals("Container")) { 93 authentication = CONTAINER_AUTH; 94 } else { 95 throw new DeploymentDescException("res-auth not valid for resource-ref " + name); 96 } 97 jndiName = jRes.getJndiName(); 98 } 99 100 104 public String getName() { 105 return name; 106 } 107 108 112 public String getTypeName() { 113 return typeName; 114 } 115 116 120 public int getAuthentication() { 121 return authentication; 122 } 123 124 128 public boolean isJdbc() { 129 return "javax.sql.DataSource".equals(typeName); 130 } 131 132 136 public String getJndiName() { 137 return jndiName; 138 } 139 140 144 public String toString() { 145 StringBuffer ret = new StringBuffer (); 146 ret.append("\ngetName()=" + getName()); 147 ret.append("\ngetTypeName()=" + getTypeName()); 148 ret.append("\ngetAuthentication()=" + AUTH[getAuthentication()]); 149 ret.append("\nisJdbc()=" + new Boolean (isJdbc()).toString()); 150 ret.append("\ngetJndiName()=" + getJndiName()); 151 return ret.toString(); 152 } 153 } 154 | Popular Tags |