On 12/10/2009 10:13 AM, Kenton Varda wrote: > Is this for the RPC system?
yes > I think you're making this a lot harder > than it needs to be. ah. > On the server side, when someone wants to export a service, they will > construct a service implementation and pass it to your system. The > com.google.protobuf.Service interface has methods getDescriptor(), > getRequestPrototype(), and getResponsePrototype(), to get the > ServiceDescriptor, request message class, and response message class > respectively. So, you don't need to consult any tables. Right. That's what I needed. Thanks. Sorry. > On the client side, your RPC implementation should merely provide the > user with an object implementing com.google.protobuf.RpcChannel. The > caller then calls MyServiceType.newStub(channel) to construct a > type-safe stub. The RPC system does not need to know what kind of > service it is. I'm not using this since you said this will disapear at some point... > 2009/12/10 Romain François <francoisrom...@free.fr > <mailto:francoisrom...@free.fr>> > > On 12/09/2009 09:00 PM, Kenton Varda wrote: > > Actually I don't think we need DescriptorPool in Java. > DescriptorPool > was primarily written for the purpose of memory management, but Java > handles that for us. If all you need is the mapping aspect, > just build > a Map<String, ServiceDescriptor> yourself and use it. > > > This is close to what I do now. Next question is : can I get hold of > the java class that is associated with a Descriptor. > > >From the service descriptor, I can get to the MethodDescriptor I > am interested in, and then I can get the Descriptor of the input > type of the method, but at that point I would like to create a > builder for the input message. Should I also maintain a > Map<String,Descriptor> > > One thing I thought of would be to go back to the file descriptor > associated with the input message type descriptor, check the two > java options, and use java reflection. would this work ? > > It is a shame the java class name is not the same as the message > type full name. > > True, in C++ there is the "global pool" which is automatically > populated > with everything compiled into the binary. This wouldn't work in > Java > because classes are not loaded until they are first accessed, so > there > is no way to populate this pool. Besides, singletons are evil. I > honestly wish that I'd never introduced the global pool in C++; > it has > lead to too many subtle singleton problems. > > 2009/12/9 Jason Hsueh <jas...@google.com > <mailto:jas...@google.com> <mailto:jas...@google.com > <mailto:jas...@google.com>>> > > > No, there isn't an equivalent to the DescriptorPool in Java. > If you > know the types that you want you can build a mapping > yourself. Or if > you'd be interested in porting the C++ DescriptorPool to > java that > would be great! > > 2009/12/9 Romain François <francoisrom...@free.fr > <mailto:francoisrom...@free.fr> > <mailto:francoisrom...@free.fr <mailto:francoisrom...@free.fr>>> > > > Hello, > > Given a service/method full name, I'd like to get hold > of the > ServiceDescriptor, or MethodDescriptor. In C++ I would > use the > DescriptorPool, but I don't see this in the java api. > > Is there a way ? > > Romain -- Romain Francois Professional R Enthusiast +33(0) 6 28 91 30 30 http://romainfrancois.blog.free.fr |- http://tr.im/Gq7i : ohloh |- http://tr.im/FtUu : new package : highlight `- http://tr.im/EAD5 : LondonR slides -- You received this message because you are subscribed to the Google Groups "Protocol Buffers" group. To post to this group, send email to proto...@googlegroups.com. To unsubscribe from this group, send email to protobuf+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/protobuf?hl=en.