openfin-gateway

OpenFin Gateway

License

License

GroupId

GroupId

com.mijibox.openfin
ArtifactId

ArtifactId

openfin-gateway
Last Version

Last Version

1.3
Release Date

Release Date

Type

Type

jar
Description

Description

openfin-gateway
OpenFin Gateway
Project URL

Project URL

https://github.com/mijibox/openfin-java-gateway
Source Code Management

Source Code Management

https://github.com/mijibox/openfin-java-gateway

Download openfin-gateway

How to add to project

<!-- https://jarcasting.com/artifacts/com.mijibox.openfin/openfin-gateway/ -->
<dependency>
    <groupId>com.mijibox.openfin</groupId>
    <artifactId>openfin-gateway</artifactId>
    <version>1.3</version>
</dependency>
// https://jarcasting.com/artifacts/com.mijibox.openfin/openfin-gateway/
implementation 'com.mijibox.openfin:openfin-gateway:1.3'
// https://jarcasting.com/artifacts/com.mijibox.openfin/openfin-gateway/
implementation ("com.mijibox.openfin:openfin-gateway:1.3")
'com.mijibox.openfin:openfin-gateway:jar:1.3'
<dependency org="com.mijibox.openfin" name="openfin-gateway" rev="1.3">
  <artifact name="openfin-gateway" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.mijibox.openfin', module='openfin-gateway', version='1.3')
)
libraryDependencies += "com.mijibox.openfin" % "openfin-gateway" % "1.3"
[com.mijibox.openfin/openfin-gateway "1.3"]

Dependencies

compile (4)

Group / Artifact Type Version
net.java.dev.jna : jna-platform jar 5.5.0
org.slf4j : slf4j-api jar 1.7.30
org.apache.commons : commons-compress jar 1.20
javax.json : javax.json-api jar 1.1.4

test (3)

Group / Artifact Type Version
ch.qos.logback : logback-classic jar 1.2.3
org.glassfish : javax.json jar 1.1.4
junit : junit jar 4.13

Project Modules

There are no modules declared in this project.

OpenFin Java Gateway

Using OpenFin API Protocol and built on top of the InterApplicationBus messaging. It opens the gateway between your Java application and OpenFin JavaScript V2 API.

Using the gateway, you can send and receive OpenFin InterApplicationBus messages natively or invoke almost any OpenFin JavaScript V2 API methods.

The following code snippet shows how to connect to OpenFin Runtime and invoke OpenFin JavaScript V2 APIs.

OpenFinGatewayLauncher.newOpenFinGatewayLauncher()
        .launcherBuilder(OpenFinLauncher.newOpenFinLauncherBuilder()
                .runtimeVersion("stable")
                .addRuntimeOption("--v=1")
                .addRuntimeOption("--no-sandbox"))
        .open()
        .thenAccept(gateway -> {
            gateway.invoke("fin.System.getVersion").thenAccept(r -> {
                System.out.println("openfin version: " + r.getResultAsString());
            });

            gateway.invoke(true, "fin.Application.startFromManifest",
                    Json.createValue("https://cdn.openfin.co/demos/hello/app.json")).thenAccept(r -> {
                        JsonObject appObj = r.getResultAsJsonObject();
                        System.out.println("appUuid: " + appObj.getJsonObject("identity").getString("uuid"));
                        ProxyObject proxyAppObj = r.getProxyObject();
                        proxyAppObj.addListener("on", "closed", (e) -> {
                            System.out.println("hello openfin closed, listener got event: " + e);
                            gateway.close();
                        });
                    }).exceptionally(e -> {
                        System.err.println("error starting hello openfin app");
                        e.printStackTrace();
                        gateway.close();
                        return null;
                    });
        });

Under the hood, it launches OpenFin Runtime directly on MacOS or Linux, and via OpenFin RVM on Windows. If OpenFin Runtime or RVM cannot be found locally, it will be downloaded from OpenFin's server or specified assetsUrl.

More examples using OpenFin Java Gateway can be found in OpenFin Java Gateway Examples

If asynchronous programming is not your thing, check out OpenFin Java-JavaScript Adapter, which is built on top of OpenFin Java Gateway.

Methods like fin.System.monitorExternalProcess that have listener nested inside an object cannot be invoked correctly at the moment. Gateway v2 will have the ability to support such.

License

Apache License 2.0

The code in this repository is covered by the included license.

However, if you run this code, it may call on the OpenFin RVM or OpenFin Runtime, which are covered by OpenFin’s Developer, Community, and Enterprise licenses. You can learn more about OpenFin licensing at the links listed below or just email OpenFin at [email protected] with questions.

https://openfin.co/developer-agreement/
https://openfin.co/licensing/

Versions

Version
1.3
1.2
1.1
1.0