KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > j2ee > sun > ws7 > serverresources > dd > WS70ResourcesProxy


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
20 /*
21  * WS70ResourcesProxy.java
22  *
23  */

24
25 package org.netbeans.modules.j2ee.sun.ws7.serverresources.dd;
26 import org.netbeans.modules.j2ee.sun.dd.api.CommonDDBean;
27
28 /**
29  *
30  * Code reused from Appserver common API module
31  */

32 public class WS70ResourcesProxy implements WS70Resources {
33
34     private WS70Resources resourcesRoot;
35     private java.util.List JavaDoc listeners;
36
37     /**
38      * Creates a new instance of WS70ResourcesProxy
39      */

40     public WS70ResourcesProxy(WS70Resources resourcesRoot) {
41         this.resourcesRoot = resourcesRoot;
42     }
43
44     public void write(java.io.Writer JavaDoc w) throws java.io.IOException JavaDoc, org.netbeans.modules.j2ee.sun.dd.api.DDException {
45         if (resourcesRoot!=null) resourcesRoot.write(w);
46     }
47
48     public void setWS70JdbcResource(int index, WS70JdbcResource value) {
49         if (resourcesRoot!=null) resourcesRoot.setWS70JdbcResource(index, value);
50     }
51
52     public int addWS70ExternalJndiResource(WS70ExternalJndiResource value) {
53         return resourcesRoot==null?-1:resourcesRoot.addWS70ExternalJndiResource(value);
54     }
55
56     public int removeWS70ExternalJndiResource(WS70ExternalJndiResource value) {
57         return resourcesRoot==null?-1:resourcesRoot.removeWS70ExternalJndiResource(value);
58     }
59
60     public int size(String JavaDoc name) {
61         return resourcesRoot==null?-1:resourcesRoot.size(name);
62     }
63
64     public Object JavaDoc[] getValues(String JavaDoc name) {
65         return resourcesRoot==null?null:resourcesRoot.getValues(name);
66     }
67
68     public Object JavaDoc getValue(String JavaDoc propertyName) {
69         return resourcesRoot==null?null:resourcesRoot.getValue(propertyName);
70     }
71
72     public org.netbeans.modules.j2ee.sun.dd.api.CommonDDBean getPropertyParent(String JavaDoc name) {
73         return resourcesRoot==null?null:resourcesRoot.getPropertyParent(name);
74     }
75
76     public String JavaDoc getAttributeValue(String JavaDoc name) {
77         return resourcesRoot==null?null:resourcesRoot.getAttributeValue(name);
78     }
79     public WS70MailResource getWS70MailResource(int index) {
80         return resourcesRoot==null?null:resourcesRoot.getWS70MailResource(index);
81     }
82
83
84     public WS70JdbcResource getWS70JdbcResource(int index) {
85         return resourcesRoot==null?null:resourcesRoot.getWS70JdbcResource(index);
86     }
87
88
89     public WS70ExternalJndiResource getWS70ExternalJndiResource(int index) {
90         return resourcesRoot==null?null:resourcesRoot.getWS70ExternalJndiResource(index);
91     }
92
93     public WS70CustomResource getWS70CustomResource(int index) {
94         return resourcesRoot==null?null:resourcesRoot.getWS70CustomResource(index);
95     }
96
97     public void setValue(String JavaDoc name, int index, Object JavaDoc value) {
98         if (resourcesRoot!=null) resourcesRoot.setValue(name, index, value);
99     }
100
101     public int addValue(String JavaDoc name, Object JavaDoc value) {
102         return resourcesRoot==null?-1:resourcesRoot.addValue(name, value);
103     }
104
105     public String JavaDoc[] findPropertyValue(String JavaDoc propName, Object JavaDoc value) {
106         return resourcesRoot==null?null:resourcesRoot.findPropertyValue(propName, value);
107     }
108
109     public int removeValue(String JavaDoc name, Object JavaDoc value) {
110         return resourcesRoot==null?-1:resourcesRoot.removeValue(name, value);
111     }
112
113     public void setValue(String JavaDoc name, Object JavaDoc value) {
114         if (resourcesRoot!=null) resourcesRoot.setValue(name, value);
115     }
116
117
118     public void setWS70CustomResource(int index, WS70CustomResource value) {
119         if (resourcesRoot!=null) resourcesRoot.setWS70CustomResource(index, value);
120     }
121
122
123     public void setValue(String JavaDoc name, Object JavaDoc[] value) {
124         if (resourcesRoot!=null) resourcesRoot.setValue(name, value);
125     }
126
127     public void addPropertyChangeListener(java.beans.PropertyChangeListener JavaDoc pcl) {
128         if (resourcesRoot != null)
129             resourcesRoot.addPropertyChangeListener(pcl);
130         listeners.add(pcl);
131     }
132
133     public void removePropertyChangeListener(java.beans.PropertyChangeListener JavaDoc pcl) {
134         if (resourcesRoot != null)
135             resourcesRoot.removePropertyChangeListener(pcl);
136         listeners.remove(pcl);
137     }
138
139     public void setWS70MailResource(int index, WS70MailResource value) {
140         if (resourcesRoot!=null) resourcesRoot.setWS70MailResource(index, value);
141     }
142
143     public int addWS70MailResource(WS70MailResource value) {
144         return resourcesRoot==null?-1:resourcesRoot.addWS70MailResource(value);
145     }
146
147     public int removeWS70MailResource(WS70MailResource value) {
148         return resourcesRoot==null?-1:resourcesRoot.removeWS70MailResource(value);
149     }
150
151     public void setWS70ExternalJndiResource(WS70ExternalJndiResource[] value) {
152         if (resourcesRoot!=null) resourcesRoot.setWS70ExternalJndiResource(value);
153     }
154
155
156     public int addWS70CustomResource(WS70CustomResource value) {
157         return resourcesRoot==null?-1:resourcesRoot.addWS70CustomResource(value);
158     }
159
160     public int removeWS70CustomResource(WS70CustomResource value) {
161         return resourcesRoot==null?-1:resourcesRoot.removeWS70CustomResource(value);
162     }
163
164     public int addWS70JdbcResource(WS70JdbcResource value) {
165         return resourcesRoot==null?-1:resourcesRoot.addWS70JdbcResource(value);
166     }
167
168     public int removeWS70JdbcResource(WS70JdbcResource value) {
169         return resourcesRoot==null?-1:resourcesRoot.removeWS70JdbcResource(value);
170     }
171
172
173     public void setWS70ExternalJndiResource(int index, WS70ExternalJndiResource value) {
174         if (resourcesRoot!=null) resourcesRoot.setWS70ExternalJndiResource(index, value);
175     }
176
177     public void setWS70CustomResource(WS70CustomResource[] value) {
178         if (resourcesRoot!=null) resourcesRoot.setWS70CustomResource(value);
179     }
180
181     public void setWS70JdbcResource(WS70JdbcResource[] value) {
182         if (resourcesRoot!=null) resourcesRoot.setWS70JdbcResource(value);
183     }
184
185     public void setWS70MailResource(WS70MailResource[] value) {
186         if (resourcesRoot!=null) resourcesRoot.setWS70MailResource(value);
187     }
188
189     public void write(java.io.OutputStream JavaDoc os) throws java.io.IOException JavaDoc {
190         if (resourcesRoot != null) {
191             resourcesRoot.write(os);
192         }
193     }
194
195     public void merge(org.netbeans.modules.j2ee.sun.dd.api.CommonDDBean root, int mode) {
196         if (root != null) {
197             if (root instanceof WS70ResourcesProxy)
198                 resourcesRoot.merge(((WS70ResourcesProxy)root).getOriginal(), mode);
199             else resourcesRoot.merge(root, mode);
200         }
201     }
202
203     public WS70Resources getOriginal() {
204         return resourcesRoot;
205     }
206     
207     public Object JavaDoc getValue(String JavaDoc name, int index) {
208         return resourcesRoot==null?null:resourcesRoot.getValues(name);
209     }
210
211     public void removeValue(String JavaDoc name, int index) {
212         if (resourcesRoot!=null) resourcesRoot.removeValue(name, index);
213     }
214
215
216     public int sizeWS70MailResource() {
217         return resourcesRoot==null?-1:resourcesRoot.sizeWS70MailResource();
218     }
219
220
221     public int sizeWS70JdbcResource() {
222         return resourcesRoot==null?-1:resourcesRoot.sizeWS70JdbcResource();
223     }
224
225
226     public int sizeWS70ExternalJndiResource() {
227         return resourcesRoot==null?-1:resourcesRoot.sizeWS70ExternalJndiResource();
228     }
229
230     public int sizeWS70CustomResource() {
231         return resourcesRoot==null?-1:resourcesRoot.sizeWS70CustomResource();
232     }
233
234     public WS70CustomResource newWS70CustomResource() {
235         return resourcesRoot==null?null:resourcesRoot.newWS70CustomResource();
236     }
237
238
239
240     public WS70MailResource[] getWS70MailResource() {
241         return resourcesRoot==null?null:resourcesRoot.getWS70MailResource();
242     }
243
244
245
246     public WS70JdbcResource[] getWS70JdbcResource() {
247         return resourcesRoot==null?null:resourcesRoot.getWS70JdbcResource();
248     }
249
250
251
252     public WS70ExternalJndiResource[] getWS70ExternalJndiResource() {
253         return resourcesRoot==null?null:resourcesRoot.getWS70ExternalJndiResource();
254     }
255
256     public String JavaDoc dumpBeanNode() {
257         return resourcesRoot==null?null:resourcesRoot.dumpBeanNode();
258     }
259
260  
261     public String JavaDoc getAttributeValue(String JavaDoc propName, String JavaDoc name) {
262         return resourcesRoot==null?null:resourcesRoot.getAttributeValue(propName, name);
263     }
264
265     public String JavaDoc getAttributeValue(String JavaDoc propName, int index, String JavaDoc name) {
266         return resourcesRoot==null?null:resourcesRoot.getAttributeValue(propName, index, name);
267     }
268
269  
270
271     public WS70CustomResource[] getWS70CustomResource() {
272         return resourcesRoot==null?null:resourcesRoot.getWS70CustomResource();
273     }
274
275     public WS70ExternalJndiResource newWS70ExternalJndiResource() {
276         return resourcesRoot==null?null:resourcesRoot.newWS70ExternalJndiResource();
277     }
278
279     public WS70JdbcResource newWS70JdbcResource() {
280         return resourcesRoot==null?null:resourcesRoot.newWS70JdbcResource();
281     }
282
283
284
285     public WS70MailResource newWS70MailResource() {
286         return resourcesRoot==null?null:resourcesRoot.newWS70MailResource();
287     }
288
289     public void setAttributeValue(String JavaDoc name, String JavaDoc value) {
290         if (resourcesRoot!=null) resourcesRoot.setAttributeValue(name, value);
291     }
292
293     public void setAttributeValue(String JavaDoc propName, String JavaDoc name, String JavaDoc value) {
294         if (resourcesRoot!=null) resourcesRoot.setAttributeValue(propName, name, value);
295     }
296
297     public void setAttributeValue(String JavaDoc propName, int index, String JavaDoc name, String JavaDoc value) {
298         if (resourcesRoot!=null) resourcesRoot.setAttributeValue(propName, index, name, value);
299     }
300
301     public Object JavaDoc clone() {
302        WS70ResourcesProxy proxy = null;
303         if (resourcesRoot==null)
304             proxy = new WS70ResourcesProxy(null);
305         else {
306             WS70Resources clonedResources=(WS70Resources)resourcesRoot.clone();
307             proxy = new WS70ResourcesProxy(clonedResources);
308         }
309         return proxy;
310     }
311    /** Resources have no version (at present) so we could throw
312        UnsupportedOperationException but it's probably just better to
313        clone it since that is what this method does anyway.
314     *
315      */

316     public CommonDDBean cloneVersion(String JavaDoc version) {
317         return (CommonDDBean) clone();
318     }
319
320
321     public void write(java.io.File JavaDoc f) throws java.io.IOException JavaDoc, org.netbeans.modules.schema2beans.Schema2BeansRuntimeException {
322         if (resourcesRoot!=null) resourcesRoot.write(f);
323     }
324     
325 }
326
Popular Tags