de.folt.util
Class InstallSupport

java.lang.Object
  extended by de.folt.util.InstallSupport

public class InstallSupport
extends java.lang.Object

Class contains some support methods for the installation process. Mainly replacing the base openTMS directory

Author:
klemens

Constructor Summary
InstallSupport()
           
 
Method Summary
 boolean adaptInstallationFiles()
          adaptInstallationFiles adapts some files immediately after an installation.
 java.lang.String getInstallFiles()
           
 java.lang.String getOPENTMSPATHDIRECTORY()
           
 void readReplace(java.lang.String[] filename, java.lang.String oldPattern, java.lang.String replPattern)
          readReplace do readReplace on a set of files given in a string array
 void readReplace(java.lang.String filename, java.lang.String oldPattern, java.lang.String replPattern)
          readReplace reads a file and replaces all occurrences of oldPattern with replPattern.
 void readReplace(java.util.Vector<java.lang.String> filename, java.lang.String oldPattern, java.lang.String replPattern)
          readReplace
 void readReplaceFromFile(java.lang.String fname, java.lang.String oldPattern, java.lang.String replPattern)
          readReplaceFromFile
 void setInstallFiles(java.lang.String installFiles)
           
 void setOPENTMSPATHDIRECTORY(java.lang.String opentmspathdirectory)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InstallSupport

public InstallSupport()
Method Detail

adaptInstallationFiles

public boolean adaptInstallationFiles()
adaptInstallationFiles adapts some files immediately after an installation.
First it is checked if in the current directory a file names "installed" exists. If yes, the method returns true (no changes have been necessary) Otherwise the variable installFiles (e.g. "replace.cmd") is read. This file contains a list of files which should be changed.
Example replace.cmd file:
 OpenTMS.xml
 lib/OpenTMS.properties
 In these files all occurrences of OPENTMSPATHDIRECTORY will be replaced with the current directory name

Returns:
true for success, otherwise false

getInstallFiles

public java.lang.String getInstallFiles()
Returns:
the installFiles

getOPENTMSPATHDIRECTORY

public java.lang.String getOPENTMSPATHDIRECTORY()
Returns:
the oPENTMSPATHDIRECTORY

readReplace

public void readReplace(java.lang.String filename,
                        java.lang.String oldPattern,
                        java.lang.String replPattern)
readReplace reads a file and replaces all occurrences of oldPattern with replPattern. The original file is backed up to .bak

Parameters:
filename - the file name to adapt
oldPattern - the pattern to change
replPattern - the pattern which is used for replacement

readReplace

public void readReplace(java.lang.String[] filename,
                        java.lang.String oldPattern,
                        java.lang.String replPattern)
readReplace do readReplace on a set of files given in a string array

Parameters:
filename - the array of strings with the filenames to replace
oldPattern - the pattern to change
replPattern - the pattern which is used for replacement

readReplace

public void readReplace(java.util.Vector<java.lang.String> filename,
                        java.lang.String oldPattern,
                        java.lang.String replPattern)
readReplace

Parameters:
filename - do readReplace on a set of files given in a Vector of strings
oldPattern - the pattern to change
replPattern - the pattern which is used for replacement

readReplaceFromFile

public void readReplaceFromFile(java.lang.String fname,
                                java.lang.String oldPattern,
                                java.lang.String replPattern)
readReplaceFromFile

Parameters:
fname -
oldPattern -
replPattern -

setInstallFiles

public void setInstallFiles(java.lang.String installFiles)
Parameters:
installFiles - the installFiles to set

setOPENTMSPATHDIRECTORY

public void setOPENTMSPATHDIRECTORY(java.lang.String opentmspathdirectory)
Parameters:
opentmspathdirectory - the oPENTMSPATHDIRECTORY to set