BuildInformation.java revision 2f6d798e90520dd1b83ac30e53838ae6fd41a150
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at legal-notices/CDDLv1_0.txt.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information:
* Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*
*
* Copyright 2006-2010 Sun Microsystems, Inc.
* Portions Copyright 2011-2015 ForgeRock AS
*/
/**
* Represents information about the current build that is
* publicly obtainable by invoking start-ds -F.
*/
/**
* Reads build information for a particular installation by reading the
* output from invoking the start-ds tool with the full information option.
* @param installation from which to gather build information
* @return BuildInformation object populated with information
* @throws ApplicationException if all or some important information could
* not be determined
*/
throws ApplicationException {
final boolean[] done = {false};
try {
// This is required in order the return code to be valid.
if (isWindows())
{
// In windows if there is an error we wait the user to click on
// return to continue.
{
public void run()
{
while (!done[0])
{
try
{
if (!done[0])
{
}
}
catch (Throwable t)
{
}
}
}
});
t.start();
}
{
}
if (-1 != colonIndex) {
}
}
if (resultCode != 0)
{
{
throw new ApplicationException(
}
else
{
try
{
NAME,
}
catch (Throwable t)
{
// We did not get the required information.
throw new ApplicationException(
null);
}
}
}
} catch (IOException | InterruptedException e) {
throw new ApplicationException(
} finally {
done[0] = true;
}
// Make sure we got values for important properties that are used
// in compareTo, equals, and hashCode
NAME,
return bi;
}
/**
* Creates an instance from a string representing a build number
* of the for MAJOR.MINOR.POINT.REVISION where MAJOR, MINOR, POINT,
* and REVISION are integers.
* @param bn String representation of a build number
* @return a BuildInformation object populated with the information
* provided in <code>bn</code>
* @throws IllegalArgumentException if <code>bn</code> is not a build
* number
*/
{
// -------------------------------------------------------
// NOTE: if you change this be sure to change getBuildString()
// -------------------------------------------------------
// Allow negative revision number for cases where there is no
// VCS available.
if (!m.matches()) {
}
try {
} catch (Exception e) {
}
return bi;
}
/**
* Creates an instance from constants present in the current build.
* @return BuildInformation created from current constant values
* @throws ApplicationException if all or some important information could
* not be determined
*/
// Make sure we got values for important properties that are used
// in compareTo, equals, and hashCode
NAME,
return bi;
}
/**
* Gets the name of this build. This is the first line of the output
* from invoking start-ds -F.
* @return String representing the name of the build
*/
}
/**
* Gets the build ID which is the 14 digit number code like 20070420110336.
*
* @return String representing the build ID
*/
public String getBuildId() {
}
/**
* Gets the major version.
*
* @return String representing the major version
*/
public Integer getMajorVersion() {
}
/**
* Gets the minor version.
*
* @return String representing the minor version
*/
public Integer getMinorVersion() {
}
/**
* Gets the point version.
*
* @return String representing the point version
*/
public Integer getPointVersion() {
}
/**
* Gets the SVN revision number.
*
* @return Integer representing the SVN revision number
*/
public Integer getRevisionNumber() {
}
/** {@inheritDoc} */
.append(": ")
.append(")");
}
}
/** {@inheritDoc} */
return 0;
return -1;
}
return -1;
}
return -1;
}
return -1;
}
return 1;
}
/** {@inheritDoc} */
if (this == o) {
return true;
}
return o != null
}
/** {@inheritDoc} */
public int hashCode() {
int hc = 11;
return hc;
}
throws ApplicationException {
throw new ApplicationException(
}
}
}
}