1 5 package xdoclet.modules.jboss.web; 6 7 import xdoclet.XDocletException; 8 9 import xdoclet.XmlSubTask; 10 import xdoclet.modules.jboss.ejb.JBossSubTask; 11 12 29 public class JBossWebXmlSubTask extends XmlSubTask 30 { 31 private final static String JBOSS_WEB_PUBLICID_4_0 = "-//JBoss//DTD Web Application 2.4//EN"; 32 private final static String JBOSS_WEB_PUBLICID_3_2 = "-//JBoss//DTD Web Application 2.3V2//EN"; 33 private final static String JBOSS_WEB_PUBLICID_3_0 = "-//JBoss//DTD Web Application 2.3//EN"; 34 private final static String JBOSS_WEB_PUBLICID_2_4 = "-//JBoss//DTD Web Application 2.2//EN"; 35 36 private final static String JBOSS_WEB_SYSTEMID_4_0 = "http://www.jboss.org/j2ee/dtd/jboss-web_4_0.dtd"; 37 private final static String JBOSS_WEB_SYSTEMID_3_2 = "http://www.jboss.org/j2ee/dtd/jboss-web_3_2.dtd"; 38 private final static String JBOSS_WEB_SYSTEMID_3_0 = "http://www.jboss.org/j2ee/dtd/jboss-web_3_0.dtd"; 39 private final static String JBOSS_WEB_SYSTEMID_2_4 = "http://www.jboss.org/j2ee/dtd/jboss-web.dtd"; 40 41 private final static String JBOSS_WEB_DTD_FILE_NAME_4_0 = "resources/jboss-web_4_0.dtd"; 42 private final static String JBOSS_WEB_DTD_FILE_NAME_3_2 = "resources/jboss-web_3_2.dtd"; 43 private final static String JBOSS_WEB_DTD_FILE_NAME_3_0 = "resources/jboss-web_3_0.dtd"; 44 private final static String JBOSS_WEB_DTD_FILE_NAME_2_4 = "resources/jboss-web.dtd"; 45 46 49 private static String DEFAULT_TEMPLATE_FILE = "resources/jboss_web_xml.xdt"; 50 51 54 private static String GENERATED_FILE_NAME = "jboss-web.xml"; 55 56 59 protected String securityDomain = ""; 60 61 64 protected String contextRoot = ""; 65 66 69 protected String virtualHost = ""; 70 71 74 protected String version = JBossSubTask.JBossVersionTypes.VERSION_3_2; 75 76 79 public JBossWebXmlSubTask() 80 { 81 setTemplateURL(getClass().getResource(DEFAULT_TEMPLATE_FILE)); 82 setDestinationFile(GENERATED_FILE_NAME); 83 } 84 85 90 public String getSecuritydomain() 91 { 92 return securityDomain; 93 } 94 95 100 public String getContextroot() 101 { 102 return contextRoot; 103 } 104 105 110 public String getVirtualhost() 111 { 112 return virtualHost; 113 } 114 115 120 public String getVersion() 121 { 122 return version; 123 } 124 125 130 public void setSecuritydomain(String securityDomain) 131 { 132 this.securityDomain = securityDomain; 133 } 134 135 140 public void setContextroot(String contextRoot) 141 { 142 this.contextRoot = contextRoot; 143 } 144 145 150 public void setVirtualhost(String virtualHost) 151 { 152 this.virtualHost = virtualHost; 153 } 154 155 160 public void setVersion(JBossSubTask.JBossVersionTypes version) 161 { 162 this.version = version.getValue(); 163 } 164 165 public void execute() throws XDocletException 166 { 167 if (getVersion().equals(JBossSubTask.JBossVersionTypes.VERSION_2_4)) { 168 setPublicId(JBOSS_WEB_PUBLICID_2_4); 169 setSystemId(JBOSS_WEB_SYSTEMID_2_4); 170 setDtdURL(getClass().getResource(JBOSS_WEB_DTD_FILE_NAME_2_4)); 171 } 172 else if (getVersion().startsWith(JBossSubTask.JBossVersionTypes.VERSION_3_0)) { 173 setPublicId(JBOSS_WEB_PUBLICID_3_0); 174 setSystemId(JBOSS_WEB_SYSTEMID_3_0); 175 setDtdURL(getClass().getResource(JBOSS_WEB_DTD_FILE_NAME_3_0)); 176 } 177 else if (getVersion().startsWith(JBossSubTask.JBossVersionTypes.VERSION_3_2)) { 178 setPublicId(JBOSS_WEB_PUBLICID_3_2); 179 setSystemId(JBOSS_WEB_SYSTEMID_3_2); 180 setDtdURL(getClass().getResource(JBOSS_WEB_DTD_FILE_NAME_3_2)); 181 } 182 else { 183 setPublicId(JBOSS_WEB_PUBLICID_4_0); 184 setSystemId(JBOSS_WEB_SYSTEMID_4_0); 185 setDtdURL(getClass().getResource(JBOSS_WEB_DTD_FILE_NAME_4_0)); 186 } 187 188 super.execute(); 189 } 190 } 191 | Popular Tags |