KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > xdoclet > modules > sybase > easerver > ejb > EAServerSubTask


1 /*
2  * Copyright (c) 2001, 2002 The XDoclet team
3  * All rights reserved.
4  */

5 package xdoclet.modules.sybase.easerver.ejb;
6
7 import org.apache.commons.logging.Log;
8
9 import xdoclet.XDocletException;
10 import xdoclet.XDocletMessages;
11 import xdoclet.modules.ejb.dd.AbstractEjbDeploymentDescriptorSubTask;
12 import xdoclet.util.LogUtil;
13 import xdoclet.util.Translator;
14
15 /**
16  * Generates configuration files for EJB jars in EAServer 4.1+
17  *
18  * @author <a HREF="mailto:stevensa@users.sourceforge.net">Andrew Stevens</a>
19  * @created August 15, 2002
20  * @ant.element display-name="EAServer" name="easerver" parent="xdoclet.modules.ejb.EjbDocletTask"
21  * @version $Revision: 1.5 $
22  * @xdoclet.merge-file file="easerver-ejb-macros.ent" relates-to="sybase-easerver-config.xml" description="An XML
23  * unparsed entity containing macro elements (e.g. defining property values)."
24  * @xdoclet.merge-file file="easerver-{0}.ent" relates-to="sybase-easerver-config.xml" description="An XML unparsed
25  * entity containing configure elements for a bean."
26  * @xdoclet.merge-file file="easerver-ejb-config.ent" relates-to="sybase-easerver-config.xml" description="An XML
27  * unparsed entity containing additional configure elements e.g. for beans not processed by XDoclet."
28  * @xdoclet.merge-file file="easerver-ejb-custom.xdt" relates-to="sybase-easerver-config.xml" description="Insertion
29  * point for custom template code which generates additional macro and configure elements."
30  */

31 public class EAServerSubTask extends AbstractEjbDeploymentDescriptorSubTask
32 {
33     /**
34      * The default template file - sybase-easerver-config_xml.xdt
35      */

36     private final static String JavaDoc DEFAULT_TEMPLATE_FILE = "resources/sybase-easerver-config_xml.xdt";
37
38     /**
39      * The generated file name - sybase-easerver-config.xml
40      */

41     private final static String JavaDoc GENERATED_FILE_NAME = "sybase-easerver-config.xml";
42
43     /**
44      * Public ID of the Jaguar-specific DD's DTD.
45      */

46     private final static String JavaDoc JAGUAR_DD_PUBLICID = "-//Sybase, Inc.//DTD EAServer configuration 1.0//EN";
47
48     /**
49      * System ID of the Jaguar-specific DD's DTD.
50      */

51     private final static String JavaDoc JAGUAR_DD_SYSTEMID = "http://www.sybase.com/dtds/easerver/sybase-easerver-config_1_0.dtd";
52
53     /**
54      * Path to the local copy of the Jaguar-specific DD's DTD.
55      */

56     private final static String JavaDoc JAGUAR_DD_DTD_FILE_NAME = "resources/sybase-easerver-config_1_0.dtd";
57
58     /**
59      * Name of the Jaguar Package in the Repository that the EJBs will be deployed to.
60      */

61     private String JavaDoc packageName = null;
62
63     /**
64      * Description of the Jaguar Package in the Repository.
65      */

66     private String JavaDoc packageDescription = null;
67
68     /**
69      * The Jaguar version.
70      */

71     private String JavaDoc version = EAServerVersionTypes.VERSION_4_1;
72
73     public EAServerSubTask()
74     {
75         setTemplateURL(getClass().getResource(DEFAULT_TEMPLATE_FILE));
76         setDestinationFile(GENERATED_FILE_NAME);
77         setPublicId(JAGUAR_DD_PUBLICID);
78         setSystemId(JAGUAR_DD_SYSTEMID);
79         setDtdURL(getClass().getResource(JAGUAR_DD_DTD_FILE_NAME));
80         setValidateXML(true);
81     }
82
83     /**
84      * Return the Jaguar version.
85      *
86      * @return The Jaguar version
87      */

88     public String JavaDoc getVersion()
89     {
90         return version;
91     }
92
93     /**
94      * Return the Jaguar Package name.
95      *
96      * @return The PackageName value
97      */

98     public String JavaDoc getPackageName()
99     {
100         return packageName;
101     }
102
103     /**
104      * Return the Jaguar Package description.
105      *
106      * @return The PackageDescription value
107      */

108     public String JavaDoc getPackageDescription()
109     {
110         return packageDescription;
111     }
112
113     /**
114      * Set the Jaguar version.
115      *
116      * @param version The new Version value
117      */

118     public void setVersion(String JavaDoc version)
119     {
120         this.version = version;
121     }
122
123     /**
124      * Set the Jaguar Package name.
125      *
126      * @param packageName The new Security Domain value
127      * @ant.required Yes
128      */

129     public void setPackageName(String JavaDoc packageName)
130     {
131         this.packageName = packageName;
132     }
133
134     /**
135      * Set the Jaguar Package description.
136      *
137      * @param packageDescription The new PackageDescription value
138      */

139     public void setPackageDescription(String JavaDoc packageDescription)
140     {
141         this.packageDescription = packageDescription;
142     }
143
144     /**
145      * Called to validate configuration parameters.
146      *
147      * @exception XDocletException Description of Exception
148      */

149     public void validateOptions() throws XDocletException
150     {
151         super.validateOptions();
152
153         Log log = LogUtil.getLog(EAServerSubTask.class, "validateOptions");
154
155         log.debug("packageName = " + getPackageName());
156         if (getPackageName() == null || getPackageName().equals("")) {
157             throw new XDocletException(Translator.getString(XDocletMessages.class, XDocletMessages.PARAMETER_MISSING_OR_EMPTY, new String JavaDoc[]{"packageName"}));
158         }
159     }
160
161     // override execute method?
162

163     /**
164      * @created 23 August 2002
165      */

166     public static class EAServerVersionTypes extends org.apache.tools.ant.types.EnumeratedAttribute
167     {
168         public final static String JavaDoc VERSION_4_1 = "4.1";
169
170         /**
171          * Gets the Values attribute of the EAServerVersionTypes object
172          *
173          * @return The Values value
174          */

175         public String JavaDoc[] getValues()
176         {
177             return (new String JavaDoc[]{VERSION_4_1});
178         }
179     }
180
181 }
182
Popular Tags