1 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 24 public class ApacheSoapSubTask extends XmlSubTask 25 { 26 private final static String SOAP_SCHEMA = "http://xml.apache.org/xml-soap/deployment"; 27 28 private static String DEFAULT_TEMPLATE_FILE = "resources/apache-soap.xdt"; 29 30 private static String GENERATED_FILE_NAME = "soap-dds-{0}.xml"; 31 protected String statelessSessionEjbProvider = "org.apache.soap.providers.StatelessEJBProvider"; 32 33 protected String statefulSessionEjbProvider = "org.apache.soap.providers.StatefulEJBProvider"; 34 35 protected String entityEjbProvider = "org.apache.soap.providers.EntityEJBProvider"; 36 37 protected Path providerClasspath; 38 39 protected String contextProviderUrl = ""; 40 41 protected String contextFactoryName = ""; 42 43 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 } 57 58 63 public String getStatelessSessionEjbProvider() 64 { 65 return statelessSessionEjbProvider; 66 } 67 68 73 public String getStatefulSessionEjbProvider() 74 { 75 return statefulSessionEjbProvider; 76 } 77 78 83 public String getEntityEjbProvider() 84 { 85 return entityEjbProvider; 86 } 87 88 93 public Path getProviderClasspath() 94 { 95 return providerClasspath; 96 } 97 98 103 public String getContextProviderUrl() 104 { 105 return contextProviderUrl; 106 } 107 108 113 public String getContextFactoryName() 114 { 115 return contextFactoryName; 116 } 117 118 123 public void setStatelessSessionEjbProvider(String statelessSessionEjbProvider) 124 { 125 this.statelessSessionEjbProvider = statelessSessionEjbProvider; 126 } 127 128 133 public void setStatefulSessionEjbProvider(String statefulSessionEjbProvider) 134 { 135 this.statefulSessionEjbProvider = statefulSessionEjbProvider; 136 } 137 138 143 public void setEntityEjbProvider(String entityEjbProvider) 144 { 145 this.entityEjbProvider = entityEjbProvider; 146 } 147 148 153 public void setProviderclasspath(Path providerClasspath) 154 { 155 this.providerClasspath = providerClasspath; 156 } 157 158 164 public void setContextProviderUrl(String contextProviderUrl) 165 { 166 this.contextProviderUrl = contextProviderUrl; 167 } 168 169 175 public void setContextFactoryName(String contextFactoryName) 176 { 177 this.contextFactoryName = contextFactoryName; 178 } 179 180 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 []{"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 []{"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 []{"entityEjbProvider"})); 203 } 204 } 205 206 211 protected void engineStarted() throws XDocletException 212 { 213 String service_urn = getCurrentClass().getDoc().getTag("soap:service").getValue(); 214 String dest_file_name = getDestinationFile(); 215 216 System.out.println(Translator.getString(XDocletModulesApacheSoapEjbMessages.class, XDocletModulesApacheSoapEjbMessages.GENERATING_DD, 217 new String []{getCurrentClass().getQualifiedName(), service_urn, dest_file_name})); 218 } 219 } 220 | Popular Tags |