KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > config > serverbeans > ThreadPool


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23  
24 /**
25  * This generated bean class ThreadPool matches the DTD element thread-pool
26  *
27  */

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 JavaDoc;
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 // BEGIN_NOI18N
42

43 public class ThreadPool extends ConfigBean implements Serializable JavaDoc
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 ThreadPool() {
51         this(Common.USE_DEFAULT_VALUES);
52     }
53
54     public ThreadPool(int options)
55     {
56         super(comparators, runtimeVersion);
57         // Properties (see root bean comments for the bean graph)
58
initPropertyTables(0);
59         this.initialize(options);
60     }
61
62     // Setting the default values of the properties
63
void initialize(int options) {
64
65     }
66
67     /**
68     * Getter for ThreadPoolId of the Element thread-pool
69     * @return the ThreadPoolId of the Element thread-pool
70     */

71     public String JavaDoc getThreadPoolId() {
72         return getAttributeValue(ServerTags.THREAD_POOL_ID);
73     }
74     /**
75     * Modify the ThreadPoolId of the Element thread-pool
76     * @param v the new value
77     * @throws StaleWriteConfigException if overwrite is false and file changed on disk
78     */

79     public void setThreadPoolId(String JavaDoc v, boolean overwrite) throws StaleWriteConfigException {
80         setAttributeValue(ServerTags.THREAD_POOL_ID, v, overwrite);
81     }
82     /**
83     * Modify the ThreadPoolId of the Element thread-pool
84     * @param v the new value
85     */

86     public void setThreadPoolId(String JavaDoc v) {
87         setAttributeValue(ServerTags.THREAD_POOL_ID, v);
88     }
89     /**
90     * Getter for MinThreadPoolSize of the Element thread-pool
91     * @return the MinThreadPoolSize of the Element thread-pool
92     */

93     public String JavaDoc getMinThreadPoolSize() {
94         return getAttributeValue(ServerTags.MIN_THREAD_POOL_SIZE);
95     }
96     /**
97     * Modify the MinThreadPoolSize of the Element thread-pool
98     * @param v the new value
99     * @throws StaleWriteConfigException if overwrite is false and file changed on disk
100     */

101     public void setMinThreadPoolSize(String JavaDoc v, boolean overwrite) throws StaleWriteConfigException {
102         setAttributeValue(ServerTags.MIN_THREAD_POOL_SIZE, v, overwrite);
103     }
104     /**
105     * Modify the MinThreadPoolSize of the Element thread-pool
106     * @param v the new value
107     */

108     public void setMinThreadPoolSize(String JavaDoc v) {
109         setAttributeValue(ServerTags.MIN_THREAD_POOL_SIZE, v);
110     }
111     /**
112     * Get the default value of MinThreadPoolSize from dtd
113     */

114     public static String JavaDoc getDefaultMinThreadPoolSize() {
115         return "0".trim();
116     }
117     /**
118     * Getter for MaxThreadPoolSize of the Element thread-pool
119     * @return the MaxThreadPoolSize of the Element thread-pool
120     */

121     public String JavaDoc getMaxThreadPoolSize() {
122         return getAttributeValue(ServerTags.MAX_THREAD_POOL_SIZE);
123     }
124     /**
125     * Modify the MaxThreadPoolSize of the Element thread-pool
126     * @param v the new value
127     * @throws StaleWriteConfigException if overwrite is false and file changed on disk
128     */

129     public void setMaxThreadPoolSize(String JavaDoc v, boolean overwrite) throws StaleWriteConfigException {
130         setAttributeValue(ServerTags.MAX_THREAD_POOL_SIZE, v, overwrite);
131     }
132     /**
133     * Modify the MaxThreadPoolSize of the Element thread-pool
134     * @param v the new value
135     */

136     public void setMaxThreadPoolSize(String JavaDoc v) {
137         setAttributeValue(ServerTags.MAX_THREAD_POOL_SIZE, v);
138     }
139     /**
140     * Get the default value of MaxThreadPoolSize from dtd
141     */

142     public static String JavaDoc getDefaultMaxThreadPoolSize() {
143         return "200".trim();
144     }
145     /**
146     * Getter for IdleThreadTimeoutInSeconds of the Element thread-pool
147     * @return the IdleThreadTimeoutInSeconds of the Element thread-pool
148     */

