KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > xdoclet > modules > ejb > EjbDocletTask


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

5 package xdoclet.modules.ejb;
6
7 import org.apache.tools.ant.BuildException;
8
9 import xdoclet.DocletTask;
10 import xdoclet.util.Translator;
11
12 /**
13  * This task executes various EJB-specific sub-tasks. Make sure to include the jar file containing Sun's javax.ejb.*
14  * classes on the taskdef's classpath.
15  *
16  * @author Ara Abrahamian (ara_e@email.com)
17  * @author Christoph G. Jung (christoph.jung@infor.de)
18  * @created April 30, 2001
19  * @ant.element name="ejbdoclet" display-name="EJB Task"
20  * @version $Revision: 1.13 $
21  */

22 public class EjbDocletTask extends DocletTask
23 {
24     /**
25      * Defaults to EJB 2.0.
26      */

27     private String JavaDoc ejbspec = EjbSpecVersion.EJB_2_0;
28
29     /**
30      * List of suffix strings used when calculating a default bean name from a class.
31      */

32     private String JavaDoc ejbClassNameSuffix = "Bean,EJB,Ejb";
33
34     /**
35      * Gets the EjbSpec attribute of the EjbDocletTask object
36      *
37      * @return The EjbSpec value
38      */

39     public String JavaDoc getEjbSpec()
40     {
41         return ejbspec;
42     }
43
44     /**
45      * Gets the EjbClassNameSuffix attribute of the EjbDocletTask object
46      *
47      * @return The EjbClassNameSuffix value
48      */

49     public String JavaDoc getEjbClassNameSuffix()
50     {
51         return ejbClassNameSuffix;
52     }
53
54     /**
55      * The version of EJB spec ejbdoclet should adhere, currently "1.1", "2.0" and "2.1" defined. If, for example, "2.0"
56      * specified, then ejbdoclet will generate EJB 2.0-compatible ejb-jar.xml file.
57      *
58      * @param ejbspec
59      * @ant.not-required No. Default is "2.0"
60      */

61     public void setEjbSpec(EjbSpecVersion ejbspec)
62     {
63         this.ejbspec = ejbspec.getValue();
64     }
65
66     /**
67      * A comma-separated list of endings which should be removed from the bean class name to generate a bean's name if
68      * no name parameter is specified in the <a HREF="../../../../tags/ejb-tags.html#@ejb.bean">ejb.bean</a> tag.
69      *
70      * @param ejbClassNameSuffix
71      * @ant.not-required No, Default is "Bean,EJB,Ejb"
72      */

73     public void setEjbClassNameSuffix(String JavaDoc ejbClassNameSuffix)
74     {
75         this.ejbClassNameSuffix = ejbClassNameSuffix;
76     }
77
78
79     protected void validateOptions() throws BuildException
80     {
81         super.validateOptions();
82         try {
83             checkClass("javax.ejb.EntityBean");
84         }
85         catch (BuildException ex) {
86             throw new BuildException(Translator.getString(XDocletModulesEjbMessages.class, XDocletModulesEjbMessages.MISSING_J2EE_CLASSES), ex);
87         }
88     }
89
90     /**
91      * @author Ara Abrahamian (ara_e@email.com)
92      * @created July 19, 2001
93      */

94     public static class EjbSpecVersion extends org.apache.tools.ant.types.EnumeratedAttribute
95     {
96         public final static String JavaDoc EJB_1_1 = "1.1";
97
98         public final static String JavaDoc EJB_2_0 = "2.0";
99
100         public final static String JavaDoc EJB_2_1 = "2.1";
101
102         /**
103          * Gets the Values attribute of the EjbSpecVersion object
104          *
105          * @return The Values value
106          */

107         public java.lang.String JavaDoc[] getValues()
108         {
109             return (new java.lang.String JavaDoc[]{
110                 EJB_1_1, EJB_2_0, EJB_2_1
111                 });
112         }
113     }
114
115 }
116
Popular Tags