|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectds.ov2.test.Data_protocol_host
class Data_protocol_host
Host driver for the data protocols that check/measure the protocol
layer. An instance of this class owns an instance of the
description class of the data protocols. Because of the size
changes of the Resizable_buffer's
therein
this description instance must only exist once (more precisely one
instance in the host driver and one instance inside the applet).
Therefore this class is an enforced singleton class.
Nested Class Summary | |
---|---|
(package private) static class |
Data_protocol_host.Data_error
Exception to indicate that an error in the protocol layer has been detected when checking the results from the applet. |
Field Summary | |
---|---|
private CardChannel |
card_channel
Channel to the applet. |
private Data_protocol_description |
description
Description instance of the data protocols. |
private PrintWriter |
out
Channel for debug and progress messages. |
private static Data_protocol_host |
singleton
Reference holding the single instance of this class. |
private Data_protocol_stubs |
stubs
Stubs for the data protocols. |
Constructor Summary | |
---|---|
protected |
Data_protocol_host(Data_protocol_description data_protocol,
CardChannel card_channel,
PrintWriter out)
Constructor. |
Method Summary | |
---|---|
private byte |
check_buffer(Resizable_buffer b,
byte count)
Check the enumberation of resulting Resizable_buffer
that we received from the card. |
long |
check_data(boolean performance_test)
Run the data protocol once for testing the protocol layer. |
private byte |
fill_buffer(Resizable_buffer b,
byte count)
Enumerate the bytes in a Resizable_buffer . |
Data_protocol_stubs |
get_stubs()
Accessor for the stubs instance. |
static Data_protocol_host |
makeit(Data_protocol_description data_protocol,
CardChannel card_channel,
PrintWriter out)
Return the signleton instance of this class. |
void |
set_size(int[] new_sizes,
boolean performance_test)
Set the sizes of the Resizable_buffer's that are used as arguments and results in
the data protocol. |
void |
set_size(int a1,
int a2,
int a3,
int a4,
int a5,
int r1,
int r2,
int r3,
int r4,
int r5,
boolean performance_test)
Same as set_size(int[], boolean) but where the 10
sizes are passed as separate arguments. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private CardChannel card_channel
private Data_protocol_description description
private PrintWriter out
private Data_protocol_stubs stubs
private static Data_protocol_host singleton
Constructor Detail |
---|
protected Data_protocol_host(Data_protocol_description data_protocol, CardChannel card_channel, PrintWriter out)
singleton
.
Asserts that singleton
is null before assigning to it.
data_protocol
- description instance of the data protocolscard_channel
- channel to the appletout
- progress/debug message channelMethod Detail |
---|
public Data_protocol_stubs get_stubs()
public static Data_protocol_host makeit(Data_protocol_description data_protocol, CardChannel card_channel, PrintWriter out)
card_channel
argument of this method.
data_protocol
- description instance of the data protocolsout
- progress/debug message channel
private byte fill_buffer(Resizable_buffer b, byte count)
Resizable_buffer
. Start with
count
. Return the count for the following Resizable_buffer
.
b
- buffer to fillcount
- starting counter
Resizable_buffer
private byte check_buffer(Resizable_buffer b, byte count) throws Data_protocol_host.Data_error
Resizable_buffer
that we received from the card. Throws Data_protocol_host.Data_error
if
an error is detected.
b
- the buffer to checkcount
- the starting count for the first byte
Data_protocol_host.Data_error
- for any detected enumeration errorpublic long check_data(boolean performance_test) throws CardException, Data_protocol_host.Data_error
set_size
or set_size
). This method uses the sizes of the buffers
in the description instance of the data protocols.
performance_test
- if true do neither enumerate arguments
nor check results
Data_protocol_host.Data_error
- for any detected error in the protocol layer
CardException
- for communication errorspublic void set_size(int[] new_sizes, boolean performance_test) throws CardException
Resizable_buffer's
that are used as arguments and results in
the data protocol. The maximal possible size for all buffers in
the applet is given by a compile time constant. If bigger sizes
are requested the applet ignores the size request. The
resulting buffer sizes are returned in any case and this method
uses them to set the buffers in the description instance of the
host driver to the same size as on the card. A message is
printed to out
if the requested size was not set on
the applet.
new_sizes
- array of 10 positive shorts with the requested
sizesperformance_test
- performance test flag to set or clear
in the applet
CardException
- on communication errorspublic void set_size(int a1, int a2, int a3, int a4, int a5, int r1, int r2, int r3, int r4, int r5, boolean performance_test) throws CardException
set_size(int[], boolean)
but where the 10
sizes are passed as separate arguments.
a1
- requested size for the first argumenta2
- requested size for the second argumenta3
- requested size for the third argumenta4
- requested size for the fourth argumenta5
- requested size for the fifth argumentr1
- requested size for the first resultr2
- requested size for the second resultr3
- requested size for the third resultr4
- requested size for the fourth resultr5
- requested size for the fifth resultperformance_test
- performance test flag to set or clear
in the applet
CardException
- for communication errors
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |