Groovy Documentation

conf
Class BootStrap

java.lang.Object
  conf.BootStrap

class BootStrap

Application start and end time actions


Property Summary
def dependenciesService

The dependencies service

def destroy

Shutdown - serialize all wikis.

def grailsApplication

The GrailsApplication object

def init

Initialisation.

def jsecSecurityManager

The JSecurity security manager

def quartzScheduler

The Quartz scheduler

def sandboxManager

SandboxManager bean.

def securityService

The security service

def sventonService

The sventon remote control service

 
Constructor Summary
BootStrap()

 
Method Summary
boolean upgrade03(Map conf, List wikis)

**************************************************** // If we are upgrading an existing DB from before JsecRolePermissionRel // and JsecUserPermssionRel had controllerName fields, then we need to fix // any instances in the DB. //**** The code between asterisks can be removed **** //**** after all such DBs have been updated **** //**** (written 26 Feb 2009 **** if(JsecControllerName.count() == 0) { // Make default controller and add to existing permissions def controllerName = securityService.getController( conf.gate.cow.security.controllers.page) JsecRolePermissionRel.list().each{ it -> if(!

 
Methods inherited from class Object
wait, wait, wait, hashCode, getClass, equals, toString, notify, notifyAll
 

Property Detail

dependenciesService

def dependenciesService
The dependencies service


destroy

def destroy
Shutdown - serialize all wikis.


grailsApplication

def grailsApplication
The GrailsApplication object


init

def init
Initialisation. Sets up the SandboxManager, data area and authorisation data if they don't yet exist.


jsecSecurityManager

def jsecSecurityManager
The JSecurity security manager


quartzScheduler

def quartzScheduler
The Quartz scheduler


sandboxManager

def sandboxManager
SandboxManager bean.


securityService

def securityService
The security service


sventonService

def sventonService
The sventon remote control service


 
Constructor Detail

BootStrap

BootStrap()


 
Method Detail

upgrade03

boolean upgrade03(Map conf, List wikis)
**************************************************** // If we are upgrading an existing DB from before JsecRolePermissionRel // and JsecUserPermssionRel had controllerName fields, then we need to fix // any instances in the DB. //**** The code between asterisks can be removed **** //**** after all such DBs have been updated **** //**** (written 26 Feb 2009 **** if(JsecControllerName.count() == 0) { // Make default controller and add to existing permissions def controllerName = securityService.getController( conf.gate.cow.security.controllers.page) JsecRolePermissionRel.list().each{ it -> if(!it.controllerName) { it.controllerName = controllerName it.save() } } JsecUserPermissionRel.list().each{ it -> if(!it.controllerName) { it.controllerName = controllerName it.save() } } // Make controllers and appropriate permissions for anonymous role. For // each of these controllers, allow any wiki, directory and action conf.gate.cow.security.controllers.anon.tokenize(',').each{name -> controllerName = securityService.getController(name.trim()) securityService.getRoleWithPermission( conf.gate.cow.security.role.anon, '*', '', controllerName, securityService.getActionList('*', '*')) } // Make controllers and appropriate permissions for admin role. For each // of these controllers, allow any wiki, directory and action conf.gate.cow.security.controllers.admin.tokenize(',').each{name -> controllerName = securityService.getController(name.trim()) securityService.getRoleWithPermission( conf.gate.cow.security.role.admin, '*', '', controllerName, securityService.getActionList('*', '*')) } } //******************************************************* //******************************************************* // If we are upgrading an existing DB from before JsecRolePermissionRel // and JsecUserPermssionRel had regular expression directory paths, then // we need to fix any instances in the DB. // Add .* to the end of all include directories in permissions, if we have not // already done so (i.e. if the main admin role on the * wiki is not .* //**** The code between asterisks can be removed **** //**** after all such DBs have been updated **** //**** (written 24 March 2009 **** def allDirsPattern = ".*" def adminRole = JsecRole.findByName(conf.gate.cow.security.role.admin) def adminRpr = JsecRolePermissionRel.findByRoleAndWikiId(adminRole, '*') if(!adminRpr.includeDir.equals(allDirsPattern)) { JsecRolePermissionRel.list().each{ it -> if(it.includeDir == null || it.includeDir.startsWith("null")) { it.includeDir = allDirsPattern it.save() } else if(!it.includeDir.endsWith(allDirsPattern)) { it.includeDir = it.includeDir + allDirsPattern it.save() } } JsecUserPermissionRel.list().each{ it -> if(it.includeDir == null || it.includeDir.startsWith("null")) { it.includeDir = allDirsPattern it.save() } else if(!it.includeDir.endsWith(allDirsPattern)) { it.includeDir = it.includeDir + allDirsPattern it.save() } } } //******************************************************* // figure out if the guest layout exists, and set config // accordingly CowUtils.setGuestLayoutPath() log.info("guest layout path: ${conf.gate.cow.guest.layout.path}") log.info("guest layout present: ${conf.gate.cow.guest.layout.present}") log.info("short name = ${conf.gate.cow.name.short}") log.info("available layouts: ${conf.gate.cow.guest.layouts}") //******************************************************* // versionning and upgrades // if there's no version record, create one CowDataVersion dataVer if(CowDataVersion.list().size() == 0) { log.info("no data area version found, creating one") dataVer = new CowDataVersion(cowDataVersion : 0.1) // default is 0.1 if(! dataVer.save(flush : true) || dataVer.hasErrors()) log.error("couldn't save data area version: ${dataVer}") } dataVer = CowDataVersion.get(1) if(dataVer) log.info("data area version: ${dataVer.cowDataVersion}") // upgrades defines what to run for each possible upgrade. It maps the // current data version to the app version, which is itself mapped to a // list of methods to call. def upgrades = [ 0.1:[0.3:[{upgrade03(conf, Wiki.list())} ] ] ] // if data version is < app version call the appropriate upgrade method def appVer = conf.gate.cow.version.minus(~/-.


 

Groovy Documentation