[Zope] Re: [Zope-dev] help me convert from j2ee to zope

Chris Withers chris at simplistix.co.uk
Thu Jan 22 05:22:59 EST 2004


Hi Ryan,

The zope-dev list for the development OF zope, not WITH it, so I'm replying to 
the more appropriate zope at zope.org list...


Ryan Boder wrote:
> I would like to stop developing with JBoss and convert to Zope.

Good for you ;-)

> The majority of my code was in EJB's. So I am trying to create Zope products
> to replace them.

That might not be necessary, but there's nothing wrong with it ;-)

> What kind of naming service is available within Zope? For example, how can I
> get a reference to one object from another object within Zope?

All objects are refered to by their paths in the ZODB.
To get from one object to another, you may want to try:

myobject.restrictedTraverse('/path/to/another/object')

> the equivalent of a local interface in J2EE. In JBoss I would use a session
> bean as the remote user interface and it would manage entity beans. So in
> Zope if I have a non-persistent object as the XML-RPC published user
> interface, how can I have it access persistent objects within Zope?

This made no sense to me as a Zope developer, and it's YEARS since I did 
anything EJB'ish. I suggest you try and present the problem you're trying to 
solve, rather than trying to bash square JBoss concepts into a round Zope hole...

> How can I create new objects programmatically in Zope? 

Depends on what type of code you want to create these objects in, what you want 
them to do, and what type of objects they are...

> In J2EE I would get
> get a home interface to a bean and then call a create method on it to create
> the bean. I know how to create new objects using ZMI in Zope, but I need
> objects to be created through remote calls from clients. For example if I
> had objects that represent tasks in Zope, I need the clients to be able to
> create and delete tasks. How do I do that?

If you're doing everything as Python Products, then you write a construction 
method, usually called manage_addMyThing, import that where you want to create 
your object, and then use it:

from MyProduct import manage_addMyThing

...
    manage_addMyThing(afolder,'new_id',...any other needed parameters...)

> Are there any other gotchas that ex J2EE developers can tell me about
> switching to Zope?

Yeah, Zope is not J2EE. Trying to think in J2EE terms and make those concepts 
work in Zope will only lead to pain and suffering for you and anyone who tries 
to help you ;-)

> I've read all the documentation I can find on the web site,

I doubt that ;-)

Zope Book?
Zope Developers Guide?
ALL the How-To's and examples?

The website is difficult to navigate, and I apologise for that, but the stuff is 
on there...

cheers,

Chris




More information about the Zope mailing list