ResourceRefDesc.java

00001 
00027 package org.objectweb.jonas_lib.deployment.api;
00028 
00029 import org.objectweb.jonas_lib.deployment.xml.ResourceRef;
00030 import org.objectweb.jonas_lib.deployment.xml.JonasResource;
00031 
00032 
00038 public class ResourceRefDesc {
00039 
00043     public static final int APPLICATION_AUTH = 0;
00044 
00048     public static final int CONTAINER_AUTH   = 1;
00049 
00053     private static final String[] AUTH = {"APPLICATION_AUTH", "CONTAINER_AUTH"};
00054 
00058     private String name;
00059 
00063     private String typeName;
00064 
00068     private int authentication;
00069 
00073     private String jndiName;
00074 
00083     public ResourceRefDesc(ClassLoader classLoader,
00084                            ResourceRef res, JonasResource jRes)
00085         throws DeploymentDescException {
00086         name = res.getResRefName();
00087         typeName = new String(res.getResType());
00088         String auth = res.getResAuth();
00089 
00090         if (auth.equals("Application")) {
00091             authentication = APPLICATION_AUTH;
00092         } else if (auth.equals("Container")) {
00093             authentication = CONTAINER_AUTH;
00094         } else {
00095             throw new DeploymentDescException("res-auth not valid for resource-ref " + name);
00096         }
00097         jndiName = jRes.getJndiName();
00098     }
00099 
00104     public String getName() {
00105         return name;
00106     }
00107 
00112     public String getTypeName() {
00113         return typeName;
00114     }
00115 
00120     public int getAuthentication() {
00121         return authentication;
00122     }
00123 
00128     public boolean isJdbc() {
00129         return "javax.sql.DataSource".equals(typeName);
00130     }
00131 
00136     public String getJndiName() {
00137         return jndiName;
00138     }
00139 
00144     public String toString() {
00145         StringBuffer ret = new StringBuffer();
00146         ret.append("\ngetName()=" + getName());
00147         ret.append("\ngetTypeName()=" + getTypeName());
00148         ret.append("\ngetAuthentication()=" + AUTH[getAuthentication()]);
00149         ret.append("\nisJdbc()=" + new Boolean(isJdbc()).toString());
00150         ret.append("\ngetJndiName()=" + getJndiName());
00151         return ret.toString();
00152     }
00153 }

Generated on Tue Feb 15 15:05:50 2005 for JOnAS by  doxygen 1.3.9.1