KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > xdoclet > modules > apache > soap > ejb > ApacheSoapSubTask


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

5 package xdoclet.modules.apache.soap.ejb;
6
7
8 import org.apache.tools.ant.types.Path;
9
10 import xdoclet.XDocletException;
11 import xdoclet.XDocletMessages;
12 import xdoclet.XmlSubTask;
13
14 import xdoclet.util.Translator;
15
16 /**
17  * @author Ara Abrahamian (ara_e@email.com)
18  * @created Oct 15, 2001
19  * @ant.element display-name="Apache SOAP" name="apachesoap" parent="xdoclet.modules.ejb.EjbDocletTask"
20  * @version $Revision: 1.10 $
21  * @xdoclet.merge-file file="soap-mappings-{0}.xml" relates-to="soap-dds-{0}.xml" description="An XML document
22  * containing the optional isd:mappings element."
23  */

24 public class ApacheSoapSubTask extends XmlSubTask
25 {
26     private final static String JavaDoc SOAP_SCHEMA = "http://xml.apache.org/xml-soap/deployment";
27
28     private static String JavaDoc DEFAULT_TEMPLATE_FILE = "resources/apache-soap.xdt";
29
30     private static String JavaDoc GENERATED_FILE_NAME = "soap-dds-{0}.xml";
31     protected String JavaDoc statelessSessionEjbProvider = "org.apache.soap.providers.StatelessEJBProvider";
32
33     protected String JavaDoc statefulSessionEjbProvider = "org.apache.soap.providers.StatefulEJBProvider";
34
35     protected String JavaDoc entityEjbProvider = "org.apache.soap.providers.EntityEJBProvider";
36
37     protected Path providerClasspath;
38
39     protected String JavaDoc contextProviderUrl = "";
40
41     protected String JavaDoc contextFactoryName = "";
42
43     /**
44      * Describe what the ApacheSoapSubTask constructor does
45      */

46     public ApacheSoapSubTask()
47     {
48         setTemplateURL(getClass().getResource(DEFAULT_TEMPLATE_FILE));
49         setDestinationFile(GENERATED_FILE_NAME);
50         setSchema(SOAP_SCHEMA);
51         setHavingClassTag("soap:service");
52         setValidateXML(false);
53
54         //setPublicId( APACHE_SOAP_PUBLICID );
55
//setDtdURL(getClass().getResource( APACHE_SOAP_DTD_FILE_NAME_2_3 ));
56
}
57
58     /**
59      * Gets the StatelessSessionEjbProvider attribute of the ApacheSoapSubTask object
60      *
61      * @return The StatelessSessionEjbProvider value
62      */

63     public String JavaDoc getStatelessSessionEjbProvider()
64     {
65         return statelessSessionEjbProvider;
66     }
67
68     /**
69      * Gets the StatefulSessionEjbProvider attribute of the ApacheSoapSubTask object
70      *
71      * @return The StatefulSessionEjbProvider value
72      */

73     public String JavaDoc getStatefulSessionEjbProvider()
74     {
75         return statefulSessionEjbProvider;
76     }
77
78     /**
79      * Gets the EntityEjbProvider attribute of the ApacheSoapSubTask object
80      *
81      * @return The EntityEjbProvider value
82      */

83     public String JavaDoc getEntityEjbProvider()
84     {
85         return entityEjbProvider;
86     }
87
88     /**
89      * Gets the ProviderClasspath attribute of the ApacheSoapSubTask object
90      *
91      * @return The ProviderClasspath value
92      */

93     public Path getProviderClasspath()
94     {
95         return providerClasspath;
96     }
97
98     /**
99      * Gets the ContextProviderUrl attribute of the ApacheSoapSubTask object
100      *
101      * @return The ContextProviderUrl value
102      */

103     public String JavaDoc getContextProviderUrl()
104     {
105         return contextProviderUrl;
106     }
107
108     /**
109      * Gets the ContextFactoryName attribute of the ApacheSoapSubTask object
110      *
111      * @return The ContextFactoryName value
112      */

113     public String JavaDoc getContextFactoryName()
114     {
115         return contextFactoryName;
116     }
117
118     /**
119      * Sets the StatelessSessionEjbProvider attribute of the ApacheSoapSubTask object
120      *
121      * @param statelessSessionEjbProvider The new StatelessSessionEjbProvider value
122      */

123     public void setStatelessSessionEjbProvider(String JavaDoc statelessSessionEjbProvider)
124     {
125         this.statelessSessionEjbProvider = statelessSessionEjbProvider;
126     }
127
128     /**
129      * Sets the StatefulSessionEjbProvider attribute of the ApacheSoapSubTask object
130      *
131      * @param statefulSessionEjbProvider The new StatefulSessionEjbProvider value
132      */

133     public void setStatefulSessionEjbProvider(String JavaDoc statefulSessionEjbProvider)
134     {
135         this.statefulSessionEjbProvider = statefulSessionEjbProvider;
136     }
137
138     /**
139      * Sets the EntityEjbProvider attribute of the ApacheSoapSubTask object
140      *
141      * @param entityEjbProvider The new EntityEjbProvider value
142      */

143     public void setEntityEjbProvider(String JavaDoc entityEjbProvider)
144     {
145         this.entityEjbProvider = entityEjbProvider;
146     }
147
148     /**
149      * Sets the Providerclasspath attribute of the ApacheSoapSubTask object
150      *
151      * @param providerClasspath The new Providerclasspath value
152      */

153     public void setProviderclasspath(Path providerClasspath)
154     {
155         this.providerClasspath = providerClasspath;
156     }
157
158     /**
159      * Sets the ContextProviderUrl attribute of the ApacheSoapSubTask object. The ContextProviderUrl is the URL
160      * associated with the JNDI context provider used when looking up an EJB's home interface.
161      *
162      * @param contextProviderUrl The new ContextProviderUrl value
163      */

164     public void setContextProviderUrl(String JavaDoc contextProviderUrl)
165     {
166         this.contextProviderUrl = contextProviderUrl;
167     }
168
169     /**
170      * Sets the ContextFactoryName attribute of the ApacheSoapSubTask object. The ContextFactoryName is the name of the
171      * JNDI context factory used when looking up an EJB's home interface.
172      *
173      * @param contextFactoryName The new ContextFactoryName value
174      */

175     public void setContextFactoryName(String JavaDoc contextFactoryName)
176     {
177         this.contextFactoryName = contextFactoryName;
178     }
179
180     /**
181      * Called to validate configuration parameters.
182      *
183      * @exception XDocletException Description of Exception
184      * @msg.bundle id="parameter_missing_or_empty" msg="parameter is missing or empty."
185      */

186     public void validateOptions() throws XDocletException
187     {
188         super.validateOptions();
189
190         if (getStatelessSessionEjbProvider() == null || getStatelessSessionEjbProvider().trim().equals("")) {
191             throw new XDocletException(Translator.getString(XDocletMessages.class, XDocletMessages.PARAMETER_MISSING_OR_EMPTY,
192                 new String JavaDoc[]{"statelessSessionEjbProvider"}));
193         }
194
195         if (getStatefulSessionEjbProvider() == null || getStatefulSessionEjbProvider().trim().equals("")) {
196             throw new XDocletException(Translator.getString(XDocletMessages.class, XDocletMessages.PARAMETER_MISSING_OR_EMPTY,
197                 new String JavaDoc[]{"statefulSessionEjbProvider"}));
198         }
199
200         if (getEntityEjbProvider() == null || getEntityEjbProvider().trim().equals("")) {
201             throw new XDocletException(Translator.getString(XDocletMessages.class, XDocletMessages.PARAMETER_MISSING_OR_EMPTY,
202                 new String JavaDoc[]{"entityEjbProvider"}));
203         }
204     }
205
206     /**
207      * Describe what the method does
208      *
209      * @exception XDocletException Describe the exception
210      */

211     protected void engineStarted() throws XDocletException
212     {
213         String JavaDoc service_urn = getCurrentClass().getDoc().getTag("soap:service").getValue();
214         String JavaDoc dest_file_name = getDestinationFile();
215
216         System.out.println(Translator.getString(XDocletModulesApacheSoapEjbMessages.class, XDocletModulesApacheSoapEjbMessages.GENERATING_DD,
217             new String JavaDoc[]{getCurrentClass().getQualifiedName(), service_urn, dest_file_name}));
218     }
219 }
220
Popular Tags