KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > geronimo > connector > deployment > jsr88 > SinglePool


1 /**
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements. See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License. You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */

17 package org.apache.geronimo.connector.deployment.jsr88;
18
19 import org.apache.geronimo.deployment.plugin.XmlBeanSupport;
20 import org.apache.geronimo.xbeans.geronimo.GerSinglepoolType;
21 import org.apache.xmlbeans.SchemaTypeLoader;
22
23 /**
24  * Settings for connectionmanager/single-pool
25  *
26  * @version $Rev: 476049 $ $Date: 2006-11-16 23:35:17 -0500 (Thu, 16 Nov 2006) $
27  */

28 public class SinglePool extends XmlBeanSupport {
29     public SinglePool() {
30         super(null);
31     }
32     public SinglePool(GerSinglepoolType pool) {
33         super(null);
34         configure(pool);
35     }
36
37     protected GerSinglepoolType getSinglePool() {
38         return (GerSinglepoolType) getXmlObject();
39     }
40
41     protected void configure(GerSinglepoolType pool) {
42         setXmlObject(pool);
43         if(!isSelectOneAssumeMatch() && !isMatchOne() && !isMatchAll()) {
44             setMatchOne(true);
45         }
46     }
47
48     // ----------------------- JavaBean Properties for single-pool ----------------------
49

50     public Integer JavaDoc getMinSize() {
51         return getSinglePool().isSetMinSize() ? new Integer JavaDoc(getSinglePool().getMinSize()) : null;
52     }
53
54     public void setMinSize(Integer JavaDoc value) {
55         Integer JavaDoc old = getMinSize();
56         if(value == null) {
57             if(getSinglePool().isSetMinSize()) {
58                 getSinglePool().unsetMinSize();
59             }
60         } else {
61             getSinglePool().setMinSize(value.intValue());
62         }
63         pcs.firePropertyChange("minSize", old, value);
64     }
65
66     public Integer JavaDoc getMaxSize() {
67         return getSinglePool().isSetMaxSize() ? new Integer JavaDoc(getSinglePool().getMaxSize()) : null;
68     }
69
70     public void setMaxSize(Integer JavaDoc value) {
71         Integer JavaDoc old = getMaxSize();
72         if(value == null) {
73             if(getSinglePool().isSetMaxSize()) {
74                 getSinglePool().unsetMaxSize();
75             }
76         } else {
77             getSinglePool().setMaxSize(value.intValue());
78         }
79         pcs.firePropertyChange("maxSize", old, value);
80     }
81
82     public Integer JavaDoc getBlockingTimeoutMillis() {
83         return getSinglePool().isSetBlockingTimeoutMilliseconds() ? new Integer JavaDoc(getSinglePool().getBlockingTimeoutMilliseconds()) : null;
84     }
85
86     public void setBlockingTimeoutMillis(Integer JavaDoc value) {
87         Integer JavaDoc old = getBlockingTimeoutMillis();
88         if(value == null) {
89             if(getSinglePool().isSetBlockingTimeoutMilliseconds()) {
90                 getSinglePool().unsetBlockingTimeoutMilliseconds();
91             }
92         } else {
93             getSinglePool().setBlockingTimeoutMilliseconds(value.intValue());
94         }
95         pcs.firePropertyChange("blockingTimeoutMillis", old, value);
96     }
97
98     public Integer JavaDoc getIdleTimeoutMinutes() {
99         return getSinglePool().isSetIdleTimeoutMinutes() ? new Integer JavaDoc(getSinglePool().getIdleTimeoutMinutes()) : null;
100     }
101
102     public void setIdleTimeoutMinutes(Integer JavaDoc value) {
103         Integer JavaDoc old = getIdleTimeoutMinutes();
104         if(value == null) {
105             if(getSinglePool().isSetIdleTimeoutMinutes()) {
106                 getSinglePool().unsetIdleTimeoutMinutes();
107             }
108         } else {
109             getSinglePool().setIdleTimeoutMinutes(value.intValue());
110         }
111         pcs.firePropertyChange("idleTimeoutMinutes", old, value);
112     }
113
114     public boolean isMatchAll() {
115         return getSinglePool().isSetMatchAll();
116     }
117
118     public void setMatchAll(boolean set) {
119         if(set) {
120             if(!isMatchAll()) {
121                 getSinglePool().addNewMatchAll();
122                 pcs.firePropertyChange("matchAll", !set, set);
123             }
124             if(isMatchOne()) setMatchOne(false);
125             if(isSelectOneAssumeMatch()) setSelectOneAssumeMatch(false);
126         } else {
127             if(isMatchAll()) {
128                 getSinglePool().unsetMatchAll();
129                 pcs.firePropertyChange("matchAll", !set, set);
130             }
131         }
132     }
133
134     public boolean isMatchOne() {
135         return getSinglePool().isSetMatchOne();
136     }
137
138     public void setMatchOne(boolean set) {
139         if(set) {
140             if(!isMatchOne()) {
141                 getSinglePool().addNewMatchOne();
142                 pcs.firePropertyChange("matchOne", !set, set);
143             }
144             if(isMatchAll()) setMatchAll(false);
145             if(isSelectOneAssumeMatch()) setSelectOneAssumeMatch(false);
146         } else {
147             if(isMatchOne()) {
148                 getSinglePool().unsetMatchOne();
149                 pcs.firePropertyChange("matchOne", !set, set);
150             }
151         }
152     }
153
154     public boolean isSelectOneAssumeMatch() {
155         return getSinglePool().isSetSelectOneAssumeMatch();
156     }
157
158     public void setSelectOneAssumeMatch(boolean set) {
159         if(set) {
160             if(!isSelectOneAssumeMatch()) {
161                 getSinglePool().addNewSelectOneAssumeMatch();
162                 pcs.firePropertyChange("selectOneAssumeMatch", !set, set);
163             }
164             if(isMatchAll()) setMatchAll(false);
165             if(isMatchOne()) setMatchOne(false);
166         } else {
167             if(isSelectOneAssumeMatch()) {
168                 getSinglePool().unsetSelectOneAssumeMatch();
169                 pcs.firePropertyChange("selectOneAssumeMatch", !set, set);
170             }
171         }
172     }
173
174     // ----------------------- End of JavaBean Properties ----------------------
175

176     protected SchemaTypeLoader getSchemaTypeLoader() {
177         return Connector15DCBRoot.SCHEMA_TYPE_LOADER;
178     }
179 }
180
Popular Tags