KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > j2ee > dd > api > common > CreateCapability


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.modules.j2ee.dd.api.common;
21 /**
22  * Ability to create a new CommonDDBean objects.
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  * @author Milan Kuchtiak
28  */

29 public interface CreateCapability {
30     /**
31      * An empty (not bound to bean graph) CommonDDBean object is created corresponding to beanName,
32      * regardless the servlet spec. version
33      * @param beanName bean name e.g. "Servlet"
34      * @return CommonDDBean object corresponding to beanName value
35      */

36     public CommonDDBean createBean(String JavaDoc beanName) throws ClassNotFoundException JavaDoc ;
37     /**
38      * An empty bean is created corresponding to beanName regardless the srvlet spec. version.
39      * The bean is nested under the actual bean.<br>
40      * There is an array of properties that will be initialized.
41      * The method is useful for DD elements containing
42      * single properties like Servlet, Taglib, ResourceRef etc.<br>
43      * Usage<pre>
44 ...
45 Servlet servlet = (Servlet)webApp.addBean("Servlet",new String[]{"ServletName","ServletClass"},
46                                           new Object[]{"TestServlet","mypackage.TestServlet"},"ServletName");
47 servlet.addBean("InitParam",new String[]{"ParamName","ParamValue"},
48                 new Object[]{"car","Volvo"},"ParamName");
49 ...
50      *</pre>
51      * @param beanName bean name
52      * @param propertyNames array of properties that should be initialized
53      * @param propertyValues array of initialization values, usually strings
54      * @param keyProperty the property name that is checked in order to evoid the duplicity, e.g. ServletName.<br>
55      * <b>keyProperty should be included to propertyNames array.</b>
56      * @return CommonDDBean object that has been nested inside the current element (CommonDDBean object).
57      * @exception ClassNotFoundException thrown when the class for beanName cannot be found under the current DD element
58      * @exception NameAlreadyUsedException thrown when object with keyProperty value already exists.
59      */

60     public CommonDDBean addBean (String JavaDoc beanName, String JavaDoc[] propertyNames, Object JavaDoc [] propertyValues, String JavaDoc keyProperty)
61         throws ClassNotFoundException JavaDoc, NameAlreadyUsedException;
62     /**
63      * An empty bean is created corresponding to beanName, regardless the servlet spec. version.
64      * The bean is included under the actual bean. The method is useful for elements containing only
65      * non-single properties like WelcomeFileList, JspConfig etc.
66      *<pre>
67 ...
68 JspConfig config = webApp.addBean("JspConfig");
69 jspConfig.addBean("JspPropertyGroup",new String[]{"UrlPattern","IncludePrelude","IncludeCoda"},
70                   new String[]{"*.jsp","/jsp/prelude.html","/jsp/coda.html"},null);
71 ...
72      *</pre>
73      * @param beanName bean name e.g. "JspConfig"
74      * @return CommonDDBean object corresponding to beanName value
75      * @exception ClassNotFoundException thrown when the class for beanName cannot be found under the current DD element
76      */

77     public CommonDDBean addBean (String JavaDoc beanName) throws ClassNotFoundException JavaDoc;
78 }
79
Popular Tags