Skip to content

Commit

Permalink
Working on using the H2 database to persist a db in file.
Browse files Browse the repository at this point in the history
With HSQL, it was always in-memory, and H2 has a lot more flexibility
and power.  It can also be embedded in a file, so I added the db/
directory to support this.
  • Loading branch information
klauern committed Feb 16, 2009
1 parent aa8445b commit 5f6321d
Show file tree
Hide file tree
Showing 10 changed files with 3,847 additions and 11 deletions.
Binary file added db/test.5.log.db
Binary file not shown.
Binary file added db/test.data.db
Binary file not shown.
Binary file added db/test.index.db
Binary file not shown.
3,783 changes: 3,783 additions & 0 deletions db/test.trace.db

Large diffs are not rendered by default.

34 changes: 31 additions & 3 deletions docs/SomeBootStrapInfo.json
@@ -1,6 +1,6 @@
/*
* In an attempt to make the bootstrapping 'look' cleaner, I'm looking into how
* much work it would take to bootstrap indirectly by using a .json file instaed.
* much work it would take to bootstrap indirectly by using a .json file instead.
* This would at least provide some basic level of visibility into the data instead
* of purely being repeated by method calls that are less-than-clear.
*
Expand All @@ -25,10 +25,38 @@
"email" :"AllanRosanes@alliantenergy.com",
"work_phone" :"?????",
"mobile_phone" :"????"
},
{
"full_name" :"Meg Sviatslovsky",
"email" :"MegSviatslovsky@alliantenergy.com",
"work_phone" :"1.666.5.5.15",
"mobile_phone" :"Something"
}
],
"Zones" : [
{
"zone_name" :"",
"zone_type" :"",
"zone_usage" :""
},
{
"zone_name" :"",
"zone_type" :"",
"zone_usage" :""
}
],
"Zones" : [],
"Events" : [],
"Ports" : [],
"Domains" : []
"Domains" : [],
"Supports" : [
{
"support_level" :"",
"disaster_recovery_level":""
},
{
"support_level":"",
"disaster_recovery_level":""
}

]
}
31 changes: 26 additions & 5 deletions grails-app/conf/BootStrap.groovy
@@ -1,26 +1,47 @@
import grails.converters.*

class BootStrap {

def init = { servletContext ->
// Create the base level types:

// Base Types (don't share relationships with other types):
// Contacts
def contact_a = new Contact(full_name:"Meg Sviatslovsky",email:"megsviatslovsky@alliantenergy.com",
work_phone:"1.608.458.0000",mobile_phone:"1.608.778.0000").save()
def contact_b = new Contact(full_name:"Nick Klauer",email:"NicholasKlauer@alliantenergy.com",
work_phone:"1.608.458.3922",mobile_phone:"1.608.516.7615").save()
def contact_c = new Contact(full_name:"Allan_Rosanes",email:"AllanRosanes@alliantenergy.com",
work_phone:"1.608.458.3333",mobile_phone:"1.608.444.4444").save()
// Events
// Zone
// Zones
def zone_a = new Zone(zone_name:"eaiprodpart1",zone_type:"JCAPS 5.1.x",
zone_usage:"JCAPS 5.1.3 Logical host server. Production").save()
def zone_b = new Zone(zone_name:"eaitestpart5",zone_type:"JCAPS 5.1.x",
zone_usage:"Test Environment for\n\n blah blah blah and some other stuff").save()
def zone_c = new Zone(zone_name:"sreprodpart1",zone_type:"SRE 5.0.5",
zone_usage:"SRE EmplInfo Schema").save()
// Domain
// Support


// Types that share something from another table:
// Events
// Application
// Ports
// Events
// Domains
def domain_a = new Domain(domain_name:"EmplInfo",domain_description:"A thing",
zone:zone_c).save()
// Port
// Integration
// IntDetail



def jsonArray = JSON.parse(new File("./docs/SomeBootStrapInfo.json").getText())

}


def loadJsonInfo(servletContext) {

}

def destroy = {
Expand Down
7 changes: 5 additions & 2 deletions grails-app/conf/DataSource.groovy
Expand Up @@ -15,7 +15,9 @@ environments {
development {
dataSource {
dbCreate = "create-drop" // one of 'create', 'create-drop','update'

// url = "jdbc:h2:mem:DevDB"
driverClassName = "org.h2.Driver"
url = "jdbc:h2:./db/test"
//Uncomment for using the Network-mode Derby client.
/*
pooled = false
Expand All @@ -30,7 +32,8 @@ environments {
test {
dataSource {
dbCreate = "update"
url = "jdbc:hsqldb:mem:testDb"
url = "jdbc:h2:file:./db/test"
driverClassName = "org.h2.Driver"
}
}
production {
Expand Down
Binary file removed lib/derbyclient.jar
Binary file not shown.
Binary file added lib/h2-1.1.107.jar
Binary file not shown.
3 changes: 2 additions & 1 deletion scripts/BootStrapDomains.groovy
Expand Up @@ -11,4 +11,5 @@ import grails.converters.*

def jsonArray = JSON.parse(new File("./docs/SomeBootStrapInfo.json").getText())
def contacts = jsonArray.get("Contacts")
contacts[1].toString()
contacts[1]
println(contacts[1])

0 comments on commit 5f6321d

Please sign in to comment.