001 /**
002 *
003 * Licensed to the Apache Software Foundation (ASF) under one or more
004 * contributor license agreements. See the NOTICE file distributed with
005 * this work for additional information regarding copyright ownership.
006 * The ASF licenses this file to You under the Apache License, Version 2.0
007 * (the "License"); you may not use this file except in compliance with
008 * the License. You may obtain a copy of the License at
009 *
010 * http://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing, software
013 * distributed under the License is distributed on an "AS IS" BASIS,
014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015 * See the License for the specific language governing permissions and
016 * limitations under the License.
017 */
018 package org.apache.geronimo.naming.deployment.jsr88;
019
020 import org.apache.geronimo.xbeans.geronimo.naming.GerEjbLocalRefType;
021
022 /**
023 * Represents an element of the ejb-local-refType in a Geronimo deployment
024 * plan.
025 * <p>
026 * Has 3 JavaBean Properties <br />
027 * - refName (type String) <br />
028 * - pattern (type Pattern) <br />
029 * - ejbLink (type String) </p>
030 *
031 * @version $Rev: 470597 $ $Date: 2006-11-02 15:30:55 -0800 (Thu, 02 Nov 2006) $
032 */
033 public class EjbLocalRef extends HasPattern {
034 public EjbLocalRef() {
035 super(null);
036 }
037
038 public EjbLocalRef(GerEjbLocalRefType xmlObject) {
039 super(xmlObject);
040 }
041
042 public void setRefName(String name) {
043 String old = getEjbLocalRef().getRefName();
044 getEjbLocalRef().setRefName(name);
045 pcs.firePropertyChange("refName", old, name);
046 }
047
048 public String getRefName() {
049 return getEjbLocalRef().getRefName();
050 }
051
052 public String getEjbLink() {
053 return getEjbLocalRef().getEjbLink();
054 }
055
056 public void setEjbLink(String link) {
057 GerEjbLocalRefType ref = getEjbLocalRef();
058 if(link != null && ref.isSetPattern()) {
059 clearPatternFromChoice();
060 }
061 String old = getEjbLink();
062 ref.setEjbLink(link);
063 pcs.firePropertyChange("ejbLink", old, link);
064 }
065
066
067 protected void clearNonPatternFromChoice() {
068 GerEjbLocalRefType ref = getEjbLocalRef();
069 if(ref.isSetEjbLink()) {
070 String temp = ref.getEjbLink();
071 ref.unsetEjbLink();
072 pcs.firePropertyChange("ejbLink", temp, null);
073 }
074 // todo: clear CORBA property
075 }
076
077 // todo: getter and setter for CORBA property
078
079 protected GerEjbLocalRefType getEjbLocalRef() {
080 return (GerEjbLocalRefType) getXmlObject();
081 }
082
083 public void configure(GerEjbLocalRefType xml) {
084 setXmlObject(xml);
085 }
086 }