1 8 9 package com.sun.enterprise.tools.common.dd; 10 11 import org.w3c.dom.*; 12 import org.netbeans.modules.schema2beans.*; 13 import java.beans.*; 14 import java.util.*; 15 16 18 public class MessageSecurity extends org.netbeans.modules.schema2beans.BaseBean 19 { 20 21 static Vector comparators = new Vector(); 22 private static final org.netbeans.modules.schema2beans.Version runtimeVersion = new org.netbeans.modules.schema2beans.Version(5, 0, 0); 23 24 static public final String MESSAGE = "Message"; static public final String REQUEST_PROTECTION = "RequestProtection"; static public final String REQUESTPROTECTIONAUTHSOURCE = "RequestProtectionAuthSource"; static public final String REQUESTPROTECTIONAUTHRECIPIENT = "RequestProtectionAuthRecipient"; static public final String RESPONSE_PROTECTION = "ResponseProtection"; static public final String RESPONSEPROTECTIONAUTHSOURCE = "ResponseProtectionAuthSource"; static public final String RESPONSEPROTECTIONAUTHRECIPIENT = "ResponseProtectionAuthRecipient"; 32 public MessageSecurity() { 33 this(Common.USE_DEFAULT_VALUES); 34 } 35 36 public MessageSecurity(int options) 37 { 38 super(comparators, runtimeVersion); 39 initPropertyTables(3); 41 this.createProperty("message", MESSAGE, 43 Common.TYPE_1_N | Common.TYPE_BEAN | Common.TYPE_KEY, 44 Message.class); 45 this.createProperty("request-protection", REQUEST_PROTECTION, 47 Common.TYPE_0_1 | Common.TYPE_BOOLEAN | Common.TYPE_KEY, 48 Boolean .class); 49 this.createAttribute(REQUEST_PROTECTION, "auth-source", "AuthSource", 50 AttrProp.ENUM | AttrProp.IMPLIED, 51 new String [] { 52 "sender", 53 "content" 54 }, null); 55 this.createAttribute(REQUEST_PROTECTION, "auth-recipient", "AuthRecipient", 56 AttrProp.ENUM | AttrProp.IMPLIED, 57 new String [] { 58 "before-content", 59 "after-content" 60 }, null); 61 this.createProperty("response-protection", RESPONSE_PROTECTION, 63 Common.TYPE_0_1 | Common.TYPE_BOOLEAN | Common.TYPE_KEY, 64 Boolean .class); 65 this.createAttribute(RESPONSE_PROTECTION, "auth-source", "AuthSource", 66 AttrProp.ENUM | AttrProp.IMPLIED, 67 new String [] { 68 "sender", 69 "content" 70 }, null); 71 this.createAttribute(RESPONSE_PROTECTION, "auth-recipient", "AuthRecipient", 72 AttrProp.ENUM | AttrProp.IMPLIED, 73 new String [] { 74 "before-content", 75 "after-content" 76 }, null); 77 this.initialize(options); 78 } 79 80 void initialize(int options) { 82 83 } 84 85 public void setMessage(int index, Message value) { 87 this.setValue(MESSAGE, index, value); 88 } 89 90 public Message getMessage(int index) { 92 return (Message)this.getValue(MESSAGE, index); 93 } 94 95 public int sizeMessage() { 97 return this.size(MESSAGE); 98 } 99 100 public void setMessage(Message[] value) { 102 this.setValue(MESSAGE, value); 103 } 104 105 public Message[] getMessage() { 107 return (Message[])this.getValues(MESSAGE); 108 } 109 110 public int addMessage(com.sun.enterprise.tools.common.dd.Message value) { 112 int positionOfNewItem = this.addValue(MESSAGE, value); 113 return positionOfNewItem; 114 } 115 116 public int removeMessage(com.sun.enterprise.tools.common.dd.Message value) { 121 return this.removeValue(MESSAGE, value); 122 } 123 124 public void setRequestProtection(boolean value) { 126 this.setValue(REQUEST_PROTECTION, (value ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE)); 127 } 128 129 public boolean isRequestProtection() { 131 Boolean ret = (Boolean )this.getValue(REQUEST_PROTECTION); 132 if (ret == null) 133 ret = (Boolean )Common.defaultScalarValue(Common.TYPE_BOOLEAN); 134 return ((java.lang.Boolean )ret).booleanValue(); 135 } 136 137 public void setRequestProtectionAuthSource(java.lang.String value) { 139 if (size(REQUEST_PROTECTION) == 0) { 141 setValue(REQUEST_PROTECTION, java.lang.Boolean.TRUE); 142 } 143 setAttributeValue(REQUEST_PROTECTION, "AuthSource", value); 144 } 145 146 public java.lang.String getRequestProtectionAuthSource() { 148 if (size(REQUEST_PROTECTION) == 0) { 150 return null; 151 } else { 152 return getAttributeValue(REQUEST_PROTECTION, "AuthSource"); 153 } 154 } 155 156 public void setRequestProtectionAuthRecipient(java.lang.String value) { 158 if (size(REQUEST_PROTECTION) == 0) { 160 setValue(REQUEST_PROTECTION, java.lang.Boolean.TRUE); 161 } 162 setAttributeValue(REQUEST_PROTECTION, "AuthRecipient", value); 163 } 164 165 public java.lang.String getRequestProtectionAuthRecipient() { 167 if (size(REQUEST_PROTECTION) == 0) { 169 return null; 170 } else { 171 return getAttributeValue(REQUEST_PROTECTION, "AuthRecipient"); 172 } 173 } 174 175 public void setResponseProtection(boolean value) { 177 this.setValue(RESPONSE_PROTECTION, (value ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE)); 178 } 179 180 public boolean isResponseProtection() { 182 Boolean ret = (Boolean )this.getValue(RESPONSE_PROTECTION); 183 if (ret == null) 184 ret = (Boolean )Common.defaultScalarValue(Common.TYPE_BOOLEAN); 185 return ((java.lang.Boolean )ret).booleanValue(); 186 } 187 188 public void setResponseProtectionAuthSource(java.lang.String value) { 190 if (size(RESPONSE_PROTECTION) == 0) { 192 setValue(RESPONSE_PROTECTION, java.lang.Boolean.TRUE); 193 } 194 setAttributeValue(RESPONSE_PROTECTION, "AuthSource", value); 195 } 196 197 public java.lang.String getResponseProtectionAuthSource() { 199 if (size(RESPONSE_PROTECTION) == 0) { 201 return null; 202 } else { 203 return getAttributeValue(RESPONSE_PROTECTION, "AuthSource"); 204 } 205 } 206 207 public void setResponseProtectionAuthRecipient(java.lang.String value) { 209 if (size(RESPONSE_PROTECTION) == 0) { 211 setValue(RESPONSE_PROTECTION, java.lang.Boolean.TRUE); 212 } 213 setAttributeValue(RESPONSE_PROTECTION, "AuthRecipient", value); 214 } 215 216 public java.lang.String getResponseProtectionAuthRecipient() { 218 if (size(RESPONSE_PROTECTION) == 0) { 220 return null; 221 } else { 222 return getAttributeValue(RESPONSE_PROTECTION, "AuthRecipient"); 223 } 224 } 225 226 230 public Message newMessage() { 231 return new Message(); 232 } 233 234 public static void addComparator(org.netbeans.modules.schema2beans.BeanComparator c) { 236 comparators.add(c); 237 } 238 239 public static void removeComparator(org.netbeans.modules.schema2beans.BeanComparator c) { 241 comparators.remove(c); 242 } 243 public void validate() throws org.netbeans.modules.schema2beans.ValidateException { 244 } 245 246 public void dump(StringBuffer str, String indent){ 248 String s; 249 Object o; 250 org.netbeans.modules.schema2beans.BaseBean n; 251 str.append(indent); 252 str.append("Message["+this.sizeMessage()+"]"); for(int i=0; i<this.sizeMessage(); i++) 254 { 255 str.append(indent+"\t"); 256 str.append("#"+i+":"); 257 n = (org.netbeans.modules.schema2beans.BaseBean) this.getMessage(i); 258 if (n != null) 259 n.dump(str, indent + "\t"); else 261 str.append(indent+"\tnull"); this.dumpAttributes(MESSAGE, i, str, indent); 263 } 264 265 str.append(indent); 266 str.append("RequestProtection"); str.append(indent+"\t"); str.append((this.isRequestProtection()?"true":"false")); 269 this.dumpAttributes(REQUEST_PROTECTION, 0, str, indent); 270 271 str.append(indent); 272 str.append("ResponseProtection"); str.append(indent+"\t"); str.append((this.isResponseProtection()?"true":"false")); 275 this.dumpAttributes(RESPONSE_PROTECTION, 0, str, indent); 276 277 } 278 public String dumpBeanNode(){ 279 StringBuffer str = new StringBuffer (); 280 str.append("MessageSecurity\n"); this.dump(str, "\n "); return str.toString(); 283 }} 284 285 287 | Popular Tags |