Class StateMachine

java.lang.Object
org.metricshub.ipmi.core.sm.StateMachine
All Implemented Interfaces:
UdpListener

public class StateMachine extends Object implements UdpListener
State machine for connecting and acquiring session with the remote host via IPMI v.2.0.
  • Constructor Details

  • Method Details

    • getCurrent

      public State getCurrent()
    • setCurrent

      public void setCurrent(State current)
    • sendMessage

      public void sendMessage(byte[] message) throws IOException
      Sends message via messenger to the managed system.
      Parameters:
      message - - the encoded message
      Throws:
      IOException - - when sending of the message fails
    • getRemoteMachineAddress

      public InetAddress getRemoteMachineAddress()
    • getRemoteMachinePort

      public int getRemoteMachinePort()
    • doExternalAction

      public void doExternalAction(StateMachineAction action)
      Sends a notification of an action to all MachineObservers
      Parameters:
      action - - a StateMachineAction to perform
    • start

      public void start(InetAddress address, int port)
      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

      public void doTransition(StateMachineEvent event)
      Performs a State transition according to the event and current state
      Parameters:
      event - - StateMachineEvent invoking the transition
      Throws:
      NullPointerException - - when machine was not yet started
      See Also:
    • notifyMessage

      public void notifyMessage(UdpMessage message)
      Description copied from interface: UdpListener
      Notifies listener of the UDP message that was received.
      Specified by:
      notifyMessage in interface UdpListener
      Parameters:
      message - - message received
    • register

      public void register(MachineObserver observer)
      Registers the listener in the StateMachine so it will be notified of the StateMachineActions performed via doExternalAction(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