/*
* 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 2008 Sun Microsystems, Inc.
* Portions Copyright 2013-2015 ForgeRock AS.
*/
/**
* Represents a particular version of OpenDJ useful for making comparisons between versions. FIXME TODO Move this file
* in ? package.
*/
private final int major;
private final int minor;
private final int point;
/**
* Creates a new build version using the provided version information.
*
* @param major
* Major release version number.
* @param minor
* Minor release version number.
* @param point
* Point release version number.
* @param rev
* VCS revision.
*/
}
/**
* Returns the build version as specified in the entry "cn=Version,cn=monitor".
*
* @param connection
* The connection to use to read the entry.
* @return The build version as specified in the current installation configuration.
* @throws ConfigException
* Sends an exception if it is impossible to retrieve the version configuration entry.
*/
try {
} catch (LdapException e) {
}
}
/**
* Checks if the binary version is the same than the instance version. If not, a configuration exception is thrown.
*
* @param connection
* The connection to use to read the configuration entry.
* @throws ConfigException
* Sends an exception if the version mismatch.
*/
}
}
/**
*
* @throws ConfigException
* If an error occurred while reading or parsing the version.
*/
final String buildInfo = ConfigurationFramework.getInstance().getInstancePath() + File.separator + "config"
try {
if (s != null) {
return valueOf(s);
} else {
}
} catch (IOException e) {
} catch (final IllegalArgumentException e) {
} finally {
}
}
/**
* Parses the string argument as a build version. The string must be of the form:
*
* <pre>
* major.minor.point.rev
* </pre>
*
* @param s
* The string to be parsed as a build version.
* @return The parsed build version.
* @throws IllegalArgumentException
* If the string does not contain a parsable build version.
*/
throw new IllegalArgumentException("Invalid version string " + s);
}
}
/**
* Returns the major release version number.
*
* @return The major release version number.
*/
public int getMajorVersion() {
return major;
}
/**
* Returns the minor release version number.
*
* @return The minor release version number.
*/
public int getMinorVersion() {
return minor;
}
/**
* Returns the point release version number.
*
* @return The point release version number.
*/
public int getPointVersion() {
return point;
}
/** {@inheritDoc} */
if (this == obj) {
return true;
} else if (obj instanceof BuildVersion) {
return major == other.major && minor == other.minor && point == other.point && rev.equals(other.rev);
} else {
return false;
}
}
/** {@inheritDoc} */
return 0;
return -1;
}
return -1;
}
return -1;
}
return -1;
}
return 1;
}
/**
* Returns the VCS revision.
*
* @return The VCS revision.
*/
return rev;
}
/** {@inheritDoc} */
public int hashCode() {
}
/**
* Returns the string representation of the version. E.g:
*
* <pre>
* version : 2.8.0.1022
* </pre>
*
* @return The string representation of the version.
*/
}
}