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 */ 017 package org.apache.geronimo.naming.deployment.jsr88; 018 019 import org.apache.geronimo.xbeans.geronimo.naming.GerEjbLocalRefType; 020 021 /** 022 * Represents an element of the ejb-local-refType in a Geronimo deployment 023 * plan. 024 * <p> 025 * Has 3 JavaBean Properties <br /> 026 * - refName (type String) <br /> 027 * - pattern (type Pattern) <br /> 028 * - ejbLink (type String) </p> 029 * 030 * @version $Rev: 476049 $ $Date: 2006-11-16 23:35:17 -0500 (Thu, 16 Nov 2006) $ 031 */ 032 public class EjbLocalRef extends HasPattern { 033 public EjbLocalRef() { 034 super(null); 035 } 036 037 public EjbLocalRef(GerEjbLocalRefType xmlObject) { 038 super(xmlObject); 039 } 040 041 public void setRefName(String name) { 042 String old = getEjbLocalRef().getRefName(); 043 getEjbLocalRef().setRefName(name); 044 pcs.firePropertyChange("refName", old, name); 045 } 046 047 public String getRefName() { 048 return getEjbLocalRef().getRefName(); 049 } 050 051 public String getEjbLink() { 052 return getEjbLocalRef().getEjbLink(); 053 } 054 055 public void setEjbLink(String link) { 056 GerEjbLocalRefType ref = getEjbLocalRef(); 057 if(link != null && ref.isSetPattern()) { 058 clearPatternFromChoice(); 059 } 060 String old = getEjbLink(); 061 ref.setEjbLink(link); 062 pcs.firePropertyChange("ejbLink", old, link); 063 } 064 065 066 protected void clearNonPatternFromChoice() { 067 GerEjbLocalRefType ref = getEjbLocalRef(); 068 if(ref.isSetEjbLink()) { 069 String temp = ref.getEjbLink(); 070 ref.unsetEjbLink(); 071 pcs.firePropertyChange("ejbLink", temp, null); 072 } 073 // todo: clear CORBA property 074 } 075 076 // todo: getter and setter for CORBA property 077 078 protected GerEjbLocalRefType getEjbLocalRef() { 079 return (GerEjbLocalRefType) getXmlObject(); 080 } 081 082 public void configure(GerEjbLocalRefType xml) { 083 setXmlObject(xml); 084 } 085 }