|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavacardx.framework.JCSystem
@TransactionType(value=NOT_SUPPORTED) public final class JCSystem
This JCSystem class complements the JCSystem
class
with functionalities required for integrating the Applet application
model and the Servlet application model to provide a consistent
programming model.
This class includes a collection of methods to control application execution, user authentication and inter-application object sharing in the Java Card environment.
Direct instances of the following classes are implicitly transferable, that is they are not bound to any context and can be passed freely between contexts. These objects are immutable:
Boolean
Byte
Character
Class
(only Class
instances
corresponding to system API, promoted shareable interfaces, extension library
and classic library classes)Throwable
and API-defined subclasses thereofInteger
Long
Short
String
(only literal and interned String objects)
Strings computed at run time are not by default implicitly
transferable; such newly created strings are bound to their creator's
context until they are explicitly interned by calling their
intern()
method, in which case they become
context-free and can be directly passed to applications in other contexts.
Instances of the following classes are explicitly transferable, that
is they are bound to their creator's context and cannot be passed between
contexts unless their ownership is explicitly transferred by calling one of
the transferOwnership
methods:
String
(newly created strings, strings computed at run
time)
Note that the ownership of the objects referenced by the components of an array are not affected when the ownership of the array is transferred. Especially, since a multi-dimensional array is an array of arrays, the ownership of nested arrays are not affected when the ownership of the nesting array is transferred.
See Runtime Environment Specification for the Java Card Platform, Connected Edition , chapter 7 for details regarding transfer of ownership.
JCSystem
,
String.intern()
Field Summary | |
---|---|
static byte |
TIME_ACCURATE
The time value returned by System.currentTimeMillis() is
accurate. |
static byte |
TIME_DELTA_ACCURATE
The difference of the values returned on two invocations of System.currentTimeMillis() corresponds to the time
elapsed between the two invocations. |
static byte |
TIME_DELTA_MIN_ACCURATE
The time between two invocations of System.currentTimeMillis() is at minimum as big as
indicated by the difference of the two values returned; the time may be
bigger. |
Method Summary | ||
---|---|---|
static
|
copyTransferable(T object)
Creates a shallow copy of the provided explicitly transferable object. |
|
static AID |
getAID(String uri)
Returns the AID object corresponding to the provided application URI. |
|
static String |
getAppProperty(String name,
String uri)
Gets the application property indicated by the specified name. |
|
static String |
getClientURI()
Returns the URI identifying the client application of the most recently called shareable interface object invoked through one of its shareable interface methods. |
|
static byte |
getCurrentTimeAccuracy()
Returns the accuracy of the time returned by System.currentTimeMillis() . |
|
static String |
getPreviousURI()
Returns the URI identifying the application in the most recently active group context. |
|
static String |
getServerURI(Shareable sio)
Returns the URI identifying the server application exposing/owning the provided Shareable Interface Object. |
|
static String |
getURI()
Returns the URI identifying the currently executing application. |
|
static String |
getURI(AID aid)
Returns the applet application URI corresponding to the instance of the AID object. |
|
static boolean |
isClientInRole(String role,
String rsrcURI)
Indicates whether the client application URI as returned by a call to getClientURI() is included in the specified
logical "role" permitted to access the specified resource (e.g., SIO-based
service or event) URI. |
|
static boolean |
isTransferable(Object object)
Tests whether an object is a direct instance of a transferable class. |
|
static boolean |
isUserInRole(String role,
String uri)
Indicates whether the authenticated user identity bound to the current thread is included in the specified logical "role" or if one of the users included in that role corresponds to a globally authenticated user - the card holder. |
|
static void |
synchronizeTime()
Requests that the time as returned by System.currentTimeMillis() be synchronized with some
external time reference. |
|
static void |
transferOwnership(Object object)
Transfers ownership of the provided object from the server application's context to the context of the client application as determined by a call to getClientURI() . |
|
static void |
transferOwnership(Object object,
Shareable sio)
Transfers ownership of the provided object to the context identified by the provided SIO. |
|
static void |
transferOwnership(Object object,
String appURI)
Transfers ownership of the provided object to the context identified by the provided application URI. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final byte TIME_ACCURATE
System.currentTimeMillis()
is
accurate.
public static final byte TIME_DELTA_ACCURATE
System.currentTimeMillis()
corresponds to the time
elapsed between the two invocations.
public static final byte TIME_DELTA_MIN_ACCURATE
System.currentTimeMillis()
is at minimum as big as
indicated by the difference of the two values returned; the time may be
bigger.
Method Detail |
---|
public static AID getAID(String uri)
uri
- the applet's application URI.
NullPointerException
- if uri
is null
.
IllegalArgumentException
- if uri
is not a well-formed application URI.public static String getAppProperty(String name, String uri)
The property retrieved is that of the application explicitly or implicitly designated by the provided application or resource URI. If the URI is null, is relative or does not designates an application, such as when it is a standard service or event URI, the configuration that applies is that of the current application.
Property names are case insensitive.
name
- the name of the application property.uri
- the application or resource URI (may be null).
NullPointerException
- if name
is null
.
IllegalArgumentException
- uri
is not null
and is not a
well-formed application or resource URIuri
is not in the namespace of one of the
applications from the current group context or is not in the
standard service or event namespace.public static String getClientURI()
The client of a shareable interface object is defined as follows:
getPreviousURI()
.getURI()
.
ServiceFactory.create()
method during a service lookup, the client
corresponds to the previously active application as determined by a call
to getPreviousURI()
, that is the application that requested the
service from the Java Card RE. If this method is called from a
EventNotificationListener.notify()
method during an event's
notification, this method returns null
since notification is
performed in a Java Card RE thread distinct from that of the application
that requested the notification.
This method is typically used by a server application, while executing a shareable interface method to determine the identity of its client and thereby control access privileges.
public static String getServerURI(Shareable sio)
sio
- the Shareable Interface Object.
NullPointerException
- if sio
is null
.public static String getURI()
Applet.register()
method has not yet
been invoked.public static String getURI(AID aid)
aid
- the applet AID.
NullPointerException
- if aid
is null
.public static String getPreviousURI()
The returned URI is the application URI previously associated with the current thread (its most recently active namespace URI).
Note that it does not return the URI of the application owning the object
from which the call was made as would be returned by the
getPreviousContextAID()
method of the classic
JCSystem
class.
If this method is called from a
EventNotificationListener.notify()
method during an event's
notification, this method returns null
since notification is
performed in a Java Card RE thread distinct from that of the application
that requested the notification.
public static boolean isClientInRole(String role, String rsrcURI)
getClientURI()
is included in the specified
logical "role" permitted to access the specified resource (e.g., SIO-based
service or event) URI.
The role definition that applies is that of the application implicitly designated by the resource URI. If the resource URI does not designates an application, such as when the resource URI is a standard service or event URI, the role definition that applies is that of the current application.
If the client application is in the same group context as the current
application (that is,
Roles and role membership can be defined using application descriptors.
getClientURI()
.equals(
getURI()
)), this method returns true
.
role
- the name of the role.rsrcURI
- the resource (e.g., SIO-based service or event) URI.
false otherwise.
NullPointerException
- if role
or rsrcURI
is
null
.
IllegalArgumentException
-
rsrcURI
is not a well-formed absolute
resource URIrsrcURI
is not in the namespace of one of the applications from the
current group context or is not in the standard service or
event namespace.
public static boolean isTransferable(Object object)
object
- the object to be tested for transferability.
NullPointerException
- if object
is null
.public static boolean isUserInRole(String role, String uri)
The role definition that applies is that of the application explicitly or implicitly designated by the provided application or resource URI. If the URI is null, is relative or does not designates an application, such as when it is a standard service or event URI, the role definition that applies is that of the current application.
Roles and role membership can be defined using application descriptors.
role
- the name of the role.uri
- the application or resource URI (may be null).
NullPointerException
- if role
is null
.
IllegalArgumentException
- uri
is not null
and is not a
well-formed application or resource URIuri
is not in the namespace of one of the
applications from the current group context or is not in the
standard service or event namespace.public static void transferOwnership(Object object)
getClientURI()
. This method is typically used
to transfer ownership of an object returned by a call to a server
application's SIO. If the object is implicitly transferable or if
the client application and server application are the same, the object's
ownership is unchanged.
object
- the object whose ownership is to be transferred.
NullPointerException
- if object
is null
.
SecurityException
- public static void transferOwnership(Object object, Shareable sio)
object
- the object whose ownership is to be transferred.sio
- the SIO from the recipient context.
NullPointerException
- if object
or sio
is
null
.
SecurityException
- sio
is owned by the
Java Card REpublic static void transferOwnership(Object object, String appURI)
object
- the object whose ownership is to be transferred.appURI
- the URI of the application from the recipient context.
NullPointerException
- if object
or appURI
is
null
.
IllegalArgumentException
- appURI
is not a well-formed application
URI,appURI
does not correspond
to a registered application.SecurityException
- public static <T> T copyTransferable(T object)
object
- the object to be copied.
NullPointerException
- if object
is null
.
IllegalArgumentException
- if the object is not a direct instance of a
transferable class.
SecurityException
- if the provided object does not belong to the current group
context.public static byte getCurrentTimeAccuracy()
System.currentTimeMillis()
.
System.currentTimeMillis()
.TIME_ACCURATE
,
TIME_DELTA_ACCURATE
,
TIME_DELTA_MIN_ACCURATE
public static void synchronizeTime()
System.currentTimeMillis()
be synchronized with some
external time reference. If supported, the Java Card VM makes a best
effort to synchronize with an external time reference. If/when
synchronization is successful, the Java Card RE fires a clock
resynchronization event with its auxiliary data set as a
Long
object which encapsulates the delta that was
applied to the system clock during the resynchronization.
A call to this method returns without waiting for the Java Card VM to synchronize with an external time reference.
Event.EVENT_CLOCK_RESYNCED_URI
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |