1 23 24 29 30 package com.sun.enterprise.tools.common.dd; 31 32 import org.w3c.dom.*; 33 import org.netbeans.modules.schema2beans.*; 34 import java.beans.*; 35 import java.util.*; 36 37 39 public class ResourceRef extends com.sun.enterprise.tools.common.dd.SunBaseBean 40 { 41 42 static Vector comparators = new Vector(); 43 44 static public final String RES_REF_NAME = "ResRefName"; static public final String JNDI_NAME = "JndiName"; static public final String DEFAULT_RESOURCE_PRINCIPAL = "DefaultResourcePrincipal"; 48 public ResourceRef() { 49 this(Common.USE_DEFAULT_VALUES); 50 } 51 52 public ResourceRef(int options) 53 { 54 super(comparators, new org.netbeans.modules.schema2beans.Version(1, 2, 0)); 55 this.createProperty("res-ref-name", RES_REF_NAME, 58 Common.TYPE_1 | Common.TYPE_STRING | Common.TYPE_KEY, 59 String .class); 60 this.createProperty("jndi-name", JNDI_NAME, 62 Common.TYPE_1 | Common.TYPE_STRING | Common.TYPE_KEY, 63 String .class); 64 this.createProperty("default-resource-principal", DEFAULT_RESOURCE_PRINCIPAL, 66 Common.TYPE_0_1 | Common.TYPE_BEAN | Common.TYPE_KEY, 67 DefaultResourcePrincipal.class); 68 this.initialize(options); 69 } 70 71 void initialize(int options) 73 { 74 75 } 76 77 public void setResRefName(String value) { 79 this.setValue(RES_REF_NAME, value); 80 } 81 82 public String getResRefName() { 84 return (String )this.getValue(RES_REF_NAME); 85 } 86 87 public void setJndiName(String value) { 89 this.setValue(JNDI_NAME, value); 90 } 91 92 public String getJndiName() { 94 return (String )this.getValue(JNDI_NAME); 95 } 96 97 public void setDefaultResourcePrincipal(DefaultResourcePrincipal value) { 99 this.setValue(DEFAULT_RESOURCE_PRINCIPAL, value); 100 } 101 102 public DefaultResourcePrincipal getDefaultResourcePrincipal() { 104 return (DefaultResourcePrincipal)this.getValue(DEFAULT_RESOURCE_PRINCIPAL); 105 } 106 107 public static void addComparator(org.netbeans.modules.schema2beans.BeanComparator c) { 109 comparators.add(c); 110 } 111 112 public static void removeComparator(org.netbeans.modules.schema2beans.BeanComparator c) { 114 comparators.remove(c); 115 } 116 public void validate() throws org.netbeans.modules.schema2beans.ValidateException { 117 boolean restrictionFailure = false; 118 if (getResRefName() == null) { 120 throw new org.netbeans.modules.schema2beans.ValidateException("getResRefName() == null", "resRefName", this); } 122 if (getJndiName() == null) { 124 throw new org.netbeans.modules.schema2beans.ValidateException("getJndiName() == null", "jndiName", this); } 126 if (getDefaultResourcePrincipal() != null) { 128 getDefaultResourcePrincipal().validate(); 129 } 130 } 131 132 public void dump(StringBuffer str, String indent){ 134 String s; 135 Object o; 136 org.netbeans.modules.schema2beans.BaseBean n; 137 str.append(indent); 138 str.append("ResRefName"); str.append(indent+"\t"); str.append("<"); s = this.getResRefName(); 142 str.append((s==null?"null":s.trim())); str.append(">\n"); this.dumpAttributes(RES_REF_NAME, 0, str, indent); 145 146 str.append(indent); 147 str.append("JndiName"); str.append(indent+"\t"); str.append("<"); s = this.getJndiName(); 151 str.append((s==null?"null":s.trim())); str.append(">\n"); this.dumpAttributes(JNDI_NAME, 0, str, indent); 154 155 str.append(indent); 156 str.append("DefaultResourcePrincipal"); n = (org.netbeans.modules.schema2beans.BaseBean) this.getDefaultResourcePrincipal(); 158 if (n != null) 159 n.dump(str, indent + "\t"); else 161 str.append(indent+"\tnull"); this.dumpAttributes(DEFAULT_RESOURCE_PRINCIPAL, 0, str, indent); 163 164 } 165 public String dumpBeanNode(){ 166 StringBuffer str = new StringBuffer (); 167 str.append("ResourceRef\n"); this.dump(str, "\n "); return str.toString(); 170 }} 171 172 174 175 448 | Popular Tags |