uicc.toolkit
Interface ToolkitRegistry


public interface ToolkitRegistry

The ToolkitRegistry interface offers basic services and methods to allow any Toolkit Applet to register its configuration (supported events) during the install phase and possibly to change it during all the applet life time. Each Toolkit Applet will get a reference to its registry entry with the static method getEntry from the ToolkitRegistrySystem class The initial state of all the events is cleared. The registry entry object implementing the ToolkitRegistry interface is a permanent JCRE entry point object

All updates performed on the ToolkitRegistry are atomic. The ToolkitRegistry update operations are subject to atomic commit capacity limitations. If the commit capacity is exceeded, no update is performed and a TransactionException exception is thrown.

Note: the constants related to the events are defined in the ToolkitConstants interface.

See Also:
ToolkitInterface, ToolkitRegistrySystem

Method Summary
 byte allocateServiceIdentifier()
          Allocate a Service identifier that the applet can manage.
 byte allocateTimer()
          Asks the CAT Runtime Environment to allocate a Timer that the applet can manage.
 void changeMenuEntry(byte id, byte[] menuEntry, short offset, short length, byte nextAction, boolean helpSupported, byte iconQualifier, short iconIdentifier)
          Changes the value of a menu entry.
 void clearEvent(short event)
          Clears an event in the Toolkit Registry entry of the applet.
 void deregisterFileEvent(short fileEvent, byte[] baFileList, short sOffset1, short sLength1, byte[] baADFAid, short sOffset2, byte bLength2)
          Deregister a ToolkitRegistry object from the EVENT_EXTERNAL_FILE_UPDATE for a file list.
 void deregisterFileEvent(short fileEvent, FileView aFileView)
          Deregister a ToolkitRegistry object from the EVENT_EXTERNAL_FILE_UPDATE for a file.
 void disableMenuEntry(byte id)
          Disables a menu entry.
 void enableMenuEntry(byte id)
          Enables a menu entry.
 short getPollInterval()
          Returns the number of seconds of the adjusted duration for the calling Toolkit Applet.
 byte initMenuEntry(byte[] menuEntry, short offset, short length, byte nextAction, boolean helpSupported, byte iconQualifier, short iconIdentifier)
          Initialises the next menu entry allocated at loading.
 boolean isEventSet(short event)
          Allows to know if an event is set in the Toolkit Registry entry of the applet.
 void registerFileEvent(short fileEvent, byte[] baFileList, short sOffset1, short sLength1, byte[] baADFAid, short sOffset2, byte bLength2)
          Register a ToolkitRegistry object to the EVENT_EXTERNAL_FILE_UPDATE for a file list.
 void registerFileEvent(short fileEvent, FileView aFileView)
          Register a ToolkitRegistry object to the EVENT_EXTERNAL_FILE_UPDATE for a file.
 void releaseServiceIdentifier(byte serviceIdentifier)
          Release a Service Identifier that has been allocated to the calling applet.
 void releaseTimer(byte timerIdentifier)
          Release a Timer that has been allocated to the calling applet.
 void requestPollInterval(short duration)
          Requests a duration for the EVENT_STATUS_COMMAND event of the registering Toolkit Applet.
 void setEvent(short event)
          Sets an event in the Toolkit Registry entry of the applet.
 void setEventList(short[] eventList, short offset, short length)
          Sets an event list in the Toolkit Registry entry of the applet.
 void setMenuEntryTextAttribute(byte id, byte[] textAttribute, short offset, short length)
          Sets the text attribute of a menu entry.
 

Method Detail

setEvent

void setEvent(short event)
              throws ToolkitException,
                     javacard.framework.TransactionException
Sets an event in the Toolkit Registry entry of the applet. No exception shall be thrown if the applet registers more than once to the same event.

Parameters:
event - value of the new event to register (between -32768 and 32767)
Throws:
ToolkitException - with the following reason codes:
  • EVENT_NOT_SUPPORTED if the event is not supported
  • EVENT_TAR_NOT_DEFINED if the event requests a TAR and the applet has not at least one TAR value assigned.
  • EVENT_ALREADY_REGISTERED if the event has already been registered (for limited event like Call Control)
  • EVENT_NOT_ALLOWED if event is EVENT_MENU_SELECTION, EVENT_MENU_SELECTION_HELP_REQUEST, EVENT_TIMER_EXPIRATION, EVENT_STATUS_COMMAND, EVENT_EVENT_ DOWNLOAD_LOCAL_CONNECTION,EVENT_EXTERNAL_FILE_UPDATE,EVENT_REMOTE_FILE_UPDATE
