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 TypeMethodDescriptionvoiddoExternalAction(StateMachineAction action) Sends a notification of an action to allMachineObserversvoiddoTransition(StateMachineEvent event) Performs aStatetransition according to the event andcurrentstateintbooleanisActive()booleanvoidnotifyMessage(UdpMessage message) Notifies listener of the UDP message that was received.voidregister(MachineObserver observer) Registers the listener in theStateMachineso it will be notified of theStateMachineActions performed viadoExternalAction(StateMachineAction)voidsendMessage(byte[] message) Sends message viamessengerto the managed system.voidsetCurrent(State current) voidstart(InetAddress address, int port) Sets the State Machine in the initial state.voidstop()Cleans up the machine resources.
-
Constructor Details
-
StateMachine
Initializes the State Machine- Parameters:
messenger- -Messengerconnected to theConstants.IPMI_PORT
-
-
Method Details
-
getCurrent
-
setCurrent
-
sendMessage
Sends message viamessengerto 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 allMachineObservers- Parameters:
action- - aStateMachineActionto 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
StateMachineis initialized, false otherwise. - See Also:
-
doTransition
Performs aStatetransition according to the event andcurrentstate- Parameters:
event- -StateMachineEventinvoking the transition- Throws:
NullPointerException- - when machine was not yet started- See Also:
-
notifyMessage
Description copied from interface:UdpListenerNotifies listener of the UDP message that was received.- Specified by:
notifyMessagein interfaceUdpListener- Parameters:
message- - message received
-
register
Registers the listener in theStateMachineso it will be notified of theStateMachineActions performed viadoExternalAction(StateMachineAction)- Parameters:
observer- -MachineObserverto register
-
isSessionChallenging
public boolean isSessionChallenging()- Returns:
- true if
StateMachineis at the point when it acquires session and will send sessionless messages
-