org.netbeans.modules.j2ee.dd/1 1.13.0 2

org.netbeans.modules.j2ee.dd.api.common
Interface CreateCapability

All Known Subinterfaces:
AppClient, Application, ComponentInterface, Ejb, EjbJar, Entity, EntityAndSession, Filter, JspConfig, JspPropertyGroup, LocaleEncodingMappingList, LoginConfig, MessageDriven, RootInterface, SecurityConstraint, ServiceRef, ServiceRefHandler, Servlet, Session, WebApp

public interface CreateCapability

Ability to create a new CommonDDBean objects.

Important note: Do not provide an implementation of this interface unless you are a DD API provider!


Method Summary
 CommonDDBean addBean(String beanName)
          An empty bean is created corresponding to beanName, regardless the servlet spec.
 CommonDDBean addBean(String beanName, String[] propertyNames, Object[] propertyValues, String keyProperty)
          An empty bean is created corresponding to beanName regardless the srvlet spec.
 CommonDDBean createBean(String beanName)
          An empty (not bound to bean graph) CommonDDBean object is created corresponding to beanName, regardless the servlet spec.
 

Method Detail

createBean

CommonDDBean createBean(String beanName)
                        throws ClassNotFoundException
An empty (not bound to bean graph) CommonDDBean object is created corresponding to beanName, regardless the servlet spec. version

Parameters:
beanName - bean name e.g. "Servlet"
Returns:
CommonDDBean object corresponding to beanName value
Throws:
ClassNotFoundException

addBean

CommonDDBean addBean(String beanName,
                     String[] propertyNames,
                     Object[] propertyValues,
                     String keyProperty)
                     throws ClassNotFoundException,
                            NameAlreadyUsedException
An empty bean is created corresponding to beanName regardless the srvlet spec. version. The bean is nested under the actual bean.
There is an array of properties that will be initialized. The method is useful for DD elements containing single properties like Servlet, Taglib, ResourceRef etc.
Usage
...
Servlet servlet = (Servlet)webApp.addBean("Servlet",new String[]{"ServletName","ServletClass"},
                                          new Object[]{"TestServlet","mypackage.TestServlet"},"ServletName");
servlet.addBean("InitParam",new String[]{"ParamName","ParamValue"},
                new Object[]{"car","Volvo"},"ParamName");
...

Parameters:
beanName - bean name
propertyNames - array of properties that should be initialized
propertyValues - array of initialization values, usually strings
keyProperty - the property name that is checked in order to evoid the duplicity, e.g. ServletName.
keyProperty should be included to propertyNames array.
Returns:
CommonDDBean object that has been nested inside the current element (CommonDDBean object).
Throws:
ClassNotFoundException - thrown when the class for beanName cannot be found under the current DD element
NameAlreadyUsedException - thrown when object with keyProperty value already exists.

addBean

CommonDDBean addBean(String beanName)
                     throws ClassNotFoundException
An empty bean is created corresponding to beanName, regardless the servlet spec. version. The bean is included under the actual bean. The method is useful for elements containing only non-single properties like WelcomeFileList, JspConfig etc.
...
JspConfig config = webApp.addBean("JspConfig");
jspConfig.addBean("JspPropertyGroup",new String[]{"UrlPattern","IncludePrelude","IncludeCoda"},
                  new String[]{"*.jsp","/jsp/prelude.html","/jsp/coda.html"},null);
...

Parameters:
beanName - bean name e.g. "JspConfig"
Returns:
CommonDDBean object corresponding to beanName value
Throws:
ClassNotFoundException - thrown when the class for beanName cannot be found under the current DD element

org.netbeans.modules.j2ee.dd/1 1.13.0 2

Built on November 20 2008.  |  Portions Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.