javacard.framework.TransactionException - if the operation would cause the commit capacity to be exceeded

setEventList

void setEventList(short[] eventList,
                  short offset,
                  short length)
                  throws java.lang.NullPointerException,
                         java.lang.ArrayIndexOutOfBoundsException,
                         ToolkitException,
                         javacard.framework.TransactionException
Sets an event list in the Toolkit Registry entry of the applet. In case of any exception the state of the registry is unchanged.

Parameters:
eventList - buffer containing the list of the new events to register
offset - offset in the eventlist buffer for event registration
length - length in the eventlist buffer for event registration
Throws:
java.lang.NullPointerException - if eventlist is null
java.lang.ArrayIndexOutOfBoundsException - if offset or length or both would cause access outside array bounds
ToolkitException - with the following reason codes:
  • EVENT_NOT_SUPPORTED if one event is not supported
  • EVENT_TAR_NOT_DEFINED if the event requests a TAR and the applet has not at least one TAR value assigned.
  • EVENT_ALREADY_REGISTERED if one event has already been registered (for limited event like Call Control)
  • EVENT_NOT_ALLOWED if eventList contains EVENT_MENU_SELECTION, EVENT_MENU_SELECTION_HELP_REQUEST, EVENT_TIMER_EXPIRATION, EVENT_STATUS_COMMAND, EVENT_EVENT_ DOWNLOAD_LOCAL_CONNECTION,EVENT_EXTERNAL_FILE_UPDATE,EVENT_REMOTE_FILE_UPDATE
javacard.framework.TransactionException - if the operation would cause the commit capacity to be exceeded

clearEvent

void clearEvent(short event)
                throws ToolkitException,
                       javacard.framework.TransactionException
Clears an event in the Toolkit Registry entry of the applet.

Parameters:
event - the value of the event to unregister (between -32768 and 32767)
Throws:
ToolkitException - with the following reason codes:
  • EVENT_NOT_ALLOWED if event is EVENT_MENU_SELECTION, EVENT_MENU_SELECTION_HELP_REQUEST, EVENT_TIMER_EXPIRATION, EVENT_STATUS_COMMAND, EVENT_EVENT_ DOWNLOAD_LOCAL_CONNECTION
javacard.framework.TransactionException - Description of the Exception

isEventSet

boolean isEventSet(short event)
Allows to know if an event is set in the Toolkit Registry entry of the applet.

Parameters:
event - the value of the event (between -32768 and 32767)
Returns:
true if the event is set in the Toolkit Registry entry of the applet, false otherwise

disableMenuEntry

void disableMenuEntry(byte id)
                      throws ToolkitException,
                             javacard.framework.TransactionException
Disables a menu entry. This method doesn't modify the registration state to the EVENT_MENU_SELECTION and EVENT_MENU_SELECTION_HELP_REQUEST. After invocation of this method, during the current card session, the CAT Runtime Environment shall dynamically update the menu stored in the Terminal.

Parameters:
id - the menu entry identifier supplied by the initMenuEntry() method
Throws:
ToolkitException - with the following reason codes:
  • ENTRY_NOT_FOUND if the menu entry does not exist for this applet
javacard.framework.TransactionException - if the operation would cause the commit capacity to be exceeded

enableMenuEntry

void enableMenuEntry(byte id)
                     throws ToolkitException,
                            javacard.framework.TransactionException
Enables a menu entry. This method doesn't modify the registration state to the EVENT_MENU_SELECTION and EVENT_MENU_SELECTION_HELP_REQUEST. After invocation of this method, during the current card session, the CAT Runtime Environment shall dynamically update the menu stored in the Terminal.

Parameters:
id - the menu entry identifier supplied by the initMenuEntry() method
Throws:
ToolkitException - with the following reason codes:
  • MENU_ENTRY_NOT_FOUND if the menu entry does not exist for this applet
javacard.framework.TransactionException - if the operation would cause the commit capacity to be exceeded

initMenuEntry