149     public String JavaDoc getIdleThreadTimeoutInSeconds() {
150         return getAttributeValue(ServerTags.IDLE_THREAD_TIMEOUT_IN_SECONDS);
151     }
152     /**
153     * Modify the IdleThreadTimeoutInSeconds of the Element thread-pool
154     * @param v the new value
155     * @throws StaleWriteConfigException if overwrite is false and file changed on disk
156     */

157     public void setIdleThreadTimeoutInSeconds(String JavaDoc v, boolean overwrite) throws StaleWriteConfigException {
158         setAttributeValue(ServerTags.IDLE_THREAD_TIMEOUT_IN_SECONDS, v, overwrite);
159     }
160     /**
161     * Modify the IdleThreadTimeoutInSeconds of the Element thread-pool
162     * @param v the new value
163     */

164     public void setIdleThreadTimeoutInSeconds(String JavaDoc v) {
165         setAttributeValue(ServerTags.IDLE_THREAD_TIMEOUT_IN_SECONDS, v);
166     }
167     /**
168     * Get the default value of IdleThreadTimeoutInSeconds from dtd
169     */

170     public static String JavaDoc getDefaultIdleThreadTimeoutInSeconds() {
171         return "120".trim();
172     }
173     /**
174     * Getter for NumWorkQueues of the Element thread-pool
175     * @return the NumWorkQueues of the Element thread-pool
176     */

177     public String JavaDoc getNumWorkQueues() {
178         return getAttributeValue(ServerTags.NUM_WORK_QUEUES);
179     }
180     /**
181     * Modify the NumWorkQueues of the Element thread-pool
182     * @param v the new value
183     * @throws StaleWriteConfigException if overwrite is false and file changed on disk
184     */

185     public void setNumWorkQueues(String JavaDoc v, boolean overwrite) throws StaleWriteConfigException {
186         setAttributeValue(ServerTags.NUM_WORK_QUEUES, v, overwrite);
187     }
188     /**
189     * Modify the NumWorkQueues of the Element thread-pool
190     * @param v the new value
191     */

192     public void setNumWorkQueues(String JavaDoc v) {
193         setAttributeValue(ServerTags.NUM_WORK_QUEUES, v);
194     }
195     /**
196     * Get the default value of NumWorkQueues from dtd
197     */

198     public static String JavaDoc getDefaultNumWorkQueues() {
199         return "1".trim();
200     }
201     /**
202     * get the xpath representation for this element
203     * returns something like abc[@name='value'] or abc
204     * depending on the type of the bean
205     */

206     protected String JavaDoc getRelativeXPath() {
207         String JavaDoc ret = null;
208         ret = "thread-pool" + (canHaveSiblings() ? "[@thread-pool-id='" + getAttributeValue("thread-pool-id") +"']" : "") ;
209         return (null != ret ? ret.trim() : null);
210     }
211
212     /*
213     * generic method to get default value from dtd
214     */

215     public static String JavaDoc getDefaultAttributeValue(String JavaDoc attr) {
216         if(attr == null) return null;
217         attr = attr.trim();
218         if(attr.equals(ServerTags.MIN_THREAD_POOL_SIZE)) return "0".trim();
219         if(attr.equals(ServerTags.MAX_THREAD_POOL_SIZE)) return "200".trim();
220         if(attr.equals(ServerTags.IDLE_THREAD_TIMEOUT_IN_SECONDS)) return "120".trim();
221         if(attr.equals(ServerTags.NUM_WORK_QUEUES)) return "1".trim();
222     return null;
223     }
224     //
225
public static void addComparator(org.netbeans.modules.schema2beans.BeanComparator c) {
226         comparators.add(c);
227     }
228
229     //
230
public static void removeComparator(org.netbeans.modules.schema2beans.BeanComparator c) {
231         comparators.remove(c);
232     }
233     public void validate() throws org.netbeans.modules.schema2beans.ValidateException {
234     }
235
236     // Dump the content of this bean returning it as a String
237
public void dump(StringBuffer JavaDoc str, String JavaDoc indent){
238         String JavaDoc s;
239         Object JavaDoc o;
240         org.netbeans.modules.schema2beans.BaseBean n;
241     }
242     public String JavaDoc dumpBeanNode(){
243         StringBuffer JavaDoc str = new StringBuffer JavaDoc();
244         str.append("ThreadPool\n"); // NOI18N
245
this.dump(str, "\n "); // NOI18N
246
return str.toString();
247     }}
248
249 // END_NOI18N
250

251
Popular Tags