cryptix

Class CryptixProperties

public class CryptixProperties extends Object

This class defines the version number of the Cryptix library, and also provides facilities needed to load and manage properties.

Version numbers should be written as a triple of integers, not as a decimal. If the last number is omitted it is assumed to be 0, so for example, version 1.10 is after version 1.2.

The property values are read from files called Cryptix.properties and Local.properties, which are stored in the Cryptix library directory. The Local.properties file (if it exists) adds to and overrides entries in Cryptix.properties, and is intended to be used for local customisations by a user or adminstrator.

The library directory is found by searching the current classpath. For each classpath entry, a "cryptix-lib" subdirectory is looked for. If the entry is a .zip or .jar file, "cryptix-lib" will be looked for in the same directory as that file.

Property values loaded from Cryptix.properties or Local.properties are always read-only. They can be accessed by untrusted code, so should not be secret.

Copyright © 1997 Systemics Ltd on behalf of the Cryptix Development Team.
All rights reserved.

$Revision: 1.13 $

Since: Cryptix 2.2.2

Author: David Hopwood Jill Baker Raif S. Naffah

Field Summary
static StringHTML_INFO
An HTML description of the provider.
static StringLIB_DIRNAME
The name of the directory in which the properties files and (if applicable) native libraries are found.
static booleanNATIVE_ALLOWED
If this constant is false, native linking is disabled regardless of any settings in the properties files.
static StringPRODUCT_NAME
The common name for this class library.
static String[]PROPERTIES_FILES
The names of the properties files.
Method Summary
static StringgetHtmlInfo()
Returns English-language HTML credits for Cryptix, in a form that could be included in an application's About box, for example.
static intgetIntermediateVersion()
Returns the intermediate version of this release of Cryptix.
static StringgetLibraryPath()
Returns the path of the library directory.
static intgetMajorVersion()
Returns the major version of this release of Cryptix.
static intgetMinorVersion()
Returns the minor version of this release of Cryptix.
static StringgetProperty(String key)
Gets the value of a property.
static StringgetProperty(String key, String defaultValue)
Gets the value of a property, or returns defaultValue if the property was not set.
static StringgetReleaseDate()
Returns the release date of this version of Cryptix, as a string in the form "yyyy/mm/dd".
static StringgetVersionString()
Returns a string describing this version of Cryptix.
static booleanisVersionAtLeast(int major, int minor, int intermediate)
Returns true iff this version of Cryptix is at least the given version.
static voidlist(PrintStream out)
Lists the properties to the PrintStream out.
static voidlist(PrintWriter out)
Lists the properties to the PrintWriter out.
static voidmain(String[] args)
Prints the Cryptix version string, whether Cryptix is installed correctly, and the location of the library directory.
static EnumerationpropertyNames()
Returns an enumeration of all the property names.
static voidsave(OutputStream os, String comment)
Saves the properties to the OutputStream os, in the format used by java.util.Properties.save.

Field Detail

HTML_INFO

static final String HTML_INFO
An HTML description of the provider.

LIB_DIRNAME

static final String LIB_DIRNAME
The name of the directory in which the properties files and (if applicable) native libraries are found.

NATIVE_ALLOWED

public static final boolean NATIVE_ALLOWED
If this constant is false, native linking is disabled regardless of any settings in the properties files.

PRODUCT_NAME

static final String PRODUCT_NAME
The common name for this class library. This is used for error messages, because most of the code for this class is duplicated between Cryptix and IJCE.

PROPERTIES_FILES

static final String[] PROPERTIES_FILES
The names of the properties files.

Method Detail

getHtmlInfo

public static String getHtmlInfo()
Returns English-language HTML credits for Cryptix, in a form that could be included in an application's About box, for example.

The returned string does not have <HTML> or <BODY> tags, so that it can easily be included in a larger page.

getIntermediateVersion

public static int getIntermediateVersion()
Returns the intermediate version of this release of Cryptix.

getLibraryPath

public static String getLibraryPath()
Returns the path of the library directory. The name of this directory is given by the LIB_DIRNAME constant.

The returned path is always absolute, and ends with a file separator character (e.g. "/" on Unix).

Throws: IOException if an error occurred during intialization, preventing the path from being determined.

getMajorVersion

public static int getMajorVersion()
Returns the major version of this release of Cryptix.

getMinorVersion

public static int getMinorVersion()
Returns the minor version of this release of Cryptix.

getProperty

public static String getProperty(String key)
Gets the value of a property.

getProperty

public static String getProperty(String key, String defaultValue)
Gets the value of a property, or returns defaultValue if the property was not set.

getReleaseDate

public static String getReleaseDate()
Returns the release date of this version of Cryptix, as a string in the form "yyyy/mm/dd".

getVersionString

public static String getVersionString()
Returns a string describing this version of Cryptix.

isVersionAtLeast

public static boolean isVersionAtLeast(int major, int minor, int intermediate)
Returns true iff this version of Cryptix is at least the given version.

list

public static void list(PrintStream out)
Lists the properties to the PrintStream out.

list

public static void list(PrintWriter out)
Lists the properties to the PrintWriter out.

main

public static void main(String[] args)
Prints the Cryptix version string, whether Cryptix is installed correctly, and the location of the library directory.

propertyNames

public static Enumeration propertyNames()
Returns an enumeration of all the property names.

save

public static void save(OutputStream os, String comment)
Saves the properties to the OutputStream os, in the format used by java.util.Properties.save. The string comment is written as a comment in the first line of the output.