KickJava   Java API By Example, From Geeks To Geeks.

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


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.GerEjbRefType;
20
21 /**
22  * Represents an element of the ejb-refType in a Geronimo deployment plan.
23  * <p>
24  * Has 4 JavaBean Properties <br />
25  * - refName (type String) <br />
26  * - pattern (type Pattern) <br />
27  * - corbaNamingGroup (type ???) <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 EjbRef extends HasPattern {
33     public EjbRef() {
34         super(null);
35     }
36
37     public EjbRef(GerEjbRefType xmlObject) {
38         super(xmlObject);
39     }
40
41     public void setRefName(String JavaDoc name) {
42         String JavaDoc old = getEjbRef().getRefName();
43         getEjbRef().setRefName(name);
44         pcs.firePropertyChange("refName", old, name);
45     }
46
47     public String JavaDoc getRefName() {
48         return getEjbRef().getRefName();
49     }
50
51     public String JavaDoc getEjbLink() {
52         return getEjbRef().getEjbLink();
53     }
54
55     public void setEjbLink(String JavaDoc link) {
56         GerEjbRefType ref = getEjbRef();
57         if(link != null) {
58             if(ref.isSetPattern()) {
59                 clearPatternFromChoice();
60             }
61             // todo: clear CORBA property
62
}
63         String JavaDoc old = getEjbLink();
64         ref.setEjbLink(link);
65         pcs.firePropertyChange("ejbLink", old, link);
66     }
67
68
69     protected void clearNonPatternFromChoice() {
70         GerEjbRefType ref = getEjbRef();
71         if(ref.isSetEjbLink()) {
72             String JavaDoc temp = ref.getEjbLink();
73             ref.unsetEjbLink();
74             pcs.firePropertyChange("ejbLink", temp, null);
75         }
76         // todo: clear CORBA property
77
}
78
79     // todo: getter and setter for CORBA property
80

81     protected GerEjbRefType getEjbRef() {
82         return (GerEjbRefType) getXmlObject();
83     }
84
85     public void configure(GerEjbRefType xml) {
86         setXmlObject(xml);
87     }
88 }
89
Popular Tags