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.naming.deployment.jsr88;
017:
018: import org.apache.geronimo.xbeans.geronimo.naming.GerResourceRefType;
019: import org.apache.geronimo.xbeans.geronimo.naming.GerResourceEnvRefType;
020:
021: /**
022: * Represents an element of the resource-env-refType in a Geronimo deployment
023: * plan.
024: * <p>
025: * Has 4 JavaBean Properties <br />
026: * - refName (type String) <br />
027: * - pattern (type Pattern) <br />
028: * - adminObjectModule (type String) <br />
029: * - adminObjectLink (type String) </p>
030: *
031: * @version $Rev: 476049 $ $Date: 2006-11-16 20:35:17 -0800 (Thu, 16 Nov 2006) $
032: */
033: public class ResourceEnvRef extends HasPattern {
034: public ResourceEnvRef() {
035: super (null);
036: }
037:
038: public ResourceEnvRef(GerResourceEnvRefType xmlObject) {
039: super (xmlObject);
040: }
041:
042: public void setRefName(String name) {
043: String old = getResourceRef().getRefName();
044: getResourceRef().setRefName(name);
045: pcs.firePropertyChange("refName", old, name);
046: }
047:
048: public String getRefName() {
049: return getResourceRef().getRefName();
050: }
051:
052: public String getAdminObjectLink() {
053: return getResourceRef().getAdminObjectLink();
054: }
055:
056: public void setAdminObjectLink(String link) {
057: GerResourceEnvRefType ref = getResourceRef();
058: if (link != null && ref.isSetPattern()) {
059: clearPatternFromChoice();
060: }
061: String old = getAdminObjectLink();
062: ref.setAdminObjectLink(link);
063: pcs.firePropertyChange("adminObjectLink", old, link);
064: }
065:
066: public String getAdminObjectModule() {
067: return getResourceRef().getAdminObjectModule();
068: }
069:
070: public void setAdminObjectModule(String module) {
071: GerResourceEnvRefType ref = getResourceRef();
072: if (module != null && ref.isSetPattern()) {
073: clearPatternFromChoice();
074: }
075: String old = getAdminObjectModule();
076: ref.setAdminObjectModule(module);
077: pcs.firePropertyChange("adminObjectModule", old, module);
078: }
079:
080: protected void clearNonPatternFromChoice() {
081: GerResourceEnvRefType ref = getResourceRef();
082: if (ref.isSetAdminObjectLink()) {
083: String temp = ref.getAdminObjectLink();
084: ref.unsetAdminObjectLink();
085: pcs.firePropertyChange("adminObjectLink", temp, null);
086: }
087: if (ref.isSetAdminObjectModule()) {
088: String temp = ref.getAdminObjectModule();
089: ref.unsetAdminObjectModule();
090: pcs.firePropertyChange("adminObjectModule", temp, null);
091: }
092: }
093:
094: protected GerResourceEnvRefType getResourceRef() {
095: return (GerResourceEnvRefType) getXmlObject();
096: }
097:
098: public void configure(GerResourceEnvRefType xml) {
099: setXmlObject(xml);
100: }
101: }
|