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 |
addAppAsset(String config)
Add a config for app asset
|
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 |
connect(RuntimeConfiguration configuration,
DesktopStateListener listener,
int timeout)
Connect to Runtime with the specified configuration.
|
void |
connectToVersion(String runtimeVersion,
DesktopStateListener listener,
int timeout)
Connect to specified version of Desktop.
|
void |
disconnect()
Disconnects from Runtime
|
protected void |
disconnect(String reason) |
void |
exit()
Notify Runtime 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 Runtime
|
void |
sendAction(String action,
org.json.JSONObject payload,
AckListener listener,
Object source)
Sends a message to Runtime
|
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 |
setDevToolsPort(int port)
Set port for accessing devtools on localhost
|
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
|
public DesktopConnection(String uuid) throws DesktopException
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 onport
- The port that Runtime is listening on for connections. -null if unknownDesktopException
- if this method fails to create a connectionpublic void launchAndConnect(String commandLineArguments, DesktopStateListener listener, int timeout) throws URISyntaxException, DesktopIOException
connectToVersion(String, DesktopStateListener, int)
instead.commandLineArguments
- Command line arguments to start the Runtime withlistener
- Receives updates on startup and connection statetimeout
- For connecting to Desktop after launch. If the connection to Runtime is not established by the timeout the listener will get an onError() callURISyntaxException
- if URL has invalid syntaxDesktopIOException
- if this method fails to connect to Runtimepublic void launchAndConnect(String desktopPath, String commandLineArguments, DesktopStateListener listener, int timeout) throws DesktopIOException
connectToVersion(String, DesktopStateListener, int)
instead.desktopPath
- Absolute path to the Runtime executablecommandLineArguments
- Command line arguments to start the Runtime withlistener
- Receives updates on startup and connection statetimeout
- For connecting to Desktop after launch. If the connection to Runtime is not established by the timeout the listener will get an onError() callDesktopIOException
- if this method fails to connect to Runtimepublic void connectToVersion(String runtimeVersion, DesktopStateListener listener, int timeout) throws DesktopIOException, IOException
runtimeVersion
- version of Runtime requiredlistener
- 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 Runtimepublic 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 RuntimeRuntimeConfiguration
public void disconnect() throws DesktopException
DesktopException
- if this method fails to disconnect from Runtimeprotected void disconnect(String reason) throws DesktopException
DesktopException
public 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 void sendAction(String action, org.json.JSONObject payload, AckListener listener, Object source)
action
- The action of the messagepayload
- The message object to sendlistener
- AckListener for the messagesource
- Message sourceAckListener
public void connect(DesktopStateListener listener)
connectToVersion(String, DesktopStateListener, int)
instead.listener
- Receives updates on startup and connection stateDesktopStateListener
public Integer registerNotificationListener(NotificationListener listener, Object source)
listener
- NotificationListener for the notificationsource
- Source of the requestNotificationListener
public void sendActionToNotificationsCenter(String action, org.json.JSONObject payload, AckListener callback, 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
,
AckListener
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)
additionalRuntimeArguments
- additional arguments, such as "--v=1" to enable more loggingpublic void setAdditionalRvmArguments(String additionalRvmArguments)
additionalRvmArguments
- additional argumentspublic void setRuntimeSecurityRealm(String runtimeSecurityRealm)
runtimeSecurityRealm
- name of the realmpublic void setRdmUrl(String url)
url
- URL of RDM servicepublic void setDevToolsPort(int port)
port
- port numberpublic void setRuntimeAssetsUrl(String url)
url/rvm url/runtime
url
- URL of Runtime assetspublic void addAppAsset(String config)
config
- config string which must be a valid JSON stringpublic void setLogLevel(boolean enabled)
enabled
- true for enabling DEBUG loggingCopyright © 2017. All rights reserved.