Page 1 of 1

Adding own service to OMERO (second test)

PostPosted: Fri Mar 18, 2016 1:17 pm
by dwj
Hi OMERO team,

As I described in Post Adding own service to OMERO I try to add an own service to OMERO. With the help of atarkowska I’m able to call the implemented service and methods from the omero shell. Now I want to use the service from a java client.
For this I expand the gateway by the method:
Code: Select all
IReceptorLightServicePrx getReceptorLightService(SecurityContext ctx)


At the client I’m able to get the service proxy without problems. But when I call the method ‘getPlasmid(long id)’ which is provided by the proxy I got the following exception:
Code: Select all
Ice.OperationNotExistException
    id.name = "0652e4ea-498a-4978-b7c0-3d2d37f86ca4omero.api.Search"
    id.category = "c4207288-3bbd-4389-a369-583226eabc64"
    facet = ""
    operation = "getPlasmid"
   at IceInternal.Outgoing.invoke(Outgoing.java:158)
   at omero.api._IReceptorLightServiceDelM.getPlasmid(_IReceptorLightServiceDelM.java:43)
   at omero.api.IReceptorLightServicePrxHelper.getPlasmid(IReceptorLightServicePrxHelper.java:58)
   at omero.api.IReceptorLightServicePrxHelper.getPlasmid(IReceptorLightServicePrxHelper.java:30)
   at OmeroAL.Client.Client.<init>(Client.java:96)
   at OmeroAL.API.Connection.Connect(Connection.java:40)
   at OmeroALTest.Controller.<init>(Controller.java:31)
   at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
   at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
   at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
   at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
   at java.lang.Class.newInstance(Class.java:442)
   at sun.reflect.misc.ReflectUtil.newInstance(ReflectUtil.java:51)
   at javafx.fxml.FXMLLoader$ValueElement.processAttribute(FXMLLoader.java:927)
   at javafx.fxml.FXMLLoader$InstanceDeclarationElement.processAttribute(FXMLLoader.java:971)
   at javafx.fxml.FXMLLoader$Element.processStartElement(FXMLLoader.java:220)
   at javafx.fxml.FXMLLoader$ValueElement.processStartElement(FXMLLoader.java:744)
   at javafx.fxml.FXMLLoader.processStartElement(FXMLLoader.java:2707)
   at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2527)
   at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2441)
   at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2409)
   at OmeroALTest.OalTest.start(OalTest.java:18)
   at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$162(LauncherImpl.java:863)
   at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$175(PlatformImpl.java:326)
   at com.sun.javafx.application.PlatformImpl.lambda$null$173(PlatformImpl.java:295)
   at java.security.AccessController.doPrivileged(Native Method)
   at com.sun.javafx.application.PlatformImpl.lambda$runLater$174(PlatformImpl.java:294)
   at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
   at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
   at com.sun.glass.ui.win.WinApplication.lambda$null$148(WinApplication.java:191)
   at java.lang.Thread.run(Thread.java:745)


It seems that I have to update parts of the ICE implementation or configuration at the Omero server.
The question is: Where and How?
Does anyone know how to do that?

Thanks,
Daniel

Re: Adding own service to OMERO (second test)

PostPosted: Tue Mar 22, 2016 9:35 am
by atarkowska
HI Daniel,

It will be very handy if you could show us your code

Ola

Re: Adding own service to OMERO (second test)

PostPosted: Tue Mar 22, 2016 10:27 am
by dwj
Hi,

Sorry, I’m not that familiar with git because I usually use TFS as version control service.
How can I check in a shelveset (so it is called at TFS) to the git repository? I use version 5.2.1 of omero and cloned it by following command:
git clone https://github.com/openmicroscopy/openmicroscopy.git --branch v5.2.1

Thanks for you help,
Daniel

Re: Adding own service to OMERO (second test)

PostPosted: Tue Mar 22, 2016 3:19 pm
by dwj
Hi,

I just checked in my version.

You can watch the changes here:

https://github.com/openmicroscopy/openm ... ServerTest

Thanks a lot,
Daniel

Re: Adding own service to OMERO (second test)

PostPosted: Tue Mar 22, 2016 4:09 pm
by jmoore
Hi Daniel,

wow. Congratulations on this. It looks like it's only a very small copy-n-paste issue which has you stumped: https://github.com/openmicroscopy/openmicroscopy/compare/develop...Daniel-Walther:ServerTest#diff-64c84d8cfdae4057c0a7e5ecf0014523R372

Code: Select all
get(omero.constants.SEARCH.value, unsecureClient == null));


That constant should be `RECEPTORLIGHTSERVICE`.

Two other comments though:

  • by adding a model object, you are effectively forking the DB. This is certainly valid, but it requires a certain amount of maintenance. If you want a lower maintenance burden (albeit with less functionality) you may want to consider using StructuredAnnotations. If you do want to have your own DB, I'd suggest modifying the DBVERSION string in etc/omero.properties. See Schema Changes for more information. Note: omero.biobank was developed with its own DB as well.
  • the service strategy you are using is the easiest for your users but the most work on the developers. Again, depending on how you see maintenance happening, you might want to look at the `omero.cmd` service style. An example is available via https://github.com/joshmoore/ome-cmd-example . Additionally, it prefers an asynchronous calling model. Note: if you choose to use StructuredAnnotations, having your own service may not be necessary at all.

All the best,
~Josh.

Re: Adding own service to OMERO (second test)

PostPosted: Tue Mar 22, 2016 6:15 pm
by dwj
Hi Josh,

Thanks a lot! It works! I changed my stupid copy-paste failure und add a '@Override' tag to the getPlasmid method at the server-side implementation (ReceptorLightServiceImpl.java).

I checked in the bugfix for those who want to use the example as a starting point for an own server implementation.

Thanks again,
Daniel

Re: Adding own service to OMERO (second test)

PostPosted: Wed Apr 06, 2016 6:56 am
by sbesson
For future references, the bug fix mentioned by Daniel is included in this commit.