toolkit / com.sas.android.visualanalytics.sdk / SASManager / createFromJson
createFromJson
fun createFromJson(input: Reader, context: Context, onConnectionComplete: ((SASManager.Result) -> Unit)? = null, onSubscribeComplete: ((Server.Result) -> Unit)? = null): Unit
Creates one or more connections to SAS Visual Analytics servers defined in JSON.
Compliant JSON defines a list of servers:
{
"servers": [
{
"serverHostName": "my.demo.server.com",
"useSSL": false,
"serverPort": 80,
"serverDescription": "_i18n:server_desc",
"useGuestMode": false,
"userId": "fred",
"password": "S3cr37!",
"reportIds": [
"17d5fb14-8c1d-40e1-9380-73ffea806c14",
"57ddfc19-7a1d-38e1-7421-81fabac02c38",
"38abce26-6a1d-37e1-7407-80ffccd04b40",
],
"reportPaths": [
"/My/Sample/Report",
"/My/Sample/Report 2"
]
}
]
}
Each server is defined by the following:
-
serverHostName(required) See ConnectionDescriptor.hostName. -
useSSL(optional) See ConnectionDescriptor.useSsl. If this is not specified, it defaults to false. -
serverPort(optional) See ConnectionDescriptor.port. If this is not specified, it defaults to 443 if useSSL is true, or 80 otherwise. -
serverDescription(optional) See ConnectionDescriptor.description. If this value is prefixed with “_i18n:”, then the remainder of the value is interpreted as the name of an Android string resource. -
useGuestMode(optional) See ConnectionDescriptor.useGuestMode. If this is not specified, it defaults to false. -
userId(required if useGuestModeis false) See ConnectionDescriptor.userId. -
password(required if useGuestModeis false) See ConnectionDescriptor.password. -
reportIds(optional) A list of reports, identified by their server URIs, to subscribe to once the connection has been created. See ReportDescriptor.forUri. -
reportPaths(optional) A list of reports, identified by their server paths, to subscribe to once the connection has been created. See ReportDescriptor.forFileSystemPath.
Parameters
input -
the JSON input.
context -
used to resolve string resources.
onConnectionComplete -
an optional callback invoked when the connection-creation process has completed
(successfully or otherwise).
onSubscribeComplete -
an optional callback invoked when a subscription process for a report has completed
(successfully or otherwise); called once for each report.
Exceptions
IOException -
if an I/O error occurs while reading from input.