byte initMenuEntry(byte[] menuEntry,
                   short offset,
                   short length,
                   byte nextAction,
                   boolean helpSupported,
                   byte iconQualifier,
                   short iconIdentifier)
                   throws java.lang.NullPointerException,
                          java.lang.ArrayIndexOutOfBoundsException,
                          ToolkitException,
                          javacard.framework.TransactionException
Initialises the next menu entry allocated at loading. The default state of the menu entry is 'enabled'. The value of the helpSupported boolean parameter defines the registration status of the applet to the event EVENT_MENU_SELECTION_HELP_REQUEST. The applet is registered to the EVENT_MENU_SELECTION. The icon identifier provided will be added to the icon identifier list of the item icon identifier list Comprehension TLV if all the applets registered to the EVENT_MENU_SELECTION provide it. The Icon list qualifier transmitted to the Terminal will be 'icon is not self explanatory' if one of the applet registered prefers this qualifier. This method shall be called by the applet in the same order than the order of the item parameters defined at the applet loading if the applet has several menu entries. The applet shall initialise all its loaded menu entries during its installation.

Parameters:
menuEntry - a reference on a byte array, containing the menu entry string
offset - offset of the menu entry string in the buffer
length - length of the menu entry string
nextAction - a byte coding the next action indicator for the menu entry (or 0)
helpSupported - equals true if help is available for the menu entry
iconQualifier - the preferred value for the icon list qualifier
iconIdentifier - the icon identifier for the menu entry (0 means no icon)
Returns:
the identifier attached to the initialised menu entry
Throws:
java.lang.NullPointerException - if menuEntry is null
java.lang.ArrayIndexOutOfBoundsException - if offset or length or both would cause access outside array bounds
ToolkitException - with the following reason codes:
  • REGISTRY_ERROR if the menu entry cannot be initialised (e.g. no more item data in applet loading parameter)
  • ALLOWED_LENGTH_EXCEEDED if the menu entry string is bigger than the allocated space
javacard.framework.TransactionException - if the operation would cause the commit capacity to be exceeded

changeMenuEntry

void changeMenuEntry(byte id,
                     byte[] menuEntry,
                     short offset,
                     short length,
                     byte nextAction,
                     boolean helpSupported,
                     byte iconQualifier,
                     short iconIdentifier)
                     throws java.lang.NullPointerException,
                            java.lang.ArrayIndexOutOfBoundsException,
                            ToolkitException,
                            javacard.framework.TransactionException
Changes the value of a menu entry. The default state of the changed menu entry is 'enabled'. The value of the helpSupported boolean parameter defines the registration status of the EVENT_MENU_SELECTION_HELP_REQUEST event. The icon identifier provided will be added to the icon identifier list of the item icon identifier list Comprehension TLV if all the applets registered to the EVENT_MENU_SELECTION provide it. The Icon list qualifier transmitted to the Terminal will be 'icon is not self explanatory' if one of the applet registered prefers this qualifier. After the invocation of this method, during the current card session, the CAT Runtime Environment shall dynamically update the menu stored in the Terminal.

Parameters:
id - the menu entry identifier supplied by the initMenuEntry() method
menuEntry - a reference on a byte array, containing the menu entry string
offset - the position of the menu entry string in the buffer
length - the length of the menu entry string
nextAction - a byte coding the next action indicator for the menu entry (or 0)
helpSupported - equals true if help is available for the menu entry
iconQualifier - the preferred value for the icon list qualifier
iconIdentifier - the icon identifier for the menu entry (0 means no icon)
Throws:
java.lang.NullPointerException - if menuEntry is null
java.lang.ArrayIndexOutOfBoundsException - if offset or length or both would cause access outside array bounds
ToolkitException - with the following reason codes:
  • MENU_ENTRY_NOT_FOUND if the menu entry does not exist for this applet
  • ALLOWED_LENGTH_EXCEEDED if the menu entry string is bigger than the allocated space
javacard.framework.TransactionException - if the operation would cause the commit capacity to be exceeded

allocateTimer

byte allocateTimer()
                   throws ToolkitException,
                          javacard.framework.TransactionException
Asks the CAT Runtime Environment to allocate a Timer that the applet can manage. By calling this method the applet is registered to the EVENT_TIMER_EXPIRATION of the allocated timer. The timer is allocated by the applet until it explicitly releases it. So it can then issue the Timer Management proactive command to start, stop or get the value of its allocated timer.

