1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200
|
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<HTML>
<BODY>
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.
<h3>1. The Overall Architecture</h3>
<p>
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.
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.
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).
The root of the deployment descriptor is accessible through the <b>{@link org.netbeans.api.web.dd.DDProvider}</b> class.
</p>
<h3>2. What it is not.</h3>
<p>
The DD API provides no UI for deployment descriptor editing.
</p>
<h3>3. The Hierarchic structure of DD API Interfaces</h3>
Package: <b>{@link org.netbeans.api.web.dd}</b>
<p>
All DD API interfaces are included to this package. <br>
Here is the hierarchic structure of the DD API interfaces :
<pre>
<b>{@link org.netbeans.api.web.dd.WebApp}</b>
- <b>{@link org.netbeans.api.web.dd.Icon}</b><font color = "800040"> [*]</font>
- <b>{@link org.netbeans.api.web.dd.InitParam}</b><font color = "800040"> [*]</font>
- <b>{@link org.netbeans.api.web.dd.Filter}</b><font color = "800040"> [*]</font>
- <b>{@link org.netbeans.api.web.dd.Icon}</b><font color = "800040"> [*]</font>
- <b>{@link org.netbeans.api.web.dd.InitParam}</b><font color = "800040"> [*]</font>
- <b>{@link org.netbeans.api.web.dd.FilterMapping}</b><font color = "800040"> [*]</font>
- <b>{@link org.netbeans.api.web.dd.Listener}</b><font color = "800040"> [*]</font>
- <b>{@link org.netbeans.api.web.dd.Icon}</b><font color = "800040"> [*]</font>
- <b>{@link org.netbeans.api.web.dd.Servlet}</b><font color = "800040"> [*]</font>
- <b>{@link org.netbeans.api.web.dd.Icon}</b><font color = "800040"> [*]</font>
- <b>{@link org.netbeans.api.web.dd.InitParam}</b><font color = "800040"> [*]</font>
- <b>{@link org.netbeans.api.web.dd.RunAs}</b><font color = "800040"> [*]</font>
- <b>{@link org.netbeans.api.web.dd.SecurityRoleRef}</b><font color = "800040"> [*]</font>
- <b>{@link org.netbeans.api.web.dd.ServletMapping}</b><font color = "800040"> [*]</font>
- <b>{@link org.netbeans.api.web.dd.SessionConfig}</b><font color = "800040"> [?]</font>
- <b>{@link org.netbeans.api.web.dd.MimeMapping}</b><font color = "800040"> [*]</font>
- <b>{@link org.netbeans.api.web.dd.WelcomeFileList}</b><font color = "800040"> [?]</font>
- <b>{@link org.netbeans.api.web.dd.ErrorPage}</b><font color = "800040"> [*]</font>
- <b>{@link org.netbeans.api.web.dd.Taglib}</b><font color = "800040"> [*]</font>
- <b>{@link org.netbeans.api.web.dd.JspConfig}</b><font color = "800040"> [?]</font>
- <b>{@link org.netbeans.api.web.dd.Taglib}</b><font color = "800040"> [*]</font>
- <b>{@link org.netbeans.api.web.dd.JspPropertyGroup}</b><font color = "800040"> [*]</font>
- <b>{@link org.netbeans.api.web.dd.SecurityConstraint}</b><font color = "800040"> [*]</font>
- <b>{@link org.netbeans.api.web.dd.WebResourceCollection}</b><font color = "800040"> [+]</font>
- <b>{@link org.netbeans.api.web.dd.AuthConstraint}</b><font color = "800040"> [?]</font>
- <b>{@link org.netbeans.api.web.dd.UserDataConstraint}</b><font color = "800040"> [?]</font>
- <b>{@link org.netbeans.api.web.dd.LoginConfig}</b><font color = "800040"> [?]</font>
- <b>{@link org.netbeans.api.web.dd.FormLoginConfig}</b><font color = "800040"> [?]</font>
- <b>{@link org.netbeans.api.web.dd.SecurityRole}</b><font color = "800040"> [*]</font>
- <b>{@link org.netbeans.api.web.dd.EnvEntry}</b><font color = "800040"> [*]</font>
- <b>{@link org.netbeans.api.web.dd.EjbRef}</b><font color = "800040"> [*]</font>
- <b>{@link org.netbeans.api.web.dd.EjbLocalRef}</b><font color = "800040"> [*]</font>
- <b>{@link org.netbeans.api.web.dd.ServiceRef}</b><font color = "800040"> [*]</font>
- <b>{@link org.netbeans.api.web.dd.Icon}</b><font color = "800040"> [*]</font>
- <b>{@link org.netbeans.api.web.dd.PortComponentRef}</b><font color = "800040"> [*]</font>
- <b>{@link org.netbeans.api.web.dd.ServiceRefHandler}</b><font color = "800040"> [*]</font>
- <b>{@link org.netbeans.api.web.dd.InitParam}</b><font color = "800040"> [*]</font>
- <b>{@link org.netbeans.api.web.dd.ResourceRef}</b><font color = "800040"> [*]</font>
- <b>{@link org.netbeans.api.web.dd.ResourceEnvRef}</b><font color = "800040"> [*]</font>
- <b>{@link org.netbeans.api.web.dd.MessageDestinationRef}</b><font color = "800040"> [*]</font>
- <b>{@link org.netbeans.api.web.dd.MessageDestination}</b><font color = "800040"> [*]</font>
- <b>{@link org.netbeans.api.web.dd.Icon}</b><font color = "800040"> [*]</font>
- <b>{@link org.netbeans.api.web.dd.LocaleEncodingMappingList}</b><font color = "800040"> [?]</font>
- <b>{@link org.netbeans.api.web.dd.LocaleEncodingMapping}</b><font color = "800040"> [+]</font>
<i><b>Comments : </b></i>
<font color = "800040">[*]</font> - objects occur multiple times in parent object (0-n)
<font color = "800040">[+]</font> - objects occur multiple times in parent object (1-n)
<font color = "800040">[?]</font> - object can occur only once in parent object (0-1)
</pre>
</p>
<h3>4. The structure of method names.</h3>
<p>
The syntax and usage of interfaces methods is very simple and straightforward.<br>
If certain object [of XYZ interface] occurs multiple times in parent object these methods are present in parent interface :
<ul>
<li> <b>XYZ [] getXYZ</b> (); - returns an array of XYZ objects</li>
<li> <b>XYZ getXYZ</b> (int i); -returns an XYZ object at the certain position (i) within the array</li>
<li> <b>void setXYZ</b> (XYZ[] array); - sets the array of XYZ objects</li>
<li> <b>void setXYZ</b> (int i, XYZ object); - sets the XYZ object at certain position (i)</li>
<li> <b>int addXYZ</b> (XYZ object); - adds the XYZ object to the parent object</li>
<li> <b>int removeXYZ</b> (XYZ object); - removes the XYZ object from the parent object</li>
<li> <b>int sizeXYZ</b> (); - returns the size of XYZ array</li>
</ul><br>
If certain object [of XYZ interface] can occur only once in parent object these methods are present in parent interface :
<ul>
<li> <b>XYZ getSingleXYZ</b> (); - returns an XYZ object or null</li>
<li> <b>void setXYZ</b> (XYZ object); - sets the XYZ object to the parent object</li>
</ul><br>
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} :
<ul>
<li> {@link org.netbeans.api.web.dd.Servlet} [] <b>getServlet</b> ();</li>
<li> {@link org.netbeans.api.web.dd.Servlet} <b>getServlet</b> (int i);</li>
<li> void <b>setServlet</b> ({@link org.netbeans.api.web.dd.Servlet}[] servlets);</li>
<li> void <b>setServlet</b> (int i, {@link org.netbeans.api.web.dd.Servlet} servlet);</li>
<li> int <b>addServlet</b> ({@link org.netbeans.api.web.dd.Servlet}servlet);</li>
<li> int <b>removeServlet</b> ({@link org.netbeans.api.web.dd.Servlet} servlet);</li>
<li> int <b>sizeServlet</b> ();</li>
<li> {@link org.netbeans.api.web.dd.WelcomeFileList} <b>getSingleWelcomeFileList</b> ();</li>
<li> void <b>setWelcomeFileList</b> ({@link org.netbeans.api.web.dd.WelcomeFileList} list);</li>
</ul><br>
Interfaces contain additional methods corresponding to the simple(String) properties following the deployment descriptor xml syntax.<br>
Example : The {@link org.netbeans.api.web.dd.Taglib} interface contains these additional getters/setters :
<ul>
<li> String <b>getTaglibUri</b> ();</li>
<li> String <b>getTaglibLocation</b> ();</li>
<li> void <b>setTaglibUri</b> (String uri);</li>
<li> void <b>setTaglibLocation</b> (String location);</li>
</ul><br>
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>
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.
</p>
<h3>5. DDProvider class - getting the root interface from web.xml file.</h3>
Package: <b>{@link org.netbeans.api.web.dd}</b>
<p>
Provides the access to the deployment descriptor root - {@link org.netbeans.api.web.dd.WebApp} - object.
The {@link org.netbeans.api.web.dd.DDProvider} class is a singleton and caches the WebApp objects in IDE.<br>
There are following methods for accessing {@link org.netbeans.api.web.dd.WebApp} object in DDProvider : <br>
<ul>
<li>{@link org.netbeans.api.web.dd.DDProvider#getDDRoot(org.openide.filesystems.FileObject)};</li>
<li>{@link org.netbeans.api.web.dd.DDProvider#getDDRoot(java.io.File)};</li>
</ul>
</p>
<h3>6. Deployment descriptor modification.</h3>
<p>
DD API enables the full modification of deployment descriptor elements including:
<ul>
<li>adding new elements</li>
<li>removing elements</li>
<li>changing the value of elements</li>
</ul>
</p>
<p>
See the <b><a href="arch/usage.html">Examples of usage</a></b>.
</p>
<h3>7. Writing changes.</h3>
<p>
The modificated {@link org.netbeans.api.web.dd.WebApp} object can be serialized to FileObject using :
<ul>
<li>void write({@link org.openide.filesystems.FileObject} fo) throws {@link java.io.IOException};</li>
</ul>
</p>
<p>
There is also another <b>write</b> mathod available on any interface to serialize the fraction of deployment descriptor to OutputStream :
<ul>
<li>void write({@link java.io.OutputStream} os) throws {@link java.io.IOException};</li>
</ul>
</p>
<p>
See the <b><a href="arch/usage.html">Examples of usage</a></b>.
</p>
<hr>
<p>
See also :
<ul>
<li><a href="architecture-summary.html">Architecture Summary</a></li>
<li><a href="apichanges.html">API Changes</a></li>
<li><a href="arch/ddapi_architecture.html">Original Architecture Document for the Web part of DD API</a></li>
</ul>
</p>
<!-- Contributors & Reviewers:
Petr Jiricka
Pavel Buzek
Jaroslav Tulach
Tomas Pavek
-->
</BODY></HTML>
|