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 AlertSubscription 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 LISTENER_CONFIG = "ListenerConfig"; 50 static public final String FILTER_CONFIG = "FilterConfig"; 51 52 public AlertSubscription() { 53 this(Common.USE_DEFAULT_VALUES); 54 } 55 56 public AlertSubscription(int options) 57 { 58 super(comparators, runtimeVersion); 59 initPropertyTables(2); 61 this.createProperty("listener-config", LISTENER_CONFIG, 62 Common.TYPE_1 | Common.TYPE_BEAN | Common.TYPE_KEY, 63 ListenerConfig.class); 64 this.createAttribute(LISTENER_CONFIG, "listener-class-name", "ListenerClassName", 65 AttrProp.CDATA | AttrProp.REQUIRED, 66 null, null); 67 this.createAttribute(LISTENER_CONFIG, "subscribe-listener-with", "SubscribeListenerWith", 68 AttrProp.CDATA | AttrProp.REQUIRED, 69 null, null); 70 this.createProperty("filter-config", FILTER_CONFIG, 71 Common.TYPE_0_1 | Common.TYPE_BEAN | Common.TYPE_KEY, 72 FilterConfig.class); 73 this.createAttribute(FILTER_CONFIG, "filter-class-name", "FilterClassName", 74 AttrProp.CDATA | AttrProp.REQUIRED, 75 null, null); 76 this.initialize(options); 77 } 78 79 void initialize(int options) { 81 82 } 83 84 public void setListenerConfig(ListenerConfig value) { 86 this.setValue(LISTENER_CONFIG, value); 87 } 88 89 public ListenerConfig getListenerConfig() { 91 return (ListenerConfig)this.getValue(LISTENER_CONFIG); 92 } 93 94 public void setFilterConfig(FilterConfig value) { 96 this.setValue(FILTER_CONFIG, value); 97 } 98 99 public FilterConfig getFilterConfig() { 101 return (FilterConfig)this.getValue(FILTER_CONFIG); 102 } 103 104 108 public String getName() { 109 return getAttributeValue(ServerTags.NAME); 110 } 111 116 public void setName(String v, boolean overwrite) throws StaleWriteConfigException { 117 setAttributeValue(ServerTags.NAME, v, overwrite); 118 } 119 123 public void setName(String v) { 124 setAttributeValue(ServerTags.NAME, v); 125 } 126 130 public ListenerConfig newListenerConfig() { 131 return new ListenerConfig(); 132 } 133 134 138 public FilterConfig newFilterConfig() { 139 return new FilterConfig(); 140 } 141 142 147 protected String getRelativeXPath() { 148 String ret = null; 149 ret = "alert-subscription" + (canHaveSiblings() ? "[@name='" + getAttributeValue("name") +"']" : "") ; 150 return (null != ret ? ret.trim() : null); 151 } 152 153 156 public static String getDefaultAttributeValue(String attr) { 157 if(attr == null) return null; 158 attr = attr.trim(); 159 return null; 160 } 161 public static void addComparator(org.netbeans.modules.schema2beans.BeanComparator c) { 163 comparators.add(c); 164 } 165 166 public static void removeComparator(org.netbeans.modules.schema2beans.BeanComparator c) { 168 comparators.remove(c); 169 } 170 public void validate() throws org.netbeans.modules.schema2beans.ValidateException { 171 } 172 173 public void dump(StringBuffer str, String indent){ 175 String s; 176 Object o; 177 org.netbeans.modules.schema2beans.BaseBean n; 178 str.append(indent); 179 str.append("ListenerConfig"); n = (org.netbeans.modules.schema2beans.BaseBean) this.getListenerConfig(); 181 if (n != null) 182 n.dump(str, indent + "\t"); else 184 str.append(indent+"\tnull"); this.dumpAttributes(LISTENER_CONFIG, 0, str, indent); 186 187 str.append(indent); 188 str.append("FilterConfig"); n = (org.netbeans.modules.schema2beans.BaseBean) this.getFilterConfig(); 190 if (n != null) 191 n.dump(str, indent + "\t"); else 193 str.append(indent+"\tnull"); this.dumpAttributes(FILTER_CONFIG, 0, str, indent); 195 196 } 197 public String dumpBeanNode(){ 198 StringBuffer str = new StringBuffer (); 199 str.append("AlertSubscription\n"); this.dump(str, "\n "); return str.toString(); 202 }} 203 204 206 | Popular Tags |