Class GrouperInstaller

java.lang.Object
edu.internet2.middleware.grouperInstaller.GrouperInstaller

public class GrouperInstaller extends Object
Install grouper
  • Field Details

  • Constructor Details

    • GrouperInstaller

      public GrouperInstaller()
  • Method Details

    • convertEhcacheBaseToProperties

      public void convertEhcacheBaseToProperties(File ehcacheBaseFile)
      Parameters:
      ehcacheBaseFile -
    • main

      public static void main(String[] args)
      Parameters:
      args -
    • getJavaCommand

      public static String getJavaCommand()
      When the installer starts, it tests and validates the java command. If found it will set the path to it for later use.
      Returns:
      path to java executable. Set by validJava()
    • reportOnConflictingJars

      public void reportOnConflictingJars(String appDir)
      Parameters:
      appDir - e.g. this.upgradeExistingApplicationDirectoryString
    • promptForEnum

      public static Object promptForEnum(String prompt, String configKey, Class<?> theClass)
      try 10 times to get enum
      Parameters:
      prompt -
      configKey -
      theClass -
      Returns:
      the object
    • promptForEnum

      public static Object promptForEnum(String prompt, String configKey, Class<?> enumClass, Object theDefault, String configKeyForDefault)
      try 10 times to get enum
      Parameters:
      prompt -
      configKey -
      enumClass -
      theDefault -
      configKeyForDefault -
      Returns:
      the object
    • copyFiles

      public void copyFiles(String fromDirString, String toDirString, Set<String> relativePathsToIgnore)
      copy files if they are different from one place to another, print out statuses
      Parameters:
      fromDirString - where to copy files from
      toDirString - where to copy files to
      relativePathsToIgnore -
    • backupAndCopyFile

      public File backupAndCopyFile(File newFile, File existingFile, boolean printDetails)
      Parameters:
      newFile -
      existingFile -
      printDetails -
      Returns:
      the bakFile
    • backupAndDeleteFile

      public File backupAndDeleteFile(File file, boolean printDetails)
      Parameters:
      file -
      printDetails -
      Returns:
      the bakFile
    • bakFile

      public File bakFile(File existingFile)
      Parameters:
      existingFile -
      Returns:
      the bak file
    • configPropertyDuplicates

      public static Set<String> configPropertyDuplicates(File file1, File file2)
      Parameters:
      file1 -
      file2 -
      Returns:
      the property names which are the same
    • downloadAndUnzipGrouperSource

      public File downloadAndUnzipGrouperSource(String branchName)
      Parameters:
      branchName -
      Returns:
      the directory of the unzipped source repo
    • downloadAndUnzipAnt

      public void downloadAndUnzipAnt()
    • downloadAndUnzipMaven

      public void downloadAndUnzipMaven()
    • downloadAndUntarWs

      public void downloadAndUntarWs()
    • downloadAndConfigureUi

      public void downloadAndConfigureUi()
    • downloadAndConfigureApi

      public void downloadAndConfigureApi()
    • gshExcutableAndDos2Unix

      public void gshExcutableAndDos2Unix(String binDirLocation)
      Parameters:
      binDirLocation - which includes trailing slash
    • dos2unix

      public static void dos2unix(File file, String fileNameInPrompt, String configSuffixAutorun)
      run dos2unix on a file
      Parameters:
      file -
      fileNameInPrompt -
      configSuffixAutorun -
    • dos2unix

      public static void dos2unix(Collection<File> files, String fileNameInPrompt, String configSuffixAutorun)
      run dos2unix on a file
      Parameters:
      files -
      fileNameInPrompt - e.g. gsh.sh
      configSuffixAutorun - suffix after grouperInstaller.autorun.dos2unix in properties file
    • gshExcutableAndDos2Unix

      public void gshExcutableAndDos2Unix(String binDirLocation, String specify)
      Parameters:
      binDirLocation - which includes trailing slash
      specify - if specifying location
    • removeLegacyHibernateProperties

      public void removeLegacyHibernateProperties(String hibernateFileLocation)
      Parameters:
      hibernateFileLocation -
    • log4jDebugSql

      public void log4jDebugSql(String log4jLocation)
      Parameters:
      log4jLocation -
    • downloadAndBuildClient

      public void downloadAndBuildClient()
    • configureTomcatUriEncoding

      public void configureTomcatUriEncoding(File serverXmlFile)
      Parameters:
      serverXmlFile -
    • mergeEhcacheXmlFiles

      public static void mergeEhcacheXmlFiles(File newEhcacheExampleFile, File existingEhcacheExampleFile, File existingEhcacheFile)
      Parameters:
      newEhcacheExampleFile -
      existingEhcacheExampleFile -
      existingEhcacheFile -
    • xmlNodeAttributeDifferences

      public static Map<String,String> xmlNodeAttributeDifferences(Element baseElement, Element configuredElement)
      Parameters:
      baseElement -
      configuredElement -
      Returns:
      the map of differences
    • copyJarFileIfNotExists

      public static boolean copyJarFileIfNotExists(File sourceFile, File destinationFile, boolean onlyIfDifferentContents, boolean ignoreWhitespace)
      Copy a jar file to another file. this perserves the file date
      Parameters:
      sourceFile -
      destinationFile -
      onlyIfDifferentContents - true if only saving due to different contents. Note, this is only for non-binary files!
      ignoreWhitespace - true to ignore whitespace in comparisons
      Returns:
      true if contents were saved (thus different if param set)
    • editFile

      public static Boolean editFile(File file, String valueRegex, String[] lineMustHaveRegexes, String[] lineCantHaveRegexes, String newValue, String description)
      edit a property in a property file
      Parameters:
      file -
      valueRegex -
      lineMustHaveRegexes -
      lineCantHaveRegexes -
      newValue -
      description - of change for sys out print
      Returns:
      true if edited file, or false if not but didnt need to, null if not found
    • editFile

      public static Boolean editFile(File file, String valueRegex, String[] lineMustHaveRegexes, String[] lineCantHaveRegexes, String newValue, String description, boolean addAttributeIfNotExists, String newAttributeName)
      edit a property in a property file
      Parameters:
      file -
      valueRegex -
      lineMustHaveRegexes -
      lineCantHaveRegexes -
      newValue -
      description - of change for sys out print
      addAttributeIfNotExists - if attribute isnt there, then if true, then add the attribute
      newAttributeName - if adding new attribute, this is the name
      Returns:
      true if edited file, or false if not but didnt need to, null if not found
    • addToFile

      public static void addToFile(File file, String line, int lineNumber, String description)
      add a line to a file. will replace \n with whatever newline is
      Parameters:
      file -
      line - (not ending in newline)
      lineNumber - 1 indexed. If not exist, add to end of file
      description - is a description of what was just changed
    • addToXmlFile

      public static void addToXmlFile(File file, String addAfterThisRegex, String[] mustPassTheseRegexes, String newValue, String description)
      add something to an xml file
      Parameters:
      file -
      addAfterThisRegex -
      mustPassTheseRegexes -
      newValue -
      description - of change for sys out print
    • editPropertiesFile

      public static void editPropertiesFile(File file, String propertyName, String propertyValue, boolean createFileIfNotExist)
      edit a property in a property file
      Parameters:
      file -
      propertyName -
      propertyValue -
      createFileIfNotExist -
    • convertEhcacheXmlToProperties

      public static void convertEhcacheXmlToProperties(File grouperCacheBasePropertiesFile, File grouperCachePropertiesFile, URL ehcacheXmlUrl)
      Parameters:
      grouperCacheBasePropertiesFile -
      grouperCachePropertiesFile -
      ehcacheXmlUrl -
    • xmlElementValue

      public static String xmlElementValue(Element parent, String subElementName, boolean required, String descriptionForError)
      get a subelement value. e.g. if the node is <source> and the sub element is <id>someId</id> It will return "someId" for subElementName "id"
      Parameters:
      parent -
      subElementName -
      required -
      descriptionForError -
      Returns:
      the string or null if not there
    • convertSourcesXmlToProperties

      public static void convertSourcesXmlToProperties(File subjectPropertiesFile, URL sourcesXmlUrl)
      Parameters:
      subjectPropertiesFile -
      sourcesXmlUrl -
    • editXmlFileAttribute

      public static Boolean editXmlFileAttribute(File file, String elementName, Map<String,String> elementMustHaveAttributeAndValue, String newAttributeName, String newValue, String description)
      edit an xml file attribute in a xml file
      Parameters:
      file -
      elementName -
      elementMustHaveAttributeAndValue -
      newValue -
      description - of change for sys out print
      newAttributeName - if adding new attribute, this is the name
      Returns:
      true if edited file, or false if not but didnt need to, null if not found