xdoclet/xdoclet-ant.not-required.patch
Fernando Nasser eb50114915 auto-import xdoclet-1.2.1-2jpp on branch devel from
xdoclet-1.2.1-2jpp.src.rpm
2004-10-14 18:44:45 +00:00

907 lines
57 KiB
Diff

--- core/src/xdoclet/TemplateSubTask.java.orig 2004-06-30 20:48:43.000000000 +0200
+++ core/src/xdoclet/TemplateSubTask.java 2004-06-30 20:28:05.000000000 +0200
@@ -245,7 +245,7 @@
* Indicates whether or not to generate for interfaces.
*
* @param acceptInterfaces
- * @ant.not-required No, default is "true"
+ * @ant.not-required "No, default is 'true'"
*/
public void setAcceptInterfaces(boolean acceptInterfaces)
{
@@ -256,7 +256,7 @@
* Indicates whether or not to generate for abstract classes.
*
* @param acceptAbstractClasses
- * @ant.not-required No, default is "true"
+ * @ant.not-required "No, default is 'true'"
*/
public void setAcceptAbstractClasses(boolean acceptAbstractClasses)
{
@@ -277,7 +277,7 @@
* Indicates whether or not package substitution should be inherited
*
* @param packageSubstitutionInheritanceSupported The new PackageSubstitutionInheritanceSupported value
- * @ant.not-required No, default is "true"
+ * @ant.not-required "No, default is 'true'"
*/
public void setPackageSubstitutionInheritanceSupported(boolean packageSubstitutionInheritanceSupported)
{
@@ -298,7 +298,7 @@
* Indicates whether or not to prefix with package structure.
*
* @param prefixWithPackageStructure The new PrefixWithPackageStructure value
- * @ant.not-required No, default is "true"
+ * @ant.not-required "No, default is 'true'"
*/
public void setPrefixWithPackageStructure(boolean prefixWithPackageStructure)
{
--- core/src/xdoclet/XmlSubTask.java.orig 2004-06-30 20:48:43.000000000 +0200
+++ core/src/xdoclet/XmlSubTask.java 2004-06-30 20:28:43.000000000 +0200
@@ -112,7 +112,7 @@
* available in some subtasks.
*
* @param useIds The new UseIds value
- * @ant.not-required No. Default is "false"
+ * @ant.not-required "No. Default is 'false'"
*/
public void setUseIds(boolean useIds)
{
@@ -124,7 +124,7 @@
* to "ISO-8859-1".
*
* @param xmlEncoding The new Xmlencoding value
- * @ant.not-required No, default is "UTF-8"
+ * @ant.not-required "No, default is 'UTF-8'"
*/
public void setXmlencoding(String xmlEncoding)
{
--- modules/apache/src/xdoclet/modules/apache/struts/StrutsConfigXmlSubTask.java.orig 2004-06-30 20:49:01.000000000 +0200
+++ modules/apache/src/xdoclet/modules/apache/struts/StrutsConfigXmlSubTask.java 2004-06-30 20:29:23.000000000 +0200
@@ -97,7 +97,7 @@
* Sets the struts version to use. Legal values are "1.0" and "1.1".
*
* @param version
- * @ant.not-required No. Default is "1.0".
+ * @ant.not-required "No. Default is '1.0'".
*/
public void setVersion(StrutsVersion version)
{
--- modules/bea/src/xdoclet/modules/bea/wls/ejb/WebLogicSubTask.java.orig 2004-06-30 20:49:01.000000000 +0200
+++ modules/bea/src/xdoclet/modules/bea/wls/ejb/WebLogicSubTask.java 2004-06-30 20:30:07.000000000 +0200
@@ -191,7 +191,7 @@
* Sets the persistence type to use. Useful if you're using a different persistence manager like MVCSoft
*
* @param persistence
- * @ant.not-required No, default is "weblogic"
+ * @ant.not-required "No, default is 'weblogic'"
*/
public void setPersistence(String persistence)
{
--- modules/ejb/src/xdoclet/modules/ejb/entity/DataObjectSubTask.java.orig 2004-06-30 20:49:01.000000000 +0200
+++ modules/ejb/src/xdoclet/modules/ejb/entity/DataObjectSubTask.java 2004-06-30 20:30:26.000000000 +0200
@@ -76,7 +76,7 @@
* The pattern by which the data object classes are named. {0}designates the EJB name.
*
* @param new_pattern The new Pattern value
- * @ant.not-required No, default is "{0}Data"
+ * @ant.not-required "No, default is '{0}Data'"
*/
public void setPattern(String new_pattern)
{
--- modules/ejb/src/xdoclet/modules/ejb/entity/ValueObjectSubTask.java.orig 2004-06-30 20:49:01.000000000 +0200
+++ modules/ejb/src/xdoclet/modules/ejb/entity/ValueObjectSubTask.java 2004-06-30 20:31:00.000000000 +0200
@@ -133,7 +133,7 @@
* The pattern by which the value object classes are named. {0} designates the EJB name.
*
* @param new_pattern The new Pattern value
- * @ant.not-required No, default is "{0}Value"
+ * @ant.not-required "No, default is '{0}Value'"
*/
public void setPattern(String new_pattern)
{
--- modules/ejb/src/xdoclet/modules/ejb/EjbDocletTask.java.orig 2004-06-30 20:49:01.000000000 +0200
+++ modules/ejb/src/xdoclet/modules/ejb/EjbDocletTask.java 2004-06-30 20:32:13.000000000 +0200
@@ -55,7 +55,7 @@
* specified, then ejbdoclet will generate EJB 2.0-compatible ejb-jar.xml file.
*
* @param ejbspec
- * @ant.not-required No. Default is "2.0"
+ * @ant.not-required "No. Default is '2.0'"
*/
public void setEjbSpec(EjbSpecVersion ejbspec)
{
@@ -67,7 +67,7 @@
* no name parameter is specified in the <a href="../../../../tags/ejb-tags.html#@ejb.bean">ejb.bean</a> tag.
*
* @param ejbClassNameSuffix
- * @ant.not-required No, Default is "Bean,EJB,Ejb"
+ * @ant.not-required "No, Default is 'Bean,EJB,Ejb'"
*/
public void setEjbClassNameSuffix(String ejbClassNameSuffix)
{
--- modules/hibernate/src/xdoclet/modules/hibernate/HibernateSubTask.java.orig 2004-06-30 20:49:01.000000000 +0200
+++ modules/hibernate/src/xdoclet/modules/hibernate/HibernateSubTask.java 2004-06-30 20:33:08.000000000 +0200
@@ -95,7 +95,7 @@
* Sets the hibernate version to use. Legal values are "1.1" and "2.0".
*
* @param version
- * @ant.not-required No. Default is "1.1".
+ * @ant.not-required "No. Default is '1.1'".
*/
public void setVersion(HibernateVersion version)
{
--- modules/hp/src/xdoclet/modules/hp/hpas/ejb/HPASSubTask.java.orig 2004-06-30 20:49:01.000000000 +0200
+++ modules/hp/src/xdoclet/modules/hp/hpas/ejb/HPASSubTask.java 2004-06-30 20:35:15.000000000 +0200
@@ -97,8 +97,8 @@
* The path to a local directory indicating where the container should passivate Stateful Session Bean instances.
*
* @param sfsbPassivationRoot The new SfsbPassivationRoot value
- * @ant.not-required No, only if <code>hpas.bean passivation="true"</code> tag is used on a stateful
- * session bean. Default is "".
+ * @ant.not-required "No, only if <code>hpas.bean passivation='true'</code> tag is used on a stateful
+ * session bean. Default is ''."
*/
public void setSfsbPassivationRoot(String sfsbPassivationRoot)
{
@@ -109,7 +109,7 @@
* Only applies when using CMP. Specifies the name of a third party persistence manager product.
*
* @param persistenceProduct The new PersistenceProduct value
- * @ant.not-required No, default is "VXML".
+ * @ant.not-required "No, default is 'VXML'."
*/
public void setPersistenceProduct(String persistenceProduct)
{
@@ -120,7 +120,7 @@
* Only applies when using CMP. Specifies the version of the third party product.
*
* @param persistenceVersion The new PersistenceVersion value
- * @ant.not-required No, default is "".
+ * @ant.not-required "No, default is ''."
*/
public void setPersistenceVersion(String persistenceVersion)
{
@@ -144,7 +144,7 @@
* generated bean class name.
*
* @param persistenceSuffix The new PersistenceSuffix value
- * @ant.not-required No, default is "".
+ * @ant.not-required "No, default is ''."
*/
public void setPersistenceSuffix(String persistenceSuffix)
{
--- modules/jboss/src/xdoclet/modules/jboss/ejb/JBossSubTask.java.orig 2004-06-30 20:49:01.000000000 +0200
+++ modules/jboss/src/xdoclet/modules/jboss/ejb/JBossSubTask.java 2004-06-30 20:46:32.000000000 +0200
@@ -1 +1,625 @@
-/*
* Copyright (c) 2001, 2002 The XDoclet team
* All rights reserved.
*/
package xdoclet.modules.jboss.ejb;
import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import xdoclet.XDocletException;
import xdoclet.XDocletMessages;
import xdoclet.modules.ejb.EjbDocletTask;
import xdoclet.modules.ejb.dd.AbstractEjbDeploymentDescriptorSubTask;
import xdoclet.util.Translator;
/**
* Creates jboss.xml, jaws.xml and/or jbosscmp-jdbc.xml deployment descriptors for JBoss.
*
* @author Ara Abrahamian (ara_e@email.com)
* @author Dmitri Colebatch (dim@bigpond.net.au)
* @created Oct 15, 2001
* @ant.element display-name="JBoss" name="jboss" parent="xdoclet.modules.ejb.EjbDocletTask"
* @version $Revision: 1.29 $
* @xdoclet.merge-file file="jboss-security.xml" relates-to="jboss.xml" description="An XML unparsed entity containing
* the optional enforce-ejb-restrictions, security-domain and/or unauthenticated-principal elements for jboss.xml"
* @xdoclet.merge-file file="jboss-beans.xml" relates-to="jboss.xml" description="An XML unparsed entity containing
* the session, entity and message-driven elements for beans you wish to include which aren't processed by
* XDoclet."
* @xdoclet.merge-file file="jboss-{0}.xml" relates-to="jboss.xml" description="An XML document containing the
* session, entity or message-driven element for a bean, to be used instead of generating it from the bean's tags."
* @xdoclet.merge-file file="jboss-resource-managers.xml" relates-to="jboss.xml" description="An XML document
* containing the resource-managers element, to use instead of generating it from jboss.resource-manager tags."
* @xdoclet.merge-file file="jboss-container.xml" relates-to="jboss.xml" description="An XML document containing the
* optional container-configurations element for jboss.xml"
* @xdoclet.merge-file file="jbosscmp-jdbc-defaults.xml" relates-to="jbosscmp-jdbc.xml" description="An XML document
* containing the defaults element for jbosscmp-jdbc.xml"
* @xdoclet.merge-file file="jbosscmp-jdbc-beans.xml" relates-to="jbosscmp-jdbc.xml" description="An XML unparsed
* entity containing entity elements for any beans you wish to include which aren't processed by XDoclet."
* @xdoclet.merge-file file="jbosscmp-jdbc-db-settings-{0}.xml" relates-to="jbosscmp-jdbc.xml" description="An XML
* unparsed entity containing various database settings for a bean. The contents should consist of (ejb-name,
* (datasource, datasource-mapping)?, create-table?, remove-table?, read-only?, read-time-out?, row-locking?,
* pk-constraint?, read-ahead?, list-cache-max?, fetch-size?, table-name?) elements."
* @xdoclet.merge-file file="jbosscmp-jdbc-{0}.xml" relates-to="jbosscmp-jdbc.xml" description="An XML unparsed entity
* containing various other settings for a bean. Should consist of the (cmp-field*, load-groups?,
* eager-load-group?, lazy-load-groups?, query*) elements."
* @xdoclet.merge-file file="jbosscmp-jdbc-dvc.xml" relates-to="jbosscmp-jdbc.xml" description="An XML unparsed entity
* containing any additional dependent-value-class elements not generated from jboss.dvc tags."
* @xdoclet.merge-file file="jbosscmp-jdbc-typemappings.xml" relates-to="jbosscmp-jdbc.xml" description="An XML
* document containing the optional type-mappings element."
* @xdoclet.merge-file file="jbosscmp-jdbc-entity-commands.xml" relates-to="jbosscmp-jdbc.xml" description="An XML
* document containing the optional entity-commands element."
* @xdoclet.merge-file file="jaws-db-settings-{0}.xml" relates-to="jboss-jaws.xml" description="An XML unparsed entity
* containing various database settings for a bean. The contents should consist of (ejb-name , datasource?)
* elements."
* @xdoclet.merge-file file="jaws-{0}.xml" relates-to="jboss-jaws.xml" description="An XML unparsed entity containing
* (cmp-field* , finder*) elements for a bean."
* @xdoclet.merge-file file="jaws-db-more-settings-{0}.xml" relates-to="jboss-jaws.xml" description="An XML unparsed
* entity containing various database settings for a bean. The contents should consist of (read-only? , table-name?
* , tuned-updates? , create-table? , remove-table? , row-locking? , time-out? , pk-constraint?) elements."
*/
public class JBossSubTask extends AbstractEjbDeploymentDescriptorSubTask
{
private final static String DEFAULT_JBOSS_XML_TEMPLATE_FILE = "resources/jboss_xml.xdt";
private final static String JBOSS_XML_FILE_NAME = "jboss.xml";
private final static String DEFAULT_JAWS_XML_TEMPLATE_FILE = "resources/jboss-jaws_xml.xdt";
private final static String JAWS_XML_FILE_NAME = "jaws.xml";
private final static String DEFAULT_JBOSSCMP_TEMPLATE_FILE = "resources/jbosscmp-jdbc_xml.xdt";
private final static String JBOSSCMP_DD_FILE_NAME = "jbosscmp-jdbc.xml";
private final static String JBOSS_DD_PUBLICID_24 = "-//JBoss//DTD JBOSS 2.4//EN";
private final static String JBOSS_DD_SYSTEMID_24 = "http://www.jboss.org/j2ee/dtd/jboss_2_4.dtd";
private final static String JBOSS_DTD_FILE_NAME_24 = "resources/jboss_2_4.dtd";
private final static String JBOSS_DD_PUBLICID_30 = "-//JBoss//DTD JBOSS 3.0//EN";
private final static String JBOSS_DD_SYSTEMID_30 = "http://www.jboss.org/j2ee/dtd/jboss_3_0.dtd";
private final static String JBOSS_DTD_FILE_NAME_30 = "resources/jboss_3_0.dtd";
private final static String JBOSS_DD_PUBLICID_32 = "-//JBoss//DTD JBOSS 3.2//EN";
private final static String JBOSS_DD_SYSTEMID_32 = "http://www.jboss.org/j2ee/dtd/jboss_3_2.dtd";
private final static String JBOSS_DTD_FILE_NAME_32 = "resources/jboss_3_2.dtd";
private final static String JAWS_DD_PUBLICID_24 = "-//JBoss//DTD JAWS 2.4//EN";
private final static String JAWS_DD_SYSTEMID_24 = "http://www.jboss.org/j2ee/dtd/jaws_2_4.dtd";
private final static String JAWS_DTD_FILE_NAME_24 = "resources/jaws_2_4.dtd";
private final static String JAWS_DD_PUBLICID_30 = "-//JBoss//DTD JAWS 3.0//EN";
private final static String JAWS_DD_SYSTEMID_30 = "http://www.jboss.org/j2ee/dtd/jaws_3_0.dtd";
private final static String JAWS_DTD_FILE_NAME_30 = "resources/jaws_3_0.dtd";
private final static String JBOSSCMP_DD_PUBLICID_30 = "-//JBoss//DTD JBOSSCMP-JDBC 3.0//EN";
private final static String JBOSSCMP_DD_SYSTEMID_30 = "http://www.jboss.org/j2ee/dtd/jbosscmp-jdbc_3_0.dtd";
private final static String JBOSSCMP_DTD_FILE_NAME_30 = "resources/jbosscmp-jdbc_3_0.dtd";
private final static String JBOSSCMP_DD_PUBLICID_32 = "-//JBoss//DTD JBOSSCMP-JDBC 3.2//EN";
private final static String JBOSSCMP_DD_SYSTEMID_32 = "http://www.jboss.org/j2ee/dtd/jbosscmp-jdbc_3_2.dtd";
private final static String JBOSSCMP_DTD_FILE_NAME_32 = "resources/jbosscmp-jdbc_3_2.dtd";
private final static String JBOSSCMP_DD_PUBLICID_40 = "-//JBoss//DTD JBOSSCMP-JDBC 4.0//EN";
private final static String JBOSSCMP_DD_SYSTEMID_40 = "http://www.jboss.org/j2ee/dtd/jbosscmp-jdbc_4_0.dtd";
private final static String JBOSSCMP_DTD_FILE_NAME_40 = "resources/jbosscmp-jdbc_4_0.dtd";
private String version = JBossVersionTypes.VERSION_2_4;
private String datasource;
private String datasourceMapping;
private String generateRelations = "false";
private String preferredRelationMapping;
private String createTable;
private String removeTable;
private String securityDomain = "";
private String unauthenticatedPrincipal = "";
private String debug = "false";
private URL jbossTemplateURL = null;
private URL jawsTemplateURL = null;
private URL jbosscmpTemplateURL = null;
/**
* Gets the template URL for jboss.xml.
*
* @return the jboss.xml template URL
*/
public URL getJbossTemplateURL()
{
return jbossTemplateURL;
}
/**
* Gets the template URL for jaws.xml .
*
* @return the jaws.xml template URL
*/
public URL getJawsTemplateURL()
{
return jawsTemplateURL;
}
/**
* Gets the template URL for jbosscmp-jdbc.xml.
*
* @return the jbosscmp-jdbc.xml template URL
*/
public URL getJbosscmpTemplateURL()
{
return jbosscmpTemplateURL;
}
/**
* Gets the Debug attribute of the JBossSubTask object
*
* @return The Debug value
*/
public String getDebug()
{
return debug;
}
/**
* Gets the Version attribute of the JBossSubTask object
*
* @return The Version value
*/
public String getVersion()
{
return version;
}
/**
* Gets the SecurityDomain attribute of the JBossSubTask object
*
* @return The SecurityDomain value
*/
public String getSecurityDomain()
{
return securityDomain;
}
/**
* Gets the unauthenticated principal name to use.
*
* @return The unauthenticated principal name
*/
public String getUnauthenticatedPrincipal()
{
return unauthenticatedPrincipal;
}
/**
* Gets the Datasource attribute of the JBossSubTask object
*
* @return The Datasource value
*/
public String getDatasource()
{
return datasource;
}
/**
* Gets the DatasourceMapping attribute of the JBossSubTask object
*
* @return The DatasourceMapping value
*/
public String getDatasourceMapping()
{
return datasourceMapping;
}
/**
* Gets the Typemapping attribute of the JBossSubTask object
*
* @return The Typemapping value
*/
public String getTypemapping()
{
return datasourceMapping;
}
/**
* Gets the GenerateRelations attribute of the JBossSubTask object
*
* @return The GenerateRelations value
*/
public String getGenerateRelations()
{
return generateRelations;
}
/**
* Gets the preferredRelationMapping attribute of the JBossSubTask object.
*
* @return The preferredRelationMapping value
*/
public String getPreferredRelationMapping()
{
return preferredRelationMapping;
}
/**
* Gets the createTable attribute of the JBossSubTask object.
*
* @return The createTable value
*/
public String getCreateTable()
{
return createTable;
}
/**
* Gets the createTable attribute of the JBossSubTask object.
*
* @return The removeTable value
*/
public String getRemoveTable()
{
return removeTable;
}
/**
* Sets the template file for jboss.xml.
*
* @param jbossTemplateFile the jboss.xml file
* @exception XDocletException
*/
public void setJbossTemplateFile(File jbossTemplateFile) throws XDocletException
{
this.jbossTemplateURL = toURL(jbossTemplateFile);
}
/**
* Sets the template file for jaws.xml.
*
* @param jawsTemplateFile the jaws.xml file
* @exception XDocletException
*/
public void setJawsTemplateFile(File jawsTemplateFile) throws XDocletException
{
this.jawsTemplateURL = toURL(jawsTemplateFile);
}
/**
* Sets the template file for jbosscmp-jdbc.xml.
*
* @param jbosscmpTemplateFile the jbosscmp-jdbc.xml file
* @exception XDocletException
*/
public void setJbosscmpTemplateFile(File jbosscmpTemplateFile) throws XDocletException
{
this.jbosscmpTemplateURL = toURL(jbosscmpTemplateFile);
}
/**
* Debug flag for jaws.xml.
*
* @param debug No, default is "false"
*/
public void setDebug(String debug)
{
this.debug = debug;
}
/**
* The version of JBoss. Supported versions are 2.4, 3.0, 3.0.1, 3.0.2, 3.0.3, 3.2 and 4.0.
*
* @param version The new Version value
* @ant.not-required No, default is "2.4".
*/
public void setVersion(JBossVersionTypes version)
{
this.version = version.getValue();
}
/**
* The security domain to use.
*
* @param aSecurityDomain The new SecurityDomain value
*/
public void setSecurityDomain(String aSecurityDomain)
{
securityDomain = aSecurityDomain;
}
/**
* The unauthenticated principal name to use.
*
* @param anUnauthenticatedPrincipal The new unauthenticated principal name
*/
public void setUnauthenticatedPrincipal(String anUnauthenticatedPrincipal)
{
unauthenticatedPrincipal = anUnauthenticatedPrincipal;
}
/**
* Sets the Datasource attribute of the JBossSubTask object
*
* @param datasource The new Datasource value
*/
public void setDatasource(String datasource)
{
this.datasource = datasource;
}
/**
* @param datasourceMapping
*/
public void setDatasourceMapping(String datasourceMapping)
{
this.datasourceMapping = datasourceMapping;
}
/**
* @param typemapping
*/
public void setTypemapping(String typemapping)
{
datasourceMapping = typemapping;
}
/**
* @param generateRelations
*/
public void setGenerateRelations(String generateRelations)
{
this.generateRelations = generateRelations;
}
/**
* @param preferredRelationMapping
*/
public void setPreferredRelationMapping(String preferredRelationMapping)
{
this.preferredRelationMapping = preferredRelationMapping;
}
/**
* @param createTable
*/
public void setCreateTable(String createTable)
{
this.createTable = createTable;
}
/**
* @param removeTable
*/
public void setRemoveTable(String removeTable)
{
this.removeTable = removeTable;
}
/**
* Called to validate configuration parameters.
*
* @exception XDocletException Description of Exception
*/
public void validateOptions() throws XDocletException
{
if (jbossTemplateURL == null)
this.jbossTemplateURL = getClass().getResource(DEFAULT_JBOSS_XML_TEMPLATE_FILE);
if (jbosscmpTemplateURL == null)
this.jbosscmpTemplateURL = getClass().getResource(DEFAULT_JBOSSCMP_TEMPLATE_FILE);
if (jawsTemplateURL == null)
this.jawsTemplateURL = getClass().getResource(DEFAULT_JAWS_XML_TEMPLATE_FILE);
// JBoss does not require a template url or a destination file
//
// super.validateOptions();
if ((hasDatasource() && !hasDatasourceMapping()) ||
(!hasDatasource() && hasDatasourceMapping())) {
throw new XDocletException(Translator.getString(XDocletModulesJBossEjbMessages.class, XDocletModulesJBossEjbMessages.DATASOURCE_DATASOURCEMAPPING_PARAMETER_MISSING, new String[]{hasDatasource() ? "datasource" : "datasourcemapping"}));
}
}
/**
* @exception XDocletException Description of Exception
*/
public void execute() throws XDocletException
{
String jbossVersion = getVersion();
URL url = getJbossTemplateURL();
if (url == null) {
throw new XDocletException("can't find template for " + JBOSS_XML_FILE_NAME);
}
setTemplateURL(url);
setDestinationFile(JBOSS_XML_FILE_NAME);
if (jbossVersion.equals(JBossVersionTypes.VERSION_3_2) ||
jbossVersion.equals(JBossVersionTypes.VERSION_4_0)) {
setPublicId(JBOSS_DD_PUBLICID_32);
setSystemId(JBOSS_DD_SYSTEMID_32);
setDtdURL(getClass().getResource(JBOSS_DTD_FILE_NAME_32));
}
else if (jbossVersion.equals(JBossVersionTypes.VERSION_3_0) ||
jbossVersion.equals(JBossVersionTypes.VERSION_3_0_1) ||
jbossVersion.equals(JBossVersionTypes.VERSION_3_0_2) ||
jbossVersion.equals(JBossVersionTypes.VERSION_3_0_3)) {
setPublicId(JBOSS_DD_PUBLICID_30);
setSystemId(JBOSS_DD_SYSTEMID_30);
setDtdURL(getClass().getResource(JBOSS_DTD_FILE_NAME_30));
}
else {
setPublicId(JBOSS_DD_PUBLICID_24);
setSystemId(JBOSS_DD_SYSTEMID_24);
setDtdURL(getClass().getResource(JBOSS_DTD_FILE_NAME_24));
}
startProcess();
String ejbSpec = (String) getContext().getConfigParam("EjbSpec");
// if there is one CMP 1.x bean or we are using JBoss 2.4, JBoss needs a jaws.xml
//
if (atLeastOneCmp1EntityBeanExists() || jbossVersion.equals(JBossVersionTypes.VERSION_2_4)) {
url = getJawsTemplateURL();
if (url == null) {
throw new XDocletException("can't find template for " + JAWS_XML_FILE_NAME);
}
setTemplateURL(url);
setDestinationFile(JAWS_XML_FILE_NAME);
if (jbossVersion.equals(JBossVersionTypes.VERSION_3_0) ||
jbossVersion.equals(JBossVersionTypes.VERSION_3_0_1) ||
jbossVersion.equals(JBossVersionTypes.VERSION_3_0_2) ||
jbossVersion.equals(JBossVersionTypes.VERSION_3_0_3) ||
jbossVersion.equals(JBossVersionTypes.VERSION_3_2) ||
jbossVersion.equals(JBossVersionTypes.VERSION_4_0)) {
setPublicId(JAWS_DD_PUBLICID_30);
setSystemId(JAWS_DD_SYSTEMID_30);
setDtdURL(getClass().getResource(JAWS_DTD_FILE_NAME_30));
}
else if (ejbSpec.equals(EjbDocletTask.EjbSpecVersion.EJB_1_1)) {
setPublicId(JAWS_DD_PUBLICID_24);
setSystemId(JAWS_DD_SYSTEMID_24);
setDtdURL(getClass().getResource(JAWS_DTD_FILE_NAME_24));
}
startProcess();
}
// if we are doing ejb spec 2.0, JBoss 3.0, and one CMP 2.x bean exists, JBoss needs
// the jbosscmp-jdbc.xml file
//
if (ejbSpec.equals(EjbDocletTask.EjbSpecVersion.EJB_2_0) &&
atLeastOneCmp2EntityBeanExists()) {
url = getJbosscmpTemplateURL();
if (url == null) {
throw new XDocletException("can't find template for " + JBOSSCMP_DD_FILE_NAME);
}
setTemplateURL(url);
setDestinationFile(JBOSSCMP_DD_FILE_NAME);
if (jbossVersion.equals(JBossVersionTypes.VERSION_3_0) ||
jbossVersion.equals(JBossVersionTypes.VERSION_3_0_1) ||
jbossVersion.equals(JBossVersionTypes.VERSION_3_0_2) ||
jbossVersion.equals(JBossVersionTypes.VERSION_3_0_3)) {
setPublicId(JBOSSCMP_DD_PUBLICID_30);
setSystemId(JBOSSCMP_DD_SYSTEMID_30);
setDtdURL(getClass().getResource(JBOSSCMP_DTD_FILE_NAME_30));
}
else if (jbossVersion.equals(JBossVersionTypes.VERSION_3_2)) {
setPublicId(JBOSSCMP_DD_PUBLICID_32);
setSystemId(JBOSSCMP_DD_SYSTEMID_32);
setDtdURL(getClass().getResource(JBOSSCMP_DTD_FILE_NAME_32));
}
else if (jbossVersion.equals(JBossVersionTypes.VERSION_4_0)) {
setPublicId(JBOSSCMP_DD_PUBLICID_40);
setSystemId(JBOSSCMP_DD_SYSTEMID_40);
setDtdURL(getClass().getResource(JBOSSCMP_DTD_FILE_NAME_40));
}
// end of else
else {
throw new XDocletException("Unknown jboss version number for cmp2 " + jbossVersion);
}
// end of else
startProcess();
}
}
/**
* @exception XDocletException Description of Exception
*/
protected void engineStarted() throws XDocletException
{
if (getDestinationFile().equals(JBOSS_XML_FILE_NAME)) {
System.out.println(Translator.getString(XDocletMessages.class, XDocletMessages.GENERATING_SOMETHING, new String[]{JBOSS_XML_FILE_NAME}));
}
else if (getDestinationFile().equals(JAWS_XML_FILE_NAME)) {
System.out.println(Translator.getString(XDocletMessages.class, XDocletMessages.GENERATING_SOMETHING, new String[]{JAWS_XML_FILE_NAME}));
}
else if (getDestinationFile().equals(JBOSSCMP_DD_FILE_NAME)) {
System.out.println(Translator.getString(XDocletMessages.class, XDocletMessages.GENERATING_SOMETHING, new String[]{JBOSSCMP_DD_FILE_NAME}));
}
}
private boolean hasDatasource()
{
return getDatasource() != null && getDatasource().trim().length() > 0;
}
private boolean hasDatasourceMapping()
{
return getDatasourceMapping() != null && getDatasourceMapping().trim().length() > 0;
}
private URL toURL(File file) throws XDocletException
{
if (file.exists()) {
try {
return file.toURL();
}
catch (MalformedURLException mue) {
throw new XDocletException(mue, "Illegal file url: " + file.getAbsolutePath());
}
}
else {
throw new XDocletException("Couldn't find file: " + file.getAbsolutePath());
}
}
/**
* @author Ara Abrahamian (ara_e@email.com)
* @created October 20, 2001
*/
public static class JBossVersionTypes extends org.apache.tools.ant.types.EnumeratedAttribute
{
public final static String VERSION_2_4 = "2.4";
public final static String VERSION_3_0 = "3.0";
public final static String VERSION_3_0_1 = "3.0.1";
public final static String VERSION_3_0_2 = "3.0.2";
public final static String VERSION_3_0_3 = "3.0.3";
public final static String VERSION_3_2 = "3.2";
public final static String VERSION_4_0 = "4.0";
/**
* Gets the Values attribute of the JBossVersionTypes object
*
* @return The Values value
*/
public String[] getValues()
{
return new String[]{VERSION_2_4, VERSION_3_0, VERSION_3_0_1, VERSION_3_0_2, VERSION_3_0_3, VERSION_3_2, VERSION_4_0};
}
}
}
\ No newline at end of file
+/*
+ * Copyright (c) 2001, 2002 The XDoclet team
+ * All rights reserved.
+ */
+package xdoclet.modules.jboss.ejb;
+
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import xdoclet.XDocletException;
+import xdoclet.XDocletMessages;
+import xdoclet.modules.ejb.EjbDocletTask;
+import xdoclet.modules.ejb.dd.AbstractEjbDeploymentDescriptorSubTask;
+import xdoclet.util.Translator;
+
+/**
+ * Creates jboss.xml, jaws.xml and/or jbosscmp-jdbc.xml deployment descriptors for JBoss.
+ *
+ * @author Ara Abrahamian (ara_e@email.com)
+ * @author Dmitri Colebatch (dim@bigpond.net.au)
+ * @created Oct 15, 2001
+ * @ant.element display-name="JBoss" name="jboss" parent="xdoclet.modules.ejb.EjbDocletTask"
+ * @version $Revision: 1.29 $
+ * @xdoclet.merge-file file="jboss-security.xml" relates-to="jboss.xml" description="An XML unparsed entity containing
+ * the optional enforce-ejb-restrictions, security-domain and/or unauthenticated-principal elements for jboss.xml"
+ * @xdoclet.merge-file file="jboss-beans.xml" relates-to="jboss.xml" description="An XML unparsed entity containing
+ * the session, entity and message-driven elements for beans you wish to include which aren't processed by
+ * XDoclet."
+ * @xdoclet.merge-file file="jboss-{0}.xml" relates-to="jboss.xml" description="An XML document containing the
+ * session, entity or message-driven element for a bean, to be used instead of generating it from the bean's tags."
+ * @xdoclet.merge-file file="jboss-resource-managers.xml" relates-to="jboss.xml" description="An XML document
+ * containing the resource-managers element, to use instead of generating it from jboss.resource-manager tags."
+ * @xdoclet.merge-file file="jboss-container.xml" relates-to="jboss.xml" description="An XML document containing the
+ * optional container-configurations element for jboss.xml"
+ * @xdoclet.merge-file file="jbosscmp-jdbc-defaults.xml" relates-to="jbosscmp-jdbc.xml" description="An XML document
+ * containing the defaults element for jbosscmp-jdbc.xml"
+ * @xdoclet.merge-file file="jbosscmp-jdbc-beans.xml" relates-to="jbosscmp-jdbc.xml" description="An XML unparsed
+ * entity containing entity elements for any beans you wish to include which aren't processed by XDoclet."
+ * @xdoclet.merge-file file="jbosscmp-jdbc-db-settings-{0}.xml" relates-to="jbosscmp-jdbc.xml" description="An XML
+ * unparsed entity containing various database settings for a bean. The contents should consist of (ejb-name,
+ * (datasource, datasource-mapping)?, create-table?, remove-table?, read-only?, read-time-out?, row-locking?,
+ * pk-constraint?, read-ahead?, list-cache-max?, fetch-size?, table-name?) elements."
+ * @xdoclet.merge-file file="jbosscmp-jdbc-{0}.xml" relates-to="jbosscmp-jdbc.xml" description="An XML unparsed entity
+ * containing various other settings for a bean. Should consist of the (cmp-field*, load-groups?,
+ * eager-load-group?, lazy-load-groups?, query*) elements."
+ * @xdoclet.merge-file file="jbosscmp-jdbc-dvc.xml" relates-to="jbosscmp-jdbc.xml" description="An XML unparsed entity
+ * containing any additional dependent-value-class elements not generated from jboss.dvc tags."
+ * @xdoclet.merge-file file="jbosscmp-jdbc-typemappings.xml" relates-to="jbosscmp-jdbc.xml" description="An XML
+ * document containing the optional type-mappings element."
+ * @xdoclet.merge-file file="jbosscmp-jdbc-entity-commands.xml" relates-to="jbosscmp-jdbc.xml" description="An XML
+ * document containing the optional entity-commands element."
+ * @xdoclet.merge-file file="jaws-db-settings-{0}.xml" relates-to="jboss-jaws.xml" description="An XML unparsed entity
+ * containing various database settings for a bean. The contents should consist of (ejb-name , datasource?)
+ * elements."
+ * @xdoclet.merge-file file="jaws-{0}.xml" relates-to="jboss-jaws.xml" description="An XML unparsed entity containing
+ * (cmp-field* , finder*) elements for a bean."
+ * @xdoclet.merge-file file="jaws-db-more-settings-{0}.xml" relates-to="jboss-jaws.xml" description="An XML unparsed
+ * entity containing various database settings for a bean. The contents should consist of (read-only? , table-name?
+ * , tuned-updates? , create-table? , remove-table? , row-locking? , time-out? , pk-constraint?) elements."
+ */
+public class JBossSubTask extends AbstractEjbDeploymentDescriptorSubTask
+{
+ private final static String DEFAULT_JBOSS_XML_TEMPLATE_FILE = "resources/jboss_xml.xdt";
+
+ private final static String JBOSS_XML_FILE_NAME = "jboss.xml";
+
+ private final static String DEFAULT_JAWS_XML_TEMPLATE_FILE = "resources/jboss-jaws_xml.xdt";
+
+ private final static String JAWS_XML_FILE_NAME = "jaws.xml";
+
+ private final static String DEFAULT_JBOSSCMP_TEMPLATE_FILE = "resources/jbosscmp-jdbc_xml.xdt";
+
+ private final static String JBOSSCMP_DD_FILE_NAME = "jbosscmp-jdbc.xml";
+
+ private final static String JBOSS_DD_PUBLICID_24 = "-//JBoss//DTD JBOSS 2.4//EN";
+
+ private final static String JBOSS_DD_SYSTEMID_24 = "http://www.jboss.org/j2ee/dtd/jboss_2_4.dtd";
+
+ private final static String JBOSS_DTD_FILE_NAME_24 = "resources/jboss_2_4.dtd";
+
+ private final static String JBOSS_DD_PUBLICID_30 = "-//JBoss//DTD JBOSS 3.0//EN";
+
+ private final static String JBOSS_DD_SYSTEMID_30 = "http://www.jboss.org/j2ee/dtd/jboss_3_0.dtd";
+
+ private final static String JBOSS_DTD_FILE_NAME_30 = "resources/jboss_3_0.dtd";
+
+ private final static String JBOSS_DD_PUBLICID_32 = "-//JBoss//DTD JBOSS 3.2//EN";
+
+ private final static String JBOSS_DD_SYSTEMID_32 = "http://www.jboss.org/j2ee/dtd/jboss_3_2.dtd";
+
+ private final static String JBOSS_DTD_FILE_NAME_32 = "resources/jboss_3_2.dtd";
+
+ private final static String JAWS_DD_PUBLICID_24 = "-//JBoss//DTD JAWS 2.4//EN";
+
+ private final static String JAWS_DD_SYSTEMID_24 = "http://www.jboss.org/j2ee/dtd/jaws_2_4.dtd";
+
+ private final static String JAWS_DTD_FILE_NAME_24 = "resources/jaws_2_4.dtd";
+
+ private final static String JAWS_DD_PUBLICID_30 = "-//JBoss//DTD JAWS 3.0//EN";
+
+ private final static String JAWS_DD_SYSTEMID_30 = "http://www.jboss.org/j2ee/dtd/jaws_3_0.dtd";
+
+ private final static String JAWS_DTD_FILE_NAME_30 = "resources/jaws_3_0.dtd";
+
+ private final static String JBOSSCMP_DD_PUBLICID_30 = "-//JBoss//DTD JBOSSCMP-JDBC 3.0//EN";
+
+ private final static String JBOSSCMP_DD_SYSTEMID_30 = "http://www.jboss.org/j2ee/dtd/jbosscmp-jdbc_3_0.dtd";
+
+ private final static String JBOSSCMP_DTD_FILE_NAME_30 = "resources/jbosscmp-jdbc_3_0.dtd";
+
+ private final static String JBOSSCMP_DD_PUBLICID_32 = "-//JBoss//DTD JBOSSCMP-JDBC 3.2//EN";
+
+ private final static String JBOSSCMP_DD_SYSTEMID_32 = "http://www.jboss.org/j2ee/dtd/jbosscmp-jdbc_3_2.dtd";
+
+ private final static String JBOSSCMP_DTD_FILE_NAME_32 = "resources/jbosscmp-jdbc_3_2.dtd";
+
+ private final static String JBOSSCMP_DD_PUBLICID_40 = "-//JBoss//DTD JBOSSCMP-JDBC 4.0//EN";
+
+ private final static String JBOSSCMP_DD_SYSTEMID_40 = "http://www.jboss.org/j2ee/dtd/jbosscmp-jdbc_4_0.dtd";
+
+ private final static String JBOSSCMP_DTD_FILE_NAME_40 = "resources/jbosscmp-jdbc_4_0.dtd";
+
+ private String version = JBossVersionTypes.VERSION_2_4;
+
+ private String datasource;
+
+ private String datasourceMapping;
+
+ private String generateRelations = "false";
+
+ private String preferredRelationMapping;
+
+ private String createTable;
+
+ private String removeTable;
+
+ private String securityDomain = "";
+
+ private String unauthenticatedPrincipal = "";
+
+ private String debug = "false";
+
+ private URL jbossTemplateURL = null;
+
+ private URL jawsTemplateURL = null;
+
+ private URL jbosscmpTemplateURL = null;
+
+ /**
+ * Gets the template URL for jboss.xml.
+ *
+ * @return the jboss.xml template URL
+ */
+ public URL getJbossTemplateURL()
+ {
+ return jbossTemplateURL;
+ }
+
+ /**
+ * Gets the template URL for jaws.xml .
+ *
+ * @return the jaws.xml template URL
+ */
+ public URL getJawsTemplateURL()
+ {
+ return jawsTemplateURL;
+ }
+
+ /**
+ * Gets the template URL for jbosscmp-jdbc.xml.
+ *
+ * @return the jbosscmp-jdbc.xml template URL
+ */
+ public URL getJbosscmpTemplateURL()
+ {
+ return jbosscmpTemplateURL;
+ }
+
+ /**
+ * Gets the Debug attribute of the JBossSubTask object
+ *
+ * @return The Debug value
+ */
+ public String getDebug()
+ {
+ return debug;
+ }
+
+ /**
+ * Gets the Version attribute of the JBossSubTask object
+ *
+ * @return The Version value
+ */
+ public String getVersion()
+ {
+ return version;
+ }
+
+ /**
+ * Gets the SecurityDomain attribute of the JBossSubTask object
+ *
+ * @return The SecurityDomain value
+ */
+ public String getSecurityDomain()
+ {
+ return securityDomain;
+ }
+
+ /**
+ * Gets the unauthenticated principal name to use.
+ *
+ * @return The unauthenticated principal name
+ */
+ public String getUnauthenticatedPrincipal()
+ {
+ return unauthenticatedPrincipal;
+ }
+
+ /**
+ * Gets the Datasource attribute of the JBossSubTask object
+ *
+ * @return The Datasource value
+ */
+ public String getDatasource()
+ {
+ return datasource;
+ }
+
+ /**
+ * Gets the DatasourceMapping attribute of the JBossSubTask object
+ *
+ * @return The DatasourceMapping value
+ */
+ public String getDatasourceMapping()
+ {
+ return datasourceMapping;
+ }
+
+ /**
+ * Gets the Typemapping attribute of the JBossSubTask object
+ *
+ * @return The Typemapping value
+ */
+ public String getTypemapping()
+ {
+ return datasourceMapping;
+ }
+
+ /**
+ * Gets the GenerateRelations attribute of the JBossSubTask object
+ *
+ * @return The GenerateRelations value
+ */
+ public String getGenerateRelations()
+ {
+ return generateRelations;
+ }
+
+ /**
+ * Gets the preferredRelationMapping attribute of the JBossSubTask object.
+ *
+ * @return The preferredRelationMapping value
+ */
+ public String getPreferredRelationMapping()
+ {
+ return preferredRelationMapping;
+ }
+
+ /**
+ * Gets the createTable attribute of the JBossSubTask object.
+ *
+ * @return The createTable value
+ */
+ public String getCreateTable()
+ {
+ return createTable;
+ }
+
+ /**
+ * Gets the createTable attribute of the JBossSubTask object.
+ *
+ * @return The removeTable value
+ */
+ public String getRemoveTable()
+ {
+ return removeTable;
+ }
+
+ /**
+ * Sets the template file for jboss.xml.
+ *
+ * @param jbossTemplateFile the jboss.xml file
+ * @exception XDocletException
+ */
+ public void setJbossTemplateFile(File jbossTemplateFile) throws XDocletException
+ {
+ this.jbossTemplateURL = toURL(jbossTemplateFile);
+ }
+
+ /**
+ * Sets the template file for jaws.xml.
+ *
+ * @param jawsTemplateFile the jaws.xml file
+ * @exception XDocletException
+ */
+ public void setJawsTemplateFile(File jawsTemplateFile) throws XDocletException
+ {
+ this.jawsTemplateURL = toURL(jawsTemplateFile);
+ }
+
+ /**
+ * Sets the template file for jbosscmp-jdbc.xml.
+ *
+ * @param jbosscmpTemplateFile the jbosscmp-jdbc.xml file
+ * @exception XDocletException
+ */
+ public void setJbosscmpTemplateFile(File jbosscmpTemplateFile) throws XDocletException
+ {
+ this.jbosscmpTemplateURL = toURL(jbosscmpTemplateFile);
+ }
+
+ /**
+ * Debug flag for jaws.xml.
+ *
+ * @param debug No, default is "false"
+ */
+ public void setDebug(String debug)
+ {
+ this.debug = debug;
+ }
+
+ /**
+ * The version of JBoss. Supported versions are 2.4, 3.0, 3.0.1, 3.0.2, 3.0.3, 3.2 and 4.0.
+ *
+ * @param version The new Version value
+ * @ant.not-required "No, default is '2.4'."
+ */
+ public void setVersion(JBossVersionTypes version)
+ {
+ this.version = version.getValue();
+ }
+
+ /**
+ * The security domain to use.
+ *
+ * @param aSecurityDomain The new SecurityDomain value
+ */
+ public void setSecurityDomain(String aSecurityDomain)
+ {
+ securityDomain = aSecurityDomain;
+ }
+
+ /**
+ * The unauthenticated principal name to use.
+ *
+ * @param anUnauthenticatedPrincipal The new unauthenticated principal name
+ */
+ public void setUnauthenticatedPrincipal(String anUnauthenticatedPrincipal)
+ {
+ unauthenticatedPrincipal = anUnauthenticatedPrincipal;
+ }
+
+ /**
+ * Sets the Datasource attribute of the JBossSubTask object
+ *
+ * @param datasource The new Datasource value
+ */
+ public void setDatasource(String datasource)
+ {
+ this.datasource = datasource;
+ }
+
+ /**
+ * @param datasourceMapping
+ */
+ public void setDatasourceMapping(String datasourceMapping)
+ {
+ this.datasourceMapping = datasourceMapping;
+ }
+
+ /**
+ * @param typemapping
+ */
+ public void setTypemapping(String typemapping)
+ {
+ datasourceMapping = typemapping;
+ }
+
+ /**
+ * @param generateRelations
+ */
+ public void setGenerateRelations(String generateRelations)
+ {
+ this.generateRelations = generateRelations;
+ }
+
+ /**
+ * @param preferredRelationMapping
+ */
+ public void setPreferredRelationMapping(String preferredRelationMapping)
+ {
+ this.preferredRelationMapping = preferredRelationMapping;
+ }
+
+ /**
+ * @param createTable
+ */
+ public void setCreateTable(String createTable)
+ {
+ this.createTable = createTable;
+ }
+
+ /**
+ * @param removeTable
+ */
+ public void setRemoveTable(String removeTable)
+ {
+ this.removeTable = removeTable;
+ }
+
+ /**
+ * Called to validate configuration parameters.
+ *
+ * @exception XDocletException Description of Exception
+ */
+ public void validateOptions() throws XDocletException
+ {
+ if (jbossTemplateURL == null)
+ this.jbossTemplateURL = getClass().getResource(DEFAULT_JBOSS_XML_TEMPLATE_FILE);
+ if (jbosscmpTemplateURL == null)
+ this.jbosscmpTemplateURL = getClass().getResource(DEFAULT_JBOSSCMP_TEMPLATE_FILE);
+ if (jawsTemplateURL == null)
+ this.jawsTemplateURL = getClass().getResource(DEFAULT_JAWS_XML_TEMPLATE_FILE);
+
+ // JBoss does not require a template url or a destination file
+ //
+ // super.validateOptions();
+
+ if ((hasDatasource() && !hasDatasourceMapping()) ||
+ (!hasDatasource() && hasDatasourceMapping())) {
+ throw new XDocletException(Translator.getString(XDocletModulesJBossEjbMessages.class, XDocletModulesJBossEjbMessages.DATASOURCE_DATASOURCEMAPPING_PARAMETER_MISSING, new String[]{hasDatasource() ? "datasource" : "datasourcemapping"}));
+ }
+ }
+
+ /**
+ * @exception XDocletException Description of Exception
+ */
+ public void execute() throws XDocletException
+ {
+ String jbossVersion = getVersion();
+
+ URL url = getJbossTemplateURL();
+
+ if (url == null) {
+ throw new XDocletException("can't find template for " + JBOSS_XML_FILE_NAME);
+ }
+
+ setTemplateURL(url);
+ setDestinationFile(JBOSS_XML_FILE_NAME);
+ if (jbossVersion.equals(JBossVersionTypes.VERSION_3_2) ||
+ jbossVersion.equals(JBossVersionTypes.VERSION_4_0)) {
+ setPublicId(JBOSS_DD_PUBLICID_32);
+ setSystemId(JBOSS_DD_SYSTEMID_32);
+ setDtdURL(getClass().getResource(JBOSS_DTD_FILE_NAME_32));
+ }
+ else if (jbossVersion.equals(JBossVersionTypes.VERSION_3_0) ||
+ jbossVersion.equals(JBossVersionTypes.VERSION_3_0_1) ||
+ jbossVersion.equals(JBossVersionTypes.VERSION_3_0_2) ||
+ jbossVersion.equals(JBossVersionTypes.VERSION_3_0_3)) {
+ setPublicId(JBOSS_DD_PUBLICID_30);
+ setSystemId(JBOSS_DD_SYSTEMID_30);
+ setDtdURL(getClass().getResource(JBOSS_DTD_FILE_NAME_30));
+ }
+ else {
+ setPublicId(JBOSS_DD_PUBLICID_24);
+ setSystemId(JBOSS_DD_SYSTEMID_24);
+ setDtdURL(getClass().getResource(JBOSS_DTD_FILE_NAME_24));
+ }
+
+ startProcess();
+
+ String ejbSpec = (String) getContext().getConfigParam("EjbSpec");
+
+ // if there is one CMP 1.x bean or we are using JBoss 2.4, JBoss needs a jaws.xml
+ //
+ if (atLeastOneCmp1EntityBeanExists() || jbossVersion.equals(JBossVersionTypes.VERSION_2_4)) {
+
+ url = getJawsTemplateURL();
+ if (url == null) {
+ throw new XDocletException("can't find template for " + JAWS_XML_FILE_NAME);
+ }
+ setTemplateURL(url);
+ setDestinationFile(JAWS_XML_FILE_NAME);
+ if (jbossVersion.equals(JBossVersionTypes.VERSION_3_0) ||
+ jbossVersion.equals(JBossVersionTypes.VERSION_3_0_1) ||
+ jbossVersion.equals(JBossVersionTypes.VERSION_3_0_2) ||
+ jbossVersion.equals(JBossVersionTypes.VERSION_3_0_3) ||
+ jbossVersion.equals(JBossVersionTypes.VERSION_3_2) ||
+ jbossVersion.equals(JBossVersionTypes.VERSION_4_0)) {
+ setPublicId(JAWS_DD_PUBLICID_30);
+ setSystemId(JAWS_DD_SYSTEMID_30);
+ setDtdURL(getClass().getResource(JAWS_DTD_FILE_NAME_30));
+ }
+ else if (ejbSpec.equals(EjbDocletTask.EjbSpecVersion.EJB_1_1)) {
+ setPublicId(JAWS_DD_PUBLICID_24);
+ setSystemId(JAWS_DD_SYSTEMID_24);
+ setDtdURL(getClass().getResource(JAWS_DTD_FILE_NAME_24));
+ }
+ startProcess();
+ }
+
+ // if we are doing ejb spec 2.0, JBoss 3.0, and one CMP 2.x bean exists, JBoss needs
+ // the jbosscmp-jdbc.xml file
+ //
+ if (ejbSpec.equals(EjbDocletTask.EjbSpecVersion.EJB_2_0) &&
+ atLeastOneCmp2EntityBeanExists()) {
+
+ url = getJbosscmpTemplateURL();
+ if (url == null) {
+ throw new XDocletException("can't find template for " + JBOSSCMP_DD_FILE_NAME);
+ }
+
+ setTemplateURL(url);
+
+ setDestinationFile(JBOSSCMP_DD_FILE_NAME);
+
+ if (jbossVersion.equals(JBossVersionTypes.VERSION_3_0) ||
+ jbossVersion.equals(JBossVersionTypes.VERSION_3_0_1) ||
+ jbossVersion.equals(JBossVersionTypes.VERSION_3_0_2) ||
+ jbossVersion.equals(JBossVersionTypes.VERSION_3_0_3)) {
+
+ setPublicId(JBOSSCMP_DD_PUBLICID_30);
+ setSystemId(JBOSSCMP_DD_SYSTEMID_30);
+ setDtdURL(getClass().getResource(JBOSSCMP_DTD_FILE_NAME_30));
+ }
+ else if (jbossVersion.equals(JBossVersionTypes.VERSION_3_2)) {
+
+ setPublicId(JBOSSCMP_DD_PUBLICID_32);
+ setSystemId(JBOSSCMP_DD_SYSTEMID_32);
+ setDtdURL(getClass().getResource(JBOSSCMP_DTD_FILE_NAME_32));
+ }
+ else if (jbossVersion.equals(JBossVersionTypes.VERSION_4_0)) {
+
+ setPublicId(JBOSSCMP_DD_PUBLICID_40);
+ setSystemId(JBOSSCMP_DD_SYSTEMID_40);
+ setDtdURL(getClass().getResource(JBOSSCMP_DTD_FILE_NAME_40));
+ }
+ // end of else
+ else {
+ throw new XDocletException("Unknown jboss version number for cmp2 " + jbossVersion);
+ }
+ // end of else
+
+ startProcess();
+ }
+ }
+
+ /**
+ * @exception XDocletException Description of Exception
+ */
+ protected void engineStarted() throws XDocletException
+ {
+ if (getDestinationFile().equals(JBOSS_XML_FILE_NAME)) {
+ System.out.println(Translator.getString(XDocletMessages.class, XDocletMessages.GENERATING_SOMETHING, new String[]{JBOSS_XML_FILE_NAME}));
+ }
+ else if (getDestinationFile().equals(JAWS_XML_FILE_NAME)) {
+ System.out.println(Translator.getString(XDocletMessages.class, XDocletMessages.GENERATING_SOMETHING, new String[]{JAWS_XML_FILE_NAME}));
+ }
+ else if (getDestinationFile().equals(JBOSSCMP_DD_FILE_NAME)) {
+ System.out.println(Translator.getString(XDocletMessages.class, XDocletMessages.GENERATING_SOMETHING, new String[]{JBOSSCMP_DD_FILE_NAME}));
+ }
+ }
+
+ private boolean hasDatasource()
+ {
+ return getDatasource() != null && getDatasource().trim().length() > 0;
+ }
+
+ private boolean hasDatasourceMapping()
+ {
+ return getDatasourceMapping() != null && getDatasourceMapping().trim().length() > 0;
+ }
+
+
+ private URL toURL(File file) throws XDocletException
+ {
+ if (file.exists()) {
+ try {
+ return file.toURL();
+ }
+ catch (MalformedURLException mue) {
+ throw new XDocletException(mue, "Illegal file url: " + file.getAbsolutePath());
+ }
+ }
+ else {
+ throw new XDocletException("Couldn't find file: " + file.getAbsolutePath());
+ }
+ }
+
+ /**
+ * @author Ara Abrahamian (ara_e@email.com)
+ * @created October 20, 2001
+ */
+ public static class JBossVersionTypes extends org.apache.tools.ant.types.EnumeratedAttribute
+ {
+ public final static String VERSION_2_4 = "2.4";
+ public final static String VERSION_3_0 = "3.0";
+ public final static String VERSION_3_0_1 = "3.0.1";
+ public final static String VERSION_3_0_2 = "3.0.2";
+ public final static String VERSION_3_0_3 = "3.0.3";
+ public final static String VERSION_3_2 = "3.2";
+ public final static String VERSION_4_0 = "4.0";
+
+ /**
+ * Gets the Values attribute of the JBossVersionTypes object
+ *
+ * @return The Values value
+ */
+ public String[] getValues()
+ {
+ return new String[]{VERSION_2_4, VERSION_3_0, VERSION_3_0_1, VERSION_3_0_2, VERSION_3_0_3, VERSION_3_2, VERSION_4_0};
+ }
+ }
+}
--- modules/libelis/src/xdoclet/modules/libelis/jdo/LidoSubTask.java.orig 2004-06-30 20:49:01.000000000 +0200
+++ modules/libelis/src/xdoclet/modules/libelis/jdo/LidoSubTask.java 2004-06-30 20:38:11.000000000 +0200
@@ -63,7 +63,7 @@
* The version of Lido. Supported versions are 1.3.
*
* @param version The new Version value
- * @ant.not-required No, default is "1.3".
+ * @ant.not-required "No, default is '1.3'."
*/
public void setVersion(LidoVersionTypes version)
{
--- modules/mvcsoft/src/xdoclet/modules/mvcsoft/ejb/MVCSoftSubTask.java.orig 2004-06-30 20:49:02.000000000 +0200
+++ modules/mvcsoft/src/xdoclet/modules/mvcsoft/ejb/MVCSoftSubTask.java 2004-06-30 20:38:48.000000000 +0200
@@ -91,7 +91,7 @@
* Sets the Connectionjndiname attribute of the MVCSoftSubTask object
*
* @param jndiName The new Connectionjndiname value
- * @ant.not-required No, default is "java:DefaultDS"
+ * @ant.not-required "No, default is 'java:DefaultDS'"
*/
public void setConnectionjndiname(String jndiName)
{
@@ -102,7 +102,7 @@
* Sets the Loggingtype attribute of the MVCSoftSubTask object
*
* @param loggingType The new Loggingtype value
- * @ant.not-required No, default is "None"
+ * @ant.not-required "No, default is 'None'"
*/
public void setLoggingtype(String loggingType)
{
--- modules/objectweb/src/xdoclet/modules/objectweb/jonas/ejb/JonasSubTask.java.orig 2004-06-30 20:49:02.000000000 +0200
+++ modules/objectweb/src/xdoclet/modules/objectweb/jonas/ejb/JonasSubTask.java 2004-06-30 20:39:18.000000000 +0200
@@ -134,7 +134,7 @@
* Sets the version of JOnAS. Supported versions are: 2.3, 2.4, 2.5, 2.6, 3.0
*
* @param version The new version value. Supported versions are: 2.3, 2.4, 2.5, 2.6, 3.0
- * @ant.not-required No, default is "2.6".
+ * @ant.not-required "No, default is '2.6'."
*/
public void setVersion(JonasVersionTypes version)
{
--- modules/objectweb/src/xdoclet/modules/objectweb/jonas/web/JonasWebSubTask.java.orig 2004-06-30 20:49:02.000000000 +0200
+++ modules/objectweb/src/xdoclet/modules/objectweb/jonas/web/JonasWebSubTask.java 2004-06-30 20:39:43.000000000 +0200
@@ -127,7 +127,7 @@
* Sets the version of JOnAS. Supported versions are: 2.6.
*
* @param version The new version value. Supported versions are: 2.6.
- * @ant.not-required No, default is "2.6".
+ * @ant.not-required "No, default is '2.6'."
*/
public void setVersion(JonasVersionTypes version)
{
--- modules/solarmetric/src/xdoclet/modules/solarmetric/jdo/KodoSubTask.java.orig 2004-06-30 20:49:02.000000000 +0200
+++ modules/solarmetric/src/xdoclet/modules/solarmetric/jdo/KodoSubTask.java 2004-06-30 20:40:02.000000000 +0200
@@ -63,7 +63,7 @@
* The version of Kodo. Supported versions are 2.3.
*
* @param version The new Version value
- * @ant.not-required No, default is "2.3".
+ * @ant.not-required "No, default is '2.3'."
*/
public void setVersion(KodoVersionTypes version)
{
--- modules/sun/src/xdoclet/modules/sun/sunone/ejb/SunONESubTask.java.orig 2004-06-30 20:49:02.000000000 +0200
+++ modules/sun/src/xdoclet/modules/sun/sunone/ejb/SunONESubTask.java 2004-06-30 20:40:57.000000000 +0200
@@ -227,7 +227,7 @@
* The SunONE/iPlanet version. Supported versions are 6.0, 6.5 and 7.0.
*
* @param version The new Version value
- * @ant.not-required No, default is "7.0".
+ * @ant.not-required "No, default is '7.0'."
*/
public void setVersion(SunONEVersionTypes version)
{
@@ -238,7 +238,7 @@
* Optional default transaction manager type for all components. Allowed values are 'local' and 'global'.
*
* @param transactionManagerType "local" or "global"
- * @ant.not-required Only used for version = 6.5, and optional even then.
+ * @ant.not-required "Only used for version = 6.5, and optional even then."
*/
public void setTransactionManagerType(String transactionManagerType)
{
@@ -249,7 +249,7 @@
* Specifies the absolute jndi-name of the database to be used for storing CMP beans in the EJB JAR file.
*
* @param cmpResourceJndiName String containing the JNDI name
- * @ant.not-required Only used for version = 7.0, and optional even then.
+ * @ant.not-required "Only used for version = 7.0, and optional even then."
*/
public void setCmpResourceJndiName(String cmpResourceJndiName)
{
--- modules/tjdo/src/xdoclet/modules/triactive/jdo/TJDOSubTask.java.orig 2004-06-30 20:49:02.000000000 +0200
+++ modules/tjdo/src/xdoclet/modules/triactive/jdo/TJDOSubTask.java 2004-06-30 20:41:15.000000000 +0200
@@ -64,7 +64,7 @@
* The version of TJDO. Supported versions are 2.0.
*
* @param version The new Version value
- * @ant.not-required No, default is "2.0".
+ * @ant.not-required "No, default is '2.0'."
*/
public void setVersion(TJDOVersionTypes version)
{