KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > api > web > dd > common > CommonDDBean


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 package org.netbeans.api.web.dd.common;
21 /**
22  * Parent of all DD API interfaces.
23  *
24  *<p><b><font color="red"><em>Important note: Do not provide an implementation of this interface unless you are a DD API provider!</em></font></b>
25  *</p>
26  *
27  * @deprecated Use the API for web module deployment descriptor in j2ee/ddapi module.
28  * @author Milan Kuchtiak
29  */

30 public interface CommonDDBean {
31     /**
32      * Adds property change listener to particular CommonDDBean object (WebApp object).
33      * @param pcl property change listener
34      */

35     public void addPropertyChangeListener(java.beans.PropertyChangeListener JavaDoc pcl);
36     /**
37      * Removes property change listener from CommonDDBean object.
38      * @param pcl property change listener
39      */

40     public void removePropertyChangeListener(java.beans.PropertyChangeListener JavaDoc pcl);
41     /**
42      * Sets the id attribute for related dd element. E.g.<pre>
43 &lt;servlet id="xyz"&gt;
44   ...
45 &lt;/servlet&gt;
46      *</pre>
47      *
48      * @param value the value for id attribute
49      */

50     public void setId(java.lang.String JavaDoc value);
51     /**
52      * Returns the id attribute for related dd element.<br>In most cases the id attribute is not specified.
53      * @return value of id attribute or null if not specified
54      */

55     public java.lang.String JavaDoc getId();
56     /**
57      * Returns the clonned CommonDDBean object.
58      * @return the clonned (not bound to bean graph) CommonDDBean object
59      */

60     public Object JavaDoc clone();
61     /**
62      * Returns the CommonDDBean object or array of CommonDDBean object for given property.<br>
63      * E.g. for retrieving the servlet-class value on Servlet object he <b>getValue("ServletClass");</b> can be used.
64      * @param propertyName name of the property the value is looking for
65      * @return the bean/array of beans related to given property
66      */

67     public Object JavaDoc getValue(String JavaDoc propertyName);
68     /**
69      * Writes the whole DD or its fraction (element related to CommonDDBean) to output stream.<br>
70      * For DD root object there is more convenient to use the {@link org.netbeans.api.web.dd.common.RootInterface#write} method.<br>
71      * The correct usage with file objects is :<pre>
72 WebApp webApp;
73 FileObject fo;
74 ...
75 // code that initializes and modifies the webApp object
76 ...
77 FileLock lock;
78 try {
79     lock=fo.lock();
80 } catch (FileAlreadyLockedException e) {
81     // handling the exception
82 }
83 if (lock!=null) {
84     try {
85         OutputStream os=fo.getOutputStream(lock);
86         try {
87             webApp.write(os);
88         } finally {
89             os.close();
90         }
91     } finally {
92         lock.releaseLock();
93     }
94 }
95 ...
96      *</pre>
97      * @param os output stream for writing
98      */

99     public void write(java.io.OutputStream JavaDoc os) throws java.io.IOException JavaDoc;
100
101 }
102
Popular Tags