public class StateMachine extends java.lang.Object implements UdpListener
Constructor and Description |
---|
StateMachine(Messenger messenger)
Initializes the State Machine
|
Modifier and Type | Method and Description |
---|---|
void |
doExternalAction(StateMachineAction action)
Sends a notification of an action to all
MachineObserver s |
void |
doTransition(StateMachineEvent event)
|
State |
getCurrent() |
java.net.InetAddress |
getRemoteMachineAddress() |
boolean |
isActive() |
boolean |
isSessionChallenging() |
void |
notifyMessage(UdpMessage message)
Notifies listener of the UDP message that was received.
|
void |
register(MachineObserver observer)
Registers the listener in the
StateMachine so it will be notified
of the StateMachineAction s performed via
doExternalAction(StateMachineAction) |
void |
sendMessage(byte[] message)
Sends message via
messenger to the managed system. |
void |
setCurrent(State current) |
void |
start(java.net.InetAddress address)
Sets the State Machine in the initial state.
|
void |
stop()
Cleans up the machine resources.
|
public StateMachine(Messenger messenger)
messenger
- - Messenger
connected to the
Constants.IPMI_PORT
public State getCurrent()
public void setCurrent(State current)
public void sendMessage(byte[] message) throws java.io.IOException
messenger
to the managed system.message
- - the encoded messagejava.io.IOException
- - when sending of the message failspublic java.net.InetAddress getRemoteMachineAddress()
public void doExternalAction(StateMachineAction action)
MachineObserver
saction
- - a StateMachineAction
to performpublic void start(java.net.InetAddress address)
address
- - IP address of the remote machine.stop()
public void stop()
start(InetAddress)
public boolean isActive()
StateMachine
is initialized, false otherwise.start(InetAddress)
,
stop()
public void doTransition(StateMachineEvent event)
event
- - StateMachineEvent
invoking the transitionjava.lang.NullPointerException
- - when machine was not yet startedstart(InetAddress)
public void notifyMessage(UdpMessage message)
UdpListener
notifyMessage
in interface UdpListener
message
- - message receivedpublic void register(MachineObserver observer)
StateMachine
so it will be notified
of the StateMachineAction
s performed via
doExternalAction(StateMachineAction)
observer
- - MachineObserver
to registerpublic boolean isSessionChallenging()
StateMachine
is at the point when it acquires
session and will send sessionless messages