Changeset 593
- Timestamp:
- 06/04/08 12:43:12
- Files:
-
- trunk/dejavu/doc/intro.html (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/dejavu/doc/intro.html
r592 r593 56 56 the creation of new Units, and their destruction.</p> 57 57 58 <p>Finally, Dejavu provides a core <tt>Arena</tt> class which you should be 59 able to leverage for any sort of application you are building. The Arena 60 object functions as a top-level "Application" object, collecting the global 61 settings for an application into one place. It doles out Sandboxes, 62 maintains a registry of Units and their associations, and manages startup 63 and shutdown operations.</p> 58 <p>Finally, Dejavu provides <tt>StorageManager</tt> classes which you should 59 be able to leverage for any sort of application you are building. There are 60 Storage Managers for Postgres, MySQL, SQL Server and other databases, as 61 well as partitioners, caching adapters, file storage adapters, etc. You can 62 use any of them as a top-level "Application" object, collecting the global 63 settings for an application into one place. A StorageManager doles out 64 Sandboxes, maintains a registry of Units and their associations, and 65 manages startup and shutdown operations.</p> 64 66 65 67 … … 87 89 Animal.many_to_one('ZooID', Zoo, 'ID') 88 90 89 # Set up a global Arena object. 90 arena = dejavu.Arena() 91 # Set up a Storage Manager. 91 92 conf = {u'Connect': r"PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE=C:\zookeeper.mdb;"} 92 arena.add_store("main","access", conf)93 arena.register_all(globals())</pre>93 root = storage.resolve("access", conf) 94 root.register_all(globals())</pre> 94 95 95 96 <p>The above creates the model for the zookeeper application. … … 103 104 <li>The association between the Animal class and the Zoo class 104 105 (many-to-one).</li> 105 <li>The setup of a dejavu <tt> Arena</tt> object, including a Storage106 Manager whichuses a Microsoft Access (Jet) database.</li>106 <li>The setup of a dejavu <tt>StorageManager</tt> object which 107 uses a Microsoft Access (Jet) database.</li> 107 108 </ol> 108 109 </p> … … 112 113 113 114 <pre>>>> import zookeeper 114 >>> box = zookeeper. arena.new_sandbox()115 >>> box = zookeeper.root.new_sandbox() 115 116 >>> box.recall(zookeeper.Animal) 116 117 [<zookeeper.Animal object at 0x013281F0>, <zookeeper.Animal object at 0x01328150>, … … 244 245 Authorship.many_to_one('authorID', Author, 'ID') 245 246 246 arena = Arena()247 arena.register_all(globals())247 root = storage.resolve("mysql", conf) 248 root.register_all(globals()) 248 249 </pre> 249 250 … … 256 257 <p>To create the tables:</p> 257 258 <pre>for cls in (Author, Publisher, Book): 258 arena.create_storage(cls)</pre>259 root.create_storage(cls)</pre> 259 260 260 261 <p>The app developer's runtime code reads as follows:</p> 261 262 <pre> 262 box = arena.new_sandbox()263 box = root.new_sandbox() 263 264 ppython = Book(title='Programming Python', price=20, 264 265 publishDate=datetime.datetime(2001, 3, 1))