Returns:
the identifier of the Timer allocated to the applet
Throws:
ToolkitException - with the following reason codes:
  • NO_TIMER_AVAILABLE if all the timers are allocated or the maximum number of timers have been allocated to this applet
javacard.framework.TransactionException - if the operation would cause the commit capacity to be exceeded

releaseTimer

void releaseTimer(byte timerIdentifier)
                  throws ToolkitException,
                         javacard.framework.TransactionException
Release a Timer that has been allocated to the calling applet. The applet is deregistered of the EVENT_TIMER_EXPIRATION for the indicated Timer Identifier.

Parameters:
timerIdentifier - the identifier of the Timer to be released
Throws:
ToolkitException - with the following reason codes:
  • INVALID_TIMER_ID if the timerIdentifierd is not allocated to this applet.
javacard.framework.TransactionException - if the operation would cause the commit capacity to be exceeded

requestPollInterval

void requestPollInterval(short duration)
                         throws ToolkitException,
                                javacard.framework.TransactionException
Requests a duration for the EVENT_STATUS_COMMAND event of the registering Toolkit Applet. Due to different duration requested by other Toolkit Applets or due to restriction of the Terminal, the CAT Runtime Environment may adjust another duration. This method can be used at every time to request a new duration.

Parameters:
duration - specifies the number of seconds requested for proactive polling. The maximum value of duration is 15300 (255 minutes). If duration is equal to POLL_NO_DURATION, the calling applet deregisters from EVENT_STATUS_COMMAND, and the CAT Runtime Environment may issue the POLLING OFF proactive command. If duration is equal to POLL_SYSTEM_DURATION, the calling applet registers to the EVENT_STATUS_COMMAND and let the CAT Runtime Environment define the duration.
Throws:
ToolkitException - with the following reason codes:
  • REGISTRY_ERROR if duration is greater than the maximum value.
javacard.framework.TransactionException - if the operation would cause the commit capacity to be exceeded

getPollInterval

short getPollInterval()
Returns the number of seconds of the adjusted duration for the calling Toolkit Applet. If the returned duration is equal to POLL_NO_DURATION, the Toolkit Applet is not registered to EVENT_STATUS_COMMAND event. The returned duration may : - be a multiple of the real adjusted poll interval time at the Terminal. - differ from the requested duration due to request of other toolkit applets or due to restrictions of the current Terminal. - be changed during the card session due requests from other Toolkit Applets. - be wrong due to direct generation of the proactive command POLL INTERVAL or POLLING OFF. - not correspond to the elapsed time due to additional STATUS commands send by the Terminal.

Returns:
the number of seconds of the adjusted duration for the applet

allocateServiceIdentifier

byte allocateServiceIdentifier()
                               throws ToolkitException,
                                      javacard.framework.TransactionException
Allocate a Service identifier that the applet can manage.
By calling this method the applet is registered to the EVENT_EVENT_ DOWNLOAD_LOCAL_CONNECTION of the allocated service.
The service identifier is allocated by the applet until it explicitly releases it. It can then issue the proactive command DECLARE SERVICE to add or delete a service to the terminal service database.

Returns:
the identifier of the Service allocated to the applet
Throws:
ToolkitException - with the following reason codes:
  • NO_SERVICE_ID_AVAILABLE if all the services are allocated or the maximum number of services Identifiers have been allocated to this applet
javacard.framework.TransactionException

releaseServiceIdentifier

void releaseServiceIdentifier(byte serviceIdentifier)
                              throws ToolkitException,
                                     javacard.framework.TransactionException
Release a Service Identifier that has been allocated to the calling applet.
The applet is deregistered of the EVENT_EVENT_ DOWNLOAD_LOCAL_CONNECTION for the indicated Service Identifier.

Parameters:
serviceIdentifier - the identifier of the Service to be released
Throws:
ToolkitException - with the following reason codes:
  • INVALID_SERVICE_ID if the serviceIdentifier is not allocated to this Applet.
javacard.framework.TransactionException

registerFileEvent

