Class Master


public class Master extends AbstractCommunicator
The master's class having in charge to send messages to the slaves and to receive (and treat) the messages from the slaves.
Author:
Zleurtor
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructs a new master object.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Adds the specified object to the list of objects listening for master events.
    final File[]
    Returns the list of snapshot set directories.
    final void
    log(String slaveName)
    The method used to send a log request to a slave.
    final void
    logLevel(org.apache.log4j.lf5.LogLevel level, String slaveName)
    The method used to send a log level change request to a slave.
    final void
    save(Map<File,int[]> inFiles, File optionsFile, File outFile)
    The method used to save snapshot files archives.
    void
    The method used to "scan" the network.
    final void
    setOptions(String options, String slaveName)
    The method used to send a set options request to a slave.
    final void
    shutdown(boolean reboot)
    The method used to send a shutdown request to the slaves.
    final void
    shutdown(String slaveName, boolean reboot)
    The method used to send a shutdown request to one slave.
    final void
    stream(String slaveName, String slaveIp)
    The method used to send a preview request to the slaves.
    final void
    The method sending snapshot requests.
    final void
    trash(File[] snapshotSets)
    The method used to clear the snapshot files.
    final void
    updateSlave(File updateFile, String prefix, String suffix, String slaveName)
    The method used to send an update request to a slave.

    Methods inherited from class zleurtor.scanmanager.model.AbstractCommunicator

    readMessage, writeMessage

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Master

      public Master() throws SocketException
      Constructs a new master object.
      Throws:
      SocketException - If an error occurs while searching the broadcast addresses.
  • Method Details

    • scan

      public void scan()
      The method used to "scan" the network.
    • takeSnapshot

      public final void takeSnapshot()
      The method sending snapshot requests.
    • save

      public final void save(Map<File,int[]> inFiles, File optionsFile, File outFile) throws IOException
      The method used to save snapshot files archives.
      Parameters:
      inFiles - The files to save into a zip archive.
      optionsFile - The files containing the snapshot options of each slave.
      outFile - The zip archive into which the files shall be saved.
      Throws:
      IOException - If an Input/Output error occurs.
    • getSnapshotSets

      public final File[] getSnapshotSets()
      Returns the list of snapshot set directories.
      Returns:
      The list of snapshot set directories.
    • trash

      public final void trash(File[] snapshotSets)
      The method used to clear the snapshot files.
      Parameters:
      snapshotSets - The sets of snapshots to delete.
    • shutdown

      public final void shutdown(boolean reboot)
      The method used to send a shutdown request to the slaves.
      Parameters:
      reboot - Whether or not the sent shutdown request shall be a reboot one.
    • shutdown

      public final void shutdown(String slaveName, boolean reboot)
      The method used to send a shutdown request to one slave.
      Parameters:
      slaveName - The name of the slave to which the shutdown request shall be sent
      reboot - Whether or not the sent shutdown request shall be a reboot one.
    • stream

      public final void stream(String slaveName, String slaveIp)
      The method used to send a preview request to the slaves.
      Parameters:
      slaveName - The name of the slave to which the preview request shall be send.
      slaveIp - The IP of the slave to which the preview request shall be send.
    • log

      public final void log(String slaveName)
      The method used to send a log request to a slave.
      Parameters:
      slaveName - The slave to which the log request shall be sent.
    • logLevel

      public final void logLevel(org.apache.log4j.lf5.LogLevel level, String slaveName)
      The method used to send a log level change request to a slave.
      Parameters:
      level - The level to which the slave's log level shall be changed.
      slaveName - The slave to which the log request shall be sent.
    • setOptions

      public final void setOptions(String options, String slaveName)
      The method used to send a set options request to a slave.
      Parameters:
      options - The new options for the slave.
      slaveName - The slave to which the options request shall be sent.
    • updateSlave

      public final void updateSlave(File updateFile, String prefix, String suffix, String slaveName)
      The method used to send an update request to a slave.
      Parameters:
      updateFile - The file containing the update for the slave.
      prefix - The update file prefix.
      suffix - The update file suffix.
      slaveName - The slave to which the update request shall be sent.
    • addMasterListener

      public boolean addMasterListener(MasterListener listener)
      Adds the specified object to the list of objects listening for master events.
      Parameters:
      listener - The object to add to the list of objects listening for master events.
      Returns:
      true If the listeners collection did not already contain the specified element.