Package zleurtor.scanmanager.model
Class Master
java.lang.Object
zleurtor.scanmanager.model.AbstractCommunicator
zleurtor.scanmanager.model.Master
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 -
Method Summary
Modifier and TypeMethodDescriptionboolean
addMasterListener
(MasterListener listener) Adds the specified object to the list of objects listening for master events.final File[]
Returns the list of snapshot set directories.final void
The method used to send a log request to a slave.final void
The method used to send a log level change request to a slave.final void
The method used to save snapshot files archives.void
scan()
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
The method used to send a shutdown request to one slave.final void
The method used to send a preview request to the slaves.final void
The method sending snapshot requests.final void
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
-
Constructor Details
-
Master
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
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
Returns the list of snapshot set directories.- Returns:
- The list of snapshot set directories.
-
trash
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
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 sentreboot
- Whether or not the sent shutdown request shall be a reboot one.
-
stream
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
The method used to send a log request to a slave.- Parameters:
slaveName
- The slave to which the log request shall be sent.
-
logLevel
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
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
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
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.
-