void registerFileEvent(short fileEvent,
                       byte[] baFileList,
                       short sOffset1,
                       short sLength1,
                       byte[] baADFAid,
                       short sOffset2,
                       byte bLength2)
                       throws ToolkitException,
                              java.lang.NullPointerException,
                              java.lang.ArrayIndexOutOfBoundsException,
                              javacard.framework.TransactionException,
                              javacard.framework.SystemException
Register a ToolkitRegistry object to the EVENT_EXTERNAL_FILE_UPDATE for a file list.

Parameters:
fileEvent - Indicates the File event to be registered
baFileList - array containing the file list. The baFileList shall be coded as the value part of the COMPREHENSION-TLV File List defined in TS 102 223 If the path provided indicates a dedicated file (DF), the Applet shall be triggered when an elementary file that is an immediate child of the DF is updated.
sOffset1 - offset in the baFileList buffer for event registration
sLength1 - length in the baFileList buffer for event registration
baADFAid - array containing the AID of the ADF. The baADFAid shall be coded as the value part of the COMPREHENSION-TLV AID defined in TS 102 223. If baADFAid is nullnull, it indicates that the file is located under the MF and not located under an ADF .
sOffset2 - offset in the baADFAid buffer for event registration
bLength2 - length in the baADFAid buffer for event registration
Throws:
java.lang.NullPointerException - if baFileList is null
java.lang.ArrayIndexOutOfBoundsException - if sOffset or sLength or both would cause access outside array bounds
javacard.framework.TransactionException - if the operation would cause the commit capacity to be exceeded
javacard.framework.SystemException - with the following reason code:
  • SystemException.ILLEGAL_VALUE if bLength2 is not in the range of 5 – 16 bytes.
ToolkitException - with the following reason code:
  • EVENT_NOT_ALLOWED if the event is one of the following events: EVENT_MENU_SELECTION, EVENT_MENU_SELECTION_HELP_REQUEST, EVENT_TIMER_EXPIRATION, EVENT_STATUS_COMMAND
  • EVENT_NOT_SUPPORTED if the event is not one of the following event: EVENT_EXTERNAL_FILE_UPDATE, EVENT_REMOTE_FILE_UPDATE.
UICCException - in case of error
  • COMMAND_NOT_ALLOWED if the referenced file is terminated

deregisterFileEvent

void deregisterFileEvent(short fileEvent,
                         byte[] baFileList,
                         short sOffset1,
                         short sLength1,
                         byte[] baADFAid,
                         short sOffset2,
                         byte bLength2)
                         throws ToolkitException,
                                java.lang.NullPointerException,
                                java.lang.ArrayIndexOutOfBoundsException,
                                javacard.framework.TransactionException,
                                javacard.framework.SystemException
Deregister a ToolkitRegistry object from the EVENT_EXTERNAL_FILE_UPDATE for a file list.

Parameters:
fileEvent - Indicates the File event to be deregistered
baFileList - array containing the file list. The baFileList shall be coded as the value part of the COMPREHENSION-TLV File List defined in TS 102 223 If a file in baFileList is a dedicated file the deregistration shall not affect the monitoring of an elementary file within the dedicated file that was individually registered. If a file in baFileList is an elementary file the deregistration will not affect the monitoring of the parent dedicated file that was individually registered.
sOffset1 - offset in the baFileList buffer for event registration
sLength1 - length in the baFileList buffer for event registration
baADFAid - array containing the AID of the ADF. The baADFAid shall be coded as the value part of the COMPREHENSION-TLV AID defined in TS 102 223. If baADFAid is null, it indicates that the file is located under the MF and not located under an ADF .
sOffset2 - offset in the baADFAid buffer for event registration
bLength2 - length in the baADFAid buffer for event registration
Throws:
java.lang.NullPointerException - if baFileList is null
java.lang.ArrayIndexOutOfBoundsException - if sOffset or sLength or both would cause access outside array bounds
javacard.framework.TransactionException - if the operation would cause the commit capacity to be exceeded
javacard.framework.SystemException - with the following reason codes:
  • SystemException.ILLEGAL_VALUE if bLength2 is not in the range of 5 – 16 bytes.
ToolkitException - with the following reason code:
  • EVENT_NOT_ALLOWED if the event is one of the following events: EVENT_MENU_SELECTION, EVENT_MENU_SELECTION_HELP_REQUEST, EVENT_TIMER_EXPIRATION, EVENT_STATUS_COMMAND
  • EVENT_NOT_SUPPORTED if the event is not one of the following event: EVENT_EXTERNAL_FILE_UPDATE, EVENT_REMOTE_FILE_UPDATE.
