1 23 24 29 30 package com.sun.enterprise.tools.common.dd.webapp; 31 32 import org.w3c.dom.*; 33 import org.netbeans.modules.schema2beans.*; 34 import java.beans.*; 35 import java.util.*; 36 import com.sun.enterprise.tools.common.dd.WebserviceEndpoint; 37 38 40 public class Servlet extends com.sun.enterprise.tools.common.dd.SunBaseBean 41 { 42 43 static Vector comparators = new Vector(); 44 45 static public final String SERVLET_NAME = "ServletName"; static public final String PRINCIPAL_NAME = "PrincipalName"; static public final String WEBSERVICE_ENDPOINT = "WebserviceEndpoint"; 49 public Servlet() { 50 this(Common.USE_DEFAULT_VALUES); 51 } 52 53 public Servlet(int options) 54 { 55 super(comparators, new org.netbeans.modules.schema2beans.Version(1, 2, 0)); 56 this.createProperty("servlet-name", SERVLET_NAME, 59 Common.TYPE_1 | Common.TYPE_STRING | Common.TYPE_KEY, 60 String .class); 61 this.createProperty("principal-name", PRINCIPAL_NAME, 63 Common.TYPE_0_1 | Common.TYPE_STRING | Common.TYPE_KEY, 64 String .class); 65 this.createProperty("webservice-endpoint", WEBSERVICE_ENDPOINT, 67 Common.TYPE_0_N | Common.TYPE_BEAN | Common.TYPE_KEY, 68 WebserviceEndpoint.class); 69 this.initialize(options); 70 } 71 72 void initialize(int options) 74 { 75 76 } 77 78 public void setServletName(String value) { 80 this.setValue(SERVLET_NAME, value); 81 } 82 83 public String getServletName() { 85 return (String )this.getValue(SERVLET_NAME); 86 } 87 88 public void setPrincipalName(String value) { 90 this.setValue(PRINCIPAL_NAME, value); 91 } 92 93 public String getPrincipalName() { 95 return (String )this.getValue(PRINCIPAL_NAME); 96 } 97 98 public void setWebserviceEndpoint(int index, WebserviceEndpoint value) { 100 this.setValue(WEBSERVICE_ENDPOINT, index, value); 101 } 102 103 public WebserviceEndpoint getWebserviceEndpoint(int index) { 105 return (WebserviceEndpoint)this.getValue(WEBSERVICE_ENDPOINT, index); 106 } 107 108 public void setWebserviceEndpoint(WebserviceEndpoint[] value) { 110 this.setValue(WEBSERVICE_ENDPOINT, value); 111 } 112 113 public WebserviceEndpoint[] getWebserviceEndpoint() { 115 return (WebserviceEndpoint[])this.getValues(WEBSERVICE_ENDPOINT); 116 } 117 118 public int sizeWebserviceEndpoint() { 120 return this.size(WEBSERVICE_ENDPOINT); 121 } 122 123 public int addWebserviceEndpoint(WebserviceEndpoint value) { 125 return this.addValue(WEBSERVICE_ENDPOINT, value); 126 } 127 128 public int removeWebserviceEndpoint(WebserviceEndpoint value) { 133 return this.removeValue(WEBSERVICE_ENDPOINT, value); 134 } 135 136 public static void addComparator(org.netbeans.modules.schema2beans.BeanComparator c) { 138 comparators.add(c); 139 } 140 141 public static void removeComparator(org.netbeans.modules.schema2beans.BeanComparator c) { 143 comparators.remove(c); 144 } 145 public void validate() throws org.netbeans.modules.schema2beans.ValidateException { 146 boolean restrictionFailure = false; 147 if (getServletName() == null) { 149 throw new org.netbeans.modules.schema2beans.ValidateException("getServletName() == null", "servletName", this); } 151 if (getPrincipalName() != null) { 153 } 154 for (int _index = 0; _index < sizeWebserviceEndpoint(); ++_index) { 156 WebserviceEndpoint element = getWebserviceEndpoint(_index); 157 if (element != null) { 158 element.validate(); 159 } 160 } 161 } 162 163 public void dump(StringBuffer str, String indent){ 165 String s; 166 Object o; 167 org.netbeans.modules.schema2beans.BaseBean n; 168 str.append(indent); 169 str.append("ServletName"); str.append(indent+"\t"); str.append("<"); s = this.getServletName(); 173 str.append((s==null?"null":s.trim())); str.append(">\n"); this.dumpAttributes(SERVLET_NAME, 0, str, indent); 176 177 str.append(indent); 178 str.append("PrincipalName"); str.append(indent+"\t"); str.append("<"); s = this.getPrincipalName(); 182 str.append((s==null?"null":s.trim())); str.append(">\n"); this.dumpAttributes(PRINCIPAL_NAME, 0, str, indent); 185 186 str.append(indent); 187 str.append("WebserviceEndpoint["+this.sizeWebserviceEndpoint()+"]"); for(int i=0; i<this.sizeWebserviceEndpoint(); i++) 189 { 190 str.append(indent+"\t"); 191 str.append("#"+i+":"); 192 n = (org.netbeans.modules.schema2beans.BaseBean) this.getWebserviceEndpoint(i); 193 if (n != null) 194 n.dump(str, indent + "\t"); else 196 str.append(indent+"\tnull"); this.dumpAttributes(WEBSERVICE_ENDPOINT, i, str, indent); 198 } 199 200 } 201 public String dumpBeanNode(){ 202 StringBuffer str = new StringBuffer (); 203 str.append("Servlet\n"); this.dump(str, "\n "); return str.toString(); 206 }} 207 208 210 211 678 | Popular Tags |