# = Og # # Copyright (c) 2004-2005, Navel Ltd (http://www.navel.gr) # Copyright (c) 2004-2005, George Moschovitis (http://www.gmosx.com) # # Og (http://www.nitrohq.com) is copyrighted free software # created and maintained by George Moschovitis (mailto:gm@navel.gr) # and released under the standard BSD Licence. For details # consult the file doc/LICENCE. require 'mega/synchash' require 'mega/syncarray' require 'glue' require 'glue/logger' require 'glue/validation' require 'glue/aspects' require 'glue/configuration' # Og (ObjectGraph) manages Ruby objects and their relations and # provides transparent and efficient object-relational mapping # and querying mechanisms. # # === Property Metadata # # Og defines, reserves and uses the following property # metadata types: # # [+:sql_index+] # Create an sql index for this property. # # [+:unique+] # This value of the property must be unique. # # === Design # # Og allows the serialization of arbitrary Ruby objects. Just # mark them as Object (or Array or Hash) in the prop_accessor # and the engine will serialize a YAML dump of the object. # Arbitrary object graphs are supported too. module Og # The version. Version = '0.24.0' # Library path. LibPath = File.dirname(__FILE__) # If true, check for implicit changes in the object # graph. For example when you add an object to a parent # the object might be removed from his previous parent. # In this case Og emmits a warning. setting :check_implicit_graph_changes, :default => false, :doc => 'If true, check for implicit changes in the object graph' # If true, only allow reading from the database. Usefull # for maintainance. # WARNING: not implemented yet. setting :read_only_mode, :default => false, :doc => 'If true, only allow reading from the database' # Prepend the following prefix to all generated SQL table names. # Usefull on hosting scenarios where you have to run multiple # web applications/sites on a single database. # # Don't set the table_prefix to nil, or you may face problems # with reserved words on some RDBM systems. For example User # maps to user which is reserved in postgresql). The prefix # should start with an alphanumeric character to be compatible # with all RDBM systems (most notable Oracle). #-- # TODO: move this to the sql store. #++ setting :table_prefix, :default => 'og', :doc => 'Prepend the prefix to all generated SQL table names' # If true, Og tries to create/update the schema in the # data store. For production/live environments set this to # false and only set to true when the object model is # upadated. For debug/development environments this should # stay true for convienience. setting :create_schema, :default => true, :doc => 'If true, Og tries to create/update the schema in the data store' # If true raises exceptions on store errors, usefull when # debugging. For production environments it should probably be # set to false to make the application more fault tolerant. setting :raise_store_exceptions, :default => true, :doc => 'If true raises exceptions on store errors' # Enable/dissable thread safe mode. setting :thread_safe, :default => true, :doc => 'Enable/dissable thread safe mode' # The active manager mattr_accessor :manager # Pseudo type for binary data class Blob; end class << self # Helper method, useful to initialize Og. # If no options are passed, sqlite is selected # as the default store. def setup(options = {:store => :sqlite}) m = @@manager = Manager.new(options) m.manage_classes return m end alias_method :connect, :setup alias_method :options=, :setup alias_method :start, :setup # Helper method. def escape(str) @@manager.store.escape(str) end end end #-- # gmosx: leave this here. #++ require 'og/manager' require 'og/errors' require 'og/types' require 'og/validation' require 'og/markers' # * George Moschovitis