CXI
Loading...
Searching...
No Matches
Public Member Functions | List of all members
CryptoServerCluster.EventHandler Interface Reference

The EventHandler interface provides callback functions, which are called if the state of the current CryptoServer within a cluster changes or an error occurs. More...

Inherited by CryptoServerCXI.EventHandler.

Public Member Functions

void stateChanged (String device, int state)
 This method is called if the state of a CryptoServer changes (e.g. More...
 
void errorOccurred (String device, int err, String where, String message)
 This method is called if an error occurred on a CryptoServer. More...
 

Detailed Description

The EventHandler interface provides callback functions, which are called if the state of the current CryptoServer within a cluster changes or an error occurs.

See also
setEventHandler()
Example:

The following code demonstrates a sample event handler:

{
public void stateChanged(String device, int state)
{
System.out.println("I: state of " + device + " changed to: " + CryptoServerCluster.DeviceState.valueOf(state));
}
public void errorOccurred(String device, int err, String where, String message)
{
System.out.println( "E: error occurred on " + device + " at " + where
+ "\ncode: 0x" + Integer.toHexString(err)
+ "\nmessage: " + message);
}
}
This class implements an interface to a cluster of Utimaco's Hardware Security Modules "CryptoServer"...
Definition: CryptoServerCluster.java:79
Device states as reported by CryptoServerCluster.EventHandler.stateChanged.
Definition: CryptoServerCluster.java:146
The EventHandler interface provides callback functions, which are called if the state of the current ...
Definition: CryptoServerCluster.java:118

The event handler can be registered with a CryptoServerCluster as follows:

...
CryptoServerCluster cs = new CryptoServerCluster(devices);
cs.setEventHandler(new EventHandler());
...

Member Function Documentation

◆ stateChanged()

void stateChanged ( String  device,
int  state 
)

This method is called if the state of a CryptoServer changes (e.g.

from DeviceState.Active to DeviceState.Closed).

Parameters
devicedevice whose state changed (see DeviceState).
statenew state

◆ errorOccurred()

void errorOccurred ( String  device,
int  err,
String  where,
String  message 
)

This method is called if an error occurred on a CryptoServer.

Parameters
devicedevice that caused the error
errerror code
wherelocation (native function) where error occurred
messageclear text error message