VersionCheck.java revision 86684ff5e358598541df265b6439d30965c803f5
/**
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 2007 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: VersionCheck.java,v 1.9 2008/12/11 18:26:37 veiming Exp $
*
*/
/*
* Portions Copyrighted 2010-2011 ForgeRock AS
*/
public class VersionCheck implements SetupConstants {
private final static String MISMATCH_MSG_TO_DEBUGLOG =
"openam.mismatch.message.to.debuglog";
private final static String IGNORE_VERSION_CHECK =
"openam.ignore.version.check";
"SNAPSHOT";
/**
* Check whether the version AM is valid.
*/
public static int isValid() {
try {
} catch (ConfiguratorException ex) {
return 1;
}
return isVersionValid();
}
public static int isVersionValid() {
AM_VERSION_CURRENT)).trim();
//don't ignore JVM version mismatch
return 1;
}
// Check to see if we need to determine what level of check
// for determining if our Version Number has changed.
{
if (getSimpleVersionNumber(configVersion).equalsIgnoreCase(getSimpleVersionNumber(amExpectedVersion)))
{
return 0;
}
}
// checking case like this, server version is
// OpenSSO Express Build 6a(2008-December-9 02:22) but
// ssoadm version is (2008-December-10 01:19)
if (writeToDebugLog) {
} else {
}
return getValidationResult();
}
if (writeToDebugLog) {
} else {
}
return getValidationResult();
}
return 0;
}
private static int getValidationResult() {
if (ignoreVersion) {
+ "The versions of the OpenAM and admin tool did not"
+ " match, however the version check was ignored");
return 0;
} else {
return 1;
}
}
/**
* Check whether the version String is compatible with expected.
*
* @param currentVersion The string of current version.
* @param expectedVersion The string of expected version.
* @return A boolean value to indicate whether the version is compatible.
*/
- 1))) {
return false;
}
} else {
boolean backwardCom = false;
currentVersion.length());
backwardCom = true;
}
for (int i = 0; i < compareLength; i++) {
if (backwardCom) {
return false;
}
} else {
break;
}
return false;
}
}
}
}
return true;
}
{ return ""; }
return versionContents[0];
}
}