UICCException - in case of error
  • COMMAND_NOT_ALLOWED if the referenced file is terminated

registerFileEvent

void registerFileEvent(short fileEvent,
                       FileView aFileView)
                       throws ToolkitException,
                              java.lang.NullPointerException,
                              javacard.framework.TransactionException
Register a ToolkitRegistry object to the EVENT_EXTERNAL_FILE_UPDATE for a file.

Parameters:
fileEvent - Indicates the File event to be registered
aFileView - The FileView object's current file indicates the file to be monitored. If the current file is a dedicated file, the Applet shall be triggered when an elementary file that is an immediate child of the DF is updated. A later change in the FileView shall not modify the registration.
Throws:
java.lang.NullPointerException - if aFileView is null
javacard.framework.TransactionException - if the operation would cause the commit capacity to be exceeded
ToolkitException - with the following reason code:
  • EVENT_NOT_ALLOWED if the event is one of the following events: EVENT_MENU_SELECTION, EVENT_MENU_SELECTION_HELP_REQUEST, EVENT_TIMER_EXPIRATION, EVENT_STATUS_COMMAND
  • EVENT_NOT_SUPPORTED if the event is not one of the following event: EVENT_EXTERNAL_FILE_UPDATE, EVENT_REMOTE_FILE_UPDATE.
UICCException - in case of error
  • COMMAND_NOT_ALLOWED if the referenced file is terminated

deregisterFileEvent

void deregisterFileEvent(short fileEvent,
                         FileView aFileView)
                         throws ToolkitException,
                                java.lang.NullPointerException,
                                javacard.framework.TransactionException
Deregister a ToolkitRegistry object from the EVENT_EXTERNAL_FILE_UPDATE for a file.

Parameters:
fileEvent - Indicates the File event to be deregistered
aFileView - The FileView object's current file indicates the file that is no longer monitored. If the current file is a dedicated file the deregistration shall not affect the monitoring of an elementary file within the dedicated file that was individually registered. If the current file is an elementary file the deregistration will not affect the monitoring of the parent dedicated file that was individually registered.
Throws:
java.lang.NullPointerException - if aFileView is null
javacard.framework.TransactionException - if the operation would cause the commit capacity to be exceeded
ToolkitException - with the following reason code:
  • EVENT_NOT_ALLOWED if the event is one of the following events: EVENT_MENU_SELECTION, EVENT_MENU_SELECTION_HELP_REQUEST, EVENT_TIMER_EXPIRATION, EVENT_STATUS_COMMAND
  • EVENT_NOT_SUPPORTED if the event is not one of the following event: EVENT_EXTERNAL_FILE_UPDATE, EVENT_REMOTE_FILE_UPDATE.
UICCException - in case of error
  • COMMAND_NOT_ALLOWED if the referenced file is terminated

setMenuEntryTextAttribute

void setMenuEntryTextAttribute(byte id,
                               byte[] textAttribute,
                               short offset,
                               short length)
                               throws java.lang.NullPointerException,
                                      java.lang.ArrayIndexOutOfBoundsException,
                                      ToolkitException,
                                      javacard.framework.TransactionException
Sets the text attribute of a menu entry. The text attribute provided will set the entry in the Text Attribute list of the Item text attribute list Comprehension TLV for the menu entry referenced by the parameter id. After the invocation of this method, during the current card session, the CAT Runtime Environment shall dynamically update the menu stored in the terminal.

Parameters:
id - the menu entry identifier supplied by the initMenuEntry() method
textAttribute - a reference on a byte array, containing the menu text attribute
offset - the position of the menu entry text attribute in the buffer
length - the length of the menu entry text attribute in the buffer
Throws:
java.lang.NullPointerException - if textAttribute is null
java.lang.ArrayIndexOutOfBoundsException - if offset or length or both would cause access outside array bounds
ToolkitException - with the following reason codes:
  • MENU_ENTRY_NOT_FOUND if the menu entry does not exist for this applet
  • BAD_INPUT_PARAMETER if the length is different from 4
javacard.framework.TransactionException - if the operation would cause the commit capacity to be exceeded