Class GrouperInstaller
java.lang.Object
edu.internet2.middleware.grouperInstaller.GrouperInstaller
Install grouper
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
structure and logic to locate where grouper is installed (or will be?)static enum
static enum
static enum
static enum
static enum
main function of grouper installerstatic enum
static enum
static enum
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
add a line to a file.static void
addToXmlFile
(File file, String addAfterThisRegex, String[] mustPassTheseRegexes, String newValue, String description) add something to an xml filebackupAndCopyFile
(File newFile, File existingFile, boolean printDetails) backupAndDeleteFile
(File file, boolean printDetails) configPropertyDuplicates
(File file1, File file2) void
configureTomcatUriEncoding
(File serverXmlFile) void
convertEhcacheBaseToProperties
(File ehcacheBaseFile) static void
convertEhcacheXmlToProperties
(File grouperCacheBasePropertiesFile, File grouperCachePropertiesFile, URL ehcacheXmlUrl) static void
convertSourcesXmlToProperties
(File subjectPropertiesFile, URL sourcesXmlUrl) void
copy files if they are different from one place to another, print out statusesstatic boolean
copyJarFileIfNotExists
(File sourceFile, File destinationFile, boolean onlyIfDifferentContents, boolean ignoreWhitespace) Copy a jar file to another file.static void
run dos2unix on a filestatic void
dos2unix
(Collection<File> files, String fileNameInPrompt, String configSuffixAutorun) run dos2unix on a filevoid
void
void
void
void
downloadAndUnzipGrouperSource
(String branchName) void
static Boolean
editFile
(File file, String valueRegex, String[] lineMustHaveRegexes, String[] lineCantHaveRegexes, String newValue, String description) edit a property in a property filestatic Boolean
editFile
(File file, String valueRegex, String[] lineMustHaveRegexes, String[] lineCantHaveRegexes, String newValue, String description, boolean addAttributeIfNotExists, String newAttributeName) edit a property in a property filestatic void
editPropertiesFile
(File file, String propertyName, String propertyValue, boolean createFileIfNotExist) edit a property in a property filestatic Boolean
editXmlFileAttribute
(File file, String elementName, Map<String, String> elementMustHaveAttributeAndValue, String newAttributeName, String newValue, String description) edit an xml file attribute in a xml filestatic String
When the installer starts, it tests and validates the java command.void
gshExcutableAndDos2Unix
(String binDirLocation) void
gshExcutableAndDos2Unix
(String binDirLocation, String specify) void
log4jDebugSql
(String log4jLocation) static void
static void
mergeEhcacheXmlFiles
(File newEhcacheExampleFile, File existingEhcacheExampleFile, File existingEhcacheFile) static Object
promptForEnum
(String prompt, String configKey, Class<?> theClass) try 10 times to get enumstatic Object
promptForEnum
(String prompt, String configKey, Class<?> enumClass, Object theDefault, String configKeyForDefault) try 10 times to get enumvoid
removeLegacyHibernateProperties
(String hibernateFileLocation) void
reportOnConflictingJars
(String appDir) static String
xmlElementValue
(Element parent, String subElementName, boolean required, String descriptionForError) get a subelement value.xmlNodeAttributeDifferences
(Element baseElement, Element configuredElement)
-
Field Details
-
TOMCAT_VERSION
- See Also:
-
JAVA_MIN_VERSION
- See Also:
-
TOMEE_VERSION
- See Also:
-
-
Constructor Details
-
GrouperInstaller
public GrouperInstaller()
-
-
Method Details
-
convertEhcacheBaseToProperties
- Parameters:
ehcacheBaseFile
-
-
main
- Parameters:
args
-
-
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
- Parameters:
appDir
- e.g. this.upgradeExistingApplicationDirectoryString
-
promptForEnum
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
copy files if they are different from one place to another, print out statuses- Parameters:
fromDirString
- where to copy files fromtoDirString
- where to copy files torelativePathsToIgnore
-
-
backupAndCopyFile
- Parameters:
newFile
-existingFile
-printDetails
-- Returns:
- the bakFile
-
backupAndDeleteFile
- Parameters:
file
-printDetails
-- Returns:
- the bakFile
-
bakFile
- Parameters:
existingFile
-- Returns:
- the bak file
-
configPropertyDuplicates
- Parameters:
file1
-file2
-- Returns:
- the property names which are the same
-
downloadAndUnzipGrouperSource
- 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
- Parameters:
binDirLocation
- which includes trailing slash
-
dos2unix
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.shconfigSuffixAutorun
- suffix after grouperInstaller.autorun.dos2unix in properties file
-
gshExcutableAndDos2Unix
- Parameters:
binDirLocation
- which includes trailing slashspecify
- if specifying location
-
removeLegacyHibernateProperties
- Parameters:
hibernateFileLocation
-
-
log4jDebugSql
- Parameters:
log4jLocation
-
-
downloadAndBuildClient
public void downloadAndBuildClient() -
configureTomcatUriEncoding
- 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 printaddAttributeIfNotExists
- if attribute isnt there, then if true, then add the attributenewAttributeName
- 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
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 filedescription
- 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
- 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 printnewAttributeName
- 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
-