org.peace_tools.core
Class PEACEInstaller

java.lang.Object
  extended by javax.swing.SwingWorker<java.lang.Void,java.lang.Void>
      extended by org.peace_tools.core.PEACEInstaller
All Implemented Interfaces:
java.lang.Runnable, java.util.concurrent.Future<java.lang.Void>, java.util.concurrent.RunnableFuture<java.lang.Void>, java.util.EventListener, javax.swing.event.DocumentListener

public class PEACEInstaller
extends javax.swing.SwingWorker<java.lang.Void,java.lang.Void>
implements javax.swing.event.DocumentListener


Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.SwingWorker
javax.swing.SwingWorker.StateValue
 
Field Summary
private  javax.swing.JPanel container
          The top-level container that logically contains all the GUI elements associated with this installer.
private static java.lang.String[] LinuxInstallFiles
          The list of files to be installed on a Linux machine.
private  javax.swing.text.DefaultStyledDocument output
          The styled document that is used to display the output from the installation process is different colors.
private  javax.swing.JProgressBar progressBar
          A roving progress bar to show the user we are doing some work.
private  Server server
          This is the server entry that is being currently installed via this wizard.
private  javax.swing.JTextPane textPane
          The text pane where the output from the installation process is displayed.
private static java.lang.String[] WindowsInstallFiles
          The list of files to be installed on a Windows machine.
 
Constructor Summary
PEACEInstaller(Server server)
          The constructor lays out the main components in this tab.
 
Method Summary
protected  void addLog(java.lang.String entry)
          Helper method to add informational output.
protected  void addLog(java.lang.String entry, java.lang.String style)
          Helper method to add string to output and scroll it.
 void changedUpdate(javax.swing.event.DocumentEvent arg0)
          Implementation for method in DocumentListener to scroll to end of the document.
private  java.lang.String copyInstallFiles(ServerSession ss)
          This is a helper method that is used to copy the install files to the server.
private  void createOutputPane()
          This is a refactored utility method to create informational labels at the top of this panel.
private  void createTopPanel()
          This is a refactored utility method to create informational labels at the top of this panel.
protected  java.lang.Void doInBackground()
           
 javax.swing.JPanel getPanel()
          Method to obtain the top-level GUI container for this installer.
 void insertUpdate(javax.swing.event.DocumentEvent arg0)
          Implementation for method in DocumentListener to scroll to end of the document.
 void removeUpdate(javax.swing.event.DocumentEvent arg0)
          Implementation for method in DocumentListener to scroll to end of the document.
 
Methods inherited from class javax.swing.SwingWorker
addPropertyChangeListener, cancel, done, execute, firePropertyChange, get, get, getProgress, getPropertyChangeSupport, getState, isCancelled, isDone, process, publish, removePropertyChangeListener, run, setProgress
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

output

private javax.swing.text.DefaultStyledDocument output
The styled document that is used to display the output from the installation process is different colors.


textPane

private javax.swing.JTextPane textPane
The text pane where the output from the installation process is displayed.


progressBar

private javax.swing.JProgressBar progressBar
A roving progress bar to show the user we are doing some work. We really can't tell how much progress has happened but we can say we are doing something so that the user understands the GUI is not hanging.


container

private javax.swing.JPanel container
The top-level container that logically contains all the GUI elements associated with this installer. This container is created in the constructor.


LinuxInstallFiles

private static final java.lang.String[] LinuxInstallFiles
The list of files to be installed on a Linux machine. Note that the last entry is the command to be executed for completing the installation. If the installation does not require running a command, then make the last entry null.


WindowsInstallFiles

private static final java.lang.String[] WindowsInstallFiles
The list of files to be installed on a Windows machine. Note that the last entry is the command to be executed for completing the installation. If the installation does not require running a command, then make the last entry null.


server

private final Server server
This is the server entry that is being currently installed via this wizard. This object is initially used to establish connection and later on to change status.

Constructor Detail

PEACEInstaller

public PEACEInstaller(Server server)
The constructor lays out the main components in this tab.

Parameters:
server - The server to be installed.
Method Detail

getPanel

public javax.swing.JPanel getPanel()
Method to obtain the top-level GUI container for this installer.

Returns:
The top-level GUI container that contains all the GUI elements associated with this installer.

createOutputPane

private void createOutputPane()
This is a refactored utility method to create informational labels at the top of this panel. This method was introduced to keep the code clutter in the constructor to a minimum. This method is called only once from the constructor.


createTopPanel

private void createTopPanel()
This is a refactored utility method to create informational labels at the top of this panel. This method was introduced to keep the code clutter in the constructor to a minimum.


addLog

protected void addLog(java.lang.String entry)
Helper method to add informational output. This is a helper method that is called from various methods to show more detailed progress information to the user. This method is synonymous to calling addLog("blah", "info");

Parameters:
entry - The log entry to be appended.

addLog

protected void addLog(java.lang.String entry,
                      java.lang.String style)
Helper method to add string to output and scroll it. This is a helper method that is called from various methods to show more detailed progress information to the user.

Parameters:
entry - The log entry to be appended.
style - The style (that determines color) for the entry.

doInBackground

protected java.lang.Void doInBackground()
                                 throws java.lang.Exception
Specified by:
doInBackground in class javax.swing.SwingWorker<java.lang.Void,java.lang.Void>
Throws:
java.lang.Exception

copyInstallFiles

private java.lang.String copyInstallFiles(ServerSession ss)
                                   throws java.lang.Exception
This is a helper method that is used to copy the install files to the server. Specifically this method copies "peace.tar.gz" and "install.sh".

Parameters:
ss - The server session to be used for copying the file(s) to the server.
Returns:
The install file to be run on the remote machine.
Throws:
java.lang.Exception - Exception is generated if errors occur while copying the install files.

changedUpdate

public void changedUpdate(javax.swing.event.DocumentEvent arg0)
Implementation for method in DocumentListener to scroll to end of the document. This is not the best of implementation for this method but is sufficient for this class.

Specified by:
changedUpdate in interface javax.swing.event.DocumentListener
Parameters:
arg0 - The document associated with the call. Currently, this event is not used.

insertUpdate

public void insertUpdate(javax.swing.event.DocumentEvent arg0)
Implementation for method in DocumentListener to scroll to end of the document. This is not the best of implementation for this method but is sufficient for this class.

Specified by:
insertUpdate in interface javax.swing.event.DocumentListener
Parameters:
arg0 - The document associated with the call. Currently, this event is not used.

removeUpdate

public void removeUpdate(javax.swing.event.DocumentEvent arg0)
Implementation for method in DocumentListener to scroll to end of the document. This is not the best of implementation for this method but is sufficient for this class.

Specified by:
removeUpdate in interface javax.swing.event.DocumentListener
Parameters:
arg0 - The document associated with the call. Currently, this event is not used.