001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005: *
006: * The contents of this file are subject to the terms of either the GNU
007: * General Public License Version 2 only ("GPL") or the Common
008: * Development and Distribution License("CDDL") (collectively, the
009: * "License"). You may not use this file except in compliance with the
010: * License. You can obtain a copy of the License at
011: * http://www.netbeans.org/cddl-gplv2.html
012: * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013: * specific language governing permissions and limitations under the
014: * License. When distributing the software, include this License Header
015: * Notice in each file and include the License file at
016: * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
017: * particular file as subject to the "Classpath" exception as provided
018: * by Sun in the GPL Version 2 section of the License file that
019: * accompanied this code. If applicable, add the following below the
020: * License Header, with the fields enclosed by brackets [] replaced by
021: * your own identifying information:
022: * "Portions Copyrighted [year] [name of copyright owner]"
023: *
024: * Contributor(s):
025: *
026: * The Original Software is NetBeans. The Initial Developer of the Original
027: * Software is Sun Microsystems, Inc. Portions Copyright 2006 Sun
028: * Microsystems, Inc. All Rights Reserved.
029: *
030: * If you wish your version of this file to be governed by only the CDDL
031: * or only the GPL Version 2, indicate your decision by adding
032: * "[Contributor] elects to include this software in this distribution
033: * under the [CDDL or GPL Version 2] license." If you do not indicate a
034: * single choice of license, a recipient has the option to distribute
035: * your version of this file under either the CDDL, the GPL Version 2 or
036: * to extend the choice of license to its licensees as provided above.
037: * However, if you add GPL Version 2 code and therefore, elected the GPL
038: * Version 2 license, then the option applies only if the new code is
039: * made subject to such option by the copyright holder.
040: */
041: /*
042: * ResourcesProxy.java
043: *
044: * Created on August 17, 2005, 3:35 PM
045: *
046: */
047:
048: package org.netbeans.modules.j2ee.sun.dd.impl.serverresources;
049:
050: import java.beans.PropertyChangeListener;
051: import java.io.IOException;
052: import java.io.OutputStream;
053: import java.math.BigDecimal;
054: import java.util.ArrayList;
055: import java.util.List;
056: import org.netbeans.modules.j2ee.sun.dd.api.ASDDVersion;
057: import org.netbeans.modules.j2ee.sun.dd.api.CommonDDBean;
058: import org.netbeans.modules.j2ee.sun.dd.api.RootInterface;
059: import org.netbeans.modules.j2ee.sun.dd.api.serverresources.Resources;
060: import org.netbeans.modules.j2ee.sun.dd.impl.RootInterfaceImpl;
061: import org.netbeans.modules.j2ee.sun.dd.impl.common.DDProviderDataObject;
062: import org.netbeans.modules.schema2beans.BaseBean;
063: import org.netbeans.modules.schema2beans.GraphManager;
064: import org.netbeans.modules.schema2beans.Schema2BeansUtil;
065: import org.openide.filesystems.FileLock;
066: import org.openide.filesystems.FileObject;
067: import org.openide.loaders.DataObject;
068: import org.xml.sax.SAXParseException;
069:
070: /**
071: *
072: * @author Nitya Doraisamy
073: */
074: public class ResourcesProxy implements Resources, RootInterfaceImpl {
075:
076: private Resources resourcesRoot;
077: private String version;
078: private int ddStatus;
079: private SAXParseException error;
080: private List<PropertyChangeListener> listeners;
081: private Schema2BeansUtil.ReindentationListener reindentationListener = new Schema2BeansUtil.ReindentationListener();
082:
083: /** Creates a new instance of ResourcesProxy */
084: public ResourcesProxy(Resources resourcesRoot) {
085: this (resourcesRoot, Resources.VERSION_1_3);
086: }
087:
088: public ResourcesProxy(Resources resourcesRoot, String version) {
089: this .resourcesRoot = resourcesRoot;
090: this .version = version;
091: this .listeners = new ArrayList<PropertyChangeListener>();
092: addPropertyChangeListener(reindentationListener);
093: }
094:
095: public int addAdminObjectResource(
096: org.netbeans.modules.j2ee.sun.dd.api.serverresources.AdminObjectResource value) {
097: return resourcesRoot == null ? -1 : resourcesRoot
098: .addAdminObjectResource(value);
099: }
100:
101: public int removeAdminObjectResource(
102: org.netbeans.modules.j2ee.sun.dd.api.serverresources.AdminObjectResource value) {
103: return resourcesRoot == null ? -1 : resourcesRoot
104: .removeAdminObjectResource(value);
105: }
106:
107: public void setPersistenceManagerFactoryResource(
108: org.netbeans.modules.j2ee.sun.dd.api.serverresources.PersistenceManagerFactoryResource[] value) {
109: if (resourcesRoot != null)
110: resourcesRoot.setPersistenceManagerFactoryResource(value);
111: }
112:
113: public void setPersistenceManagerFactoryResource(
114: int index,
115: org.netbeans.modules.j2ee.sun.dd.api.serverresources.PersistenceManagerFactoryResource value) {
116: if (resourcesRoot != null)
117: resourcesRoot.setPersistenceManagerFactoryResource(index,
118: value);
119: }
120:
121: public void setAdminObjectResource(
122: org.netbeans.modules.j2ee.sun.dd.api.serverresources.AdminObjectResource[] value) {
123: if (resourcesRoot != null)
124: resourcesRoot.setAdminObjectResource(value);
125: }
126:
127: public void setJdbcResource(
128: int index,
129: org.netbeans.modules.j2ee.sun.dd.api.serverresources.JdbcResource value) {
130: if (resourcesRoot != null)
131: resourcesRoot.setJdbcResource(index, value);
132: }
133:
134: public int addConnectorResource(
135: org.netbeans.modules.j2ee.sun.dd.api.serverresources.ConnectorResource value) {
136: return resourcesRoot == null ? -1 : resourcesRoot
137: .addConnectorResource(value);
138: }
139:
140: public int removeConnectorResource(
141: org.netbeans.modules.j2ee.sun.dd.api.serverresources.ConnectorResource value) {
142: return resourcesRoot == null ? -1 : resourcesRoot
143: .removeConnectorResource(value);
144: }
145:
146: public void setJdbcConnectionPool(
147: int index,
148: org.netbeans.modules.j2ee.sun.dd.api.serverresources.JdbcConnectionPool value) {
149: if (resourcesRoot != null)
150: resourcesRoot.setJdbcConnectionPool(index, value);
151: }
152:
153: public void setConnectorConnectionPool(
154: int index,
155: org.netbeans.modules.j2ee.sun.dd.api.serverresources.ConnectorConnectionPool value) {
156: if (resourcesRoot != null)
157: resourcesRoot.setConnectorConnectionPool(index, value);
158: }
159:
160: public int addExternalJndiResource(
161: org.netbeans.modules.j2ee.sun.dd.api.serverresources.ExternalJndiResource value) {
162: return resourcesRoot == null ? -1 : resourcesRoot
163: .addExternalJndiResource(value);
164: }
165:
166: public int removeExternalJndiResource(
167: org.netbeans.modules.j2ee.sun.dd.api.serverresources.ExternalJndiResource value) {
168: return resourcesRoot == null ? -1 : resourcesRoot
169: .removeExternalJndiResource(value);
170: }
171:
172: public void setAdminObjectResource(
173: int index,
174: org.netbeans.modules.j2ee.sun.dd.api.serverresources.AdminObjectResource value) {
175: if (resourcesRoot != null)
176: resourcesRoot.setAdminObjectResource(index, value);
177: }
178:
179: public int size(String name) {
180: return resourcesRoot == null ? -1 : resourcesRoot.size(name);
181: }
182:
183: public Object[] getValues(String name) {
184: return resourcesRoot == null ? null : resourcesRoot
185: .getValues(name);
186: }
187:
188: public Object getValue(String propertyName) {
189: return resourcesRoot == null ? null : resourcesRoot
190: .getValue(propertyName);
191: }
192:
193: public org.netbeans.modules.j2ee.sun.dd.api.CommonDDBean getPropertyParent(
194: String name) {
195: return resourcesRoot == null ? null : resourcesRoot
196: .getPropertyParent(name);
197: }
198:
199: public String getAttributeValue(String name) {
200: return resourcesRoot == null ? null : resourcesRoot
201: .getAttributeValue(name);
202: }
203:
204: public org.netbeans.modules.j2ee.sun.dd.api.serverresources.ResourceAdapterConfig getResourceAdapterConfig(
205: int index) {
206: return resourcesRoot == null ? null : resourcesRoot
207: .getResourceAdapterConfig(index);
208: }
209:
210: public org.netbeans.modules.j2ee.sun.dd.api.serverresources.PersistenceManagerFactoryResource getPersistenceManagerFactoryResource(
211: int index) {
212: return resourcesRoot == null ? null : resourcesRoot
213: .getPersistenceManagerFactoryResource(index);
214: }
215:
216: public org.netbeans.modules.j2ee.sun.dd.api.serverresources.MailResource getMailResource(
217: int index) {
218: return resourcesRoot == null ? null : resourcesRoot
219: .getMailResource(index);
220: }
221:
222: public org.netbeans.modules.j2ee.sun.dd.api.serverresources.JmsResource getJmsResource(
223: int index) {
224: return resourcesRoot == null ? null : resourcesRoot
225: .getJmsResource(index);
226: }
227:
228: public org.netbeans.modules.j2ee.sun.dd.api.serverresources.JdbcResource getJdbcResource(
229: int index) {
230: return resourcesRoot == null ? null : resourcesRoot
231: .getJdbcResource(index);
232: }
233:
234: public org.netbeans.modules.j2ee.sun.dd.api.serverresources.JdbcConnectionPool getJdbcConnectionPool(
235: int index) {
236: return resourcesRoot == null ? null : resourcesRoot
237: .getJdbcConnectionPool(index);
238: }
239:
240: public org.netbeans.modules.j2ee.sun.dd.api.serverresources.ExternalJndiResource getExternalJndiResource(
241: int index) {
242: return resourcesRoot == null ? null : resourcesRoot
243: .getExternalJndiResource(index);
244: }
245:
246: public org.netbeans.modules.j2ee.sun.dd.api.serverresources.CustomResource getCustomResource(
247: int index) {
248: return resourcesRoot == null ? null : resourcesRoot
249: .getCustomResource(index);
250: }
251:
252: public org.netbeans.modules.j2ee.sun.dd.api.serverresources.AdminObjectResource getAdminObjectResource(
253: int index) {
254: return resourcesRoot == null ? null : resourcesRoot
255: .getAdminObjectResource(index);
256: }
257:
258: public org.netbeans.modules.j2ee.sun.dd.api.serverresources.ConnectorConnectionPool getConnectorConnectionPool(
259: int index) {
260: return resourcesRoot == null ? null : resourcesRoot
261: .getConnectorConnectionPool(index);
262: }
263:
264: public org.netbeans.modules.j2ee.sun.dd.api.serverresources.ConnectorResource getConnectorResource(
265: int index) {
266: return resourcesRoot == null ? null : resourcesRoot
267: .getConnectorResource(index);
268: }
269:
270: public void setValue(String name, int index, Object value) {
271: if (resourcesRoot != null)
272: resourcesRoot.setValue(name, index, value);
273: }
274:
275: public int addValue(String name, Object value) {
276: return resourcesRoot == null ? -1 : resourcesRoot.addValue(
277: name, value);
278: }
279:
280: public String[] findPropertyValue(String propName, Object value) {
281: return resourcesRoot == null ? null : resourcesRoot
282: .findPropertyValue(propName, value);
283: }
284:
285: public int removeValue(String name, Object value) {
286: return resourcesRoot == null ? -1 : resourcesRoot.removeValue(
287: name, value);
288: }
289:
290: public void setValue(String name, Object value) {
291: if (resourcesRoot != null)
292: resourcesRoot.setValue(name, value);
293: }
294:
295: public void setJmsResource(
296: org.netbeans.modules.j2ee.sun.dd.api.serverresources.JmsResource[] value) {
297: if (resourcesRoot != null)
298: resourcesRoot.setJmsResource(value);
299: }
300:
301: public void setConnectorConnectionPool(
302: org.netbeans.modules.j2ee.sun.dd.api.serverresources.ConnectorConnectionPool[] value) {
303: if (resourcesRoot != null)
304: resourcesRoot.setConnectorConnectionPool(value);
305: }
306:
307: public void setJmsResource(
308: int index,
309: org.netbeans.modules.j2ee.sun.dd.api.serverresources.JmsResource value) {
310: if (resourcesRoot != null)
311: resourcesRoot.setJmsResource(index, value);
312: }
313:
314: public void setResourceAdapterConfig(
315: int index,
316: org.netbeans.modules.j2ee.sun.dd.api.serverresources.ResourceAdapterConfig value) {
317: if (resourcesRoot != null)
318: resourcesRoot.setResourceAdapterConfig(index, value);
319: }
320:
321: public void setCustomResource(
322: int index,
323: org.netbeans.modules.j2ee.sun.dd.api.serverresources.CustomResource value) {
324: if (resourcesRoot != null)
325: resourcesRoot.setCustomResource(index, value);
326: }
327:
328: public int addJdbcConnectionPool(
329: org.netbeans.modules.j2ee.sun.dd.api.serverresources.JdbcConnectionPool value) {
330: return resourcesRoot == null ? -1 : resourcesRoot
331: .addJdbcConnectionPool(value);
332: }
333:
334: public int removeJdbcConnectionPool(
335: org.netbeans.modules.j2ee.sun.dd.api.serverresources.JdbcConnectionPool value) {
336: return resourcesRoot == null ? -1 : resourcesRoot
337: .removeJdbcConnectionPool(value);
338: }
339:
340: public void setValue(String name, Object[] value) {
341: if (resourcesRoot != null)
342: resourcesRoot.setValue(name, value);
343: }
344:
345: public void addPropertyChangeListener(
346: java.beans.PropertyChangeListener pcl) {
347: if (resourcesRoot != null)
348: resourcesRoot.addPropertyChangeListener(pcl);
349: listeners.add(pcl);
350: }
351:
352: public void removePropertyChangeListener(
353: java.beans.PropertyChangeListener pcl) {
354: if (resourcesRoot != null)
355: resourcesRoot.removePropertyChangeListener(pcl);
356: listeners.remove(pcl);
357: }
358:
359: public void setMailResource(
360: int index,
361: org.netbeans.modules.j2ee.sun.dd.api.serverresources.MailResource value) {
362: if (resourcesRoot != null)
363: resourcesRoot.setMailResource(index, value);
364: }
365:
366: public int addMailResource(
367: org.netbeans.modules.j2ee.sun.dd.api.serverresources.MailResource value) {
368: return resourcesRoot == null ? -1 : resourcesRoot
369: .addMailResource(value);
370: }
371:
372: public int removeMailResource(
373: org.netbeans.modules.j2ee.sun.dd.api.serverresources.MailResource value) {
374: return resourcesRoot == null ? -1 : resourcesRoot
375: .removeMailResource(value);
376: }
377:
378: public void setExternalJndiResource(
379: org.netbeans.modules.j2ee.sun.dd.api.serverresources.ExternalJndiResource[] value) {
380: if (resourcesRoot != null)
381: resourcesRoot.setExternalJndiResource(value);
382: }
383:
384: public void setConnectorResource(
385: int index,
386: org.netbeans.modules.j2ee.sun.dd.api.serverresources.ConnectorResource value) {
387: if (resourcesRoot != null)
388: resourcesRoot.setConnectorResource(index, value);
389: }
390:
391: public int addCustomResource(
392: org.netbeans.modules.j2ee.sun.dd.api.serverresources.CustomResource value) {
393: return resourcesRoot == null ? -1 : resourcesRoot
394: .addCustomResource(value);
395: }
396:
397: public int removeCustomResource(
398: org.netbeans.modules.j2ee.sun.dd.api.serverresources.CustomResource value) {
399: return resourcesRoot == null ? -1 : resourcesRoot
400: .removeCustomResource(value);
401: }
402:
403: public int addJdbcResource(
404: org.netbeans.modules.j2ee.sun.dd.api.serverresources.JdbcResource value) {
405: return resourcesRoot == null ? -1 : resourcesRoot
406: .addJdbcResource(value);
407: }
408:
409: public int removeJdbcResource(
410: org.netbeans.modules.j2ee.sun.dd.api.serverresources.JdbcResource value) {
411: return resourcesRoot == null ? -1 : resourcesRoot
412: .removeJdbcResource(value);
413: }
414:
415: public int addJmsResource(
416: org.netbeans.modules.j2ee.sun.dd.api.serverresources.JmsResource value) {
417: return resourcesRoot == null ? -1 : resourcesRoot
418: .addJmsResource(value);
419: }
420:
421: public int removeJmsResource(
422: org.netbeans.modules.j2ee.sun.dd.api.serverresources.JmsResource value) {
423: return resourcesRoot == null ? -1 : resourcesRoot
424: .removeJmsResource(value);
425: }
426:
427: public void setExternalJndiResource(
428: int index,
429: org.netbeans.modules.j2ee.sun.dd.api.serverresources.ExternalJndiResource value) {
430: if (resourcesRoot != null)
431: resourcesRoot.setExternalJndiResource(index, value);
432: }
433:
434: public int addPersistenceManagerFactoryResource(
435: org.netbeans.modules.j2ee.sun.dd.api.serverresources.PersistenceManagerFactoryResource value) {
436: return resourcesRoot == null ? -1 : resourcesRoot
437: .addPersistenceManagerFactoryResource(value);
438: }
439:
440: public int removePersistenceManagerFactoryResource(
441: org.netbeans.modules.j2ee.sun.dd.api.serverresources.PersistenceManagerFactoryResource value) {
442: return resourcesRoot == null ? -1 : resourcesRoot
443: .removePersistenceManagerFactoryResource(value);
444: }
445:
446: public void setCustomResource(
447: org.netbeans.modules.j2ee.sun.dd.api.serverresources.CustomResource[] value) {
448: if (resourcesRoot != null)
449: resourcesRoot.setCustomResource(value);
450: }
451:
452: public void setJdbcConnectionPool(
453: org.netbeans.modules.j2ee.sun.dd.api.serverresources.JdbcConnectionPool[] value) {
454: if (resourcesRoot != null)
455: resourcesRoot.setJdbcConnectionPool(value);
456: }
457:
458: public int addConnectorConnectionPool(
459: org.netbeans.modules.j2ee.sun.dd.api.serverresources.ConnectorConnectionPool value) {
460: return resourcesRoot == null ? -1 : resourcesRoot
461: .addConnectorConnectionPool(value);
462: }
463:
464: public int removeConnectorConnectionPool(
465: org.netbeans.modules.j2ee.sun.dd.api.serverresources.ConnectorConnectionPool value) {
466: return resourcesRoot == null ? -1 : resourcesRoot
467: .removeConnectorConnectionPool(value);
468: }
469:
470: public void setJdbcResource(
471: org.netbeans.modules.j2ee.sun.dd.api.serverresources.JdbcResource[] value) {
472: if (resourcesRoot != null)
473: resourcesRoot.setJdbcResource(value);
474: }
475:
476: public int addResourceAdapterConfig(
477: org.netbeans.modules.j2ee.sun.dd.api.serverresources.ResourceAdapterConfig value) {
478: return resourcesRoot == null ? -1 : resourcesRoot
479: .addResourceAdapterConfig(value);
480: }
481:
482: public int removeResourceAdapterConfig(
483: org.netbeans.modules.j2ee.sun.dd.api.serverresources.ResourceAdapterConfig value) {
484: return resourcesRoot == null ? -1 : resourcesRoot
485: .removeResourceAdapterConfig(value);
486: }
487:
488: public void setResourceAdapterConfig(
489: org.netbeans.modules.j2ee.sun.dd.api.serverresources.ResourceAdapterConfig[] value) {
490: if (resourcesRoot != null)
491: resourcesRoot.setResourceAdapterConfig(value);
492: }
493:
494: public void setMailResource(
495: org.netbeans.modules.j2ee.sun.dd.api.serverresources.MailResource[] value) {
496: if (resourcesRoot != null)
497: resourcesRoot.setMailResource(value);
498: }
499:
500: public void setConnectorResource(
501: org.netbeans.modules.j2ee.sun.dd.api.serverresources.ConnectorResource[] value) {
502: if (resourcesRoot != null)
503: resourcesRoot.setConnectorResource(value);
504: }
505:
506: public void merge(
507: org.netbeans.modules.j2ee.sun.dd.api.CommonDDBean root,
508: int mode) {
509: if (root != null) {
510: if (root instanceof ResourcesProxy)
511: resourcesRoot.merge(((ResourcesProxy) root)
512: .getOriginal(), mode);
513: else
514: resourcesRoot.merge(root, mode);
515: }
516: }
517:
518: public Resources getOriginal() {
519: return resourcesRoot;
520: }
521:
522: public Object getValue(String name, int index) {
523: return resourcesRoot == null ? null : resourcesRoot
524: .getValues(name);
525: }
526:
527: public void removeValue(String name, int index) {
528: if (resourcesRoot != null)
529: resourcesRoot.removeValue(name, index);
530: }
531:
532: public int sizeResourceAdapterConfig() {
533: return resourcesRoot == null ? -1 : resourcesRoot
534: .sizeResourceAdapterConfig();
535: }
536:
537: public int sizePersistenceManagerFactoryResource() {
538: return resourcesRoot == null ? -1 : resourcesRoot
539: .sizePersistenceManagerFactoryResource();
540: }
541:
542: public int sizeMailResource() {
543: return resourcesRoot == null ? -1 : resourcesRoot
544: .sizeMailResource();
545: }
546:
547: public int sizeJmsResource() {
548: return resourcesRoot == null ? -1 : resourcesRoot
549: .sizeJmsResource();
550: }
551:
552: public int sizeJdbcResource() {
553: return resourcesRoot == null ? -1 : resourcesRoot
554: .sizeJdbcResource();
555: }
556:
557: public int sizeJdbcConnectionPool() {
558: return resourcesRoot == null ? -1 : resourcesRoot
559: .sizeJdbcConnectionPool();
560: }
561:
562: public int sizeExternalJndiResource() {
563: return resourcesRoot == null ? -1 : resourcesRoot
564: .sizeExternalJndiResource();
565: }
566:
567: public int sizeCustomResource() {
568: return resourcesRoot == null ? -1 : resourcesRoot
569: .sizeCustomResource();
570: }
571:
572: public int sizeConnectorResource() {
573: return resourcesRoot == null ? -1 : resourcesRoot
574: .sizeConnectorResource();
575: }
576:
577: public int sizeConnectorConnectionPool() {
578: return resourcesRoot == null ? -1 : resourcesRoot
579: .sizeConnectorConnectionPool();
580: }
581:
582: public int sizeAdminObjectResource() {
583: return resourcesRoot == null ? -1 : resourcesRoot
584: .sizeAdminObjectResource();
585: }
586:
587: public org.netbeans.modules.j2ee.sun.dd.api.serverresources.CustomResource newCustomResource() {
588: return resourcesRoot == null ? null : resourcesRoot
589: .newCustomResource();
590: }
591:
592: public org.netbeans.modules.j2ee.sun.dd.api.serverresources.ConnectorResource newConnectorResource() {
593: return resourcesRoot == null ? null : resourcesRoot
594: .newConnectorResource();
595: }
596:
597: public org.netbeans.modules.j2ee.sun.dd.api.serverresources.ConnectorConnectionPool newConnectorConnectionPool() {
598: return resourcesRoot == null ? null : resourcesRoot
599: .newConnectorConnectionPool();
600: }
601:
602: public org.netbeans.modules.j2ee.sun.dd.api.serverresources.AdminObjectResource newAdminObjectResource() {
603: return resourcesRoot == null ? null : resourcesRoot
604: .newAdminObjectResource();
605: }
606:
607: public org.netbeans.modules.j2ee.sun.dd.api.serverresources.ResourceAdapterConfig[] getResourceAdapterConfig() {
608: return resourcesRoot == null ? null : resourcesRoot
609: .getResourceAdapterConfig();
610: }
611:
612: public org.netbeans.modules.j2ee.sun.dd.api.serverresources.PersistenceManagerFactoryResource[] getPersistenceManagerFactoryResource() {
613: return resourcesRoot == null ? null : resourcesRoot
614: .getPersistenceManagerFactoryResource();
615: }
616:
617: public org.netbeans.modules.j2ee.sun.dd.api.serverresources.MailResource[] getMailResource() {
618: return resourcesRoot == null ? null : resourcesRoot
619: .getMailResource();
620: }
621:
622: public org.netbeans.modules.j2ee.sun.dd.api.serverresources.JmsResource[] getJmsResource() {
623: return resourcesRoot == null ? null : resourcesRoot
624: .getJmsResource();
625: }
626:
627: public org.netbeans.modules.j2ee.sun.dd.api.serverresources.JdbcResource[] getJdbcResource() {
628: return resourcesRoot == null ? null : resourcesRoot
629: .getJdbcResource();
630: }
631:
632: public org.netbeans.modules.j2ee.sun.dd.api.serverresources.JdbcConnectionPool[] getJdbcConnectionPool() {
633: return resourcesRoot == null ? null : resourcesRoot
634: .getJdbcConnectionPool();
635: }
636:
637: public org.netbeans.modules.j2ee.sun.dd.api.serverresources.ExternalJndiResource[] getExternalJndiResource() {
638: return resourcesRoot == null ? null : resourcesRoot
639: .getExternalJndiResource();
640: }
641:
642: public String dumpBeanNode() {
643: return resourcesRoot == null ? null : resourcesRoot
644: .dumpBeanNode();
645: }
646:
647: public org.netbeans.modules.j2ee.sun.dd.api.serverresources.AdminObjectResource[] getAdminObjectResource() {
648: return resourcesRoot == null ? null : resourcesRoot
649: .getAdminObjectResource();
650: }
651:
652: public String getAttributeValue(String propName, String name) {
653: return resourcesRoot == null ? null : resourcesRoot
654: .getAttributeValue(propName, name);
655: }
656:
657: public String getAttributeValue(String propName, int index,
658: String name) {
659: return resourcesRoot == null ? null : resourcesRoot
660: .getAttributeValue(propName, index, name);
661: }
662:
663: public org.netbeans.modules.j2ee.sun.dd.api.serverresources.ConnectorConnectionPool[] getConnectorConnectionPool() {
664: return resourcesRoot == null ? null : resourcesRoot
665: .getConnectorConnectionPool();
666: }
667:
668: public org.netbeans.modules.j2ee.sun.dd.api.serverresources.ConnectorResource[] getConnectorResource() {
669: return resourcesRoot == null ? null : resourcesRoot
670: .getConnectorResource();
671: }
672:
673: public org.netbeans.modules.j2ee.sun.dd.api.serverresources.CustomResource[] getCustomResource() {
674: return resourcesRoot == null ? null : resourcesRoot
675: .getCustomResource();
676: }
677:
678: public org.netbeans.modules.j2ee.sun.dd.api.serverresources.ExternalJndiResource newExternalJndiResource() {
679: return resourcesRoot == null ? null : resourcesRoot
680: .newExternalJndiResource();
681: }
682:
683: public org.netbeans.modules.j2ee.sun.dd.api.serverresources.JdbcConnectionPool newJdbcConnectionPool() {
684: return resourcesRoot == null ? null : resourcesRoot
685: .newJdbcConnectionPool();
686: }
687:
688: public org.netbeans.modules.j2ee.sun.dd.api.serverresources.JdbcResource newJdbcResource() {
689: return resourcesRoot == null ? null : resourcesRoot
690: .newJdbcResource();
691: }
692:
693: public org.netbeans.modules.j2ee.sun.dd.api.serverresources.JmsResource newJmsResource() {
694: return resourcesRoot == null ? null : resourcesRoot
695: .newJmsResource();
696: }
697:
698: public org.netbeans.modules.j2ee.sun.dd.api.serverresources.MailResource newMailResource() {
699: return resourcesRoot == null ? null : resourcesRoot
700: .newMailResource();
701: }
702:
703: public org.netbeans.modules.j2ee.sun.dd.api.serverresources.PersistenceManagerFactoryResource newPersistenceManagerFactoryResource() {
704: return resourcesRoot == null ? null : resourcesRoot
705: .newPersistenceManagerFactoryResource();
706: }
707:
708: public org.netbeans.modules.j2ee.sun.dd.api.serverresources.ResourceAdapterConfig newResourceAdapterConfig() {
709: return resourcesRoot == null ? null : resourcesRoot
710: .newResourceAdapterConfig();
711: }
712:
713: public void setAttributeValue(String name, String value) {
714: if (resourcesRoot != null)
715: resourcesRoot.setAttributeValue(name, value);
716: }
717:
718: public void setAttributeValue(String propName, String name,
719: String value) {
720: if (resourcesRoot != null)
721: resourcesRoot.setAttributeValue(propName, name, value);
722: }
723:
724: public void setAttributeValue(String propName, int index,
725: String name, String value) {
726: if (resourcesRoot != null)
727: resourcesRoot.setAttributeValue(propName, index, name,
728: value);
729: }
730:
731: public Object clone() {
732: ResourcesProxy proxy = null;
733: if (resourcesRoot == null)
734: proxy = new ResourcesProxy(null);
735: else {
736: Resources clonedResources = (Resources) resourcesRoot
737: .clone();
738: proxy = new ResourcesProxy(clonedResources);
739: }
740: return proxy;
741: }
742:
743: /** Resources have no version (at present) so we could throw UnsupportedOperationException
744: * but it's probably just better to clone it since that is what this method does anyway.
745: */
746: public CommonDDBean cloneVersion(String version) {
747: return (CommonDDBean) clone();
748: }
749:
750: public void write(java.io.OutputStream os)
751: throws java.io.IOException {
752: if (resourcesRoot != null) {
753: resourcesRoot.write(os);
754: }
755: }
756:
757: public void write(java.io.Writer w) throws java.io.IOException,
758: org.netbeans.modules.j2ee.sun.dd.api.DDException {
759: if (resourcesRoot != null)
760: resourcesRoot.write(w);
761: }
762:
763: public void write(java.io.File f)
764: throws java.io.IOException,
765: org.netbeans.modules.schema2beans.Schema2BeansRuntimeException {
766: if (resourcesRoot != null)
767: resourcesRoot.write(f);
768: }
769:
770: public void write(FileObject fo) throws IOException {
771: if (resourcesRoot != null) {
772: DataObject dataObject = DataObject.find(fo);
773: if (dataObject instanceof DDProviderDataObject) {
774: ((DDProviderDataObject) dataObject)
775: .writeModel(resourcesRoot);
776: } else {
777: FileLock lock = fo.lock();
778: try {
779: OutputStream os = fo.getOutputStream(lock);
780: try {
781: write(os);
782: } finally {
783: os.close();
784: }
785: } finally {
786: lock.releaseLock();
787: }
788: }
789: }
790: }
791:
792: public void setVersion(BigDecimal version) {
793: throw new UnsupportedOperationException("Not supported yet.");
794: }
795:
796: public BigDecimal getVersion() {
797: return new java.math.BigDecimal(version);
798: }
799:
800: public RootInterface getRootInterface() {
801: return this ;
802: }
803:
804: public SAXParseException getError() {
805: return error;
806: }
807:
808: public void setError(SAXParseException error) {
809: this .error = error;
810: }
811:
812: public boolean hasOriginal() {
813: return getOriginal() != null;
814: }
815:
816: public ASDDVersion getASDDVersion() {
817: throw new UnsupportedOperationException("Not supported yet.");
818: }
819:
820: public int getStatus() {
821: return ddStatus;
822: }
823:
824: public void setStatus(int value) {
825: if (ddStatus != value) {
826: java.beans.PropertyChangeEvent evt = new java.beans.PropertyChangeEvent(
827: this , PROPERTY_STATUS, Integer.valueOf(ddStatus),
828: Integer.valueOf(value));
829: ddStatus = value;
830: for (int i = 0; i < listeners.size(); i++) {
831: listeners.get(i).propertyChange(evt);
832: }
833: }
834: }
835:
836: public boolean isTrivial(String nameProperty) {
837: // Root nodes are non-trivial by definition.
838: return false;
839: }
840:
841: public boolean isEventSource(RootInterface rootDD) {
842: return resourcesRoot != null && resourcesRoot == rootDD;
843: }
844:
845: public GraphManager graphManager() {
846: return resourcesRoot instanceof BaseBean ? ((BaseBean) resourcesRoot)
847: .graphManager()
848: : null;
849: }
850:
851: }
|