devdaily home | apple | java | perl | unix | directory | blog

What this is

This file is included in the DevDaily.com "Ruby Source Code Warehouse" project. The intent of this project is to help you "Learn Ruby by Example" TM.

Other links

The source code

# The container name provides the base for the filenames of the database
# files used to store the container content. The directory within which
# the files are opened is taken from the environment passed through the
# Container constructor.  If no environment was provided, then the
# directory used will be the current working directory.
class BDB::XML::Container
   include Enumerable
   class << self
      #
      #create a new Container object
      #
      #* name
      #  the name of the container
      #
      #* flags
      #  The flags must be the string "r", "r+", "w", "w+", "a", "a+" or
      #  and integer value.
      #
      #* mode
      #  mode for creation (see chmod(2))
      #
      #* options
      #  Hash with the possible keys
      #
      #  * env
      #    the Berkeley DB environment within which all database
      #    operations are to be performed.
      #
      #  * txn
      #    the transaction within which all database
      #    operations are to be performed.
      #
      #  * set_pagesize
      #    Set the pagesize of the primary database (512 < size < 64K)
      #
      def  new(name = nil, flags = 0, mode = 0, options = {})
      end
      
      #Dump the container name into the specified file.
      #
      def  dump(name, filename)
      end
      
      #Load data from the specified file into the container name
      #
      def  load(name, filename)
      end
      
      #Remove the container name
      #
      def  remove(name)
      end
      
      #Rename the container name
      #
      def  rename(name, newname)
      end
      
      #Verify the container name, and save the content in 
      #filename
      #
      #* flags
      #  flags can has the value BDB::AGGRESSIVE
      #
      def  salvage(name, filename, flags = 0)
      end
      
      #Set the name for the container name. The underlying files for the
      #container are not renamed - for that, see Container::rename
      #
      def  set_name(name, str)
      end
      
      #Verify the container name
      #
      #
      def  verify(name)
      end
   end
   
   #close an open container
   #
   #* flags
   #  flags can has the value 0 or BDB::NOSYNC
   #
   def  close(flags = 0)
   end
   
   #Remove the document from the container
   #
   #* document
   #  document can be an ID or an BDB::XML::Document previously stored
   #
   #* flags
   #  flags can has the value 0 or BDB::AUTO_COMMIT
   #
   def  delete(document, flags = 0)
   end
   
   #return the current environment for the container, or nil
   #
   def  environment
   end
   #same than  environment
   def  env
   end
   
   #return true if the container was opend in an environment
   #
   def  environment?
   end
   #same than  environment?
   def  env?
   end
   
   #Iterate over all documents
   #
   def  each 
      yield doc
   end
   
   #Fetch the document from the container
   #
   #* id
   #  the id assigned to the document when it was first added to a container
   #
   #* flags
   #  flags can has the value 0 or BDB::DIRTY_READ, BDB::RMW
   #
   def  self[id]
   end
   #same than  self[id]
   def  get(id, flags = 0)
   end
   
   #Replace the document (see also #update)
   #
   def  self[id] = document
   end
   
   #set the indexing : index must be an BDB::XML::Index object
   #
   def  index=(index)
   end
   
   #Retrieve the BDB::XML::Index
   #
   #Return nil if no indexing was specified
   #
   def  index
   end
   
   #in-place modification of all documents according to the state of the 
   #BDB::XML::Modify object, which contains an XPath expression to 
   #target document nodes, as well as specification of the modifications 
   #to perform
   #
   #context is an optional BDB::XML::Context used for the update
   #operations on the container.
   #
   #flags must be set to zero or BDB::RMW to acquire a write lock
   #
   def  modify(mod, context = nil, flags = 0)
   end
   
   #return the name of the container
   #
   def  name
   end
   
   #Set the name of the container. Can be called only on a closed container
   #See also Container::set_name
   #
   def  name=(str)
   end
   
   #return true if the container is open
   #
   def  open?
   end
   
   #Pre-parse an XPath query and return an BDB::XML::XPath object
   #
   #* query
   #  the XPath query to execute against the container
   #
   #* context
   #  the context within which the query will be executed
   #
   def  parse(query, context = nil)
   end
   
   #Add a document to the container and return an ID
   #
   #* document
   #  an object BDB::XML::Document or any object suitable for 
   #  BDB::XML::Document::new
   #
   #* flags
   #  flags can be 0 or BDB::AUTO_COMMIT
   #
   def  push(document, flags = 0)
   end
   
   #Add a document to the container and return self
   #
   def  <<(document)
   end
   
   #Query the container with an XPath expression, which can be an object
   #BDB::XML::XPath or a String
   #
   #* flags
   #  flags can have the value 0 or BDB::DIRTY_READ, BDB::RMW
   #
   #return a BDB::XML::Results object
   #
   def  query(xpath, flags = 0)
   end
   
   #Iterate over the result of a query
   #
   #returntype can have the values BDB::XML::Context::Document
   #or BDB::XML::Context::Values
   #
   #the query is evaluated lazily
   #
   def  search(xpath, returntype = BDB::XML::Context::Document) 
      yield doc
   end
   
   #return the transaction associated with the container, or nil
   #
   def  transaction
   end
   
   #return true if the container is associated with a transaction
   #
   def  in_transaction?
   end
   #same than  in_transaction?
   def  transaction?
   end
   
   #Update a document within the container
   #
   def  update(document)
   end
   
   #return an BDB::XML::UpdateContext which can be used to perform
   #[], []=, push, delete, update operation
   #    
   #This can be used for a performance improvement
   # 
   def  update_context 
      yield cxt
   end
   #same than  update_context {|cxt| ... }
   def  context 
      yield cxt
   end
end




Copyright 1998-2008 Alvin Alexander
All Rights Reserved.
 
devdaily.com is based in louisville, kentucky, and this web site is hosted by godaddy.com