Archived

This forum has been archived. Please start a new discussion on GitHub.

implement location service in Java

Hi,

Location Services mentions that location service implementation is out of the scope for the document. Are there any examples, specifically in Java, already out there?

A colleague of mine got it working with Python by:
import Ice
import CustomIPC.Locator

class FileRegistry(Ice.Locator, CustomIPC.Locator.FileRegistry):

Implementing
def findObjectById_async(self, cb, id, current = None):
def findAdapterById_async(self, cb, id, current = None):

creating an OA, adding self to it, activating, and setting default locator to it.

My problem trying to do this in Java is not knowing exactly what interfaces to implement or classes to extend.
Implementing Ice.Locator can't be right as it implements Ice.Object and then too much internal stuff is exposed.

Thanks.

Comments

  • If you want to implement your own location service, you need to implement the Ice::Locator interface and register your locator with the Ice run time. You can look at the implementation of the locator in IceGrid for inspiration.

    I don't understand what you mean by derivation from Ice::Object exposing too much internal stuff. In fact every servant is-a Ice::Object--that's just how the API works.

    Cheers,

    Michi.
  • benoit
    benoit Rennes, France
    Hi,

    You can also look at the implementation of the location service from the test/Ice/location test in your Ice for Java distribution. In Java, you need to create a class that extends Ice._LocatorDisp to implement the locator interface.

    Cheers,
    Benoit.
  • Thanks, that works. I was looking for a concrete class that already implemented Ice.Object and most of Ice.Locator to extend, not abstract interfaces to implement.