Package org.metricshub.ipmi.core.sm
Class StateMachine
java.lang.Object
org.metricshub.ipmi.core.sm.StateMachine
- All Implemented Interfaces:
UdpListener
State machine for connecting and acquiring session with the remote host via
IPMI v.2.0.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
doExternalAction
(StateMachineAction action) Sends a notification of an action to allMachineObserver
svoid
doTransition
(StateMachineEvent event) Performs aState
transition according to the event andcurrent
stateint
boolean
isActive()
boolean
void
notifyMessage
(UdpMessage message) Notifies listener of the UDP message that was received.void
register
(MachineObserver observer) Registers the listener in theStateMachine
so it will be notified of theStateMachineAction
s performed viadoExternalAction(StateMachineAction)
void
sendMessage
(byte[] message) Sends message viamessenger
to the managed system.void
setCurrent
(State current) void
start
(InetAddress address, int port) Sets the State Machine in the initial state.void
stop()
Cleans up the machine resources.
-
Constructor Details
-
StateMachine
Initializes the State Machine- Parameters:
messenger
- -Messenger
connected to theConstants.IPMI_PORT
-
-
Method Details
-
getCurrent
-
setCurrent
-
sendMessage
Sends message viamessenger
to the managed system.- Parameters:
message
- - the encoded message- Throws:
IOException
- - when sending of the message fails
-
getRemoteMachineAddress
-
getRemoteMachinePort
public int getRemoteMachinePort() -
doExternalAction
Sends a notification of an action to allMachineObserver
s- Parameters:
action
- - aStateMachineAction
to perform
-
start
Sets the State Machine in the initial state.- Parameters:
address
- - IP address of the remote machine.port
- - UDP remoteMachinePort of the remote machine- See Also:
-
stop
public void stop()Cleans up the machine resources.- See Also:
-
isActive
public boolean isActive()- Returns:
- true if
StateMachine
is initialized, false otherwise. - See Also:
-
doTransition
Performs aState
transition according to the event andcurrent
state- Parameters:
event
- -StateMachineEvent
invoking the transition- Throws:
NullPointerException
- - when machine was not yet started- See Also:
-
notifyMessage
Description copied from interface:UdpListener
Notifies listener of the UDP message that was received.- Specified by:
notifyMessage
in interfaceUdpListener
- Parameters:
message
- - message received
-
register
Registers the listener in theStateMachine
so it will be notified of theStateMachineAction
s performed viadoExternalAction(StateMachineAction)
- Parameters:
observer
- -MachineObserver
to register
-
isSessionChallenging
public boolean isSessionChallenging()- Returns:
- true if
StateMachine
is at the point when it acquires session and will send sessionless messages
-