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 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228
|
<!--
- DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
-
- Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
-
- The contents of this file are subject to the terms of either the GNU
- General Public License Version 2 only ("GPL") or the Common
- Development and Distribution License("CDDL") (collectively, the
- "License"). You may not use this file except in compliance with the
- License. You can obtain a copy of the License at
- http://www.netbeans.org/cddl-gplv2.html
- or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
- specific language governing permissions and limitations under the
- License. When distributing the software, include this License Header
- Notice in each file and include the License file at
- nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
- particular file as subject to the "Classpath" exception as provided
- by Sun in the GPL Version 2 section of the License file that
- accompanied this code. If applicable, add the following below the
- License Header, with the fields enclosed by brackets [] replaced by
- your own identifying information:
- "Portions Copyrighted [year] [name of copyright owner]"
-
- Contributor(s):
-
- The Original Software is NetBeans. The Initial Developer of the Original
- Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
- Microsystems, Inc. All Rights Reserved.
-
- If you wish your version of this file to be governed by only the CDDL
- or only the GPL Version 2, indicate your decision by adding
- "[Contributor] elects to include this software in this distribution
- under the [CDDL or GPL Version 2] license." If you do not indicate a
- single choice of license, a recipient has the option to distribute
- your version of this file under either the CDDL, the GPL Version 2 or
- to extend the choice of license to its licensees as provided above.
- However, if you add GPL Version 2 code and therefore, elected the GPL
- Version 2 license, then the option applies only if the new code is
- made subject to such option by the copyright holder.
-->
<HTML>
<BODY>
<h2>Deployment Descriptor API Overview.</h2>
<p>
<b><i>Deprecated, use <a href="@org-netbeans-modules-j2ee-dd@/index.html">J2EE Deployment Descriptor API</a>.</i></b>
</p>
<p>
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.<br>
</p>
<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="arch/ddapi_architecture.html">Architecture Document for DD API</a></li>
<li><a href="architecture-summary.html">Architecture Summary</a></li>
<li><a href="apichanges.html">API Changes</a></li>
</ul>
</p>
<!-- Contributors & Reviewers:
Petr Jiricka
Pavel Buzek
Jaroslav Tulach
Tomas Pavek
-->
</BODY></HTML>
|