2
- DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
4
- Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
6
- The contents of this file are subject to the terms of either the GNU
7
- General Public License Version 2 only ("GPL") or the Common
8
- Development and Distribution License("CDDL") (collectively, the
9
- "License"). You may not use this file except in compliance with the
10
- License. You can obtain a copy of the License at
11
- http://www.netbeans.org/cddl-gplv2.html
12
- or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
13
- specific language governing permissions and limitations under the
14
- License. When distributing the software, include this License Header
15
- Notice in each file and include the License file at
16
- nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
17
- particular file as subject to the "Classpath" exception as provided
18
- by Sun in the GPL Version 2 section of the License file that
19
- accompanied this code. If applicable, add the following below the
20
- License Header, with the fields enclosed by brackets [] replaced by
21
- your own identifying information:
22
- "Portions Copyrighted [year] [name of copyright owner]"
26
- The Original Software is NetBeans. The Initial Developer of the Original
27
- Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
28
- Microsystems, Inc. All Rights Reserved.
30
- If you wish your version of this file to be governed by only the CDDL
31
- or only the GPL Version 2, indicate your decision by adding
32
- "[Contributor] elects to include this software in this distribution
33
- under the [CDDL or GPL Version 2] license." If you do not indicate a
34
- single choice of license, a recipient has the option to distribute
35
- your version of this file under either the CDDL, the GPL Version 2 or
36
- to extend the choice of license to its licensees as provided above.
37
- However, if you add GPL Version 2 code and therefore, elected the GPL
38
- Version 2 license, then the option applies only if the new code is
39
- made subject to such option by the copyright holder.
44
The DD API has been developed in order to satisfy the requirement to access the web module deployment descriptor for other Netbeans modules in a simple and servlet spec.-independant way.
46
<h3>1. The Overall Architecture</h3>
48
The DD API is based on a bunch of interfaces based on the deployment descriptor xml structure. The names of interfaces correspond to the names of deployment descriptor elements in <b>web.xml</b> file.
49
The DD API interfaces are organized in a hierarchic tree structure where they are accassible through the root - <b>{@link org.netbeans.api.web.dd.WebApp}</b> - interface.
50
The implementation of DD API interfaces is hidden for clients. It is based on schema2beans infrastructure and is the DD version - specific. (there is always requirement to support at least two successive versions of DD specification).
51
The root of the deployment descriptor is accessible through the <b>{@link org.netbeans.api.web.dd.DDProvider}</b> class.
54
<h3>2. What it is not.</h3>
56
The DD API provides no UI for deployment descriptor editing.
59
<h3>3. The Hierarchic structure of DD API Interfaces</h3>
60
Package: <b>{@link org.netbeans.api.web.dd}</b>
62
All DD API interfaces are included to this package. <br>
63
Here is the hierarchic structure of the DD API interfaces :
65
<b>{@link org.netbeans.api.web.dd.WebApp}</b>
66
- <b>{@link org.netbeans.api.web.dd.Icon}</b><font color = "800040"> [*]</font>
67
- <b>{@link org.netbeans.api.web.dd.InitParam}</b><font color = "800040"> [*]</font>
68
- <b>{@link org.netbeans.api.web.dd.Filter}</b><font color = "800040"> [*]</font>
69
- <b>{@link org.netbeans.api.web.dd.Icon}</b><font color = "800040"> [*]</font>
70
- <b>{@link org.netbeans.api.web.dd.InitParam}</b><font color = "800040"> [*]</font>
71
- <b>{@link org.netbeans.api.web.dd.FilterMapping}</b><font color = "800040"> [*]</font>
72
- <b>{@link org.netbeans.api.web.dd.Listener}</b><font color = "800040"> [*]</font>
73
- <b>{@link org.netbeans.api.web.dd.Icon}</b><font color = "800040"> [*]</font>
74
- <b>{@link org.netbeans.api.web.dd.Servlet}</b><font color = "800040"> [*]</font>
75
- <b>{@link org.netbeans.api.web.dd.Icon}</b><font color = "800040"> [*]</font>
76
- <b>{@link org.netbeans.api.web.dd.InitParam}</b><font color = "800040"> [*]</font>
77
- <b>{@link org.netbeans.api.web.dd.RunAs}</b><font color = "800040"> [*]</font>
78
- <b>{@link org.netbeans.api.web.dd.SecurityRoleRef}</b><font color = "800040"> [*]</font>
79
- <b>{@link org.netbeans.api.web.dd.ServletMapping}</b><font color = "800040"> [*]</font>
80
- <b>{@link org.netbeans.api.web.dd.SessionConfig}</b><font color = "800040"> [?]</font>
81
- <b>{@link org.netbeans.api.web.dd.MimeMapping}</b><font color = "800040"> [*]</font>
82
- <b>{@link org.netbeans.api.web.dd.WelcomeFileList}</b><font color = "800040"> [?]</font>
83
- <b>{@link org.netbeans.api.web.dd.ErrorPage}</b><font color = "800040"> [*]</font>
84
- <b>{@link org.netbeans.api.web.dd.Taglib}</b><font color = "800040"> [*]</font>
85
- <b>{@link org.netbeans.api.web.dd.JspConfig}</b><font color = "800040"> [?]</font>
86
- <b>{@link org.netbeans.api.web.dd.Taglib}</b><font color = "800040"> [*]</font>
87
- <b>{@link org.netbeans.api.web.dd.JspPropertyGroup}</b><font color = "800040"> [*]</font>
88
- <b>{@link org.netbeans.api.web.dd.SecurityConstraint}</b><font color = "800040"> [*]</font>
89
- <b>{@link org.netbeans.api.web.dd.WebResourceCollection}</b><font color = "800040"> [+]</font>
90
- <b>{@link org.netbeans.api.web.dd.AuthConstraint}</b><font color = "800040"> [?]</font>
91
- <b>{@link org.netbeans.api.web.dd.UserDataConstraint}</b><font color = "800040"> [?]</font>
92
- <b>{@link org.netbeans.api.web.dd.LoginConfig}</b><font color = "800040"> [?]</font>
93
- <b>{@link org.netbeans.api.web.dd.FormLoginConfig}</b><font color = "800040"> [?]</font>
94
- <b>{@link org.netbeans.api.web.dd.SecurityRole}</b><font color = "800040"> [*]</font>
95
- <b>{@link org.netbeans.api.web.dd.EnvEntry}</b><font color = "800040"> [*]</font>
96
- <b>{@link org.netbeans.api.web.dd.EjbRef}</b><font color = "800040"> [*]</font>
97
- <b>{@link org.netbeans.api.web.dd.EjbLocalRef}</b><font color = "800040"> [*]</font>
98
- <b>{@link org.netbeans.api.web.dd.ServiceRef}</b><font color = "800040"> [*]</font>
99
- <b>{@link org.netbeans.api.web.dd.Icon}</b><font color = "800040"> [*]</font>
100
- <b>{@link org.netbeans.api.web.dd.PortComponentRef}</b><font color = "800040"> [*]</font>
101
- <b>{@link org.netbeans.api.web.dd.ServiceRefHandler}</b><font color = "800040"> [*]</font>
102
- <b>{@link org.netbeans.api.web.dd.InitParam}</b><font color = "800040"> [*]</font>
103
- <b>{@link org.netbeans.api.web.dd.ResourceRef}</b><font color = "800040"> [*]</font>
104
- <b>{@link org.netbeans.api.web.dd.ResourceEnvRef}</b><font color = "800040"> [*]</font>
105
- <b>{@link org.netbeans.api.web.dd.MessageDestinationRef}</b><font color = "800040"> [*]</font>
106
- <b>{@link org.netbeans.api.web.dd.MessageDestination}</b><font color = "800040"> [*]</font>
107
- <b>{@link org.netbeans.api.web.dd.Icon}</b><font color = "800040"> [*]</font>
108
- <b>{@link org.netbeans.api.web.dd.LocaleEncodingMappingList}</b><font color = "800040"> [?]</font>
109
- <b>{@link org.netbeans.api.web.dd.LocaleEncodingMapping}</b><font color = "800040"> [+]</font>
111
<i><b>Comments : </b></i>
112
<font color = "800040">[*]</font> - objects occur multiple times in parent object (0-n)
113
<font color = "800040">[+]</font> - objects occur multiple times in parent object (1-n)
114
<font color = "800040">[?]</font> - object can occur only once in parent object (0-1)
118
<h3>4. The structure of method names.</h3>
120
The syntax and usage of interfaces methods is very simple and straightforward.<br>
121
If certain object [of XYZ interface] occurs multiple times in parent object these methods are present in parent interface :
123
<li> <b>XYZ [] getXYZ</b> (); - returns an array of XYZ objects</li>
124
<li> <b>XYZ getXYZ</b> (int i); -returns an XYZ object at the certain position (i) within the array</li>
125
<li> <b>void setXYZ</b> (XYZ[] array); - sets the array of XYZ objects</li>
126
<li> <b>void setXYZ</b> (int i, XYZ object); - sets the XYZ object at certain position (i)</li>
127
<li> <b>int addXYZ</b> (XYZ object); - adds the XYZ object to the parent object</li>
128
<li> <b>int removeXYZ</b> (XYZ object); - removes the XYZ object from the parent object</li>
129
<li> <b>int sizeXYZ</b> (); - returns the size of XYZ array</li>
131
If certain object [of XYZ interface] can occur only once in parent object these methods are present in parent interface :
133
<li> <b>XYZ getSingleXYZ</b> (); - returns an XYZ object or null</li>
134
<li> <b>void setXYZ</b> (XYZ object); - sets the XYZ object to the parent object</li>
136
Example : The {@link org.netbeans.api.web.dd.WebApp} interface contains these methods for getting/setting {@link org.netbeans.api.web.dd.Servlet}s and {@link org.netbeans.api.web.dd.WelcomeFileList} :
138
<li> {@link org.netbeans.api.web.dd.Servlet} [] <b>getServlet</b> ();</li>
139
<li> {@link org.netbeans.api.web.dd.Servlet} <b>getServlet</b> (int i);</li>
140
<li> void <b>setServlet</b> ({@link org.netbeans.api.web.dd.Servlet}[] servlets);</li>
141
<li> void <b>setServlet</b> (int i, {@link org.netbeans.api.web.dd.Servlet} servlet);</li>
142
<li> int <b>addServlet</b> ({@link org.netbeans.api.web.dd.Servlet}servlet);</li>
143
<li> int <b>removeServlet</b> ({@link org.netbeans.api.web.dd.Servlet} servlet);</li>
144
<li> int <b>sizeServlet</b> ();</li>
145
<li> {@link org.netbeans.api.web.dd.WelcomeFileList} <b>getSingleWelcomeFileList</b> ();</li>
146
<li> void <b>setWelcomeFileList</b> ({@link org.netbeans.api.web.dd.WelcomeFileList} list);</li>
149
Interfaces contain additional methods corresponding to the simple(String) properties following the deployment descriptor xml syntax.<br>
150
Example : The {@link org.netbeans.api.web.dd.Taglib} interface contains these additional getters/setters :
152
<li> String <b>getTaglibUri</b> ();</li>
153
<li> String <b>getTaglibLocation</b> ();</li>
154
<li> void <b>setTaglibUri</b> (String uri);</li>
155
<li> void <b>setTaglibLocation</b> (String location);</li>
157
Interfaces usually extends some interfaces from the <b>{@link org.netbeans.api.web.dd.common}</b> package. For example if a DD element has the description property, it extends the {@link org.netbeans.api.web.dd.common.DescriptionInterface} containing the methods for description property handling.<br>
158
Example : The {@link org.netbeans.api.web.dd.WebApp}, {@link org.netbeans.api.web.dd.Servlet}, {@link org.netbeans.api.web.dd.Filter}, {@link org.netbeans.api.web.dd.Listener}, {@link org.netbeans.api.web.dd.ServiceRef}, {@link org.netbeans.api.web.dd.WebResourceCollection} interfaces have the additional functionality for description proprty.
161
<h3>5. DDProvider class - getting the root interface from web.xml file.</h3>
162
Package: <b>{@link org.netbeans.api.web.dd}</b>
164
Provides the access to the deployment descriptor root - {@link org.netbeans.api.web.dd.WebApp} - object.
165
The {@link org.netbeans.api.web.dd.DDProvider} class is a singleton and caches the WebApp objects in IDE.<br>
166
There are following methods for accessing {@link org.netbeans.api.web.dd.WebApp} object in DDProvider : <br>
168
<li>{@link org.netbeans.api.web.dd.DDProvider#getDDRoot(org.openide.filesystems.FileObject)};</li>
169
<li>{@link org.netbeans.api.web.dd.DDProvider#getDDRoot(java.io.File)};</li>
173
<h3>6. Deployment descriptor modification.</h3>
175
DD API enables the full modification of deployment descriptor elements including:
177
<li>adding new elements</li>
178
<li>removing elements</li>
179
<li>changing the value of elements</li>
183
See the <b><a href="arch/usage.html">Examples of usage</a></b>.
186
<h3>7. Writing changes.</h3>
188
The modificated {@link org.netbeans.api.web.dd.WebApp} object can be serialized to FileObject using :
190
<li>void write({@link org.openide.filesystems.FileObject} fo) throws {@link java.io.IOException};</li>
194
There is also another <b>write</b> mathod available on any interface to serialize the fraction of deployment descriptor to OutputStream :
196
<li>void write({@link java.io.OutputStream} os) throws {@link java.io.IOException};</li>
200
See the <b><a href="arch/usage.html">Examples of usage</a></b>.
207
<li><a href="architecture-summary.html">Architecture Summary</a></li>
208
<li><a href="apichanges.html">API Changes</a></li>
209
<li><a href="arch/ddapi_architecture.html">Original Architecture Document for the Web part of DD API</a></li>
212
<!-- Contributors & Reviewers: