KickJava   Java API By Example, From Geeks To Geeks.

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


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.GerResourceRefType;
20 import org.apache.geronimo.xbeans.geronimo.naming.GerResourceEnvRefType;
21
22 /**
23  * Represents an element of the resource-env-refType in a Geronimo deployment
24  * plan.
25  * <p>
26  * Has 4 JavaBean Properties <br />
27  * - refName (type String) <br />
28  * - pattern (type Pattern) <br />
29  * - adminObjectModule (type String) <br />
30  * - adminObjectLink (type String) </p>
31  *
32  * @version $Rev: 476049 $ $Date: 2006-11-16 23:35:17 -0500 (Thu, 16 Nov 2006) $
33  */

34 public class ResourceEnvRef extends HasPattern {
35     public ResourceEnvRef() {
36         super(null);
37     }
38
39     public ResourceEnvRef(GerResourceEnvRefType xmlObject) {
40         super(xmlObject);
41     }
42
43     public void setRefName(String JavaDoc name) {
44         String JavaDoc old = getResourceRef().getRefName();
45         getResourceRef().setRefName(name);
46         pcs.firePropertyChange("refName", old, name);
47     }
48
49     public String JavaDoc getRefName() {
50         return getResourceRef().getRefName();
51     }
52
53     public String JavaDoc getAdminObjectLink() {
54         return getResourceRef().getAdminObjectLink();
55     }
56
57     public void setAdminObjectLink(String JavaDoc link) {
58         GerResourceEnvRefType ref = getResourceRef();
59         if(link != null && ref.isSetPattern()) {
60             clearPatternFromChoice();
61         }
62         String JavaDoc old = getAdminObjectLink();
63         ref.setAdminObjectLink(link);
64         pcs.firePropertyChange("adminObjectLink", old, link);
65     }
66
67     public String JavaDoc getAdminObjectModule() {
68         return getResourceRef().getAdminObjectModule();
69     }
70
71     public void setAdminObjectModule(String JavaDoc module) {
72         GerResourceEnvRefType ref = getResourceRef();
73         if(module != null && ref.isSetPattern()) {
74             clearPatternFromChoice();
75         }
76         String JavaDoc old = getAdminObjectModule();
77         ref.setAdminObjectModule(module);
78         pcs.firePropertyChange("adminObjectModule", old, module);
79     }
80
81
82     protected void clearNonPatternFromChoice() {
83         GerResourceEnvRefType ref = getResourceRef();
84         if(ref.isSetAdminObjectLink()) {
85             String JavaDoc temp = ref.getAdminObjectLink();
86             ref.unsetAdminObjectLink();
87             pcs.firePropertyChange("adminObjectLink", temp, null);
88         }
89         if(ref.isSetAdminObjectModule()) {
90             String JavaDoc temp = ref.getAdminObjectModule();
91             ref.unsetAdminObjectModule();
92             pcs.firePropertyChange("adminObjectModule", temp, null);
93         }
94     }
95
96     protected GerResourceEnvRefType getResourceRef() {
97         return (GerResourceEnvRefType) getXmlObject();
98     }
99
100     public void configure(GerResourceEnvRefType xml) {
101         setXmlObject(xml);
102     }
103 }
104
Popular Tags