1 13 14 package org.ejbca.appserver.jboss; 15 16 import java.util.Properties ; 17 18 import org.apache.commons.lang.StringUtils; 19 import org.ejbca.ui.tcp.CmpTcpConfiguration; 20 import org.ejbca.ui.tcp.CmpTcpServer; 21 import org.jboss.system.ServiceMBeanSupport; 22 23 26 public class CmpTcpService extends ServiceMBeanSupport implements CmpTcpServiceMBean 27 { 28 29 32 private String allowRaVerifyPopo = "false"; 33 34 private String defaultCA = null; 35 36 private String extractUsernameComponent = null; 37 38 39 private String operationMode = "normal"; 40 41 private String eeProfile = "EMTPTY"; 42 43 private String certProfile = "ENDUSER"; 44 45 private String caName = "AdminCA1"; 46 47 private String responseProtection = null; 48 49 private String raAuthenticationSecret = null; 50 private String raNameGenerationParameters = "CN"; private String raModeNameGenerationScheme = "DN"; 52 private String prefix = null; 53 private String postfix = null; 54 55 private String portNo = "829"; 56 private String logDir = "./log"; 57 private String confFile = ""; 58 59 public String getName() 60 { 61 return "CmpTcpService"; 62 } 63 64 public void startService() throws Exception 65 { 66 Properties properties = new Properties (); 67 String str = getAllowRaVerifyPopo(); 68 if (StringUtils.equals("true", str)) { 69 log.debug("allowRAVerifyPopo=true"); 70 properties.setProperty("allowRaVerifyPopo", "true"); 71 } 72 str = getDefaultCA(); 73 log.debug("defaultCA="+str); 74 if (StringUtils.isNotEmpty(str)) { 75 properties.setProperty("defaultCA", str); 76 } 77 str = getExtractUsernameComponent(); 78 log.debug("extractUsernameComponent="+str); 79 if (StringUtils.isNotEmpty(str)) { 80 properties.setProperty("extractUsernameComponent", str); 81 } 82 str = getOperationMode(); 83 log.debug("operationMode="+str); 84 if (StringUtils.isNotEmpty(str)) { 85 properties.setProperty("operationMode", str); 86 } 87 str = getRaModeNameGenerationScheme(); 88 log.debug("raModeNameGenerationScheme="+str); 89 if (StringUtils.isNotEmpty(str)) { 90 properties.setProperty("raModeNameGenerationScheme", str); 91 } 92 str = getRaNameGenerationParameters(); 93 log.debug("raModeNameGenerationParameters="+str); 94 if (StringUtils.isNotEmpty(str)) { 95 properties.setProperty("raModeNameGenerationParameters", str); 96 } 97 str = getPrefix(); 98 log.debug("raModeNameGenerationPrefix="+str); 99 if (StringUtils.isNotEmpty(str)) { 100 properties.setProperty("raModeNameGenerationPrefix", str); 101 } 102 str = getPostfix(); 103 log.debug("raModeNameGenerationPostfix="+str); 104 if (StringUtils.isNotEmpty(str)) { 105 properties.setProperty("raModeNameGenerationPostfix", str); 106 } 107 108 str = getResponseProtection(); 109 if (StringUtils.isNotEmpty(str)) { 110 log.debug("responseProtection="+str); 111 properties.setProperty("responseProtection", str); 112 } 113 str = getRaAuthenticationSecret(); 114 if (StringUtils.isNotEmpty(str)) { 115 log.debug("raAuthenticationSecret is not null"); 116 properties.setProperty("raAuthenticationSecret", str); 117 } 118 str = getEeProfile(); 119 if (StringUtils.isNotEmpty(str)) { 120 log.debug("endEntityProfile="+str); 121 properties.setProperty("endEntityProfile", str); 122 } 123 str = getCertProfile(); 124 if (StringUtils.isNotEmpty(str)) { 125 log.debug("certificateProfile="+str); 126 properties.setProperty("certificateProfile", str); 127 } 128 str = getCaName(); 129 if (StringUtils.isNotEmpty(str)) { 130 log.debug("caName="+str); 131 properties.setProperty("caName", str); 132 } 133 str = getPortNo(); 134 if (StringUtils.isNotEmpty(str)) { 135 log.debug("portNo="+str); 136 properties.setProperty("portNo", str); 137 } 138 str = getLogDir(); 139 if (StringUtils.isNotEmpty(str)) { 140 log.debug("logDir="+str); 141 properties.setProperty("logDir", str); 142 } 143 str = getConfFile(); 144 if (StringUtils.isNotEmpty(str)) { 145 log.debug("confFile="+str); 146 properties.setProperty("confFile", str); 147 } 148 149 CmpTcpConfiguration.instance().init(properties); 150 CmpTcpServer.start(); 151 } 152 153 public void stopService() 154 { 155 CmpTcpServer.stop(); 156 } 157 158 public String getAllowRaVerifyPopo() { 159 return allowRaVerifyPopo; 160 } 161 162 public void setAllowRaVerifyPopo(String allowRaVerifyPopo) { 163 this.allowRaVerifyPopo = allowRaVerifyPopo; 164 } 165 166 public String getCaName() { 167 return caName; 168 } 169 170 public void setCaName(String caName) { 171 this.caName = caName; 172 } 173 174 public String getCertProfile() { 175 return certProfile; 176 } 177 178 public void setCertProfile(String certProfile) { 179 this.certProfile = certProfile; 180 } 181 182 public String getDefaultCA() { 183 return defaultCA; 184 } 185 186 public void setDefaultCA(String defaultCA) { 187 this.defaultCA = defaultCA; 188 } 189 190 public String getRaModeNameGenerationScheme() { 191 return raModeNameGenerationScheme; 192 } 193 194 public void setRaModeNameGenerationScheme(String generatorComponent) { 195 raModeNameGenerationScheme = generatorComponent; 196 } 197 198 public String getEeProfile() { 199 return eeProfile; 200 } 201 202 public void setEeProfile(String eeProfile) { 203 this.eeProfile = eeProfile; 204 } 205 206 public String getExtractUsernameComponent() { 207 return extractUsernameComponent; 208 } 209 210 public void setExtractUsernameComponent(String extractUsernameComponent) { 211 this.extractUsernameComponent = extractUsernameComponent; 212 } 213 214 public String getRaNameGenerationParameters() { 215 return raNameGenerationParameters; 216 } 217 218 public void setRaNameGenerationParameters(String mode) { 219 this.raNameGenerationParameters = mode; 220 } 221 222 public String getPostfix() { 223 return postfix; 224 } 225 226 public void setPostfix(String postfix) { 227 this.postfix = postfix; 228 } 229 230 public String getPrefix() { 231 return prefix; 232 } 233 234 public void setPrefix(String prefix) { 235 this.prefix = prefix; 236 } 237 238 public String getResponseProtection() { 239 return responseProtection; 240 } 241 242 public void setResponseProtection(String responseProtection) { 243 this.responseProtection = responseProtection; 244 } 245 246 public String getRaAuthenticationSecret() { 247 return raAuthenticationSecret; 248 } 249 250 public void setRaAuthenticationSecret(String raAuthenticationSecret) { 251 this.raAuthenticationSecret = raAuthenticationSecret; 252 } 253 254 public String getOperationMode() { 255 return operationMode; 256 } 257 258 public void setOperationMode(String operationMode) { 259 this.operationMode = operationMode; 260 } 261 public String getPortNo() { 262 return portNo; 263 } 264 265 public void setPortNo(String port) { 266 this.portNo = port; 267 } 268 269 public String getLogDir() { 270 return logDir; 271 } 272 273 public void setLogDir(String dir) { 274 this.logDir = dir; 275 } 276 277 public String getConfFile() { 278 return this.confFile; 279 } 280 281 public void setConfFile(String file) { 282 this.confFile = file; 283 } 284 285 286 } | Popular Tags |