~ubuntu-branches/ubuntu/natty/eucalyptus/natty-updates

« back to all changes in this revision

Viewing changes to clc/modules/database/conf/scripts/after_database.groovy

  • Committer: Bazaar Package Importer
  • Author(s): Dustin Kirkland
  • Date: 2009-12-17 18:22:02 UTC
  • mto: This revision was merged to the branch mainline in revision 83.
  • Revision ID: james.westby@ubuntu.com-20091217182202-0v2v09ry3cxrvh84
Tags: upstream-1.6.2~bzr1103
ImportĀ upstreamĀ versionĀ 1.6.2~bzr1103

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
import org.hibernate.ejb.*
 
2
import com.eucalyptus.util.*
 
3
import edu.ucsb.eucalyptus.cloud.ws.*;
 
4
 
 
5
hiber_config = [
 
6
  'hibernate.archive.autodetection': 'jar, class, hbm',
 
7
  'hibernate.show_sql': 'false',
 
8
  'hibernate.format_sql': 'false',
 
9
  'hibernate.connection.autocommit': 'true',
 
10
  'hibernate.hbm2ddl.auto': 'update',
 
11
  'hibernate.generate_statistics': 'true',
 
12
]
 
13
contexts = ['general','images','auth','config','walrus','storage','dns']
 
14
contexts.each {  
 
15
  pool_config = new pools(new Binding([context_name:it])).run()
 
16
  cache_config  = new caches(new Binding([context_name:it])).run()
 
17
  config = new Ejb3Configuration();
 
18
  LogUtil.logHeader( "Hibernate for ${it}" ).log(hiber_config.inspect())
 
19
  hiber_config.each { k, v -> config.setProperty(k, v) }
 
20
  LogUtil.logHeader( "Pool for ${it}").log( pool_config.inspect() )
 
21
  pool_config.each { k, v -> config.setProperty(k, v) }
 
22
  LogUtil.logHeader( "Cache for ${it}").log( cache_config )
 
23
  cache_config.each { k, v -> config.setProperty(k, v) }
 
24
  entity_list = new entities(new Binding([context_name:it])).run()
 
25
  LogUtil.logHeader("Entities for ${it}")
 
26
  entity_list.each{ ent ->
 
27
    LogUtil.log( ent.toString() )
 
28
    config.addAnnotatedClass( ent )
 
29
  }
 
30
  try {
 
31
    DatabaseUtil.registerPersistenceContext("eucalyptus_${it}", config)
 
32
  } catch( Throwable t ) {
 
33
    t.printStackTrace();
 
34
    System.exit(1)
 
35
  }
 
36
}
 
37
WalrusControl.deferedInitializer( );
 
38
WalrusManager.deferedInitializer( );
 
39
BlockStorage.deferedInitializer( );