cz.polous.andaria
Class Installer

java.lang.Object
  extended by cz.polous.andaria.ProgressBar
      extended by cz.polous.andaria.PatcherQueue
          extended by cz.polous.andaria.Installer
All Implemented Interfaces:
java.lang.Runnable

 class Installer
extends PatcherQueue

Installer se stara o rozbalovani (nebo jen kopirovani) souboru do adresare s ultimou. Po rozbaleni souboru do adresare s uo se koukne po instalacnich skriptech start_a.bat nebo start_b.bat a kdyz je najde tak je spusti. Po uspesnem nainstalovani oznaci soubor jako nainstalovany a odstrani z fornty pro instalaci Class is singleton.

Author:
Martin Polehla (andaria_patcher@polous.cz)

Nested Class Summary
 
Nested classes/interfaces inherited from class cz.polous.andaria.ProgressBar
ProgressBar.BARS
 
Field Summary
private  long extractProgressPart
           
private  long extractTotalSize
           
private  boolean failed
           
private static Installer INSTANCE
           
(package private)  long singlediv
           
(package private)  long totalsize
           
(package private)  long totalsizeEnd
           
 
Fields inherited from class cz.polous.andaria.PatcherQueue
log, patchQueue
 
Constructor Summary
private Installer()
          Creates a new instance of Runner
 
Method Summary
protected  void addPatchItem(PatchItem p)
          Add new PatchItem to queue.
private  void exec(java.lang.String[] command)
          Run file in separated thread and pause installator thread using wait() method.
(package private)  void executeNext()
          Main install procedure - (re)set progress indicator (for fun of users, generated random value .-) ) - Unpack patch files - if exists start_a.bat, execute it - if exists start_g.bat, execute it - finish install procedure and remove file from queue
static Installer getInstance()
           
 void setExtractedProgress(long value)
          Part of progressbar belogns to file extraction and rest of bar belongs to patch instalation process.
 void setExtractedTotal(long value)
          TotalExtractedSize hold total size of files to extract.
 void setFailed(boolean failed)
           
 
Methods inherited from class cz.polous.andaria.PatcherQueue
cancel, canceled, getFirstItem, inProgress, isFinished, notCanceled, pause, removeFirst, reset, run, start, startSafe
 
Methods inherited from class cz.polous.andaria.ProgressBar
getSingleMax, getSingleProgress, getSpeedLabelText, getTotalMax, getTotalProgress, removeFromTotalProgress, resetProgressBar, resetProgressBar, setLabelSpeed, setLabelText, setSingleMax, setSingleProgress, setSingleProgressPercents, setTotalMax, setTotalProgress, updateProgressBar
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INSTANCE

private static final Installer INSTANCE

failed

private boolean failed

extractTotalSize

private long extractTotalSize

extractProgressPart

private long extractProgressPart

totalsize

long totalsize

totalsizeEnd

long totalsizeEnd

singlediv

long singlediv
Constructor Detail

Installer

private Installer()
Creates a new instance of Runner

Method Detail

setFailed

public void setFailed(boolean failed)

getInstance

public static Installer getInstance()

addPatchItem

protected void addPatchItem(PatchItem p)
Add new PatchItem to queue. Override PatchQueue method - Installer try start automaticly after new file added to queue.

Overrides:
addPatchItem in class PatcherQueue
Parameters:
p - item to add
See Also:
Downloader.executeNext()

exec

private void exec(java.lang.String[] command)
Run file in separated thread and pause installator thread using wait() method. Installer thread is resumed using work() method. Note: this is reason of existing safeWork()

Parameters:
command - Command to execute

executeNext

void executeNext()
Main install procedure - (re)set progress indicator (for fun of users, generated random value .-) ) - Unpack patch files - if exists start_a.bat, execute it - if exists start_g.bat, execute it - finish install procedure and remove file from queue

Specified by:
executeNext in class PatcherQueue

setExtractedProgress

public void setExtractedProgress(long value)
Part of progressbar belogns to file extraction and rest of bar belongs to patch instalation process. setExtractedProgress count and set progressbar while extracting patch files.


setExtractedTotal

public void setExtractedTotal(long value)
TotalExtractedSize hold total size of files to extract. This entry is used to calculate extract progress bar part [setExtractedProgress()].