Class ClientConnection

java.lang.Object
info.mikethomas.jfold.SocketConnection
info.mikethomas.jfold.ClientConnection
All Implemented Interfaces:
Connection

public class ClientConnection extends SocketConnection implements Connection

ClientConnection class.

Version:
7.5.1
Author:
Michael Thomas (mikepthomas@outlook.com)
  • Field Details

  • Constructor Details

    • ClientConnection

      public ClientConnection() throws IOException

      Default Constructor for ClientConnection.

      Throws:
      IOException - if any.
    • ClientConnection

      public ClientConnection(String address, int port) throws IOException

      Constructor for ClientConnection.

      Parameters:
      address - a String object.
      port - a int.
      Throws:
      IOException - a int.
  • Method Details

    • bond

      public final void bond(Inet4Address ip, int port, String input)
      Bond a packet file to a outgoing debug socket connection.
      Specified by:
      bond in interface Connection
      Parameters:
      ip - a Inet4Address object.
      port - a int.
      input - a String object.
    • configured

      public final void configured()
      Return a configuration indicating if the client has set a user, team or passkey.
      Specified by:
      configured in interface Connection
    • doCycle

      public final void doCycle()
      Run one client cycle.
      Specified by:
      doCycle in interface Connection
    • downloadCore

      public final void downloadCore(String type, URL url)
      Download a core.
      Specified by:
      downloadCore in interface Connection
      Parameters:
      type - of core
      url - of core
    • finish

      public final void finish()
      Finish all slots.
      Specified by:
      finish in interface Connection
    • finish

      public final void finish(int slot)
      Finish requested slot.
      Specified by:
      finish in interface Connection
      Parameters:
      slot - number
    • getInfo

      public final String getInfo(String category, String key)
      Print application information for requested category and key.
      Specified by:
      getInfo in interface Connection
      Parameters:
      category - to return information from
      key - to return information from
      Returns:
      String value from information
    • getInfo

      public final String getInfo(InfoItem infoItem) throws InfoException
      Print application information for requested InfoItem.
      Specified by:
      getInfo in interface Connection
      Parameters:
      infoItem - a InfoItem object.
      Returns:
      a String object.
      Throws:
      InfoException - if any.
    • info

      public final List info() throws InfoException
      List application information.
      Specified by:
      info in interface Connection
      Returns:
      List
      Throws:
      InfoException - if any.
    • inject

      public final void inject(Inet4Address ip, int port, String input)
      Inject a packet file to a listening debug socket. Will wait until packet is processed.
      Specified by:
      inject in interface Connection
      Parameters:
      ip - a Inet4Address object.
      port - a int.
      input - a String object.
    • maskUnitState

      public final void maskUnitState()
      Disable specified unit states.
      Specified by:
      maskUnitState in interface Connection
    • numSlots

      public final int numSlots() throws NumSlotsException
      Get number of slots.
      Specified by:
      numSlots in interface Connection
      Returns:
      integer number of slots
      Throws:
      NumSlotsException - if any.
    • option

      public final String option(String name)
      Get a configuration option.
      Specified by:
      option in interface Connection
      Parameters:
      name - of option
      Returns:
      requested option
    • option

      public final String option(String name, String value)
      Set a configuration option.
      Specified by:
      option in interface Connection
      Parameters:
      name - of option
      value - to set
      Returns:
      requested option
    • options

      public final Options options() throws OptionsException
      List all options with their non-default values.
      Specified by:
      options in interface Connection
      Returns:
      Options
      Throws:
      OptionsException - if any.
    • options

      public final Options options(boolean listDefault, boolean listUnset) throws OptionsException
      List all options with their non-default values.
      Specified by:
      options in interface Connection
      Parameters:
      listDefault - if true defaulted options will be listed
      listUnset - if true unset options will also be listed
      Returns:
      Options
      Throws:
      OptionsException - if any.
    • pause

      public final void pause()
      Pause all slots.
      Specified by:
      pause in interface Connection
    • pause

      public final void pause(int slot)
      Pause requested slot.
      Specified by:
      pause in interface Connection
      Parameters:
      slot - number
    • ppd

      public final int ppd() throws PpdException
      Get current total estimated Points Per Day.
      Specified by:
      ppd in interface Connection
      Returns:
      points per day
      Throws:
      PpdException - if any.
    • queueInfo

      public final List<Unit> queueInfo() throws QueueInfoException
      Get work unit queue information.
      Specified by:
      queueInfo in interface Connection
      Returns:
      List Unit
      Throws:
      QueueInfoException - if any.
    • requestId

      public final void requestId()
      Request an ID from the assignment server.
      Specified by:
      requestId in interface Connection
    • requestWs

      public final void requestWs()
      Request work server assignment from the assignment server.
      Specified by:
      requestWs in interface Connection
    • save

      public final void save()
      Save the configuration either to the file the configuration was last loaded from.
      Specified by:
      save in interface Connection
    • save

      public final void save(String file)
      Save the configuration either to the specified file.
      Specified by:
      save in interface Connection
      Parameters:
      file - to save to
    • shutdown

      public final void shutdown()
      Shutdown the application.
      Specified by:
      shutdown in interface Connection
    • simulationInfo

      public final SimulationInfo simulationInfo(int slot) throws SimulationInfoException
      Get current simulation information.
      Specified by:
      simulationInfo in interface Connection
      Parameters:
      slot - number
      Returns:
      SimulationInfo
      Throws:
      SimulationInfoException - if any.
    • slotAdd

      public final void slotAdd(String type)
      Add a new slot.
      Specified by:
      slotAdd in interface Connection
      Parameters:
      type - of slot
    • slotDelete

      public final void slotDelete(int slot)
      Delete a slot. If it is running a unit it will be stopped.
      Specified by:
      slotDelete in interface Connection
      Parameters:
      slot - number
    • slotInfo

      public final List<Slot> slotInfo() throws SlotInfoException
      Get slot information.
      Specified by:
      slotInfo in interface Connection
      Returns:
      List Slot
      Throws:
      SlotInfoException - if any.
    • slotModify

      public final void slotModify(String id, String type)
      Modify an existing slot.
      Specified by:
      slotModify in interface Connection
      Parameters:
      id - string
      type - string
    • slotOptions

      public final SlotOptions slotOptions(int slot) throws SlotOptionsException
      Get slot options.
      Specified by:
      slotOptions in interface Connection
      Parameters:
      slot - a int.
      Returns:
      SlotOptions options
      Throws:
      SlotOptionsException - if any.
    • trajectory

      public final void trajectory(int slot)
      Get current protein trajectory.
      Specified by:
      trajectory in interface Connection
      Parameters:
      slot - number
    • triggerSave

      public final void triggerSave()
      Trigger config save after a delay.
      Specified by:
      triggerSave in interface Connection
    • unpause

      public final void unpause()
      Unpause all slots.
      Specified by:
      unpause in interface Connection
    • unpause

      public final void unpause(int slot)
      Unpause requested slot.
      Specified by:
      unpause in interface Connection
      Parameters:
      slot - number
    • uptime

      public final String uptime()
      Print application uptime.
      Specified by:
      uptime in interface Connection
      Returns:
      uptime value in "HH\h MM\m SS\s" format
    • waitForUnits

      public final void waitForUnits()
      Wait for all running units to finish.
      Specified by:
      waitForUnits in interface Connection