# File lib/og.rb, line 181
        def initialize(config)
                @config = config

                # populate with default options if needed.
                @config[:connection_count] ||= 1
                
                # require the backend.                
                backend = @config[:backend] || "psql"
                require "og/backends/#{backend}"
                eval %{       @config[:backend] = #{backend.capitalize}Backend }
                
                @connection_pool = N::Pool.new
                @managed_classes = N::SafeHash.new
                
                Logger.info "Connecting to database '#{@config[:database]}' using backend '#{backend}'."
                
                @config[:connection_count].times do
                        @connection_pool << Og::Connection.new(self)
                end
        
                # gmosx, FIXME: this automanage code is not elegant and slow
                # should probably recode this, along with glue/property.rb
                
                if Og.auto_manage_classes
                        # automatically manage classes with properties and metadata.
                        # gmosx: Any idea how to optimize this?
                        classes_to_manage = []
                        ObjectSpace.each_object(Class) do |c|
                                if c.respond_to?(:__props) and c.__props
                                        classes_to_manage << c
                                end
                        end
                        Logger.info "Og auto manages the following classes:"
                        Logger.info "#{classes_to_manage.inspect}"
                        manage_classes(*classes_to_manage)
                end

                # use the newly created database.
                Og.use(self)
        end