KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > geronimo > naming > deployment > jsr88 > EjbLocalRef


1 /**
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements. See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License. You may obtain a copy of the License at
8  *
9  * 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  */

17 package org.apache.geronimo.naming.deployment.jsr88;
18
19 import org.apache.geronimo.xbeans.geronimo.naming.GerEjbLocalRefType;
20
21 /**
22  * Represents an element of the ejb-local-refType in a Geronimo deployment
23  * plan.
24  * <p>
25  * Has 3 JavaBean Properties <br />
26  * - refName (type String) <br />
27  * - pattern (type Pattern) <br />
28  * - ejbLink (type String) </p>
29  *
30  * @version $Rev: 476049 $ $Date: 2006-11-16 23:35:17 -0500 (Thu, 16 Nov 2006) $
31  */

32 public class EjbLocalRef extends HasPattern {
33     public EjbLocalRef() {
34         super(null);
35     }
36
37     public EjbLocalRef(GerEjbLocalRefType xmlObject) {
38         super(xmlObject);
39     }
40
41     public void setRefName(String JavaDoc name) {
42         String JavaDoc old = getEjbLocalRef().getRefName();
43         getEjbLocalRef().setRefName(name);
44         pcs.firePropertyChange("refName", old, name);
45     }
46
47     public String JavaDoc getRefName() {
48         return getEjbLocalRef().getRefName();
49     }
50
51     public String JavaDoc getEjbLink() {
52         return getEjbLocalRef().getEjbLink();
53     }
54
55     public void setEjbLink(String JavaDoc link) {
56         GerEjbLocalRefType ref = getEjbLocalRef();
57         if(link != null && ref.isSetPattern()) {
58             clearPatternFromChoice();
59         }
60         String JavaDoc old = getEjbLink();
61         ref.setEjbLink(link);
62         pcs.firePropertyChange("ejbLink", old, link);
63     }
64
65
66     protected void clearNonPatternFromChoice() {
67         GerEjbLocalRefType ref = getEjbLocalRef();
68         if(ref.isSetEjbLink()) {
69             String JavaDoc temp = ref.getEjbLink();
70             ref.unsetEjbLink();
71             pcs.firePropertyChange("ejbLink", temp, null);
72         }
73         // todo: clear CORBA property
74
}
75
76     // todo: getter and setter for CORBA property
77

78     protected GerEjbLocalRefType getEjbLocalRef() {
79         return (GerEjbLocalRefType) getXmlObject();
80     }
81
82     public void configure(GerEjbLocalRefType xml) {
83         setXmlObject(xml);
84     }
85 }
86
Popular Tags