01: /**
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * 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: */package org.apache.geronimo.naming.deployment.jsr88;
17:
18: import org.apache.geronimo.xbeans.geronimo.naming.GerGbeanLocatorType;
19:
20: /**
21: * Represents an element of the gbean-locatorType in a Geronimo
22: * deployment plan.
23: * <p>
24: * Has 2 JavaBean Properties <br />
25: * - GBeanLink (type String) <br />
26: * - pattern (type Pattern) </p>
27: *
28: * @version $Rev: 484989 $ $Date: 2006-12-09 06:54:26 -0800 (Sat, 09 Dec 2006) $
29: */
30: public class GBeanLocator extends HasPattern {
31: public GBeanLocator() {
32: super (null);
33: }
34:
35: public GBeanLocator(GerGbeanLocatorType xmlObject) {
36: super (xmlObject);
37: }
38:
39: protected GerGbeanLocatorType getGBeanLocator() {
40: return (GerGbeanLocatorType) getXmlObject();
41: }
42:
43: public void configure(GerGbeanLocatorType xml) {
44: setXmlObject(xml);
45: }
46:
47: public String getGBeanLink() {
48: return getGBeanLocator().getGbeanLink();
49: }
50:
51: public void setGBeanLink(String link) {
52: GerGbeanLocatorType locator = getGBeanLocator();
53: if (link != null && locator.isSetPattern()) {
54: clearPatternFromChoice();
55: }
56: String old = getGBeanLink();
57: locator.setGbeanLink(link);
58: pcs.firePropertyChange("GBeanLink", old, link);
59: }
60:
61: protected void clearNonPatternFromChoice() {
62: GerGbeanLocatorType locator = getGBeanLocator();
63: if (locator.isSetGbeanLink()) {
64: String temp = locator.getGbeanLink();
65: locator.unsetGbeanLink();
66: pcs.firePropertyChange("GBeanLink", temp, null);
67: }
68: }
69: }
|