Intel

Developer Zone

IntelApplet

com.intel.util

Class IntelApplet

  • java.lang.Object
    • com.intel.runtime.core.Service
      • com.intel.util.IntelApplet
  • Direct Known Subclasses:
    ServiceApplet


    public abstract class IntelApplet
    extends com.intel.runtime.core.Service
    This is the base class that must be inherited by all applets. The applets must not inherit the com.intel.beihai.core.Service class directly.
    • Constructor Summary

      Constructors
      Constructor and Description
      IntelApplet()
    • Method Summary

      Methods
      Modifier and Type Method and Description
      int getResponseBufferSize()
      Returns the maximum size that can be returned by the applet in response.
      int getSessionId(byte[] sessionId, int index)
      Return a unique applet session identifier.
      int getSessionIdLength()
      Return the length of applet session identifier.
      java.lang.String getUUID()
      Returns the UUID of this applet in String representation.
      abstract int invokeCommand(int commandId, byte[] request)
      This method will be called by the VM to handle a command sent to this applet instance.
      int onClose()
      This method will be called by the VM when the session being handled by this applet instance is being closed and this applet instance is about to be removed.
      int onCloseSession()
      This method must not be used directly.
      int onCommand(int command, byte[] params)
      This method must not be used directly.
      int onInit(byte[] request)
      This method will be called by the VM when a new session is opened to the applet and this applet instance is being created to handle the new session.
      int onOpenSession(byte[] params)
      This method must not be used directly.
      void sendAsynchMessage(byte[] data, int index, int length)
      Sends message to the SW application communicating with this applet via asynchronous interface.
      void setResponse(byte[] response, int index, int length)
      Updates the response data to be returned during invokeCommand method.
      void setResponseCode(int responseCode)
      Updates the response code to be returned after invokeCommand method processing to the SW application.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, toString
    • Constructor Detail

      • IntelApplet

        public IntelApplet()
    • Method Detail

      • onOpenSession

        public final int onOpenSession(byte[] params)
        This method must not be used directly.
        Specified by:
        onOpenSession in class com.intel.runtime.core.Service
        See Also:
        onInit(byte[])
      • onCloseSession

        public final int onCloseSession()
        This method must not be used directly.
        Specified by:
        onCloseSession in class com.intel.runtime.core.Service
        See Also:
        onClose()
      • onCommand

        public final int onCommand(int command,
                    byte[] params)
        This method must not be used directly.
        Specified by:
        onCommand in class com.intel.runtime.core.Service
        See Also:
        invokeCommand(int commandId, byte[] request)
      • onInit 

        public int onInit(byte[] request)
        This method will be called by the VM when a new session is opened to the applet and this applet instance is being created to handle the new session. This method cannot provide response data and therefore calling setResponse or setResponseCode methods from it will throw a NullPointerException.
        Parameters:
        request - the input data sent to the applet during session creation
        Returns:
        APPLET_SUCCESS if the operation was processed successfully, any other status code in case of error (note that all error codes will be treated similarly by the VM by sending "cancel" error code to the SW application).
      • onClose

        public int onClose()
        This method will be called by the VM when the session being handled by this applet instance is being closed and this applet instance is about to be removed. This method cannot provide response data and therefore calling setResponse or setResponseCode methods from it will throw a NullPointerException.
        Returns:
        APPLET_SUCCESS code (the status code is not used by the VM).
      • invokeCommand

        public abstract int invokeCommand(int commandId,
                        byte[] request)
        This method will be called by the VM to handle a command sent to this applet instance. To return the response data to the command, call the setResponse method before returning from this method. In order to provide a return value for the command, which will be delivered to the SW application communicating with the applet, setResponseCode method should be called. The return value of the invokeCommand method is not guaranteed to be delivered to the SW application, and therefore should not be used for this purpose (applet is expected to return APPLET_SUCCESS code from this method).
        Parameters:
        commandId - the command ID (applet specific). The user should check this argument value since it might be APPLET_INVALID_COMMAND_ID in case the VM ran out of resources.
        request - The input data for this command. The user should check this argument value since it might be null in case the the VM ran out of resources.
        Returns:
        APPLET_SUCCESS code.
      • setResponse

        public final void setResponse(byte[] response,
                       int index,
                       int length)
        Updates the response data to be returned during invokeCommand method. Note that calling this method more than once will reset the response data previously set.
        Parameters:
        response - the response data to be returned during command processing
        index - index in the response data array
        length - length of the response data to be returned
      • getResponseBufferSize

        public final int getResponseBufferSize()
        Returns the maximum size that can be returned by the applet in response.
        Returns:
        the maximum size that can be returned by the applet in response.
      • setResponseCode

        public final void setResponseCode(int responseCode)
        Updates the response code to be returned after invokeCommand method processing to the SW application. Note that calling this method more than once will reset the code previously set. If not set, the default response code that will be returned to SW application is 0.
        Parameters:
        responseCode - the response code to be returned to SW application after processing the invokeCommand method. Note that the possible values definition and their interpretation are under the responsibility of the applet and the SW application, and the underlying infrastructure will simply pass through this response code.
      • getUUID

        public final java.lang.String getUUID()
        Returns the UUID of this applet in String representation.
        Returns:
        The UUID of this applet in String representation. All the characters of the string are lower case. The returned string format is a hex string of length 36 with 4 hypens.
      • sendAsynchMessage

        public final void sendAsynchMessage(byte[] data,
                             int index,
                             int length)
                                     throws UtilException
        Sends message to the SW application communicating with this applet via asynchronous interface. Note that if the SW application did not register for receiving asynchronous messages, the message will be silently dropped. In addition, note that this interface should not be used for transferring large amount of data to prevent exhaustion of system resources, but only for notifications.
        Parameters:
        data - message data
        index - index in the message data array
        length - length of data to be sent
        Throws:
        UtilOutOfResourcesException - in case the system has no resources available for sending this message.
        AccessDeniedException - in case the caller has no permissions for this operation
        UtilException - in case there is a system error.
      • getSessionId

        public final int getSessionId(byte[] sessionId,
                       int index)
        Return a unique applet session identifier.
        Parameters:
        sessionId - output array for storing the session ID
        index - index in the output array
        Returns:
        the length of the applet session identifier that was copied into sessionId array
      • getSessionIdLength

        public final int getSessionIdLength()
        Return the length of applet session identifier.
        Returns:
        the length of applet session identifier.