/**
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
*
* The contents of this file are subject to the terms
* of the Common Development and Distribution License
* (the License). You may not use this file except in
* compliance with the License.
*
* You can obtain a copy of the License at
* See the License for the specific language governing
* permission and limitations under the License.
*
* When distributing Covered Code, include this CDDL
* Header Notice in each file and include the License file
* at opensso/legal/CDDLv1.0.txt.
* If applicable, add the following below the CDDL Header,
* with the fields enclosed by brackets [] replaced by
* your own identifying information:
* "Portions Copyrighted [year] [name of copyright owner]"
*
* $Id: TomcatVersionValidator.java,v 1.2 2008/11/28 12:36:22 saueree Exp $
*
* Portions Copyrighted 2014-2015 ForgeRock AS.
*/
implements IConstants, IConfigKeys {
/*
* Localized constants
*/
"VA_MSG_TOMCAT_VAL_TOMCAT_VERSION";
"VA_WRN_TOMCAT_IN_VAL_TOMCAT_VERSION";
/** Hashmap of Validator names and integers */
super();
}
/**
* Method isTomcatVersionValid
*
*
* @param catalinaHomeDir
* @param props
* @param state
*
* @return ValidationResult
*
*/
if (isTomcatVersionValid(state)) {
new Object[] { catalinaHomeDir });
}
{
new Object[] { catalinaHomeDir });
}
return new ValidationResult(
null,
}
try {
.put(
"VALID_TOMCAT_VERSION",
"isTomcatVersionValid",
paramObjs));
} catch (NoSuchMethodException nsme) {
"HomeDirValidator: NoSuchMethodException "
+ "thrown while loading method :",
nsme);
throw new InstallException(
nsme);
} catch (SecurityException se) {
"HomeDirValidator: SecurityException thrown "
+ "while loading method :",
se);
throw new InstallException(
se);
"HomeDirValidator: Exception thrown while "
+ "loading method :",
ex);
throw new InstallException(
ex);
}
}
try {
" jarFile = " + catalinaJarPath);
}
}
// A non-null value means a supported version was found
if (versionString != null) {
return true;
} else {
return false;
}
}
/**
* For the given ServerInfo output from org.apache.catalina.util.ServerInfo, return true or false depending on if
* this version of Tomcat is supported.
* @param serverInfo The out from the ServerInfo command.
* @return the version as a String from constants TOMCAT_VER_60, TOMCAT_VER_70, TOMCAT_VER_80
* or null if not a valid version
*/
// Parse the output looking for the Server number string, for example:
// Server number: 6.0.24.0
// Server number: 7.0.39.0
if (currentIndex == -1) {
return null;
}
// If we don't find this character, just take the remainder of the string, we only care about the start
if (endIndex == -1) {
}
// Only versions 6.0.x, 7.0.x and 8.0.x are currently valid.
}
" found version: " + result);
}
return result;
}
/**
* Method executeCommand
*
*
* @param commandArray
* @param environment
* @param resultBuffer
*
* @return
*
*/
private int executeCommand(
int status;
try {
reader = new BufferedReader(
if (resultBuffer != null) {
.append('\n');
}
} else {
}
}
} catch (InterruptedException exc) {
throw new RuntimeException(
"TomcatVersionValidator.executeCommand(...) error waiting for "
+ commandArray[0]);
} catch (IOException exc) {
throw new RuntimeException(
"TomcatVersionValidator.executeCommand(...) : "
} finally {
try {
} catch (IOException exc) {
"TomcatVersionValidator.executeCommand(...) : "
+ "Error executing java runtime command",
exc);
}
}
}
return status;
}
}