public class DesktopConnection extends Object
| Constructor and Description |
|---|
DesktopConnection(String uuid)
Creates a new connection to Runtime.
|
DesktopConnection(String uuid,
String host,
Integer port)
Deprecated.
use
DesktopConnection(String) instead. |
| Modifier and Type | Method and Description |
|---|---|
void |
addEventCallback(org.json.JSONObject subscriptionObject,
EventListener listener,
AckListener callback,
Object source)
Registers an event listener on the specified event
|
CompletionStage<Ack> |
addEventCallbackAsync(org.json.JSONObject subscriptionObject,
EventListener listener,
Object source) |
void |
addExternalMessageHandler(ExternalMessageListener listener,
Object source)
Registers a listener to handle messages for this connection's UUID originating via HTTPS/HTTP
|
void |
connect(DesktopStateListener listener)
Connects to an Runtime process.
|
void |
connect(RuntimeConfiguration configuration,
DesktopStateListener listener,
int timeout)
Connect to Runtime with the specified configuration.
|
void |
disconnect()
Disconnects from Runtime
|
protected void |
disconnect(String reason) |
void |
exit()
Notify Runtime to exit
|
Channel |
getChannel(String name)
Gets specified channel.
|
InterApplicationBus |
getInterApplicationBus()
Gets the Inter-Application message dispatcher associated with this DesktopConnection
|
Interop |
getInterop()
Gets Interop API object.
|
Integer |
getPort()
Gets port number that Runtime is running on
|
SnapshotSource |
getSnapshotSource()
Gets SnapshotSource API object
|
String |
getUuid()
Gets the UUID of this connection.
|
boolean |
isConnected()
InterApplicationBus
|
<T> CompletableFuture<T> |
launchManifest(String manifestUrl,
Class<T> type,
RVMOptions options) |
void |
removeEventCallback(org.json.JSONObject subscriptionObject,
EventListener listener,
AckListener callback,
Object source)
Removes a previously registered event listener from the specified event
|
CompletionStage<Ack> |
removeEventCallbackAsync(org.json.JSONObject subscriptionObject,
EventListener listener,
Object source) |
protected void |
respondToPing(long pingId) |
void |
sendAction(String action,
org.json.JSONObject payload)
Sends a message to Runtime
|
void |
sendAction(String action,
org.json.JSONObject payload,
AckListener ackListener,
Object source)
Sends a message to Runtime
|
CompletableFuture<Ack> |
sendActionAsync(String action,
org.json.JSONObject payload,
Object source) |
void |
setAdditionalRuntimeArguments(String additionalRuntimeArguments)
Deprecated.
use
RuntimeConfiguration instead |
void |
setAdditionalRvmArguments(String additionalRvmArguments)
Deprecated.
use
RuntimeConfiguration instead |
void |
setDevToolsPort(int port)
Deprecated.
use
RuntimeConfiguration instead |
void |
setLogLevel(boolean enabled)
Deprecated.
|
void |
setRdmUrl(String url)
Deprecated.
|
void |
setRuntimeSecurityRealm(String runtimeSecurityRealm)
Deprecated.
use
RuntimeConfiguration instead |
public DesktopConnection(String uuid) throws DesktopException
Creates a new connection to Runtime.
If the system property "com.openfin.desktop.threads.message.out=nThreads" is
defined, it creates OpenFinThreadPool with fixed thread pool size of nThread and uses it to send
outgoing messages. If the system property "com.openfin.desktop.threads.message.in=nThreads" is
defined, it creates OpenFinThreadPool with fixed thread pool size of nThread and uses it to process
incoming messages. Otherwise ForkJoinPool.commonPool() will be used to process incoming and/or outgoing messages.
uuid - unique ID for Runtime to refer to this DesktopConnectionDesktopException - if this method fails to create a connectionpublic DesktopConnection(String uuid, String host, Integer port) throws DesktopException
DesktopConnection(String) instead.uuid - unique ID for Runtime to refer to this DesktopConnectionhost - The host that Runtime is running on. Only "localhost" is acceptedport - The port that Runtime is listening on for connections. -null if
unknownDesktopException - if this method fails to create a connectionpublic void connect(RuntimeConfiguration configuration, DesktopStateListener listener, int timeout) throws DesktopIOException, IOException
configuration - an instance of RuntimeConfigurationlistener - Receives updates on startup and connection statetimeout - number of seconds to wait for connection. If connection to Runtime is not established by the timeout the listener will get an onError() callDesktopIOException - if this method fails to connect to RuntimeIOException - if IO exception is thrown during launching RuntimeRuntimeConfigurationpublic void disconnect()
throws DesktopException
DesktopException - if this method fails to disconnect from Runtimeprotected void disconnect(String reason) throws DesktopException
DesktopExceptionpublic boolean isConnected()
public void exit()
throws DesktopException
DesktopException - if this method fails to exitpublic InterApplicationBus getInterApplicationBus()
public Integer getPort()
public void sendAction(String action, org.json.JSONObject payload) throws DesktopException
action - The action of the messagepayload - The message object to sendDesktopException - if this method fails to send the messagepublic CompletableFuture<Ack> sendActionAsync(String action, org.json.JSONObject payload, Object source)
public void sendAction(String action, org.json.JSONObject payload, AckListener ackListener, Object source)
action - The action of the messagepayload - The message object to sendackListener - AckListener for the messagesource - Message sourceAckListenerpublic void connect(DesktopStateListener listener)
listener - Receives updates on startup and connection stateDesktopStateListenerpublic CompletionStage<Ack> addEventCallbackAsync(org.json.JSONObject subscriptionObject, EventListener listener, Object source)
public void addEventCallback(org.json.JSONObject subscriptionObject,
EventListener listener,
AckListener callback,
Object source)
subscriptionObject - JSON object containing subscription information such as the topic and typelistener - EventListener for the eventcallback - AckListener for this requestsource - Source of this requestEventListener,
AckListenerpublic CompletionStage<Ack> removeEventCallbackAsync(org.json.JSONObject subscriptionObject, EventListener listener, Object source)
public void removeEventCallback(org.json.JSONObject subscriptionObject,
EventListener listener,
AckListener callback,
Object source)
subscriptionObject - JSON object containing subscription information such as the topic and typelistener - EventListener that was registered beforecallback - AckListener for this requestsource - source of this requestprotected void respondToPing(long pingId)
public void addExternalMessageHandler(ExternalMessageListener listener, Object source)
listener - process a received HTTPS/HTTP message for this connectionsource - The object that originally registered the listenerpublic void setAdditionalRuntimeArguments(String additionalRuntimeArguments)
RuntimeConfiguration insteadadditionalRuntimeArguments - additional arguments, such as "--v=1" to enable more loggingpublic void setAdditionalRvmArguments(String additionalRvmArguments)
RuntimeConfiguration insteadadditionalRvmArguments - additional argumentspublic void setRuntimeSecurityRealm(String runtimeSecurityRealm)
RuntimeConfiguration insteadruntimeSecurityRealm - name of the realmpublic void setRdmUrl(String url)
connect(RuntimeConfiguration, DesktopStateListener, int) instead.url - URL of RDM servicepublic void setDevToolsPort(int port)
RuntimeConfiguration insteadport - port numberpublic void setLogLevel(boolean enabled)
enabled - true for enabling DEBUG loggingpublic Channel getChannel(String name)
name - Name of the channelChannel object with the given name.public Interop getInterop()
public SnapshotSource getSnapshotSource()
public String getUuid()
public <T> CompletableFuture<T> launchManifest(String manifestUrl, Class<T> type, RVMOptions options) throws IllegalArgumentException
IllegalArgumentExceptionCopyright © 2022. All rights reserved.