1 23 24 28 29 package com.sun.enterprise.config.clientbeans; 30 31 import org.w3c.dom.*; 32 import org.netbeans.modules.schema2beans.*; 33 import java.beans.*; 34 import java.util.*; 35 import java.io.Serializable ; 36 import com.sun.enterprise.config.ConfigBean; 37 import com.sun.enterprise.config.ConfigException; 38 import com.sun.enterprise.config.StaleWriteConfigException; 39 import com.sun.enterprise.util.i18n.StringManager; 40 41 43 public class TargetServer extends ConfigBean implements Serializable 44 { 45 46 static Vector comparators = new Vector(); 47 private static final org.netbeans.modules.schema2beans.Version runtimeVersion = new org.netbeans.modules.schema2beans.Version(4, 2, 0); 48 49 static public final String DESCRIPTION = "Description"; 50 static public final String SECURITY = "Security"; 51 52 public TargetServer() { 53 this(Common.USE_DEFAULT_VALUES); 54 } 55 56 public TargetServer(int options) 57 { 58 super(comparators, runtimeVersion); 59 initPropertyTables(2); 61 this.createProperty("description", DESCRIPTION, 62 Common.TYPE_0_1 | Common.TYPE_STRING | Common.TYPE_KEY, 63 String .class); 64 this.createProperty("security", SECURITY, 65 Common.TYPE_0_1 | Common.TYPE_BEAN | Common.TYPE_KEY, 66 Security.class); 67 this.initialize(options); 68 } 69 70 void initialize(int options) { 72 73 } 74 75 78 public String getDescription() { 79 return (String ) getValue(ClientTags.DESCRIPTION); 80 } 81 85 public void setDescription(String v){ 86 setValue(ClientTags.DESCRIPTION, (null != v ? v.trim() : null)); 87 } 88 public void setSecurity(Security value) { 90 this.setValue(SECURITY, value); 91 } 92 93 public Security getSecurity() { 95 return (Security)this.getValue(SECURITY); 96 } 97 98 102 public String getName() { 103 return getAttributeValue(ClientTags.NAME); 104 } 105 110 public void setName(String v, boolean overwrite) throws StaleWriteConfigException { 111 setAttributeValue(ClientTags.NAME, v, overwrite); 112 } 113 117 public void setName(String v) { 118 setAttributeValue(ClientTags.NAME, v); 119 } 120 124 public String getAddress() { 125 return getAttributeValue(ClientTags.ADDRESS); 126 } 127 132 public void setAddress(String v, boolean overwrite) throws StaleWriteConfigException { 133 setAttributeValue(ClientTags.ADDRESS, v, overwrite); 134 } 135 139 public void setAddress(String v) { 140 setAttributeValue(ClientTags.ADDRESS, v); 141 } 142 146 public String getPort() { 147 return getAttributeValue(ClientTags.PORT); 148 } 149 154 public void setPort(String v, boolean overwrite) throws StaleWriteConfigException { 155 setAttributeValue(ClientTags.PORT, v, overwrite); 156 } 157 161 public void setPort(String v) { 162 setAttributeValue(ClientTags.PORT, v); 163 } 164 168 public Security newSecurity() { 169 return new Security(); 170 } 171 172 177 protected String getRelativeXPath() { 178 String ret = null; 179 ret = "target-server" + (canHaveSiblings() ? "[@name='" + getAttributeValue("name") +"']" : "") ; 180 return (null != ret ? ret.trim() : null); 181 } 182 183 186 public static String getDefaultAttributeValue(String attr) { 187 if(attr == null) return null; 188 attr = attr.trim(); 189 return null; 190 } 191 public static void addComparator(org.netbeans.modules.schema2beans.BeanComparator c) { 193 comparators.add(c); 194 } 195 196 public static void removeComparator(org.netbeans.modules.schema2beans.BeanComparator c) { 198 comparators.remove(c); 199 } 200 public void validate() throws org.netbeans.modules.schema2beans.ValidateException { 201 } 202 203 public void dump(StringBuffer str, String indent){ 205 String s; 206 Object o; 207 org.netbeans.modules.schema2beans.BaseBean n; 208 str.append(indent); 209 str.append("Description"); str.append(indent+"\t"); str.append("<"); o = this.getDescription(); 213 str.append((o==null?"null":o.toString().trim())); str.append(">\n"); this.dumpAttributes(DESCRIPTION, 0, str, indent); 216 217 str.append(indent); 218 str.append("Security"); n = (org.netbeans.modules.schema2beans.BaseBean) this.getSecurity(); 220 if (n != null) 221 n.dump(str, indent + "\t"); else 223 str.append(indent+"\tnull"); this.dumpAttributes(SECURITY, 0, str, indent); 225 226 } 227 public String dumpBeanNode(){ 228 StringBuffer str = new StringBuffer (); 229 str.append("TargetServer\n"); this.dump(str, "\n "); return str.toString(); 232 }} 233 234 236 | Popular Tags |