com.intel.util
Class ServiceClient
- java.lang.Object
-
- com.intel.util.ServiceClient
-
public final class ServiceClient extends java.lang.Object
This class should be used by the client side of the inter-applet communication in order to consume services provided by a service applet.
-
-
Field Summary
Fields Modifier and Type Field and Description static int
APPLET_ERROR_BAD_PARAMETERS
static int
APPLET_ERROR_GENERIC
static int
APPLET_EXCEEDED_MAX_CLIENT_SESSIONS
static int
APPLET_INTERNAL_SESSION_NUM_EXCEEDED
static int
APPLET_OUT_OF_MEMORY
static int
APPLET_SERVICE_CLOSED
static int
APPLET_SERVICE_UNCAUGHT_EXCEPTION
static int
APPLET_SERVICE_UUID_NOT_FOUND
static int
APPLET_SUCCESS
static int
MAX_INTERNAL_SESSIONS
The maximal number of concurrent internal open sessions
-
Constructor Summary
Constructors Constructor and Description ServiceClient()
Create a new instance of a service client.
-
Method Summary
Methods Modifier and Type Method and Description int
closeSession()
Closes this session to the service applet.int
openSession(java.lang.String serviceUuid, byte[] request)
Opens a new session to the service applet with the provided UUID.int
sendAndRecv(int commandId, byte[] request, ServiceResult result)
Sends the provided command to the service applet an retrieves the result.
-
-
-
Field Detail
-
APPLET_SUCCESS
public static final int APPLET_SUCCESS
- See Also:
- Constant Field Values
-
APPLET_ERROR_GENERIC
public static final int APPLET_ERROR_GENERIC
- See Also:
- Constant Field Values
-
APPLET_ERROR_BAD_PARAMETERS
public static final int APPLET_ERROR_BAD_PARAMETERS
- See Also:
- Constant Field Values
-
APPLET_EXCEEDED_MAX_CLIENT_SESSIONS
public static final int APPLET_EXCEEDED_MAX_CLIENT_SESSIONS
- See Also:
- Constant Field Values
-
APPLET_OUT_OF_MEMORY
public static final int APPLET_OUT_OF_MEMORY
- See Also:
- Constant Field Values
-
APPLET_SERVICE_UUID_NOT_FOUND
public static final int APPLET_SERVICE_UUID_NOT_FOUND
- See Also:
- Constant Field Values
-
APPLET_SERVICE_CLOSED
public static final int APPLET_SERVICE_CLOSED
- See Also:
- Constant Field Values
-
APPLET_SERVICE_UNCAUGHT_EXCEPTION
public static final int APPLET_SERVICE_UNCAUGHT_EXCEPTION
- See Also:
- Constant Field Values
-
APPLET_INTERNAL_SESSION_NUM_EXCEEDED
public static final int APPLET_INTERNAL_SESSION_NUM_EXCEEDED
- See Also:
- Constant Field Values
-
MAX_INTERNAL_SESSIONS
public static final int MAX_INTERNAL_SESSIONS
The maximal number of concurrent internal open sessions- See Also:
- Constant Field Values
-
-
Method Detail
-
openSession
public final int openSession(java.lang.String serviceUuid, byte[] request) throws UtilException
Opens a new session to the service applet with the provided UUID. NOTE: this function is synchronous.- Parameters:
serviceUuid
- the UUID of the target service applet,can be a hex string of length 32 or a hex string of length 36 with 4 hypensrequest
- the request data that is passed to the service applet new session handler, can't be null use an empty array instead- Returns:
- One of the following error codes:
APPLET_SUCCESS
on success.APPLET_ERROR_BAD_PARAMETERS
in case of an internal error.APPLET_SERVICE_UUID_NOT_FOUND
in case service UUID was not found.APPLET_OUT_OF_MEMORY
in case the system is out of memory.APPLET_EXCEEDED_MAX_CLIENT_SESSIONS
in case the exceeded the maximum number of client sessionsAPPLET_SERVICE_CLOSED
in case the service instance was closed.APPLET_INTERNAL_SESSION_NUM_EXCEEDED
in case the internal sessions number has exceeded the allowed limit.
- Throws:
IllegalParameterException
- if one or more of the parameters is invalidAccessDeniedException
- if this applet doesn't have the permission to consume the service appletIllegalUseException
- if this method is invoked more than once without a precedingcloseSession()
ServiceUnavailableException
- if the target service applet doesn't have existing sessionUtilException
- if some kind of internal error occurred
-
closeSession
public final int closeSession() throws UtilException
Closes this session to the service applet.- Returns:
- One of the following error codes:
APPLET_SUCCESS
on success.APPLET_SERVICE_CLOSED
in case the service instance was closed.
- Throws:
IllegalUseException
- if this method is invoked before a successful invocation ofopenSession()
UtilException
- if some kind of internal error occurred
-
sendAndRecv
public final int sendAndRecv(int commandId, byte[] request, ServiceResult result) throws UtilException
Sends the provided command to the service applet an retrieves the result. NOTE: this function is synchronous.- Parameters:
commandId
- the command ID (applet specific)request
- the input data for this command, can't be null, use an empty array insteadresult
- the result of the operations- Returns:
- One of the following error codes:
APPLET_SUCCESS
on success.APPLET_OUT_OF_MEMORY
in case the system is out of memory.APPLET_SERVICE_CLOSED
in case the service instance was closed.APPLET_SERVICE_UNCAUGHT_EXCEPTION
in case the service instance was terminated with an uncaught exception.
- Throws:
IllegalParameterException
- if one or more of the parameters is invalidIllegalUseException
- if this method is invoked before a successful invocation ofopenSession()
UtilException
- if some kind of internal error occurred
-
-