help me convert from j2ee to zope
Hi, I would like to stop developing with JBoss and convert to Zope. I have been able to figure most things out using the Zope website but I have a few questions... The majority of my code was in EJB's. So I am trying to create Zope products to replace them. 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? This would be 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? How can I create new objects programmatically in Zope? 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? Are there any other gotchas that ex J2EE developers can tell me about switching to Zope? I've read all the documentation I can find on the web site, so if I've missed something please point me to it. Thanks, -- Ryan Boder http://www.bitwiser.org/icanoop
Hi Ryan, I am not certain if this is the right mailing list here, because zope-dev is for the development _of_ Zope, not the development of products _with_ Zope. However if this thread starts to assemble a survey comparing Zope to J2EE, this may be interesting for the Zope development, especially if there are things in J2EE which may inspire Zope, or converse there are Zopish ways which provide a better solution than J2EE for some problems.
I would like to stop developing with JBoss and convert to Zope.
I have been able to figure most things out using the Zope website but I have a few questions...
The majority of my code was in EJB's. So I am trying to create Zope products to replace them.
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? This would be 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?
Usually You should have some persistent object around by the Zope framework when handling request. If doing an XML-RPC call You are already talking to some persistent object given to You by the ZPublisher. I am not sure what is the appropriate equivalent of a session bean in J2EE if looking at Zope. Inside any persistent object You should be able to get other objects by calling "unrestrictedTraverve('/path/to/object')" if You know the path to the object. Alternatively You could use a catalog to look up objects if You are not sure where the objects are ... as the catalog is a persistent object itself this means You need a globally available catalog for Your application which You know You can look up in a certain location ...
How can I create new objects programmatically in Zope? 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?
There are "factory methods" for nearly all persistent objects. They are registered in the "context.registerClass" call in the __init__.py of the corresponding product (normally). These methods then are available via the "manage_addProduct" attribute on every "folder" object; i.e. for adding a Page Template (which is a class defined in the "PageTemplates" Product) programatically You say: folder.manage_addProduct['PageTemplates'].manage_addPageTemplate('template_id', template_content) where "folder" is the object which should contain the new page template, and template_content is a string containing the contents of the new template.
I've read all the documentation I can find on the web site, so if I've missed something please point me to it.
Another source of inspiration is to install products which seem to do something similar what You want and try to figure out how they did it. (I personally prefer Silva for rather obvious reasons ;) Cheers, Clemens
participants (2)
-
Clemens Robbenhaar -
Ryan Boder