I want to give operators access to this from clients while we’re still trying to resolve performance issues so that I don’t have to take lots of calls in the early hours of the morning to press this button myself
Mmm, not easily. It’s a private method on the GatewayNetworkManager you get from GatewayContext::getGatewayAreaNetworkManager and it takes the record ID as a parameter, not the name of the connection.
I’m almost there, I just don’t know how to get the id. On the available connections collection items I’ve tried getting getId, getLocalUUID and some others. The restart connection method is looking for an id of type Java.lang.Long any clues?
When I try to implement this code I get the following errors for line 1 and 2: “ImportError: No module named gateway”
And for line 3 : “ImportError: No module named simpleorm”
What could I be doing wrong?
Also, would this work for either outgoing or incoming connections?
Thanks for any help, I’m looking for exactly this function!
IgnitionGateway is an internal "implementation" class. You aren't supposed to program against it.
The proper way to do something like this is to write a module, where you will be delivered a (documented) GatewayContext object in your setup hook and can use that to get access to the (supported from module development) managers that represent various subsystems.
None of what Nick wrote is supported from scripting. Your resource for discovery is these forums.
@PGriffith, so is there is no "proper" way to get a GatewayContext object for gateway scripting, outside of developing a module?
The use case I was looking into was finding a way to list all configured gateway network connections and their status since that does not seem to be available through the system functions. I managed to pull some detail by making a revised version of @nminchin's script above using trial-and-error and guesswork (see below)... but it would be great to have better documentation on the attributes for each object used (particularly for class com.inductiveautomation.metro.impl.ConnectionWatcher), or a supported/approved way to get at the same detail.
BTW, I am aware of the very limited status info available in the system tags at [System]Gateway/Gateway Network.
No, because IA doesn't promise to keep SDK APIs backwards compatible, and implementation details do change from time to time. Module authors are expected to suck it up deal with it.
Just know that anything you do in jython with a context object is subject to breakage on Ignition upgrades, and IA support will ignore your whining about it.
For a concrete example:
For basically all of Ignition's lifetime, we've been using SimpleORM and an internal database, though the 'flavor' of that internal DB has changed from HSQLDB to SQLite. We also take great pains to make supported operations continue to work even when you upgrade Ignition.
So if the things you're doing in that script were supported, but we ditched SimpleORM (as we are in 8.3.0, when gateway config is moving to the filesystem), we would have to spend even more engineering effort adapting all of the scripting you had in place to "bridge" all the calls to whatever new system we come up with. Now expand that example to literally everything else in the gateway, designer, and client, across every version, across the entire history of Ignition.
We have to have some line in the sand as far as guaranteed support; what we've come up with is allowing access to these internal details (we don't make any effort to prevent you from doing things like you and Nick are doing here), but also not making it easier - because the "right" thing to do is for us to make a better first-party API that is supported (and maintained) that solves the problem(s) you might have. For everything we can't/won't/haven't done first party, you've got the forums.
So the "right" solution would be an ideas post or a support ticket that describes your problem, and we'll collate that together with everyone else's feedback and decide on a future path for the product forward.