KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > xdoclet > modules > pramati > ejb > PramatiSubTask


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

5 package xdoclet.modules.pramati.ejb;
6
7 import xdoclet.XDocletException;
8 import xdoclet.XDocletMessages;
9 import xdoclet.modules.ejb.dd.AbstractEjbDeploymentDescriptorSubTask;
10 import xdoclet.util.Translator;
11
12 /**
13  * Generates Pramati deployment files
14  *
15  * @author <a HREF="mailto:plightbo@hotmail.com">Patrick Lightbody</a>
16  * @created Feb 21, 2002
17  * @ant.element display-name="Pramati" name="pramati" parent="xdoclet.modules.ejb.EjbDocletTask"
18  */

19 public class PramatiSubTask extends AbstractEjbDeploymentDescriptorSubTask
20 {
21     private final static String JavaDoc PRAMATI_DEFAULT_TEMPLATE_FILE = "resources/pramati.xdt";
22
23     private final static String JavaDoc PRAMATI_DD_FILE_NAME = "pramati-j2ee-server.xml";
24
25     private final static String JavaDoc PRAMATI_OR_DEFAULT_TEMPLATE_FILE = "resources/pramati-or-map.xdt";
26
27     private final static String JavaDoc PRAMATI_OR_DD_FILE_NAME = "pramati-or-map.xml";
28
29     private String JavaDoc _version = "3.0";
30
31     private String JavaDoc _dataSource = "";
32
33     private String JavaDoc _jarName = "";
34
35     /**
36      * Gets the Datasource attribute of the PramatiSubTask object
37      *
38      * @return The Datasource value
39      */

40     public String JavaDoc getDatasource()
41     {
42         return _dataSource;
43     }
44
45     /**
46      * Gets the Version attribute of the PramatiSubTask object
47      *
48      * @return The Version value
49      */

50     public String JavaDoc getVersion()
51     {
52         return _version;
53     }
54
55     /**
56      * Gets the JarName attribute of the PramatiSubTask object
57      *
58      * @return The JarName value
59      */

60     public String JavaDoc getJarName()
61     {
62         return _jarName;
63     }
64
65     /**
66      * Sets the Datasource attribute of the PramatiSubTask object
67      *
68      * @param new_data_source The new Datasource value
69      */

70     public void setDatasource(String JavaDoc new_data_source)
71     {
72         _dataSource = new_data_source;
73     }
74
75     /**
76      * Sets the Version attribute of the PramatiSubTask object
77      *
78      * @param version The new Version value
79      */

80     public void setVersion(String JavaDoc version)
81     {
82         _version = version;
83     }
84
85     /**
86      * Sets the JarName attribute of the PramatiSubTask object
87      *
88      * @param jarName The new JarName value
89      */

90     public void setJarName(String JavaDoc jarName)
91     {
92         this._jarName = jarName;
93     }
94
95     /**
96      * Called to validate configuration parameters.
97      *
98      * @exception XDocletException Description of Exception
99      */

100     public void validateOptions() throws XDocletException
101     {
102         // Overridden, as the template url & destination file are set later in execute()
103
//
104
// super.validateOptions();
105
}
106
107     /**
108      * Describe what the method does
109      *
110      * @exception XDocletException Describe the exception
111      */

112     public void execute() throws XDocletException
113     {
114         setTemplateURL(getClass().getResource(PRAMATI_DEFAULT_TEMPLATE_FILE));
115         setDestinationFile(PRAMATI_DD_FILE_NAME);
116
117         startProcess();
118
119         if (atLeastOneCmpEntityBeanExists()) {
120             setTemplateURL(getClass().getResource(PRAMATI_OR_DEFAULT_TEMPLATE_FILE));
121             setDestinationFile(PRAMATI_OR_DD_FILE_NAME);
122             startProcess();
123         }
124     }
125
126     /**
127      * Describe what the method does
128      *
129      * @exception XDocletException Describe the exception
130      */

131     protected void engineStarted() throws XDocletException
132     {
133         if (getDestinationFile().equals(PRAMATI_DD_FILE_NAME)) {
134             System.out.println(Translator.getString(XDocletMessages.class, XDocletMessages.GENERATING_SOMETHING, new String JavaDoc[]{PRAMATI_DD_FILE_NAME}));
135         }
136         else if (getDestinationFile().equals(PRAMATI_OR_DD_FILE_NAME)) {
137             System.out.println(Translator.getString(XDocletMessages.class, XDocletMessages.GENERATING_SOMETHING, new String JavaDoc[]{PRAMATI_OR_DD_FILE_NAME}));
138         }
139     }
140 }
141
Popular Tags