com.openfin.desktop
Class DesktopConnection

java.lang.Object
  extended by com.openfin.desktop.DesktopConnection

public class DesktopConnection
extends Object

A object for launching, connecting to, and controlling AppDesktop.


Constructor Summary
DesktopConnection(String uuid)
          Creates a new connection to AppDesktop
DesktopConnection(String uuid, String host, Integer port)
          Creates a new connection to AppDesktop
 
Method Summary
 void addEventCallback(org.json.JSONObject subscriptionObject, EventListener listener, AckListener callback, Object source)
          Registers an event listener on the specified event
 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)
          Deprecated. use connectToVersion(String, DesktopStateListener, int) instead.
 void connectToVersion(String desktopVersion, DesktopStateListener listener, int timeout)
          Connect to specified version of Desktop.
 void disconnect()
          Disconnects from AppDesktop
 void exit()
          Notify AppDesktop to exit
 InterApplicationBus getInterApplicationBus()
          Gets the Inter-Application message dispatcher associated with this DesktopConnection
 Integer getPort()
          Gets port number that Runtime is running on
 boolean isConnected()
          InterApplicationBus
 void launchAndConnect(String commandLineArguments, DesktopStateListener listener, int timeout)
          Deprecated. use connectToVersion(String, DesktopStateListener, int) instead.
 void launchAndConnect(String desktopPath, String commandLineArguments, DesktopStateListener listener, int timeout)
          Deprecated. use connectToVersion(String, DesktopStateListener, int) instead.
 Integer registerNotificationListener(NotificationListener listener, Object source)
          Registers listener for a new notification
 void removeEventCallback(org.json.JSONObject subscriptionObject, EventListener listener, AckListener callback, Object source)
          Removes a previously registered event listener from the specified event
protected  void respondToPing(long pingId)
           
 void sendAction(String action, org.json.JSONObject payload)
          Sends a message to AppDesktop
 void sendAction(String action, org.json.JSONObject payload, AckListener listener, Object source)
          Sends a message to AppDesktop
 void sendActionToNotificationsCenter(String action, org.json.JSONObject payload, AckListener callback, Object source)
           
 void setAdditionalRuntimeArguments(String additionalRuntimeArguments)
          Set additional runtime arguments passed to the Runtime
 void setAdditionalRvmArguments(String additionalRvmArguments)
          Set additional runtime arguments passed to the RVM
 void setLogLevel(boolean enabled)
          Deprecated.  
 void setRdmUrl(String url)
          Set URL of RDM service
 void setRuntimeAssetsUrl(String url)
          Set root URL/URI for the RVM and Runtime assets.
 void setRuntimeSecurityRealm(String runtimeSecurityRealm)
          Set security realm of the Runtime
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DesktopConnection

public DesktopConnection(String uuid)
                  throws DesktopException
Creates a new connection to AppDesktop

Parameters:
uuid - unique ID for AppDesktop to refer to this DesktopConnection
Throws:
DesktopException

DesktopConnection

public DesktopConnection(String uuid,
                         String host,
                         Integer port)
                  throws DesktopException
Creates a new connection to AppDesktop

Parameters:
uuid - unique ID for AppDesktop to refer to this DesktopConnection
host - The host that AppDesktop is running on
port - The port that AppDesktop is listening on for connections. -null if unknown
Throws:
DesktopException
Method Detail

launchAndConnect

public void launchAndConnect(String commandLineArguments,
                             DesktopStateListener listener,
                             int timeout)
                      throws URISyntaxException,
                             DesktopIOException
Deprecated. use connectToVersion(String, DesktopStateListener, int) instead.

Launches AppDesktop and notifies the listener when connected. This method launches OpenFinRVM.exe embedded in the jar.

Parameters:
commandLineArguments - Command line arguments to start the AppDesktop with
listener - Receives updates on startup and connection state
timeout - For connecting to Desktop after launch. If the connection to AppDesktop is not established by the timeout the listener will get an onError() call
Throws:
URISyntaxException
DesktopIOException

launchAndConnect

public void launchAndConnect(String desktopPath,
                             String commandLineArguments,
                             DesktopStateListener listener,
                             int timeout)
                      throws URISyntaxException,
                             DesktopIOException
Deprecated. use connectToVersion(String, DesktopStateListener, int) instead.

Launches AppDesktop and notifies the listener when connected.

Parameters:
desktopPath - Absolute path to the AppDesktop executable
commandLineArguments - Command line arguments to start the AppDesktop with
listener - Receives updates on startup and connection state
timeout - For connecting to Desktop after launch. If the connection to AppDesktop is not established by the timeout the listener will get an onError() call
Throws:
URISyntaxException
DesktopIOException

connectToVersion

