1 23 24 28 29 package com.sun.enterprise.config.serverbeans; 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 TransformationRule 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 50 public TransformationRule() { 51 this(Common.USE_DEFAULT_VALUES); 52 } 53 54 public TransformationRule(int options) 55 { 56 super(comparators, runtimeVersion); 57 initPropertyTables(0); 59 this.initialize(options); 60 } 61 62 void initialize(int options) { 64 65 } 66 67 71 public String getName() { 72 return getAttributeValue(ServerTags.NAME); 73 } 74 79 public void setName(String v, boolean overwrite) throws StaleWriteConfigException { 80 setAttributeValue(ServerTags.NAME, v, overwrite); 81 } 82 86 public void setName(String v) { 87 setAttributeValue(ServerTags.NAME, v); 88 } 89 93 public boolean isEnabled() { 94 return toBoolean(getAttributeValue(ServerTags.ENABLED)); 95 } 96 101 public void setEnabled(boolean v, boolean overwrite) throws StaleWriteConfigException { 102 setAttributeValue(ServerTags.ENABLED, ""+(v==true), overwrite); 103 } 104 108 public void setEnabled(boolean v) { 109 setAttributeValue(ServerTags.ENABLED, ""+(v==true)); 110 } 111 114 public static String getDefaultEnabled() { 115 return "true".trim(); 116 } 117 121 public String getApplyTo() { 122 return getAttributeValue(ServerTags.APPLY_TO); 123 } 124 129 public void setApplyTo(String v, boolean overwrite) throws StaleWriteConfigException { 130 setAttributeValue(ServerTags.APPLY_TO, v, overwrite); 131 } 132 136 public void setApplyTo(String v) { 137 setAttributeValue(ServerTags.APPLY_TO, v); 138 } 139 142 public static String getDefaultApplyTo() { 143 return "request".trim(); 144 } 145 149 public String getRuleFileLocation() { 150 return getAttributeValue(ServerTags.RULE_FILE_LOCATION); 151 } 152 157 public void setRuleFileLocation(String v, boolean overwrite) throws StaleWriteConfigException { 158 setAttributeValue(ServerTags.RULE_FILE_LOCATION, v, overwrite); 159 } 160 164 public void setRuleFileLocation(String v) { 165 setAttributeValue(ServerTags.RULE_FILE_LOCATION, v); 166 } 167 172 protected String getRelativeXPath() { 173 String ret = null; 174 ret = "transformation-rule" + (canHaveSiblings() ? "[@name='" + getAttributeValue("name") +"']" : "") ; 175 return (null != ret ? ret.trim() : null); 176 } 177 178 181 public static String getDefaultAttributeValue(String attr) { 182 if(attr == null) return null; 183 attr = attr.trim(); 184 if(attr.equals(ServerTags.ENABLED)) return "true".trim(); 185 if(attr.equals(ServerTags.APPLY_TO)) return "request".trim(); 186 return null; 187 } 188 public static void addComparator(org.netbeans.modules.schema2beans.BeanComparator c) { 190 comparators.add(c); 191 } 192 193 public static void removeComparator(org.netbeans.modules.schema2beans.BeanComparator c) { 195 comparators.remove(c); 196 } 197 public void validate() throws org.netbeans.modules.schema2beans.ValidateException { 198 } 199 200 public void dump(StringBuffer str, String indent){ 202 String s; 203 Object o; 204 org.netbeans.modules.schema2beans.BaseBean n; 205 } 206 public String dumpBeanNode(){ 207 StringBuffer str = new StringBuffer (); 208 str.append("TransformationRule\n"); this.dump(str, "\n "); return str.toString(); 211 }} 212 213 215 | Popular Tags |