Class Client
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final record
Structure to wrap anInputStream
and its content-type. -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionConstructor that defines a secured connection.Constructor that defines a secured connection.Constructor that defines a secured connection.Constructor. -
Method Summary
Modifier and TypeMethodDescriptionchangePassword
(String currentPassword, String newPassword) Change password.void
close()
Close this instance.Send a command and receive a response.Send a command and receive a response.Retrieve stream of data for the give file [name].getError()
Get the current error if any.static Fault
Extract fault if any from the given JSON object.Login method.void
logout()
Logout method.void
Reconnect the client.Run a report and retrieve its output.Run a report and retrieve its output.Retrieve stream of data for the [name].upload
(String mimeType, InputStream data) Upload new binary content to the server.upload
(String mimeType, InputStream data, String streamNameOrID) Upload some binary content to the server.
-
Field Details
-
NOT_CONNECTED
-
-
Constructor Details
-
Client
-
Client
Constructor that defines a secured connection.- Parameters:
host
- Host where the SO is hosted.application
- Name of the application (typically, the database name).secured
- Whether secured connection (TLS encryption) is required or not.
-
Client
Constructor that defines a secured connection.- Parameters:
host
- Host where the SO is hosted.application
- Name of the application (typically, the database name).deviceWidth
- Device width (applicable if you are connecting from a device that has a view-width).deviceHeight
- Device height (applicable if you are connecting from a device that has a view-height).
-
Client
Constructor.- Parameters:
host
- Host where the SO is hosted.application
- Name of the application (typically, the database name).deviceWidth
- Device width (applicable if you are connecting from a device that has a view-width).deviceHeight
- Device height (applicable if you are connecting from a device that has a view-height).secured
- Whether secured connection (TLS encryption) is required or not.
-
-
Method Details
-
reconnect
public void reconnect()Reconnect the client.Note: This will reset everything. However, it knows how to re-login to the server if required.
-
getError
Get the current error if any.- Returns:
- Error or null if in any error state.
-
login
-
logout
public void logout()Logout method. This should be invoked if theClient
is no more required. If you try to use this instance afterward, it may give unexpected results. -
close
-
changePassword
-
command
Send a command and receive a response.The [attributes] should contain a map of the parameters. Please refer to the SO Connector documentation for parameter details. Please note that [command] is passed as the first parameter and thus, it need not be specified in the [attributes]. Also, "session" is not required because [Client] will automatically add that.
- Parameters:
command
- Command.attributes
- Attributes.- Returns:
- Response as a JSON instance is returned.
-
command
Send a command and receive a response.The [attributes] should contain a map of the parameters. Please refer to the SO Connector documentation for parameter details. Please note that [command] is passed as the first parameter and thus, it need not be specified in the [attributes]. Also, "session" is not required because [Client] will automatically add that. If the optional [preserveServerState] value is true, the "continue" attribute will be set to preserve the server state (See documentation).
- Parameters:
command
- Command.attributes
- Attributes.preserveServerState
- Whether preserve the server state or not.- Returns:
- Response as a JSON instance is returned.
-
upload
Upload new binary content to the server.- Parameters:
mimeType
- Mime-type should be correctly specified because it will not be verified by the server.data
- Data to be uploaded.- Returns:
- If successfully uploaded (Status == "OK"), the "id" attribute will contain the ID of the new content created.
-
upload
Upload some binary content to the server.- Parameters:
mimeType
- Mime-type should be correctly specified because it will not be verified by the server.data
- Data to be uploaded.streamNameOrID
- If not blank or null, the corresponding content will be overwritten. It could be specified as the content-name or the ID of the content.- Returns:
- If successfully uploaded (Status == "OK"), the "id" attribute will contain the ID of the content.
-
getFault
-
stream
Retrieve stream of data for the [name].You should have got the [name] from a previous request.
- Parameters:
name
- Name of the stream. (Mostly as a stringified Id).- Returns:
- An instance of
Client.Data
. This contains anInputStream
containing binary data if theClient.Data.error()
isnull
.Client.Data.mimeType()
provides the content-type.
-
file
Retrieve stream of data for the give file [name].You should have got the [name] from a previous request or it could be the name of a file in the SO platform.
- Parameters:
name
- Name of the stream.- Returns:
- An instance of
Client.Data
. This contains anInputStream
containing binary data if theClient.Data.error()
isnull
.Client.Data.mimeType()
provides the content-type.
-
report
Run a report and retrieve its output.- Parameters:
logic
- Name of the report logic.parameters
- Parameters for the report.- Returns:
- An instance of
Client.Data
. This contains anInputStream
containing binary data if theClient.Data.error()
isnull
.Client.Data.mimeType()
provides the content-type.
-
report
Run a report and retrieve its output.- Parameters:
logic
- Name of the report logic.- Returns:
- An instance of
Client.Data
. This contains anInputStream
containing binary data if theClient.Data.error()
isnull
.Client.Data.mimeType()
provides the content-type.
-