Lateef Jackson wrote:
> I am just starting to use Webware and it rocks!! I just hacked up some
> code for IMAP (anyone else working on this drop me mail). And I was
> about to do some database suff but my experience as a Java programming
> (Jetty/Jboss) made me wonder how to put objects into Webware? I don't
> know if it exist but what would be super nice if a OR (Object
> Repository) like a stripted down JNDI was available. I would
> like to be
> able to use the DBPool (from MiscUtil) anywhere in the
> Webware. It would
> be nice to only create it once and then store it in the OR till it was
> needed at a later time. There are a lot of objects that would
> be nice to
> do this with. Is there already a method of doing this?
Webware doesn't provide any special mechanism for this, but I don't think
it's necessary. Python makes this easy. Just create a regular Python
module (somewhere on your pythonpath but NOT in a context directory) and put
your initialization code for your shared objects into it at module scope.
The first time the module is imported, the initialization code will be
executed (and Python guarantees that it will only be executed once, even in
a multi-threaded app like Webware). And wherever you need access to the
shared objects, just import the module and use the objects.
Get latest updates about Open Source Projects, Conferences and News.