Class GatewayInterface
java.lang.Object
com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface
- All Implemented Interfaces:
- GatewayConstants
The GatewayInterface provides an interface for all Client and Designer communication with the gateway. It uses an XML
 formatted message sent over HTTP to the "Gateway" servlet on the Ignition gateway (located at
 http://ip.address/[context]/system/gateway).
 
 This class knows how to encode messages (via the various createMessage functions) and parses the response into a
 GatewayResponse object. It also handles cookie tracking for session management.
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic classA MessagePrinter that has some static string values pre-encoded into byte[]'sstatic classBasic implementation of message printer for messages with variable number of argumentsstatic interfaceUsed to allow the GatewayConnectionManager to monitor the kinds of exceptions that are being thrown from the gateway.static interfacestatic classA MessagePrinter for invoke messages (MTYPE_INVOKE_FUNCTION)static interfaceA MessagePrinter simply prints its message to an outputstream.
- 
Field SummaryFieldsFields inherited from interface com.inductiveautomation.ignition.common.gateway.GatewayConstants_DATE_FORMATTER, ARG_MESSAGETYPE, ARG_MODULEID, ATR_INDEX, ATR_LENGTH, ATR_NAME, ATR_TYPE, booleanNull, byteNull, charNull, CONNECT_TIMEOUT, DATE_FORMAT_STRING, doubleNull, ELM_ARG, ELM_COLLIST, ELM_COLUMN, ELM_COMPRESSEDROWS, ELM_DATA, ELM_ERRORCODE, ELM_ERRORMESSAGE, ELM_EXCLS, ELM_EXMSG, ELM_EXOVERRIDES_TOSTRING, ELM_EXSTRING, ELM_MBODY, ELM_MESSAGE, ELM_MTYPE, ELM_NOTIFICATION, ELM_NOTIFICATIONS, ELM_RESPONSE, ELM_ROW, ELM_ROWS, ELM_SERIALIZED_RESPONSE, ELM_SETCOOKIE, ELM_STACKTRACE, ELM_STELM, ELM_STELM_DECL, ELM_STELM_FILE, ELM_STELM_LINE, ELM_STELM_METH, ERRNO_ASYNC_CALL, ERRNO_ASYNC_CALL_CANCELED, ERRNO_ASYNC_CALL_FAILED, ERRNO_BROWSE_ERROR, ERRNO_COMM_ERROR, ERRNO_CONNECTION_MODE, ERRNO_DBCONNECTION_NAMING, ERRNO_DBCONNECTION_SQL, ERRNO_HISTORY_QUERY_ERROR, ERRNO_INSECURE_REDIRECT, ERRNO_INTERNAL, ERRNO_INVALIDARGS, ERRNO_INVOCATION_EXCEPTION, ERRNO_LICENE_RESTRICTED, ERRNO_LOGIN_CANCELLED, ERRNO_LOGIN_FAILED, ERRNO_LOGIN_FAILED_LICENSING, ERRNO_NAMING, ERRNO_NO_SESSION, ERRNO_NON_ACTIVE_NODE, ERRNO_NON_MASTER_NODE, ERRNO_NOT_AUTHORIZED, ERRNO_NOTIMP, ERRNO_OK, ERRNO_PARSE, ERRNO_PASSWORD_EXPIRED, ERRNO_PONG, ERRNO_POST_ERROR, ERRNO_PROJECT_PULL, ERRNO_PROJECT_PUSH, ERRNO_RUNTIME_EXPIRED, ERRNO_SQL, ERRNO_SQLTAGS_PROVIDER_DISABLED, ERRNO_SQLTAGS_PROVIDER_FAULTED, ERRNO_SQLTAGS_PROVIDER_LOADING, ERRNO_SQLTAGS_PROVIDER_MISSING, ERRNO_SQLTAGS_SEND_TAGS, ERRNO_SSL_REQUIRED, ERRNO_TIMEOUT, ERRNO_TRIAL_EXPIRED, ERRNO_VERSION_INCOMPATABILITY, ERROR_MESSAGE_TYPE, floatNull, intNull, longNull, MODE_DISCONNECTED, MODE_FULL, MODE_READ_ONLY, MTYPE_COPY_IMAGE, MTYPE_CREATE_IMAGE_FOLDER, MTYPE_DBTEST, MTYPE_GET_NEW_RESOURCEID, MTYPE_INVALID, MTYPE_INVOKE_FUNCTION, MTYPE_LIST_AUTHS, MTYPE_LIST_COLS, MTYPE_LIST_DBS, MTYPE_LIST_IDPS, MTYPE_LIST_IMAGES, MTYPE_LIST_MODULES, MTYPE_LIST_ROLES, MTYPE_LIST_SECURITY_LEVELS, MTYPE_LIST_SQLTAG_PROVIDERS, MTYPE_LIST_TABLES, MTYPE_LIST_ZONES, MTYPE_PING, MTYPE_PLATFORM_EDITION, MTYPE_PUBLIC_PING, MTYPE_REMOVE_IMAGE, MTYPE_RENAME_IMAGE_FOLDER, MTYPE_REPORT_ERROR, MTYPE_SEND_EMAIL, MTYPE_SQLTAGS_ADD_SCANCLASS, MTYPE_SQLTAGS_ADD_TAGS, MTYPE_SQLTAGS_EDIT_SCANCLASS, MTYPE_SQLTAGS_EDIT_TAGS, MTYPE_SQLTAGS_ERROR_LIST, MTYPE_SQLTAGS_FSQL_BROWSE, MTYPE_SQLTAGS_FSQL_LIST, MTYPE_SQLTAGS_GET_SCANCLASS, MTYPE_SQLTAGS_LIST, MTYPE_SQLTAGS_META_LIST, MTYPE_SQLTAGS_POLL, MTYPE_SQLTAGS_REMOVE_SCANCLASS, MTYPE_SQLTAGS_REMOVE_TAGS, MTYPE_SQLTAGS_WRITE, MTYPE_STATUS_POLL, MTYPE_UPLOAD_IMAGE, MTYPE_VERSION_CHECK, OPC_BROWSE_TIMEOUT, PROTECT_DIALOG_TYPE, shortNull, SOCKET_TIMEOUT, WARNING_MESSAGE_TYPE
- 
Constructor SummaryConstructorsModifierConstructorDescriptionprotectedFor overriddingGatewayInterface(ScopeVersionHash version, HttpURL gatewayUrl, boolean ssl, int connectTimeout, int socketTimeout, int concurrencyLevel, int opcBrowseTimeout) 
- 
Method SummaryModifier and TypeMethodDescriptionvoidconnectionCheck(boolean publicPing) Sends a ping message that (optionally) doesn't require a session.static StringcreateDoubleArgMessage(int type, String argName1, String arg1, String argName2, String arg2) Creates an message with two arguments.static StringcreateMessage(int type) Creates a message with no argumentsstatic StringcreateMessage(int type, String[] argNames, String[] args) Creates a message that allows for any number of arguments where each argument has one valuestatic StringcreateMessage(int type, String[] argNames, String[][] args) Creates a message that allows for any number of arguments including indexed argument valuesbooleanstatic CookieManagerlong<T> Tinvoke(String function, Serializable... args) Invokes a function on the gateway.<T> TinvokeWithTimeout(String function, int timeout, Serializable... args) booleanisSSL()<T> TmoduleInvoke(String moduleId, String function, Serializable... args) Invokes a function on the gateway side of a module by delegating the call to the module's RPC handler.<T> TmoduleInvokeSafe(String moduleId, String function, Class[] signature, Serializable... args) Special version of ModuleInvoke lets the caller specify the argument signature, in case any of the arguments may be nullstatic MessageBuildernewMessage(int type) intping()Sends a message to the gateway and returns ERRNO_PONG if communication was successful, some other errno otherwise.intA special type of ping message that doesn't require a session.pullProject(Collection<ProjectSnapshot> snapshots) voidpushProject(List<ChangeOperation> diffs) voidreportError(String message, String details, String sysProps, String userDescription, String userName, String userContact) runLimitQuery(String query, String datasource, String txId, Integer limit, Serializable[] params, Class<?>[] paramTypes) Sends a MTYPE_RUN_QUERY command to the gateway, returning the raw responserunPrepStmt(String query, String datasource, boolean getIds, Object... args) Deprecated.runPrepStmt(String query, String datasource, String txId, boolean getIds, Object... args) Deprecated.Please use the following style instead:Sends a basic string-query MTYPE_RUN_QUERY command to the gateway, returning the raw responserunQuery(String query, String datasource, String txId, Serializable[] params, Class<?>[] paramTypes) runTagCalculationQuery(List<? extends Path> paths, List<? extends Aggregate> calculations, Date startDate, Date endDate, List<String> aliases, Flags queryFlags) runTagDensityQuery(Collection<? extends Path> paths, Date startDate, Date endDate) runTagHistoryQuery(Collection<? extends Path> paths, Date startDate, Date endDate, int returnSize, Aggregate aggregationMode, ReturnFormat format, List<String> aliases, List<? extends Aggregate> colAggModes, Flags queryFlags) runTagHistoryQuery(Collection<? extends Path> paths, Date startDate, Date endDate, int returnSize, Aggregate aggregationMode, ReturnFormat format, List<String> aliases, List<? extends Aggregate> colAggModes, Flags queryFlags, int timeoutMillis) runUpdateQuery(String query, String datasource) Deprecated.use RunUpdateQueryMessage instead.runUpdateQuery(String query, String datasource, String txId, boolean getIds) Deprecated.use RunUpdateQueryMessage instead, like this:voidsendEmail(String smtpProfileName, String from, String subject, String body, String contentType, String[] recipients, String[] ccRecipients, String[] bccRecipients, String[] attachNames, String[] attachData, int timeout, int retries, String priority, String[] replyTo) voidsendEmail(String smtp, String from, String subject, String body, String contentType, String[] recips, String username, String password, String priority, String[] attachNames, String[] attachData, int timeout, String[] replyTo) sendMessage(String message) sendMessage(String message, GatewayInterface.MessagePrinter printer, int socketTimeout) voidvoidsetHttpConcurrency(int concurrencyLevel) voidInforms the GatewayInterface that the next request invoked on this thread should be privileged.voidvoidsetSSL(boolean ssl) voidvoidsimulateDisconnect(int seconds) 
- 
Field Details- 
ENCODING- See Also:
 
 
- 
- 
Constructor Details- 
GatewayInterfaceprotected GatewayInterface()For overridding
- 
GatewayInterfacepublic GatewayInterface(ScopeVersionHash version, HttpURL gatewayUrl, boolean ssl, int connectTimeout, int socketTimeout, int concurrencyLevel, int opcBrowseTimeout) 
 
- 
- 
Method Details- 
getHeaderCookieManager
- 
setThroughputMonitor
- 
getGatewayAddress
- 
isSSLpublic boolean isSSL()
- 
setSSLpublic void setSSL(boolean ssl) 
- 
setGatewayExceptionMonitor
- 
setPushNotificationListener
- 
simulateDisconnectpublic void simulateDisconnect(int seconds) 
- 
sendMessage- Throws:
- GatewayException
 
- 
sendMessage- Throws:
- GatewayException
 
- 
sendMessagepublic Object sendMessage(String message, GatewayInterface.MessagePrinter printer, int socketTimeout) throws GatewayException - Throws:
- GatewayException
 
- 
getCookie
- 
runUpdateQueryDeprecated.use RunUpdateQueryMessage instead.- Throws:
- GatewayException
 
- 
runUpdateQuery@Deprecated public Dataset runUpdateQuery(String query, String datasource, String txId, boolean getIds) throws GatewayException Deprecated.use RunUpdateQueryMessage instead, like this:sendMessage(new RunUpdateQueryMessage(query) .database(datasource) .transactionId(txId) .getIds(getIds)) - Throws:
- GatewayException
 
- 
runPrepStmt@Deprecated public Dataset runPrepStmt(String query, String datasource, boolean getIds, Object... args) throws GatewayException Deprecated.- Throws:
- GatewayException
 
- 
runPrepStmt@Deprecated public Dataset runPrepStmt(String query, String datasource, String txId, boolean getIds, Object... args) throws GatewayException Deprecated.Please use the following style instead:sendMessage(new RunPrepStmtMessage(query) .database(dbName) .queryArgs(args) .transactionId(txId) .getIds(getIds) .build()); - Throws:
- GatewayException
 
- 
getModules- Throws:
- GatewayException
 
- 
sendEmailpublic void sendEmail(String smtp, String from, String subject, String body, String contentType, String[] recips, String username, String password, String priority, String[] attachNames, String[] attachData, int timeout, String[] replyTo) throws Exception - Throws:
- Exception
 
- 
sendEmailpublic void sendEmail(String smtpProfileName, String from, String subject, String body, String contentType, String[] recipients, String[] ccRecipients, String[] bccRecipients, String[] attachNames, String[] attachData, int timeout, int retries, String priority, String[] replyTo) throws Exception - Throws:
- Exception
- Since:
- 7.8.0
 
- 
runTagHistoryQuerypublic Dataset runTagHistoryQuery(Collection<? extends Path> paths, Date startDate, Date endDate, int returnSize, Aggregate aggregationMode, ReturnFormat format, List<String> aliases, List<? extends Aggregate> colAggModes, Flags queryFlags) throws GatewayException - Throws:
- GatewayException
 
- 
runTagHistoryQuerypublic Dataset runTagHistoryQuery(Collection<? extends Path> paths, Date startDate, Date endDate, int returnSize, Aggregate aggregationMode, ReturnFormat format, List<String> aliases, List<? extends Aggregate> colAggModes, Flags queryFlags, int timeoutMillis) throws GatewayException - Throws:
- GatewayException
 
- 
runTagCalculationQuerypublic Dataset runTagCalculationQuery(List<? extends Path> paths, List<? extends Aggregate> calculations, Date startDate, Date endDate, List<String> aliases, Flags queryFlags) throws GatewayException - Throws:
- GatewayException
 
- 
runTagDensityQuerypublic Dataset runTagDensityQuery(Collection<? extends Path> paths, Date startDate, Date endDate) throws GatewayException - Throws:
- GatewayException
 
- 
runQuerySends a basic string-query MTYPE_RUN_QUERY command to the gateway, returning the raw response- Throws:
- GatewayException
 
- 
runQuery- Throws:
- GatewayException
 
- 
runQuerypublic Dataset runQuery(String query, String datasource, String txId, Serializable[] params, Class<?>[] paramTypes) throws GatewayException - Throws:
- GatewayException
 
- 
runLimitQuerypublic Dataset runLimitQuery(String query, String datasource, String txId, Integer limit, Serializable[] params, Class<?>[] paramTypes) throws GatewayException Sends a MTYPE_RUN_QUERY command to the gateway, returning the raw response- Parameters:
- query- The query to execute.
- datasource- The datasource to run against.
- txId- The transaction ID to run against, if any.
- limit- The maximum number of rows to return. If <=0, all rows will be returned.
- params- An array of parameters. If this is non null and non empty, the query will be executed as a prepared statement.
- paramTypes- An array of parameter types. Used to disambiguate the type of any null arguments. Must match the ordinality of params
- Throws:
- GatewayException
 
- 
moduleInvokeSafepublic <T> T moduleInvokeSafe(String moduleId, String function, Class[] signature, Serializable... args) throws GatewayException Special version of ModuleInvoke lets the caller specify the argument signature, in case any of the arguments may be null- Throws:
- GatewayException
 
- 
moduleInvokepublic <T> T moduleInvoke(String moduleId, String function, Serializable... args) throws GatewayException Invokes a function on the gateway side of a module by delegating the call to the module's RPC handler.- Throws:
- GatewayException
 
- 
invokeInvokes a function on the gateway. It will return the return value of the function, or throw an exception if something went wrong.- Parameters:
- function- The function name, optionally with a sub function. Examples: "GetGatewayTimezone" or "SQLTags.writeToTag"
- args- Any number of args to send to the function
- Throws:
- GatewayException
 
- 
invokeWithTimeoutpublic <T> T invokeWithTimeout(String function, int timeout, Serializable... args) throws GatewayException - Throws:
- GatewayException
 
- 
reportErrorpublic void reportError(String message, String details, String sysProps, String userDescription, String userName, String userContact) throws Exception - Throws:
- Exception
 
- 
pullProject- Throws:
- Exception
 
- 
pushProject- Throws:
- Exception
 
- 
pingpublic int ping()Sends a message to the gateway and returns ERRNO_PONG if communication was successful, some other errno otherwise. (requires session)
- 
publicPingpublic int publicPing()A special type of ping message that doesn't require a session. returns ERRNO_COMM_ERROR if the ping was not successful.
- 
getLastPingException
- 
connectionCheckSends a ping message that (optionally) doesn't require a session. Throws an exception if the ping was not successful.- Throws:
- GatewayException
 
- 
getGatewayVersion- Throws:
- GatewayException
 
- 
getPlatformEdition- Returns:
- the Gateway platform edition, where "" corresponds to the standard edition, and "edge" corresponds to the Edge edition.
- Throws:
- GatewayException
 
- 
dbTest
- 
createDoubleArgMessagepublic static String createDoubleArgMessage(int type, String argName1, String arg1, String argName2, String arg2) Creates an message with two arguments. This overload is purely for efficiency so that we're not creating arrays unnecessarily
- 
createMessageCreates a message that allows for any number of arguments where each argument has one value
- 
createMessageCreates a message with no arguments
- 
createMessageCreates a message that allows for any number of arguments including indexed argument values
- 
newMessage
- 
getSelectQueryMetric
- 
getSelectQueryRowMetric
- 
getLastMessagepublic long getLastMessage()
- 
setPrivilegedRequestFlagpublic void setPrivilegedRequestFlag()Informs the GatewayInterface that the next request invoked on this thread should be privileged. This means that it is not subject to concurrency throttling. This flag will be automatically reset to false after the request.
- 
setHttpConcurrencypublic void setHttpConcurrency(int concurrencyLevel) 
 
-