1 5 package xdoclet.modules.borland.bes.ejb; 6 7 import xdoclet.XDocletException; 8 import xdoclet.XDocletMessages; 9 import xdoclet.modules.ejb.dd.AbstractEjbDeploymentDescriptorSubTask; 10 import xdoclet.util.Translator; 11 12 34 public class BorlandSubTask extends AbstractEjbDeploymentDescriptorSubTask 35 { 36 private final static String BORLAND_DD_FILE_NAME = "ejb-borland.xml"; 37 38 private final static String BORLAND_DD_PUBLICID = 39 "-//Borland Software Corporation//DTD Enterprise JavaBeans 2.0//EN"; 40 41 private final static String BORLAND_DD_SYSTEMID = 42 "http://www.borland.com/devsupport/appserver/dtds/ejb-jar_2_0-borland.dtd"; 43 44 private final static String BORLAND_DTD_FILE_NAME = 45 "resources/ejb-borland_2_0.dtd"; 46 47 private static String DEFAULT_TEMPLATE_FILE = 48 "resources/ejb-borland_2_0.xdt"; 49 50 private String _version = "5.1"; 51 52 private String _datasource = "NO DATA SOURCE!"; 53 54 private String _datasourceMapping = "NO DATASOURCE MAPPING!"; 55 56 private boolean _createTables = false; 57 58 public BorlandSubTask() 59 { 60 setTemplateURL(getClass().getResource(DEFAULT_TEMPLATE_FILE)); 61 setDestinationFile(BORLAND_DD_FILE_NAME); 62 setPublicId(BORLAND_DD_PUBLICID); 63 setSystemId(BORLAND_DD_SYSTEMID); 64 setDtdURL(getClass().getResource(BORLAND_DTD_FILE_NAME)); 65 } 66 67 72 public String getVersion() 73 { 74 return _version; 75 } 76 77 82 public String getCreatetables() 83 { 84 return _createTables ? "True" : "False"; 85 } 86 87 92 public String getDatasource() 93 { 94 return _datasource; 95 } 96 97 98 public String getDatasourceMapping() 99 { 100 return _datasourceMapping; 101 } 102 103 108 public void setVersion(String version) 109 { 110 _version = version; 111 } 112 113 118 public void setCreatetables(boolean flag) 119 { 120 _createTables = flag; 121 } 122 123 128 public void setDatasource(String datasource) 129 { 130 _datasource = datasource; 131 } 132 133 136 public void setDatasourceMapping(String datasourceMapping) 137 { 138 _datasourceMapping = datasourceMapping; 139 } 140 141 146 public void validateOptions() throws XDocletException 147 { 148 } 151 152 157 protected void engineStarted() throws XDocletException 158 { 159 if (getDestinationFile().equals(BORLAND_DD_FILE_NAME)) { 160 System.out.println( 161 Translator.getString( 162 XDocletMessages.class, 163 XDocletMessages.GENERATING_SOMETHING, 164 new String []{BORLAND_DD_FILE_NAME})); 165 } 166 } 167 168 private boolean hasDatasource() 169 { 170 return getDatasource() != null && getDatasource().trim().length() > 0; 171 } 172 173 private boolean hasDatasourceMapping() 174 { 175 return getDatasourceMapping() != null 176 && getDatasourceMapping().trim().length() > 0; 177 } 178 179 } 180 | Popular Tags |