1 5 package xdoclet.modules.hibernate; 6 7 import java.util.Collection ; 8 9 import xdoclet.XDocletException; 10 11 import xdoclet.XmlSubTask; 12 13 import xdoclet.util.Translator; 14 29 public class JBossServiceSubTask 30 extends XmlSubTask implements HibernateProperties 31 { 32 33 36 private static String DEFAULT_TEMPLATE_FILE = "resources/jboss-service.xdt"; 37 38 41 private static String GENERATED_SERVICE_FILE_NAME = "jboss-service.xml"; 42 43 private String _jndiName = null; 44 private String _dataSource = null; 45 private String _dialect = null; 46 private String _serviceName = null; 47 private boolean _useOuterJoin = false; 48 private boolean _showSql = false; 49 private String _userName = null; 50 private String _password = null; 51 private String _userTransactionName = null; 52 private String _transactionStrategy = null; 53 private String _cacheProvider = null; 54 private String _depends = null; 55 56 private String _transactionManagerStrategy = null; 57 private String _maxFetchDepth = null; 58 private String _jdbcFetchSize = null; 59 private String _useQueryCache = null; 60 private String _querySubstitutions = null; 61 private String _defaultSchema = null; 62 private String _autoCreate = null; 63 private String _version = "2.1"; 64 65 68 public JBossServiceSubTask() 69 { 70 setSubTaskName("jbossservice"); 71 setHavingClassTag("hibernate.class"); 72 setTemplateURL(getClass().getResource(DEFAULT_TEMPLATE_FILE)); 73 setDestinationFile(GENERATED_SERVICE_FILE_NAME); 74 } 75 76 public String getTransactionManagerStrategy() 77 { 78 return _transactionManagerStrategy; 79 } 80 81 public String getUserTransactionName() 82 { 83 return _userTransactionName; 84 } 85 86 public String getTransactionStrategy() 87 { 88 return _transactionStrategy; 89 } 90 91 public String getCacheProvider() 92 { 93 return _cacheProvider; 94 } 95 96 public String getDepends() 97 { 98 return _depends; 99 } 100 101 public String getUserName() 102 { 103 return _userName; 104 } 105 106 public String getPassword() 107 { 108 return _password; 109 } 110 111 public boolean getUseOuterJoin() 112 { 113 return _useOuterJoin; 114 } 115 116 public boolean getShowSql() 117 { 118 return _showSql; 119 } 120 121 126 public String getServiceName() 127 { 128 return _serviceName; 129 } 130 131 public String getJndiName() 132 { 133 return _jndiName; 134 } 135 136 public String getDataSource() 137 { 138 return _dataSource; 139 } 140 141 public String getDialect() 142 { 143 return _dialect; 144 } 145 146 public String getAutoCreate() 147 { 148 return _autoCreate; 149 } 150 151 public String getDriver() 152 { 153 throw new UnsupportedOperationException ("JBossServiceSubTask does not have a Driver attribute."); 154 } 155 156 public String getJdbcUrl() 157 { 158 throw new UnsupportedOperationException ("JBossServiceSubTask does not have a jdbcUrl attribute."); 159 } 160 161 public String getPoolSize() 162 { 163 throw new UnsupportedOperationException ("JBossServiceSubTask does not have a poolSize attribute."); 164 } 165 166 public Collection getJndiProperties() 167 { 168 throw new UnsupportedOperationException ("JBossServiceSubTask does not have a jndiProperties attribute."); 169 } 170 171 public Collection getOtherProperties() 172 { 173 throw new UnsupportedOperationException ("JBossServiceSubTask does not have an otherProperties attribute."); 174 } 175 176 public Collection getOtherMappings() 177 { 178 throw new UnsupportedOperationException ("JBossServiceSubTask does not have an otherMappings attribute."); 179 } 180 181 184 public String getDefaultSchema() 185 { 186 return _defaultSchema; 187 } 188 189 192 public String getJdbcFetchSize() 193 { 194 return _jdbcFetchSize; 195 } 196 197 200 public String getMaxFetchDepth() 201 { 202 return _maxFetchDepth; 203 } 204 205 208 public String getQuerySubstitutions() 209 { 210 return _querySubstitutions; 211 } 212 213 216 public String getUseQueryCache() 217 { 218 return _useQueryCache; 219 } 220 221 public String getVersion() 222 { 223 return _version; 224 } 225 226 233 public void setAutoCreate(String autoCreate) 234 { 235 _autoCreate = autoCreate; 236 } 237 238 244 public void setTransactionManagerStrategy(String transactionManagerStrategy) 245 { 246 _transactionManagerStrategy = transactionManagerStrategy; 247 } 248 249 255 public void setUserTransactionName(String userTransactionName) 256 { 257 _userTransactionName = userTransactionName; 258 } 259 260 266 public void setTransactionStrategy(String transactionStrategy) 267 { 268 _transactionStrategy = transactionStrategy; 269 } 270 271 277 public void setCacheProvider(String cacheProvider) 278 { 279 _cacheProvider = cacheProvider; 280 } 281 282 288 public void setDepends(String depends) 289 { 290 _depends = depends; 291 } 292 293 299 public void setUserName(String userName) 300 { 301 _userName = userName; 302 } 303 304 310 public void setPassword(String password) 311 { 312 _password = password; 313 } 314 315 321 public void setUseOuterJoin(boolean useOuterJoin) 322 { 323 _useOuterJoin = useOuterJoin; 324 } 325 326 332 public void setShowSql(boolean showSql) 333 { 334 _showSql = showSql; 335 } 336 337 341 public void setServiceName(String serviceName) 342 { 343 _serviceName = serviceName; 344 } 345 346 352 public void setJndiName(String jndiName) 353 { 354 _jndiName = jndiName; 355 } 356 357 364 public void setDataSource(String dataSource) 365 { 366 _dataSource = dataSource; 367 } 368 369 377 public void setDialect(String dialect) 378 { 379 _dialect = dialect; 380 } 381 382 388 public void setDefaultSchema(String string) 389 { 390 _defaultSchema = string; 391 } 392 393 399 public void setJdbcFetchSize(String string) 400 { 401 _jdbcFetchSize = string; 402 } 403 404 410 public void setMaxFetchDepth(String string) 411 { 412 _maxFetchDepth = string; 413 } 414 415 421 public void setQuerySubstitutions(String string) 422 { 423 _querySubstitutions = string; 424 } 425 426 432 public void setUseQueryCache(String string) 433 { 434 _useQueryCache = string; 435 } 436 437 444 public void setVersion(String version) 445 { 446 _version = version; 447 } 448 449 450 public void validateOptions() throws XDocletException 451 { 452 super.validateOptions(); 453 454 if (getJndiName() == null) { 455 throw new XDocletException(Translator.getString(XDocletModulesHibernateMessages.class, 456 XDocletModulesHibernateMessages.JNDI_NAME_REQUIRED)); 457 } 458 459 if (getServiceName() == null) { 460 throw new XDocletException(Translator.getString(XDocletModulesHibernateMessages.class, 461 XDocletModulesHibernateMessages.SERVICE_NAME_REQUIRED)); 462 } 463 } 464 465 470 protected void engineStarted() throws XDocletException 471 { 472 System.out.println(Translator.getString(XDocletModulesHibernateMessages.class, 473 XDocletModulesHibernateMessages.GENERATING_JBOSS_SERVICE_DESCRIPTOR)); 474 } 475 } 476 | Popular Tags |