public void connectToVersion(String desktopVersion,
                             DesktopStateListener listener,
                             int timeout)
                      throws URISyntaxException,
                             DesktopIOException,
                             IOException
Connect to specified version of Desktop. If the specified version is not running, this method will try to start it.

Parameters:
desktopVersion - version of Desktop required
listener - Receives updates on startup and connection state
timeout - number of seconds to wait for connection. If connection to Runtime is not established by the timeout the listener will get an onError() call
Throws:
URISyntaxException
DesktopIOException
IOException

disconnect

public void disconnect()
                throws DesktopException
Disconnects from AppDesktop

Throws:
DesktopException

isConnected

public boolean isConnected()
InterApplicationBus

Returns:
true if connected

exit

public void exit()
          throws DesktopException
Notify AppDesktop to exit

Throws:
DesktopException

getInterApplicationBus

public InterApplicationBus getInterApplicationBus()
Gets the Inter-Application message dispatcher associated with this DesktopConnection

Returns:
InterApplicationBus

getPort

public Integer getPort()
Gets port number that Runtime is running on

Returns:
port number

sendAction

public void sendAction(String action,
                       org.json.JSONObject payload)
                throws DesktopException,
                       DesktopIOException
Sends a message to AppDesktop

Parameters:
action - The action of the message
payload - The message object to send
Throws:
DesktopException
DesktopIOException

sendAction

public void sendAction(String action,
                       org.json.JSONObject payload,
                       AckListener listener,
                       Object source)
Sends a message to AppDesktop

Parameters:
action - The action of the message
payload - The message object to send
listener - AckListener for the message
source - Message source
See Also:
AckListener

connect

public void connect(DesktopStateListener listener)
             throws URISyntaxException,
                    DesktopIOException
Deprecated. use connectToVersion(String, DesktopStateListener, int) instead.

Connects to an AppDesktop process

Parameters:
listener - Receives updates on startup and connection state
Throws:
URISyntaxException
DesktopIOException
See Also:
DesktopStateListener

registerNotificationListener

public Integer registerNotificationListener(NotificationListener listener,
                                            Object source)
Registers listener for a new notification

Parameters:
listener - NotificationListener for the notification
source - Source of the request
Returns:
Notification Id
See Also:
NotificationListener

sendActionToNotificationsCenter

public void sendActionToNotificationsCenter(String action,
                                            org.json.JSONObject payload,
                                            AckListener callback,
                                            Object source)

addEventCallback

public void addEventCallback(org.json.JSONObject subscriptionObject,
                             EventListener listener,
                             AckListener callback,
                             Object source)
Registers an event listener on the specified event

Parameters:
subscriptionObject - JSON object containing subscription information such as the topic and type
listener - EventListener for the event
callback - AckListener for this request
source - Source of this request
See Also:
EventListener, AckListener

removeEventCallback

public void removeEventCallback(org.json.JSONObject subscriptionObject,
                                EventListener listener,
                                AckListener callback,
                                Object source)
Removes a previously registered event listener from the specified event

Parameters:
subscriptionObject - JSON object containing subscription information such as the topic and type
listener - EventListener that was registered before
callback - AckListener for this request
source - source of this request

respondToPing

protected void respondToPing(long pingId)

addExternalMessageHandler

public void addExternalMessageHandler(ExternalMessageListener listener,
                                      Object source)
Registers a listener to handle messages for this connection's UUID originating via HTTPS/HTTP

Parameters:
listener - process a received HTTPS/HTTP message for this connection
source - The object that originally registered the listener

setAdditionalRuntimeArguments

public void setAdditionalRuntimeArguments(String additionalRuntimeArguments)
Set additional runtime arguments passed to the Runtime

Parameters:
additionalRuntimeArguments - additional arguments, such as "--v=1" to enable more logging

setAdditionalRvmArguments

public void setAdditionalRvmArguments(String additionalRvmArguments)
Set additional runtime arguments passed to the RVM

Parameters:
additionalRvmArguments - additional arguments

setRuntimeSecurityRealm

public void setRuntimeSecurityRealm(String runtimeSecurityRealm)
Set security realm of the Runtime

Parameters:
runtimeSecurityRealm - name of the realm

setRdmUrl

public void setRdmUrl(String url)
Set URL of RDM service

Parameters:
url -

setRuntimeAssetsUrl

public void setRuntimeAssetsUrl(String url)
Set root URL/URI for the RVM and Runtime assets. This can be a CDN or other server location. RVM and Runtime assets should be served from the following paths:
  url/rvm
  url/runtime
 

Parameters:
url -

setLogLevel

public void setLogLevel(boolean enabled)
Deprecated. 

Set log level to be FINE

Parameters:
enabled -


Copyright © 2016. All rights reserved.