KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > j2ee > websphere6 > WSDDBeanRoot


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19 package org.netbeans.modules.j2ee.websphere6;
20
21 import javax.enterprise.deploy.model.*;
22 import javax.enterprise.deploy.shared.*;
23
24 /**
25  * Wrapper for the j2eeserver's implementation of <code>DDBeanRoot</code>.
26  * This class serves as a wrapper for j2eeserver's implementation of
27  * <code>DDBeanRoot</code> that fixes its incompartibility with the
28  * JSR-88 specification. The j2eeserver's implementation returns
29  * <i>'/&lt;app-type&gt;'</i> as its xpath, while the specification requires
30  * the xpath to be <i>'/'</i>.
31  *
32  * @author Kirill Sorokin
33  */

34 public class WSDDBeanRoot implements DDBeanRoot {
35     /**
36      * The original j2eeserver's <code>DDBeanRoot</code> implementation, all
37      * operations except <code>getXpath()</code> and
38      * <code>getDeployableObject</code> are delegated to it
39      */

40     private DDBeanRoot bean;
41     
42     /**
43      * Handle for the plugin's <code>DeployableObject</code> wrapper, it is
44      * used in the <code>getDeploaybleObject()</code> call
45      */

46     private WSDeployableObject parentObject;
47     
48     /**
49      * Creates a new instance of <code>WSDDBeanRoot</code>
50      *
51      * @param bean the original j2eeserver's <code>DDBeanRoot</code>
52      * implementation
53      * @param parentObject the plugin's parent <code>DeployableObject</code>
54      * wrapper
55      */

56     public WSDDBeanRoot(DDBeanRoot bean, WSDeployableObject parentObject) {
57         // save the instance variables
58
this.bean = bean;
59         this.parentObject = parentObject;
60     }
61     
62     /**
63      * Returns the original j2eeserver's <code>DDBeanRoot</code> implementation
64      * object
65      *
66      * @return the original j2eeserver's DDBeanRoot
67      */

68     public DDBeanRoot getOrigin() {
69         return bean;
70     }
71     
72     /**
73      * Returns the specification compliant <code>DDBeanRoot</code>'s xpath,
74      * i.e. <i>'/'</i>
75      *
76      * @return string containing the correct DDBeanRoot's xpath, i.e. <i>'/'</i>
77      */

78     public String JavaDoc getXpath() {
79         return "/"; // NOI18N
80
}
81     
82     /**
83      * Delegates the call to the j2eeserver's <code>DDBeanRoot</code>
84      * implementation object.
85      */

86     public String JavaDoc getAttributeValue(String JavaDoc str) {
87         return bean.getAttributeValue(str);
88     }
89     
90     /**
91      * Delegates the call to the j2eeserver's <code>DDBeanRoot</code>
92      * implementation object.
93      */

94     public DDBean[] getChildBean(String JavaDoc str) {
95         return bean.getChildBean(str);
96     }
97     
98     /**
99      * Delegates the call to the j2eeserver's <code>DDBeanRoot</code>
100      * implementation object.
101      */

102     public String JavaDoc[] getText(String JavaDoc str) {
103         return bean.getText(str);
104     }
105     
106     /**
107      * Delegates the call to the j2eeserver's <code>DDBeanRoot</code>
108      * implementation object.
109      */

110     public void removeXpathListener(String JavaDoc str, XpathListener xpathListener) {
111         bean.removeXpathListener(str, xpathListener);
112     }
113     
114     /**
115      * Delegates the call to the j2eeserver's <code>DDBeanRoot</code>
116      * implementation object.
117      */

118     public void addXpathListener(String JavaDoc str, XpathListener xpathListener) {
119         bean.addXpathListener(str, xpathListener);
120     }
121     
122     /**
123      * Delegates the call to the j2eeserver's <code>DDBeanRoot</code>
124      * implementation object.
125      */

126     public String JavaDoc[] getAttributeNames() {
127         return bean.getAttributeNames();
128     }
129     
130     /**
131      * Delegates the call to the j2eeserver's <code>DDBeanRoot</code>
132      * implementation object.
133      */

134     public String JavaDoc getDDBeanRootVersion() {
135         return bean.getDDBeanRootVersion();
136     }
137     
138     /**
139      * Returns the parent <code>DeployableObject</code> object, currently a
140      * plugin wrapper for the j2eeserver's implementation
141      *
142      * @return parent <code>DeployableObject</code> implementation
143      */

144     public DeployableObject getDeployableObject() {
145         return parentObject;
146     }
147     
148     /**
149      * Delegates the call to the j2eeserver's <code>DDBeanRoot</code>
150      * implementation object.
151      */

152     public String JavaDoc getFilename() {
153         return bean.getFilename();
154     }
155     
156     /**
157      * Delegates the call to the j2eeserver's <code>DDBeanRoot</code>
158      * implementation object.
159      */

160     public String JavaDoc getId() {
161         return bean.getId();
162     }
163     
164     /**
165      * Delegates the call to the j2eeserver's <code>DDBeanRoot</code>
166      * implementation object.
167      */

168     
169     public String JavaDoc getModuleDTDVersion() {
170         return bean.getDDBeanRootVersion();
171     }
172     
173     /**
174      * Delegates the call to the j2eeserver's <code>DDBeanRoot</code>
175      * implementation object.
176      */

177     public DDBeanRoot getRoot() {
178         return bean.getRoot();
179     }
180     
181     /**
182      * Delegates the call to the j2eeserver's <code>DDBeanRoot</code>
183      * implementation object.
184      */

185     public String JavaDoc getText() {
186         return bean.getText();
187     }
188     
189     /**
190      * Delegates the call to the j2eeserver's <code>DDBeanRoot</code>
191      * implementation object.
192      */

193     public ModuleType getType() {
194         return bean.getType();
195     }
196 }
Popular Tags