com.opencms.boot
Class CmsSetupUtils

java.lang.Object
  |
  +--com.opencms.boot.CmsSetupUtils

public class CmsSetupUtils
extends Object

This class provides several utilities and methods used by the OpenCms setup wizard

Author:
Magnus Meurer

Constructor Summary
CmsSetupUtils(String basePath)
          Constructor
 
Method Summary
 void backupRegistry(String registryFilename, String originalRegistryFilename)
          Restores the registry.xml either to or from a backup file, depending whether the setup wizard is executed the first time (the backup registry doesnt exist) or not (the backup registry exists).
static boolean compareJDKVersions(String usedJDK, String requiredJDK)
          Checks if the used JDK is a higher version than the required JDK
 void copyFile(String sourceFilename, String destFilename)
          Copies a given file.
static String escape(String source, String encoding)
          URLEncodes a given string similar to JavaScript.
 Vector getErrors()
           
 void saveProperties(source.org.apache.java.util.ExtendedProperties extProp, String originalFile, boolean backup)
          Saves properties to specified file.
static boolean supportedServletEngine(String thisEngine, String[] supportedEngines)
          Checks if the used servlet engine is part of the servlet engines OpenCms supports
static int unsupportedServletEngine(String thisEngine, String[] unsupportedEngines)
          Checks if the used servlet engine is part of the servlet engines OpenCms does NOT support
static void writeVersionInfo(String thisEngine, String usedJDK, String basePath)
          Writes the version info of the used servlet engine and the used JDK to the version.txt
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CmsSetupUtils

public CmsSetupUtils(String basePath)
Constructor

Method Detail

saveProperties

public void saveProperties(source.org.apache.java.util.ExtendedProperties extProp,
                           String originalFile,
                           boolean backup)
Saves properties to specified file.

Parameters:
extProp - Properties to be saved
originalFile - File to save props to
backup - if true, create backupfile

copyFile

public void copyFile(String sourceFilename,
                     String destFilename)
Copies a given file.

Parameters:
sourceFilename - source file
destFilename - destination file

backupRegistry

public void backupRegistry(String registryFilename,
                           String originalRegistryFilename)
Restores the registry.xml either to or from a backup file, depending whether the setup wizard is executed the first time (the backup registry doesnt exist) or not (the backup registry exists).

Parameters:
originalRegistryFilename - something like "registry.ori"
registryFilename - the registry's real file name "registry.xml"

escape

public static String escape(String source,
                            String encoding)
URLEncodes a given string similar to JavaScript.

Parameters:
source - string to be encoded

getErrors

public Vector getErrors()

compareJDKVersions

public static boolean compareJDKVersions(String usedJDK,
                                         String requiredJDK)
Checks if the used JDK is a higher version than the required JDK

Parameters:
usedJDK - The JDK version in use
requiredJDK - The required JDK version
Returns:
true if used JDK version is equal or higher than required JDK version, false otherwise

supportedServletEngine

public static boolean supportedServletEngine(String thisEngine,
                                             String[] supportedEngines)
Checks if the used servlet engine is part of the servlet engines OpenCms supports

Parameters:
thisEngine - The servlet engine in use
supportedEngines - All known servlet engines OpenCms supports
Returns:
true if this engine is supported, false if it was not found in the list

unsupportedServletEngine

public static int unsupportedServletEngine(String thisEngine,
                                           String[] unsupportedEngines)
Checks if the used servlet engine is part of the servlet engines OpenCms does NOT support

Parameters:
thisEngine - The servlet engine in use
Returns:
supportedEngines index or -1 if not found

writeVersionInfo

public static void writeVersionInfo(String thisEngine,
                                    String usedJDK,
                                    String basePath)
Writes the version info of the used servlet engine and the used JDK to the version.txt

Parameters:
thisEngine - The servlet engine in use
usedJDK - The JDK version in use