001: /**
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */package org.apache.geronimo.connector.deployment.jsr88;
017:
018: import org.apache.geronimo.deployment.plugin.XmlBeanSupport;
019: import org.apache.geronimo.xbeans.geronimo.GerSinglepoolType;
020: import org.apache.xmlbeans.SchemaTypeLoader;
021:
022: /**
023: * Settings for connectionmanager/single-pool
024: *
025: * @version $Rev: 476049 $ $Date: 2006-11-16 20:35:17 -0800 (Thu, 16 Nov 2006) $
026: */
027: public class SinglePool extends XmlBeanSupport {
028: public SinglePool() {
029: super (null);
030: }
031:
032: public SinglePool(GerSinglepoolType pool) {
033: super (null);
034: configure(pool);
035: }
036:
037: protected GerSinglepoolType getSinglePool() {
038: return (GerSinglepoolType) getXmlObject();
039: }
040:
041: protected void configure(GerSinglepoolType pool) {
042: setXmlObject(pool);
043: if (!isSelectOneAssumeMatch() && !isMatchOne() && !isMatchAll()) {
044: setMatchOne(true);
045: }
046: }
047:
048: // ----------------------- JavaBean Properties for single-pool ----------------------
049:
050: public Integer getMinSize() {
051: return getSinglePool().isSetMinSize() ? new Integer(
052: getSinglePool().getMinSize()) : null;
053: }
054:
055: public void setMinSize(Integer value) {
056: Integer old = getMinSize();
057: if (value == null) {
058: if (getSinglePool().isSetMinSize()) {
059: getSinglePool().unsetMinSize();
060: }
061: } else {
062: getSinglePool().setMinSize(value.intValue());
063: }
064: pcs.firePropertyChange("minSize", old, value);
065: }
066:
067: public Integer getMaxSize() {
068: return getSinglePool().isSetMaxSize() ? new Integer(
069: getSinglePool().getMaxSize()) : null;
070: }
071:
072: public void setMaxSize(Integer value) {
073: Integer old = getMaxSize();
074: if (value == null) {
075: if (getSinglePool().isSetMaxSize()) {
076: getSinglePool().unsetMaxSize();
077: }
078: } else {
079: getSinglePool().setMaxSize(value.intValue());
080: }
081: pcs.firePropertyChange("maxSize", old, value);
082: }
083:
084: public Integer getBlockingTimeoutMillis() {
085: return getSinglePool().isSetBlockingTimeoutMilliseconds() ? new Integer(
086: getSinglePool().getBlockingTimeoutMilliseconds())
087: : null;
088: }
089:
090: public void setBlockingTimeoutMillis(Integer value) {
091: Integer old = getBlockingTimeoutMillis();
092: if (value == null) {
093: if (getSinglePool().isSetBlockingTimeoutMilliseconds()) {
094: getSinglePool().unsetBlockingTimeoutMilliseconds();
095: }
096: } else {
097: getSinglePool().setBlockingTimeoutMilliseconds(
098: value.intValue());
099: }
100: pcs.firePropertyChange("blockingTimeoutMillis", old, value);
101: }
102:
103: public Integer getIdleTimeoutMinutes() {
104: return getSinglePool().isSetIdleTimeoutMinutes() ? new Integer(
105: getSinglePool().getIdleTimeoutMinutes()) : null;
106: }
107:
108: public void setIdleTimeoutMinutes(Integer value) {
109: Integer old = getIdleTimeoutMinutes();
110: if (value == null) {
111: if (getSinglePool().isSetIdleTimeoutMinutes()) {
112: getSinglePool().unsetIdleTimeoutMinutes();
113: }
114: } else {
115: getSinglePool().setIdleTimeoutMinutes(value.intValue());
116: }
117: pcs.firePropertyChange("idleTimeoutMinutes", old, value);
118: }
119:
120: public boolean isMatchAll() {
121: return getSinglePool().isSetMatchAll();
122: }
123:
124: public void setMatchAll(boolean set) {
125: if (set) {
126: if (!isMatchAll()) {
127: getSinglePool().addNewMatchAll();
128: pcs.firePropertyChange("matchAll", !set, set);
129: }
130: if (isMatchOne())
131: setMatchOne(false);
132: if (isSelectOneAssumeMatch())
133: setSelectOneAssumeMatch(false);
134: } else {
135: if (isMatchAll()) {
136: getSinglePool().unsetMatchAll();
137: pcs.firePropertyChange("matchAll", !set, set);
138: }
139: }
140: }
141:
142: public boolean isMatchOne() {
143: return getSinglePool().isSetMatchOne();
144: }
145:
146: public void setMatchOne(boolean set) {
147: if (set) {
148: if (!isMatchOne()) {
149: getSinglePool().addNewMatchOne();
150: pcs.firePropertyChange("matchOne", !set, set);
151: }
152: if (isMatchAll())
153: setMatchAll(false);
154: if (isSelectOneAssumeMatch())
155: setSelectOneAssumeMatch(false);
156: } else {
157: if (isMatchOne()) {
158: getSinglePool().unsetMatchOne();
159: pcs.firePropertyChange("matchOne", !set, set);
160: }
161: }
162: }
163:
164: public boolean isSelectOneAssumeMatch() {
165: return getSinglePool().isSetSelectOneAssumeMatch();
166: }
167:
168: public void setSelectOneAssumeMatch(boolean set) {
169: if (set) {
170: if (!isSelectOneAssumeMatch()) {
171: getSinglePool().addNewSelectOneAssumeMatch();
172: pcs.firePropertyChange("selectOneAssumeMatch", !set,
173: set);
174: }
175: if (isMatchAll())
176: setMatchAll(false);
177: if (isMatchOne())
178: setMatchOne(false);
179: } else {
180: if (isSelectOneAssumeMatch()) {
181: getSinglePool().unsetSelectOneAssumeMatch();
182: pcs.firePropertyChange("selectOneAssumeMatch", !set,
183: set);
184: }
185: }
186: }
187:
188: // ----------------------- End of JavaBean Properties ----------------------
189:
190: protected SchemaTypeLoader getSchemaTypeLoader() {
191: return Connector15DCBRoot.SCHEMA_TYPE_LOADER;
192: }
193: }
|