1 23 24 29 30 package com.sun.enterprise.tools.common.dd.connector; 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 MapElement extends com.sun.enterprise.tools.common.dd.SunBaseBean 40 { 41 42 static Vector comparators = new Vector(); 43 44 static public final String PRINCIPAL = "Principal"; static public final String BACKEND_PRINCIPAL = "BackendPrincipal"; static public final String BACKENDPRINCIPALUSERNAME = "BackendPrincipalUserName"; static public final String BACKENDPRINCIPALPASSWORD = "BackendPrincipalPassword"; static public final String BACKENDPRINCIPALCREDENTIAL = "BackendPrincipalCredential"; 50 public MapElement() { 51 this(Common.USE_DEFAULT_VALUES); 52 } 53 54 public MapElement(int options) 55 { 56 super(comparators, new org.netbeans.modules.schema2beans.Version(1, 2, 0)); 57 this.createProperty("principal", PRINCIPAL, 60 Common.TYPE_1_N | Common.TYPE_BEAN | Common.TYPE_KEY, 61 Principal.class); 62 this.createAttribute(PRINCIPAL, "user-name", "UserName", 63 AttrProp.CDATA | AttrProp.REQUIRED, 64 null, null); 65 this.createProperty("backend-principal", BACKEND_PRINCIPAL, 67 Common.TYPE_0_1 | Common.TYPE_BOOLEAN | Common.TYPE_KEY, 68 Boolean .class); 69 this.createAttribute(BACKEND_PRINCIPAL, "user-name", "UserName", 70 AttrProp.CDATA | AttrProp.REQUIRED, 71 null, null); 72 this.createAttribute(BACKEND_PRINCIPAL, "password", "Password", 73 AttrProp.CDATA | AttrProp.REQUIRED, 74 null, null); 75 this.createAttribute(BACKEND_PRINCIPAL, "credential", "Credential", 76 AttrProp.CDATA | AttrProp.REQUIRED, 77 null, null); 78 this.initialize(options); 79 } 80 81 void initialize(int options) 83 { 84 85 } 86 87 public void setPrincipal(int index, Principal value) { 89 this.setValue(PRINCIPAL, index, value); 90 } 91 92 public Principal getPrincipal(int index) { 94 return (Principal)this.getValue(PRINCIPAL, index); 95 } 96 97 public void setPrincipal(Principal[] value) { 99 this.setValue(PRINCIPAL, value); 100 } 101 102 public Principal[] getPrincipal() { 104 return (Principal[])this.getValues(PRINCIPAL); 105 } 106 107 public int sizePrincipal() { 109 return this.size(PRINCIPAL); 110 } 111 112 public int addPrincipal(com.sun.enterprise.tools.common.dd.connector.Principal value) { 114 return this.addValue(PRINCIPAL, value); 115 } 116 117 public int removePrincipal(com.sun.enterprise.tools.common.dd.connector.Principal value) { 122 return this.removeValue(PRINCIPAL, value); 123 } 124 125 public void setBackendPrincipal(boolean value) { 127 this.setValue(BACKEND_PRINCIPAL, (value ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE)); 128 } 129 130 public boolean isBackendPrincipal() { 132 Boolean ret = (Boolean )this.getValue(BACKEND_PRINCIPAL); 133 if (ret == null) 134 ret = (Boolean )Common.defaultScalarValue(Common.TYPE_BOOLEAN); 135 return ((java.lang.Boolean )ret).booleanValue(); 136 } 137 138 public void setBackendPrincipalUserName(java.lang.String value) { 140 if (size(BACKEND_PRINCIPAL) == 0) { 142 setValue(BACKEND_PRINCIPAL, ""); 143 } 144 setAttributeValue(BACKEND_PRINCIPAL, "UserName", value); 145 } 146 147 public java.lang.String getBackendPrincipalUserName() { 149 if (size(BACKEND_PRINCIPAL) == 0) { 151 return null; 152 } else { 153 return getAttributeValue(BACKEND_PRINCIPAL, "UserName"); 154 } 155 } 156 157 public void setBackendPrincipalPassword(java.lang.String value) { 159 if (size(BACKEND_PRINCIPAL) == 0) { 161 setValue(BACKEND_PRINCIPAL, ""); 162 } 163 setAttributeValue(BACKEND_PRINCIPAL, "Password", value); 164 } 165 166 public java.lang.String getBackendPrincipalPassword() { 168 if (size(BACKEND_PRINCIPAL) == 0) { 170 return null; 171 } else { 172 return getAttributeValue(BACKEND_PRINCIPAL, "Password"); 173 } 174 } 175 176 public void setBackendPrincipalCredential(java.lang.String value) { 178 if (size(BACKEND_PRINCIPAL) == 0) { 180 setValue(BACKEND_PRINCIPAL, ""); 181 } 182 setAttributeValue(BACKEND_PRINCIPAL, "Credential", value); 183 } 184 185 public java.lang.String getBackendPrincipalCredential() { 187 if (size(BACKEND_PRINCIPAL) == 0) { 189 return null; 190 } else { 191 return getAttributeValue(BACKEND_PRINCIPAL, "Credential"); 192 } 193 } 194 195 public static void addComparator(org.netbeans.modules.schema2beans.BeanComparator c) { 197 comparators.add(c); 198 } 199 200 public static void removeComparator(org.netbeans.modules.schema2beans.BeanComparator c) { 202 comparators.remove(c); 203 } 204 public void validate() throws org.netbeans.modules.schema2beans.ValidateException { 205 boolean restrictionFailure = false; 206 if (sizePrincipal() == 0) { 208 throw new org.netbeans.modules.schema2beans.ValidateException("sizePrincipal() == 0", "principal", this); } 210 for (int _index = 0; _index < sizePrincipal(); ++_index) { 211 com.sun.enterprise.tools.common.dd.connector.Principal element = getPrincipal(_index); 212 if (element != null) { 213 element.validate(); 214 } 215 } 216 if (getBackendPrincipalUserName() == null) { 219 throw new org.netbeans.modules.schema2beans.ValidateException("getBackendPrincipalUserName() == null", "backendPrincipalUserName", this); } 221 if (getBackendPrincipalPassword() == null) { 223 throw new org.netbeans.modules.schema2beans.ValidateException("getBackendPrincipalPassword() == null", "backendPrincipalPassword", this); } 225 if (getBackendPrincipalCredential() == null) { 227 throw new org.netbeans.modules.schema2beans.ValidateException("getBackendPrincipalCredential() == null", "backendPrincipalCredential", this); } 229 } 230 231 public void dump(StringBuffer str, String indent){ 233 String s; 234 Object o; 235 org.netbeans.modules.schema2beans.BaseBean n; 236 str.append(indent); 237 str.append("Principal["+this.sizePrincipal()+"]"); for(int i=0; i<this.sizePrincipal(); i++) 239 { 240 str.append(indent+"\t"); 241 str.append("#"+i+":"); 242 n = (org.netbeans.modules.schema2beans.BaseBean) this.getPrincipal(i); 243 if (n != null) 244 n.dump(str, indent + "\t"); else 246 str.append(indent+"\tnull"); this.dumpAttributes(PRINCIPAL, i, str, indent); 248 } 249 250 str.append(indent); 251 str.append("BackendPrincipal"); str.append(indent+"\t"); str.append((this.isBackendPrincipal()?"true":"false")); 254 this.dumpAttributes(BACKEND_PRINCIPAL, 0, str, indent); 255 256 } 257 public String dumpBeanNode(){ 258 StringBuffer str = new StringBuffer (); 259 str.append("MapElement\n"); this.dump(str, "\n "); return str.toString(); 262 }} 263 264 266 267 338 | Popular Tags |