1 5 package xdoclet.modules.objectweb.jonas.web; 6 7 import org.apache.tools.ant.types.EnumeratedAttribute; 8 9 import xdoclet.XDocletException; 10 import xdoclet.XmlSubTask; 11 12 20 public class JonasWebSubTask extends XmlSubTask 21 { 22 25 private final static String DEFAULT_JONAS_DD_FILE_NAME = "jonas-web.xml"; 26 27 30 private final static String DEFAULT_TEMPLATE_FILE = "resources/jonas-web_xml.xdt"; 31 32 35 private final static String JONAS_DTD_FILE_NAME_2_6 36 = "resources/jonas-web-app_2_6.dtd"; 37 38 41 private final static String JONAS_DD_SYSTEMID_2_6 42 = "http://www.objectweb.org/jonas/dtds/jonas-web-app_2_6.dtd"; 43 44 47 private final static String JONAS_DD_PUBLICID_2_6 48 = "-//ObjectWeb//DTD JOnAS Web App 2.6//EN"; 49 50 53 private String version = JonasVersionTypes.DEFAULT_VERSION; 54 55 58 private String host = null; 59 60 63 private String contextRoot = null; 64 65 68 public JonasWebSubTask() 69 { 70 setTemplateURL(getClass().getResource(DEFAULT_TEMPLATE_FILE)); 71 setDestinationFile(DEFAULT_JONAS_DD_FILE_NAME); 72 } 73 74 79 public String getContextroot() 80 { 81 return contextRoot; 82 } 83 84 89 public String getHost() 90 { 91 return host; 92 } 93 94 99 public String getVersion() 100 { 101 return version; 102 } 103 104 110 public void setContextroot(String contextRoot) 111 { 112 this.contextRoot = contextRoot; 113 } 114 115 121 public void setHost(String host) 122 { 123 this.host = host; 124 } 125 126 132 public void setVersion(JonasVersionTypes version) 133 { 134 this.version = version.getValue(); 135 } 136 137 public void execute() throws XDocletException 138 { 139 if (getVersion().equals(JonasVersionTypes.VERSION_2_6)) { 140 if (getPublicId() == null) 141 setPublicId(JONAS_DD_PUBLICID_2_6); 142 if (getSystemId() == null) 143 setSystemId(JONAS_DD_SYSTEMID_2_6); 144 if (getDtdURL() == null) 145 setDtdURL(getClass().getResource(JONAS_DTD_FILE_NAME_2_6)); 146 } 147 startProcess(); 148 } 149 150 152 158 public static class JonasVersionTypes extends EnumeratedAttribute 159 { 160 public final static String VERSION_2_6 = "2.6"; 161 public final static String DEFAULT_VERSION = VERSION_2_6; 162 163 168 public String [] getValues() 169 { 170 return (new String []{VERSION_2_6}); 171 } 172 } 173 174 } 175 | Popular Tags |