[2] | 1 | import sys, config |
---|
| 2 | import galaxy.webapps.community.model |
---|
| 3 | import galaxy.webapps.community.datatypes |
---|
| 4 | from galaxy.web import security |
---|
| 5 | from galaxy.tags.tag_handler import CommunityTagHandler |
---|
| 6 | |
---|
| 7 | class UniverseApplication( object ): |
---|
| 8 | """Encapsulates the state of a Universe application""" |
---|
| 9 | def __init__( self, **kwargs ): |
---|
| 10 | print >> sys.stderr, "python path is: " + ", ".join( sys.path ) |
---|
| 11 | # Read config file and check for errors |
---|
| 12 | self.config = config.Configuration( **kwargs ) |
---|
| 13 | self.config.check() |
---|
| 14 | config.configure_logging( self.config ) |
---|
| 15 | # Set up datatypes registry |
---|
| 16 | self.datatypes_registry = galaxy.webapps.community.datatypes.Registry( self.config.root, self.config.datatypes_config ) |
---|
| 17 | galaxy.model.set_datatypes_registry( self.datatypes_registry ) |
---|
| 18 | # Determine the database url |
---|
| 19 | if self.config.database_connection: |
---|
| 20 | db_url = self.config.database_connection |
---|
| 21 | else: |
---|
| 22 | db_url = "sqlite://%s?isolation_level=IMMEDIATE" % self.config.database |
---|
| 23 | # Initialize database / check for appropriate schema version |
---|
| 24 | from galaxy.webapps.community.model.migrate.check import create_or_verify_database |
---|
| 25 | create_or_verify_database( db_url, self.config.database_engine_options ) |
---|
| 26 | # Setup the database engine and ORM |
---|
| 27 | from galaxy.webapps.community.model import mapping |
---|
| 28 | self.model = mapping.init( self.config.file_path, |
---|
| 29 | db_url, |
---|
| 30 | self.config.database_engine_options ) |
---|
| 31 | # Security helper |
---|
| 32 | self.security = security.SecurityHelper( id_secret=self.config.id_secret ) |
---|
| 33 | # Tag handler |
---|
| 34 | self.tag_handler = CommunityTagHandler() |
---|
| 35 | # Load security policy |
---|
| 36 | self.security_agent = self.model.security_agent |
---|
| 37 | def shutdown( self ): |
---|
| 38 | pass |
---|