1 14 15 package org.quickserver.util.xmlreader; 16 17 import org.quickserver.net.server.QuickServer; 18 19 29 public class QuickServerConfig extends BasicServerConfig { 30 31 private QSAdminServerConfig qSAdminServerConfig; 32 private DBObjectPoolConfig dDObjectPoolConfig; 33 private ApplicationConfiguration applicationConfiguration; 34 private InitServerHooks initServerHooks; 35 36 private String securityManagerClass = null; 37 private String configFile = null; 38 private String applicationJarPath = null; 39 40 public QuickServerConfig() { 41 setName("QuickServer v"+QuickServer.getVersion()); 42 } 43 44 48 public void setQSAdminServerConfig(QSAdminServerConfig config) { 49 qSAdminServerConfig = config; 50 } 51 54 public QSAdminServerConfig getQSAdminServerConfig() { 55 return qSAdminServerConfig; 56 } 57 58 63 public void setDBObjectPoolConfig(DBObjectPoolConfig dDObjectPoolConfig) { 64 this.dDObjectPoolConfig = dDObjectPoolConfig; 65 } 66 70 public DBObjectPoolConfig getDBObjectPoolConfig() { 71 return dDObjectPoolConfig; 72 } 73 74 80 public void setApplicationConfiguration( 81 ApplicationConfiguration applicationConfiguration) { 82 this.applicationConfiguration = applicationConfiguration; 83 } 84 88 public ApplicationConfiguration getApplicationConfiguration() { 89 return applicationConfiguration; 90 } 91 92 93 101 public void setSecurityManagerClass(String securityManagerClass) { 102 if(securityManagerClass!=null) 103 this.securityManagerClass = securityManagerClass; 104 } 105 110 public String getSecurityManagerClass() { 111 return securityManagerClass; 112 } 113 114 118 protected void setConfigFile(String fileName) { 119 configFile = fileName; 120 } 121 122 126 public String getConfigFile() { 127 return configFile; 128 } 129 130 131 138 public void setApplicationJarPath(String applicationJarPath) { 139 this.applicationJarPath = applicationJarPath; 140 } 141 142 149 public String getApplicationJarPath() { 150 return applicationJarPath; 151 } 152 153 154 159 public void setInitServerHooks(InitServerHooks initServerHooks) { 160 this.initServerHooks = initServerHooks; 161 } 162 163 168 public InitServerHooks getInitServerHooks() { 169 return initServerHooks; 170 } 171 172 176 public String toXML(String pad) { 177 if(pad==null) pad=""; 178 StringBuffer sb = new StringBuffer (); 179 sb.append(pad+"<quickserver>\n"); 180 181 if(getName()!=null) 182 sb.append(pad+"\t<name>"+getName()+"</name>\n"); 183 if(getServerBanner()!=null) 184 sb.append(pad+"\t<server-banner>"+getServerBanner()+"</server-banner>\n"); 185 sb.append(pad+"\t<port>"+getPort()+"</port>\n"); 186 if(getBindAddr()!=null) 187 sb.append(pad+"\t<bind-address>"+getBindAddr()+"</bind-address>\n"); 188 189 sb.append( getServerMode().toXML(pad+"\t") ); 190 191 if(getClientEventHandler()!=null) 192 sb.append(pad+"\t<client-event-handler>"+getClientEventHandler()+"</client-event-handler>\n"); 193 if(getClientCommandHandler()!=null) 194 sb.append(pad+"\t<client-command-handler>"+getClientCommandHandler()+"</client-command-handler>\n"); 195 if(getClientObjectHandler()!=null) 196 sb.append(pad+"\t<client-object-handler>"+getClientObjectHandler()+"</client-object-handler>\n"); 197 if(getClientBinaryHandler()!=null) 198 sb.append(pad+"\t<client-binary-handler>"+getClientBinaryHandler()+"</client-binary-handler>\n"); 199 if(getClientWriteHandler()!=null) 200 sb.append(pad+"\t<client-write-handler>"+getClientWriteHandler()+"</client-write-handler>\n"); 201 if(getClientAuthenticationHandler()!=null) 202 sb.append(pad+"\t<client-authentication-handler>"+getClientAuthenticationHandler()+"</client-authentication-handler>\n"); 203 else if(getAuthenticator()!=null) 204 sb.append(pad+"\t<authenticator>"+getAuthenticator()+"</authenticator>\n"); 205 if(getClientData()!=null) 206 sb.append(pad+"\t<client-data>"+getClientData()+"</client-data>\n"); 207 if(getClientExtendedEventHandler()!=null) 208 sb.append(pad+"\t<client-extended-event-handler>"+getClientExtendedEventHandler()+"</client-extended-event-handler>\n"); 209 210 sb.append( getDefaultDataMode().toXML(pad+"\t") ); 211 212 sb.append(pad+"\t<timeout>"+getTimeout()+"</timeout>\n"); 213 if(getTimeoutMsg()!=null) 214 sb.append(pad+"\t<timeout-msg>"+getTimeoutMsg()+"</timeout-msg>\n"); 215 216 sb.append(pad+"\t<max-auth-try>"+getMaxAuthTry()+"</max-auth-try>\n"); 217 if(getMaxAuthTryMsg()!=null) 218 sb.append(pad+"\t<max-auth-try-msg>"+getMaxAuthTryMsg()+"</max-auth-try-msg>\n"); 219 220 sb.append(pad+"\t<max-connection>"+getMaxConnection()+"</max-connection>\n"); 221 if(getMaxConnectionMsg()!=null) 222 sb.append(pad+"\t<max-connection-msg>"+getMaxConnectionMsg()+"</max-connection-msg>\n"); 223 224 225 if(getConsoleLoggingLevel()!=null) 226 sb.append(pad+"\t<console-logging-level>"+getConsoleLoggingLevel()+"</console-logging-level>\n"); 227 if(getConsoleLoggingFormatter()!=null) 228 sb.append(pad+"\t<console-logging-formatter>"+getConsoleLoggingFormatter()+"</console-logging-formatter>\n"); 229 230 sb.append(getObjectPoolConfig().toXML(pad+"\t")); 231 232 sb.append(pad+"\t<communication-logging>\n"); 233 sb.append(pad+"\t\t<enable>"+getCommunicationLogging()+"</enable>\n"); 234 sb.append(pad+"\t</communication-logging>\n"); 235 236 if(getDBObjectPoolConfig()!=null) { 237 sb.append( getDBObjectPoolConfig().toXML(pad+"\t") ); 238 } 239 240 if(getSecurityManagerClass()!=null) { 241 sb.append(pad+"\t<security-manager-class>"+getSecurityManagerClass()+"</security-manager-class>\n"); 242 } 243 244 if(getAccessConstraintConfig()!=null) { 245 sb.append(getAccessConstraintConfig().toXML(pad+"\t")); 246 } 247 248 if(getQSAdminServerConfig()!=null) 249 sb.append( getQSAdminServerConfig().toXML(pad+"\t") ); 250 251 252 if(getApplicationConfiguration()!=null) { 253 sb.append( getApplicationConfiguration().toXML(pad+"\t") ); 254 } 255 256 if(getApplicationJarPath()!=null) { 257 sb.append(pad+"\t<application-jar-path>"+ 258 getApplicationJarPath()+ 259 "</application-jar-path>\n"); 260 } 261 262 if(getServerHooks()!=null) { 263 sb.append( getServerHooks().toXML(pad+"\t") ); 264 } 265 266 if(getInitServerHooks()!=null) { 267 sb.append( getInitServerHooks().toXML(pad+"\t") ); 268 } 269 270 sb.append( getSecure().toXML(pad+"\t") ); 271 sb.append( getAdvancedSettings().toXML(pad+"\t") ); 272 273 sb.append(pad+"</quickserver>\n"); 274 return sb.toString(); 275 } 276 277 public String toString() { 278 return toXML(null); 279 } 280 } 281 | Popular Tags |