Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support websocket URLs #21

Merged
merged 15 commits into from
Dec 17, 2019
Merged

Support websocket URLs #21

merged 15 commits into from
Dec 17, 2019

Conversation

dominikl
Copy link
Member

@dominikl dominikl commented Aug 19, 2019

Websocket connection works in principle, but at the moment you'll get a "Failed to get inet address...." warning when the gateway tries to get the IP of the server. This PR just fixes the issue.

Test with something like this, e.g. against idr next ( this would implicitly also test ome/omero-blitz#66 ):

public static void main(String... args) throws Exception {
        LoginCredentials cred = new LoginCredentials("USERNAME",
                "PASSWORD",
                "wss://[OMERO SERVER]/omero-ws", 443);
        Gateway gateway = new Gateway(new SimpleLogger());
        ExperimenterData user = gateway.connect(cred);
        System.out.println("Logged in as "+user.getUserName());
        gateway.disconnect();
    }

Then also test the 'normal' login via hostname only, and hostname + port.

@jburel
Copy link
Member

jburel commented Aug 20, 2019

tested in a notebook with today's gateway build.
I can connect to idr-next.
Few difference with the Python connection: ws is used instead of wss. Port did not have to be specified.
It did not work if I use ws or if the port is not specified.
cc @manics

@jburel
Copy link
Member

jburel commented Aug 20, 2019

i also tested using R and I could connect to idr-next too

@dominikl
Copy link
Member Author

dominikl commented Aug 20, 2019

Sorry @jburel , I pretty much overhauled the ServerInformation class again, would have to test again. So basically there are now two methods: The previous getHostname() which now really only returns the hostname (even if a websocket URL was specified) and getHost() which either returns a websocket address or the hostname (if only a hostname was specified), as intended to be used to create the omero.client.
This should be backwards compatible, because the behaviour of setHostname() and getHostname() doesn't change when used with hostnames like it used to be (only for the new websocket URLs it will be different).

Copy link
Member

@manics manics left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One minor comment, but based on testing ome/omero-insight#66 this works well.

@dominikl dominikl changed the title Get hostname in case URL was given Support websocket URLs Sep 12, 2019
Copy link
Member

@joshmoore joshmoore left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two minor comments that can easily be handled in a follow-up. They are more general guidelines that we could apply to all Java classes. Otherwise, 👍

Copy link
Member

@joshmoore joshmoore left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like the final-related issues I saw previously have been taken care of.

One thing outwith this PR to discuss: the addition of methods would suggest this be released as 5.6, for example, if someone has previously subclassed.

@dominikl
Copy link
Member Author

I'm not sure what that means with respect to merging the PR: Can't be merged until we plan to release a 5.6 version?

@manics
Copy link
Member

manics commented Oct 22, 2019

I vote for getting this in, I've tested the merge build in a Docker container on mybinder.org and it's worked!

@joshmoore
Copy link
Member

I'd put it the other way around. I don't see anything blocking the release of this PR, but we should discuss the version number.

@manics
Copy link
Member

manics commented Oct 22, 2019

Noticed an issue on Linux when no preferences are set:

$ rm -rf ~/.java ~/omero
$ ./OMERO.insight-5.5.7-SNAPSHOT/bin/omero-insight
Oct 22, 2019 12:28:39 PM java.util.prefs.FileSystemPreferences$1 run
INFO: Created user preferences directory.
Abnormal termination due to an uncaught exception.
java.lang.NullPointerException
	at org.openmicroscopy.shoola.util.ui.login.ServerEditor.initComponents(ServerEditor.java:182)
	at org.openmicroscopy.shoola.util.ui.login.ServerEditor.<init>(ServerEditor.java:378)
	at org.openmicroscopy.shoola.util.ui.login.ServerEditor.<init>(ServerEditor.java:365)
	at org.openmicroscopy.shoola.util.ui.login.ScreenLogin.<init>(ScreenLogin.java:835)
	at org.openmicroscopy.shoola.env.ui.SplashScreenManager.initializedView(SplashScreenManager.java:172)
	at org.openmicroscopy.shoola.env.ui.SplashScreenManager.<init>(SplashScreenManager.java:236)
	at org.openmicroscopy.shoola.env.ui.SplashScreenProxy.<init>(SplashScreenProxy.java:123)
	at org.openmicroscopy.shoola.env.ui.UIFactory.makeSplashScreen(UIFactory.java:59)
	at org.openmicroscopy.shoola.env.init.SplashScreenInit.execute(SplashScreenInit.java:86)
	at org.openmicroscopy.shoola.env.init.Initializer.doInit(Initializer.java:275)
	at org.openmicroscopy.shoola.env.Container.runStartupProcedure(Container.java:118)
	at org.openmicroscopy.shoola.env.Container.access$000(Container.java:68)
	at org.openmicroscopy.shoola.env.Container$1.run(Container.java:164)
	at java.lang.Thread.run(Thread.java:748)
Abnormal termination due to an uncaught exception.
java.lang.NullPointerException
	at org.openmicroscopy.shoola.util.ui.login.ServerEditor.initComponents(ServerEditor.java:182)
	at org.openmicroscopy.shoola.util.ui.login.ServerEditor.<init>(ServerEditor.java:378)
	at org.openmicroscopy.shoola.util.ui.login.ServerEditor.<init>(ServerEditor.java:365)
	at org.openmicroscopy.shoola.util.ui.login.ScreenLogin.<init>(ScreenLogin.java:835)
	at org.openmicroscopy.shoola.env.ui.SplashScreenManager.initializedView(SplashScreenManager.java:172)
	at org.openmicroscopy.shoola.env.ui.SplashScreenManager.<init>(SplashScreenManager.java:236)
	at org.openmicroscopy.shoola.env.ui.SplashScreenProxy.<init>(SplashScreenProxy.java:123)
	at org.openmicroscopy.shoola.env.ui.UIFactory.makeSplashScreen(UIFactory.java:59)
	at org.openmicroscopy.shoola.env.init.SplashScreenInit.execute(SplashScreenInit.java:86)
	at org.openmicroscopy.shoola.env.init.Initializer.doInit(Initializer.java:275)
	at org.openmicroscopy.shoola.env.Container.runStartupProcedure(Container.java:118)
	at org.openmicroscopy.shoola.env.Container.access$000(Container.java:68)
	at org.openmicroscopy.shoola.env.Container$1.run(Container.java:164)
	at java.lang.Thread.run(Thread.java:748)
Exception in thread "Initializer"

@dominikl
Copy link
Member Author

Thanks, good point, I never tested this case. Rather refers to ome/omero-insight#66 I think.

@sbesson
Copy link
Member

sbesson commented Oct 23, 2019

Re version numbers, reading the difference between master and the last tag. I see #22 #18 both introduce backwards-compatible API and deprecate some methods. My vote also goes towards calling this a day, merging and releasing all features since 5.5.4 as org.openmicroscopy:omero-gateway:5.6.0

@dominikl
Copy link
Member Author

Sorry, had to add one more commit to bump the blitz version to 5.5.4 so that ome/omero-blitz#66 is included. On that occassion also rebased to latest master branch.

this.uri = new URI(null,null, hostname,
port, null, null, null);
}
} catch (URISyntaxException e) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you want to log the error?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thought about it. But at that point I don't have any reference to the Gateway, which has the Logger.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok understood

@jburel jburel merged commit c40c55a into ome:master Dec 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants