1 64 package com.jcorporate.expresso.core; 65 66 import com.jcorporate.expresso.core.db.DBException; 67 import com.jcorporate.expresso.core.dbobj.Schema; 68 import com.jcorporate.expresso.core.dbobj.SecuredDBObject; 69 import com.jcorporate.expresso.core.misc.ConfigManager; 70 import com.jcorporate.expresso.core.security.User; 71 import com.jcorporate.expresso.kernel.InstallLog; 72 import com.jcorporate.expresso.kernel.util.ClassLocator; 73 import com.jcorporate.expresso.services.dbobj.JobQueue; 74 75 76 86 public final class ExpressoSchema extends Schema { 87 private static String currentVersionString = "5.6.0"; 88 91 95 private static boolean isInitialized = false; 96 97 102 public ExpressoSchema() throws DBException { 103 if (isInitialized) { 104 return; 105 } 106 107 108 try { 109 ClassLocator.loadClass("org.apache.log4j.Logger"); 110 } catch (Exception e) { 111 System.err.println("You have an older version of log4j. " + 112 "Please install a version greater or equal to version 1.2.1"); 113 } 114 115 if (ConfigManager.isInitialized()) { 116 isInitialized = true; 117 118 try { 119 constructDBObjects(); 120 constructControllers(); 121 122 addReportPage(com.jcorporate.expresso.ext.report.DownloadUsers.class); 124 125 126 addJob(com.jcorporate.expresso.ext.job.SendNotice.class); 127 addJob(com.jcorporate.expresso.services.job.TestJob.class); 128 addJob(com.jcorporate.expresso.services.job.ControllerJob.class); 129 addJob(com.jcorporate.expresso.services.job.ValidationJob.class); 130 addJob(com.jcorporate.expresso.services.job.ClearOldValidation.class); 131 132 133 addServlet(com.jcorporate.expresso.core.servlet.Test.class); 134 135 constructSetupValues(); 136 } catch (Exception e) { 137 e.printStackTrace(); 138 isInitialized = false; 139 throw new DBException(e); 140 } 141 } 142 143 } 144 145 146 153 public String getDefaultComponentCode() { 154 return ""; 155 } 156 157 163 public String getDefaultDescription() { 164 return "Expresso Framework Schema"; 165 } 166 167 172 public String getMessageBundlePath() { 173 return "com/jcorporate/expresso/core"; 174 } 175 176 177 182 public String getVersion() { 183 return currentVersionString; 184 } 185 186 195 public synchronized void otherSetup(InstallLog installLog, 196 String dataContext) throws com.jcorporate.expresso.core.db.DBException { 197 JobQueue jq = new JobQueue(SecuredDBObject.SYSTEM_ACCOUNT); 199 jq.setDataContext(dataContext); 200 jq.setField(JobQueue.FLD_JOBCODE, 201 com.jcorporate.expresso.services.job.ClearOldValidation.class.getName()); 202 if (!jq.find()) { 203 204 jq.setField(JobQueue.FLD_JOBCRON_PARAMS, "0,0,-1,-1,7,-1"); 206 jq.setField(JobQueue.FLD_SERVERID, 0); 207 jq.setField(JobQueue.FLD_STATUS_CODE, JobQueue.JOB_STATUS_AVAILABLE); 208 jq.setField(JobQueue.FLD_JOBCODE, 209 com.jcorporate.expresso.services.job.ClearOldValidation.class. 210 getName()); 211 jq.setField(JobQueue.FLD_UID, User.getAdminId(dataContext)); 212 jq.add(); 213 installLog.info("Added " + 214 com.jcorporate.expresso.services.job. 215 ClearOldValidation.class.getName() + 216 " to execute once a week"); 217 } else { 218 installLog.info("Clear Old Validation Job already exists in jobqueue, skipping add."); 219 } 220 221 super.otherSetup(installLog, dataContext); 222 } 223 224 227 protected void constructControllers() { 228 229 addController(com.jcorporate.expresso.services.controller.ControllerSecurityMatrix.class); 230 addController(com.jcorporate.expresso.services.controller.QueueJob.class); 231 addController(com.jcorporate.expresso.services.controller.SimpleLoginController.class); 232 addController(com.jcorporate.expresso.services.controller.SimpleRegistration.class); 233 addController(com.jcorporate.expresso.services.controller.JobSecurityMatrix.class); 234 addController(com.jcorporate.expresso.services.controller.CacheControl.class); 235 236 addController(com.jcorporate.expresso.services.controller.DBMaint.class); 238 addController(com.jcorporate.expresso.services.controller.EditUserPreference.class); 239 240 addController(com.jcorporate.expresso.ext.controller.HealthCheck.class); 242 addController(com.jcorporate.expresso.ext.controller.DataTransfer.class); 243 addController(com.jcorporate.expresso.services.controller.ValidationController.class); 244 addController(com.jcorporate.expresso.ext.controller.Download.class); 245 addController(com.jcorporate.expresso.ext.xml.controller.XMLController.class); 246 addController(com.jcorporate.expresso.ext.controller.RunSQL.class); 247 addController(com.jcorporate.expresso.services.controller.Log.class); 248 addController(com.jcorporate.expresso.services.controller.Status.class); 249 addController(com.jcorporate.expresso.services.controller.DBSecurityMatrix.class); 250 251 addController(com.jcorporate.expresso.ext.controller.Upload.class); 252 addController(com.jcorporate.expresso.ext.controller.ServeTextFile.class); 253 addController(com.jcorporate.expresso.ext.controller.ComponentManager.class); 254 addController(com.jcorporate.expresso.ext.controller.ReportServer.class); 255 addController(com.jcorporate.expresso.services.controller.CronController.class); 256 257 addController(com.jcorporate.expresso.services.controller.configuration.CreateSettingsWizard.class); 261 262 addController(com.jcorporate.expresso.services.controller.Configuration.class); 263 264 addController(com.jcorporate.expresso.services.controller.configuration.UpgradeSettingsWizard.class); 265 } 266 267 270 protected void constructDBObjects() { 271 addDBObject(com.jcorporate.expresso.services.dbobj.Event.class); 272 addDBObject(com.jcorporate.expresso.services.dbobj.EventMail.class); 273 addDBObject(com.jcorporate.expresso.services.dbobj.MimeTypes.class); 274 addDBObject(com.jcorporate.expresso.services.dbobj.DBMessage.class); 275 addDBObject(com.jcorporate.expresso.services.dbobj.DBOtherMap.class); 276 addDBObject(com.jcorporate.expresso.services.dbobj.DBObjLimit.class); 277 addDBObject(com.jcorporate.expresso.ext.dbobj.DownloadFiles.class); 278 addDBObject(com.jcorporate.expresso.services.dbobj.Setup.class); 279 addDBObject(com.jcorporate.expresso.services.dbobj.UserPreferenceVal.class); 280 addDBObject(com.jcorporate.expresso.services.dbobj.UserPreferenceDef.class); 281 addDBObject(com.jcorporate.expresso.services.dbobj.ControllerDefault.class); 282 addDBObject(com.jcorporate.expresso.ext.dbobj.ISOCountryCodes.class); 283 addDBObject(com.jcorporate.expresso.ext.dbobj.ReverseLookupDomains.class); 284 285 286 addDBObject(com.jcorporate.expresso.services.dbobj.ControllerSecurity.class); 287 addDBObject(com.jcorporate.expresso.services.dbobj.DefaultUserInfo.class); 288 addDBObject(com.jcorporate.expresso.services.dbobj.UserGroup.class); 289 addDBObject(com.jcorporate.expresso.ext.dbobj.RegisteredUser.class); 290 addDBObject(com.jcorporate.expresso.ext.dbobj.regobj.Person.class); 291 addDBObject(com.jcorporate.expresso.ext.dbobj.regobj.Phone.class); 292 addDBObject(com.jcorporate.expresso.ext.dbobj.regobj.Address.class); 293 addDBObject(com.jcorporate.expresso.ext.dbobj.regobj.Contact.class); 294 addDBObject(com.jcorporate.expresso.ext.dbobj.RestrictedCountries.class); 295 addDBObject(com.jcorporate.expresso.ext.dbobj.RestrictedOverrides.class); 296 addDBObject(com.jcorporate.expresso.services.dbobj.DBObjSecurity.class); 297 addDBObject(com.jcorporate.expresso.services.dbobj.JobSecurity.class); 298 addDBObject(com.jcorporate.expresso.services.dbobj.GroupMembers.class); 299 addDBObject(com.jcorporate.expresso.services.dbobj.GroupNest.class); 300 addDBObject(com.jcorporate.expresso.services.dbobj.RegistrationDomain.class); 301 addDBObject(com.jcorporate.expresso.services.dbobj.RegistrationObjectMap.class); 302 addDBObject(com.jcorporate.expresso.services.dbobj.RowPermissions.class); 303 addDBObject(com.jcorporate.expresso.services.dbobj.RowGroupPerms.class); 304 305 addDBObject(com.jcorporate.expresso.ext.dbobj.DownloadLog.class); 306 addDBObject(com.jcorporate.expresso.ext.dbobj.PerfTests.class); 307 addDBObject(com.jcorporate.expresso.ext.dbobj.PerfTestStat.class); 308 addDBObject(com.jcorporate.expresso.ext.dbobj.PerfTestSet.class); 309 addDBObject(com.jcorporate.expresso.ext.dbobj.PerfTestSetDet.class); 310 addDBObject(com.jcorporate.expresso.services.dbobj.JobQueue.class); 311 addDBObject(com.jcorporate.expresso.services.dbobj.JobQueueParam.class); 312 addDBObject(com.jcorporate.expresso.services.dbobj.LogEntry.class); 313 addDBObject(com.jcorporate.expresso.services.dbobj.SchemaList.class); 314 addDBObject(com.jcorporate.expresso.services.dbobj.JobHandlerRegistry.class); 315 addDBObject(com.jcorporate.expresso.services.dbobj.JobHandlerControl.class); 316 addDBObject(com.jcorporate.expresso.ext.dbobj.AppIntegration.class); 317 addDBObject(com.jcorporate.expresso.services.dbobj.ValidationQueue.class); 318 addDBObject(com.jcorporate.expresso.services.dbobj.ValidationQueueParam.class); 319 addDBObject(com.jcorporate.expresso.services.dbobj.UserPreference.class); 320 addDBObject(com.jcorporate.expresso.ext.xml.dbobj.UserAgent.class); 321 addDBObject(com.jcorporate.expresso.ext.xml.dbobj.ControllerXSLMap.class); 322 323 324 addDBObject(com.jcorporate.expresso.ext.dbobj.AuditLog.class); 325 addDBObject(com.jcorporate.expresso.ext.dbobj.AuditLogL.class); 326 327 328 addDBObject(com.jcorporate.expresso.services.dbobj.ChangeLog.class); 329 330 } 331 332 337 protected void constructSetupValues() throws DBException { 338 addSetup("DefaultXSL", "Default XSL Stylesheet", 339 "%web-app%/expresso/xsl/default.xsl"); 340 addSetup("BaseDir", 341 getString("Web_Document_Root_Director"), 342 getSetupDefault("BaseDir", "%web-app%")); 343 addSetup("HTTPServ", 344 getString("Web_Server_Host_Name"), 345 getSetupDefault("HTTPServ", "javacorp")); 346 addSetup("MAILFrom", 347 getString("Value_for_From_field_in_Ev"), 348 getSetupDefault("MAILFrom", "none")); 349 addSetup("MAILPassword", 350 getString("Password_for_sending_e-mai"), 351 getSetupDefault("MAILPassword", "")); 352 addSetup("MAILServer", 353 getString("SMTP_Server_Name_for_sendi"), 354 getSetupDefault("MAILServer", "example.org")); 355 addSetup("MAILUserName", 356 getString("User_Name_for_sending_e-ma"), 357 getSetupDefault("MAILUserName", "")); 358 addSetup("MaxJobs", 359 getString("Max_Number_of_Server_Jobs_"), 360 getSetupDefault("MaxJobs", "1")); 361 addSetup("ServletPath", 362 getString("Default_path_for_Servlets"), 363 getSetupDefault("ServletPath", "/servlet")); 364 addSetup("ServletPort", 365 getString("Port_Number_for_Servlet_Se"), 366 getSetupDefault("ServletPort", "80")); 367 addSetup("TempDir", getString("Temporary_Directory"), 368 getSetupDefault("TempDir", "%web-app%temp/")); 369 addSetup("TimerInterval", 370 getString("Scan_Job_Queue_and_directo"), 371 getSetupDefault("TimerInterval", "30")); 372 addSetup("ConnTimeOut", 373 getString("Database_Connection_Timout"), 374 getSetupDefault("ConnTimeOut", "60")); 375 addSetup("DefaultGroup", 376 getString("Default_User_Group_for_Sel"), 377 getSetupDefault("DefaultGroup", "Demo")); 378 addSetup("MaxConnections", 379 getString("Maximum_connections_to_att"), 380 getSetupDefault("MaxConnections", "4")); 381 addSetup("MinConnections", 382 getString("Minimum_connections_to_att"), 383 getSetupDefault("MinConnections", "2")); 384 addSetup("MailList", 385 getString("Mailing_List_Address"), 386 getSetupDefault("MailList", "opensource@servlets.net")); 387 addSetup("RestartServer", getString("RestartServer"), 388 getSetupDefault("RestartServer", "")); 389 390 addSetup("RequireEmailValidate", 392 getString("RequireEmailValidate"), 393 getSetupDefault("RequireEmailValidate", "N")); 394 addSetup("EmailValidateURL", 395 getString("EmailValidateURL"), 396 getSetupDefault("EmailValidateURL", 397 "http://www.yourdomain.com/servlet/EmailValidation")); 398 addSetup("AdminName", getString("AdminName"), 399 getSetupDefault("AdminName", "webmaster")); 400 addSetup("AdminEmail", getString("AdminEmail"), 401 getSetupDefault("AdminEmail", "")); 402 addSetup("CompanyName", getString("CompanyName"), 403 getSetupDefault("CompanyName", "")); 404 addSetup("HomePageURL", getString("HomePageURL"), 405 getSetupDefault("HomePageURL", "")); 406 addSetup("ServletEvent", getString("ServletEvent"), 407 getSetupDefault("ServletEvent", "Y")); 408 addSetup("ContextPath", "Context Path for Expresso", 409 getSetupDefault("ContextPath", "%context%")); 410 addSetup("Header", "Header URL for Framesets", 411 getSetupDefault("Header", "%context%/%expresso-dir%/header.jsp")); 412 addSetup("HeaderHeight", 413 "Size of Header for Framesets", 414 getSetupDefault("HeaderHeight", "73")); 415 416 addSetup("SecurityDB", 417 "Database to use for User/Group Security Info", 418 getSetupDefault("SecurityDB", "")); 419 420 addSetup("SecurityDBObjs", 421 "Database Objects that use the SecurityDB db/context", 422 getSetupDefault("SecurityDB", "")); 423 424 addSetup("defaultRegDomain", 428 "Default Registration Domain", 429 getSetupDefault("defaultRegDomain", "default")); 430 431 addSetup("defaultCSS", "Default CSS Extension", 432 getSetupDefault("defaultCSS", "")); 433 434 addSetup("privacyPolicy", 435 "URL To Website Privacy Policy", 436 getSetupDefault("privacyPolicy", "")); 437 438 addSetup("isNotifyOnJobSuccess", 439 "Boolean flag for whether to send an e-mail notification when a job completes successfully", 440 "N"); 441 442 443 445 addSetup("insecureDBMaint", 446 "Allow DBMaint to Edit Unsecured DBObjects", "N"); 447 448 addSetup("enableGlobalExceptions", 449 "Allow all Expresso Controllers to pass unhandled exception to GlobalExceptions as of Struts 1.1", 450 "N"); 451 452 addSetup("AsyncClaimTimeout", "Claim Timeout for Asynchronous processes", "30000"); 454 455 addSetup("AsyncNumThreads", "Number of aysnc handling threads", "10"); 456 addSetup("AsyncQueueSize", "Size of queue for waiting async processes.", "20"); 457 458 } 459 } 460 461 462 | Popular Tags |