[ https://issues.apache.org/jira/browse/ZOOKEEPER-425?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12780278#action_12780278 ]
David Bosschaert commented on ZOOKEEPER-425: -------------------------------------------- Let me explain the context of my work. For the OSGi Remote Services Admin Service (an OSGi specification based on the Distributed OSGi RFC 119 work) we are working on the Reference Implementation in CXF (http://cxf.apache.org/distributed-osgi.html). The Reference Implementation supports the Discovery concepts of the Remote Service specification and for the implementation we make use of ZooKeeper. In our code, we use zookeeper in two ways: * In zookeeper client code. This code resides in bundles that import the org.apache.zookeeper and org.apache.zookeeper.data * We also need to be able to run the zookeeper server from inside an OSGi bundle So this is really cases 1 & 3 above. I think we all agree on 1, and I can certainly put that in a separate patch. On part 2 - this is the one that Alan filed ZOOKEEPER-584 for, right? This is a case that I don't need at this point, and therefore I probably don't understand what the best way to realize it is. I understand that this can be quite useful and registering a 'trivial' zookeeper object in the service registry is easy, but I guess what Alan is really looking for is an object from which he can get some management information. I really see this as a separate issue and one possibly best solved by someone who actually has a need for this. The code that I attached does address part 3 somewhat, although I agree that it could be better. However it's a start. The zookeeper server starts and can be configured. I can try to make the shutdown/restart on reconfiguration work as well. I haven't been troubled by the System.exits() yet. It works well enough for me at the moment, although it could be improved. Could we not do the improvement over time in the future, starting off with something that works a bit like in my patch and then making it better over time? Patrick, on your comment re a contrib package. First of all the code is not specific to an osgi container and should work equally in all osgi frameworks. Do you mean just putting the source code in a separate location or are you also thinking of putting it in a separate jar file? I would suggest putting the Activator and ManagedService in the ordinary zookeeper.jar. Outside of an OSGi framework these classes are simply ignored, but when the jar is used as an OSGi bundle they are automatically found and used. If you put it in a separate jar you will have to deploy 2 bundles before you can run the zookeeper server in an OSGi framework, which is possible but you'd have to export org.apache.zookeeper.server which is currently internal to make it work. Besides these two classes are currently only about 5kb in total. > Add OSGi metadata to zookeeper.jar > ---------------------------------- > > Key: ZOOKEEPER-425 > URL: https://issues.apache.org/jira/browse/ZOOKEEPER-425 > Project: Zookeeper > Issue Type: Improvement > Components: build > Affects Versions: 3.1.1 > Reporter: David Bosschaert > Attachments: MANIFEST.MF, zk_patch3.patch > > > After adding OSGi metadata to zookeeper.jar it can be used as both an OSGi > bundle as well as an ordinary jar file. > In the CXF/DOSGi project the buildsystem does this using the > maven-bundle-plugin: > http://svn.apache.org/repos/asf/cxf/dosgi/trunk/discovery/distributed/zookeeper-wrapper/pom.xml > The MANIFEST.MF generated by maven-bundle-plugin is attached to this bug, > this works for the CXF/DOSGi project. > If your buildsystem isn't using maven, I would advise to use bnd > (http://www.aqute.biz/Code/Bnd). BND defines its own ant task in which you > should be able to use more or less the same instructions as were used in > maven: > <instructions> > <Bundle-Name>ZooKeeper bundle</Bundle-Name> > <Bundle-Description>This bundle contains the ZooKeeper > library</Bundle-Description> > <Bundle-SymbolicName>org.apache.hadoop.zookeeper</Bundle-SymbolicName> > <Bundle-Version>3.1.1</Bundle-Version> > <Import-Package>*</Import-Package> > <Export-Package>*;version=3.1.1</Export-Package> > </instructions> > Oh and one other thing. Is it really necessary to put the source code in the > Jar file too? I would put that in a separate source distribution :) > See also: > http://mail-archives.apache.org/mod_mbox/hadoop-zookeeper-user/200905.mbox/%3c4a2009b1.3030...@yahoo-inc.com%3e -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.