# = Og # # Copyright (c) 2004-2005, George Moschovitis (http://www.gmosx.com) # Copyright (c) 2004-2005, Navel Ltd (http://www.navel.gr) # # Og 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 'glue' require 'glue/logger' require 'glue/attribute' require 'glue/property' require 'glue/array' require 'glue/hash' require 'glue/time' require 'glue/pool' 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. # # === Features # # The library provides the following features: # # + Object-Relational mapping, automatically maps standard # Ruby objects to sql schemas # + Absolutely no configuration files. # + Multiple stores (PostgreSQL, MySQL, SQLite, Oraclei, SqlServer, ..). # + Supports non SQL stores (in-memory, filesystem, ..). # + ActiveRecord-style meta language and db aware methods. # + Deserialize to Ruby Objects. # + Deserialize sql join queries to Ruby Objects. # + Eager associations. # + Serialize arbitrary ruby object graphs through YAML. # + Connection pooling. # + Thread safety. # + SQL transactions. # + Aspect oriented constructs allow interception of lifecycle callbacks. # + Transparent support for cascading deletes for all backends. # + Hierarchical structures (nested sets) # + Works safely as part of distributed application. # + Simple implementation. # # === 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. # # === Lifecycle Callbacks # # * og_read # * og_insert # * og_update # * og_delete module Og # The version. Version = '0.21.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' # Marker module. If included in a class, the Og automanager # ignores this class. module Unmanageable; end # The active manager mattr_accessor :manager # Pseudo type for binary data class Blob; end end # gmosx: leave this here. require 'og/manager' require 'og/errors' require 'og/types' require 'og/validation' # * George Moschovitis