Project Wonder 5.0

er.extensions.foundation
Class ERXProperties

java.lang.Object
  extended by java.util.Dictionary<K,V>
      extended by java.util.Hashtable<java.lang.Object,java.lang.Object>
          extended by java.util.Properties
              extended by er.extensions.foundation.ERXProperties
All Implemented Interfaces:
com.webobjects.foundation.NSKeyValueCoding, java.io.Serializable, java.lang.Cloneable, java.util.Map<java.lang.Object,java.lang.Object>

public class ERXProperties
extends java.util.Properties
implements com.webobjects.foundation.NSKeyValueCoding

Collection of simple utility methods used to get and set properties in the system properties. The only reason this class is needed is because all of the methods in NSProperties have been deprecated. This is a wee bit annoying. The usual method is to have a method like getBoolean off of Boolean which would resolve the System property as a Boolean object. Properties can be set in all the following places:

TODO - If this would fallback to calling the System getProperty, we could ask that Project Wonder frameworks only use this class.

See Also:
Serialized Form
Properties
er.extensions.ERXProperties.RetainDefaultsEnableder.extensions.ERXProperties.RetainDefaultsEnabled
           

Nested Class Summary
static class ERXProperties._Properties
          _Properties is a subclass of Properties that provides support for including other Properties files on the fly.
static class ERXProperties.EncryptedOperator
           Encrypted operator supports decrypting values using the default crypter.
static class ERXProperties.InRangeOperator
           InRangeOperator provides support for defining properties that only get set if a value falls within a specific range of values.
static interface ERXProperties.Operator
           Property operators work like array operators.
static class ERXProperties.Property
           
 
Nested classes/interfaces inherited from interface com.webobjects.foundation.NSKeyValueCoding
com.webobjects.foundation.NSKeyValueCoding._BooleanFieldBinding, com.webobjects.foundation.NSKeyValueCoding._BooleanMethodBinding, com.webobjects.foundation.NSKeyValueCoding._FieldBinding, com.webobjects.foundation.NSKeyValueCoding._ForwardingBinding, com.webobjects.foundation.NSKeyValueCoding._KeyBinding, com.webobjects.foundation.NSKeyValueCoding._KeyBindingCreation, com.webobjects.foundation.NSKeyValueCoding._MethodBinding, com.webobjects.foundation.NSKeyValueCoding._NumberFieldBinding, com.webobjects.foundation.NSKeyValueCoding._NumberMethodBinding, com.webobjects.foundation.NSKeyValueCoding._ReflectionKeyBindingCreation, com.webobjects.foundation.NSKeyValueCoding.DefaultImplementation, com.webobjects.foundation.NSKeyValueCoding.ErrorHandling, com.webobjects.foundation.NSKeyValueCoding.Null, com.webobjects.foundation.NSKeyValueCoding.UnknownKeyException, com.webobjects.foundation.NSKeyValueCoding.Utility, com.webobjects.foundation.NSKeyValueCoding.ValueAccessor
 
Field Summary
protected  java.lang.String applicationNameForAppending
          caches the application name that is appended to the key for lookup
static java.lang.String DefaultString
          default string
static org.apache.log4j.Logger log
          logging support
 
Fields inherited from class java.util.Properties
defaults
 
Fields inherited from interface com.webobjects.foundation.NSKeyValueCoding
_CLASS, NullValue
 
Constructor Summary
ERXProperties()
           
 
Method Summary
static com.webobjects.foundation.NSArray<ERXProperties.Property> allProperties()
           
static java.util.Map<java.lang.String,java.lang.String> allPropertiesMap(boolean protectValues)
          Returns all of the properties in the system mapped to their evaluated values, sorted by key.
static java.lang.String applicationDeveloperProperties()
          Returns the application-specific user properties.
static java.lang.String applicationMachinePropertiesPath(java.lang.String fileName)
          Returns the path to the application-specific system-wide file "fileName".
protected  java.lang.String applicationNameForAppending()
          Caches the application name for appending to the key.
static java.lang.String applicationUserProperties()
          Returns the application-specific user properties.
static java.util.Properties applyConfiguration(java.util.Properties source, java.util.Properties commandLine)
          Apply the current configuration to the supplied properties.
static com.webobjects.foundation.NSArray arrayForKey(java.lang.String s)
          Cover method for returning an NSArray for a given system property.
static com.webobjects.foundation.NSArray arrayForKeyWithDefault(java.lang.String s, com.webobjects.foundation.NSArray defaultValue)
          Cover method for returning an NSArray for a given system property and set a default value if not given.
static java.math.BigDecimal bigDecimalForKey(java.lang.String s)
          Cover method for returning a BigDecimal for a given system property.
static java.math.BigDecimal bigDecimalForKeyWithDefault(java.lang.String s, java.math.BigDecimal defaultValue)
          Cover method for returning a BigDecimal for a given system property or a default value.
static boolean booleanForKey(java.lang.String s)
          Cover method for returning a boolean for a given system property.
static boolean booleanForKeyWithDefault(java.lang.String s, boolean defaultValue)
          Cover method for returning a boolean for a given system property or a default value.
static com.webobjects.foundation.NSArray<java.lang.String> componentsSeparatedByString(java.lang.String key, java.lang.String separator)
          Returns an array of strings separated with the given separator string.
static com.webobjects.foundation.NSArray<java.lang.String> componentsSeparatedByStringWithDefault(java.lang.String key, java.lang.String separator, com.webobjects.foundation.NSArray<java.lang.String> defaultValue)
          Returns an array of strings separated with the given separator string.
static java.lang.String decryptedStringForKey(java.lang.String propertyName)
          Returns the decrypted value for the given property name using the default crypter if the property propertyName.encrypted=true.
static java.lang.String decryptedStringForKeyWithDefault(java.lang.String propertyName, java.lang.String defaultValue)
          If the propertyName.encrypted property is set to true, returns the plain text value of the given property name, after decrypting it with the ERXCrypto.defaultCrypter.
static java.lang.String decryptedStringForKeyWithEncryptedDefault(java.lang.String propertyName, java.lang.String defaultValue)
          Returns the decrypted value for the given property name using the ERXCrypto.defaultCrypter.
static com.webobjects.foundation.NSDictionary dictionaryForKey(java.lang.String s)
          Cover method for returning an NSDictionary for a given system property.
static com.webobjects.foundation.NSDictionary dictionaryForKeyWithDefault(java.lang.String s, com.webobjects.foundation.NSDictionary defaultValue)
          Cover method for returning an NSDictionary for a given system property or the default value.
static double doubleForKey(java.lang.String s)
          Cover method for returning a double for a given system property.
static double doubleForKeyWithDefault(java.lang.String s, double defaultValue)
          Cover method for returning a double for a given system property with a default value.
static void evaluatePropertyOperators(java.util.Properties originalProperties, java.util.Properties destinationProperties)
          For each property in originalProperties, process the keys and avlues with the registered property operators and stores the converted value into destinationProperties.
static float floatForKey(java.lang.String s)
          Cover method for returning a float for a given system property.
static float floatForKeyWithDefault(java.lang.String s, float defaultValue)
          Cover method for returning a float for a given system property with a default value.
static ERXProperties fromExternalForm(java.lang.String string)
          Load the properties from a String in Property file format.
static java.lang.String getActualPath(java.lang.String path)
          Returns actual full path to the given file system path that could contain symbolic links.
 java.lang.String getProperty(java.lang.String key)
          Overriding the default getProperty method to first check: key.<ApplicationName> before checking for key.
static int intForKey(java.lang.String s)
          Cover method for returning an int for a given system property.
static int intForKeyWithDefault(java.lang.String s, int defaultValue)
          Cover method for returning an int for a given system property with a default value.
static java.lang.String logString(java.util.Properties properties)
          Returns a string suitable for logging.
static long longForKey(java.lang.String s)
          Cover method for returning a long for a given system property.
static long longForKeyWithDefault(java.lang.String s, long defaultValue)
          Cover method for returning a long for a given system property with a default value.
static com.webobjects.foundation.NSArray optionalConfigurationFiles()
          Gets an array of optionally defined configuration files.
static java.lang.String pathForPropertiesUnderProjectPath(java.lang.String projectPath)
          Returns the full path to the Properties file under the given project path.
static com.webobjects.foundation.NSArray pathsForUserAndBundleProperties()
          Returns an array of paths to the Properties and WebObjects.properties files contained in the application/framework bundles and home directory.
static com.webobjects.foundation.NSArray pathsForUserAndBundleProperties(boolean reportLoggingEnabled)
           
static void populateSystemProperties()
          Puts handy properties such as com.webobjects.version into the system properties.
static java.util.Properties propertiesFromArgv(java.lang.String[] argv)
          Sets and returns properties object with the values from the given command line arguments string array.
static java.util.Properties propertiesFromFile(java.io.File file)
          Gets the properties for a given file.
static java.util.Properties propertiesFromPath(java.lang.String path)
          Reads a Java properties file at the given path and returns a Properties object as the result.
static java.util.Map<java.lang.String,java.lang.String> propertiesMap(java.util.Properties properties, boolean protectValues)
          Returns all of the properties in the system mapped to their evaluated values, sorted by key.
static void removeKey(java.lang.String key)
           
static void setArrayForKey(com.webobjects.foundation.NSArray array, java.lang.String key)
          Sets an array in the System properties for a particular key.
static void setCommandLineArguments(java.lang.String[] argv)
           
static void setDictionaryForKey(com.webobjects.foundation.NSDictionary dictionary, java.lang.String key)
          Sets a dictionary in the System properties for a particular key.
static void setOperatorForKey(ERXProperties.Operator operator, java.lang.String key)
          Registers a property operator for a particular key.
static void setStringForKey(java.lang.String string, java.lang.String key)
          Sets a string in the System properties for another string.
static java.lang.String sourceVersionString()
          Returns the version string of the given framework.
static java.lang.String stringForKey(java.lang.String s)
          Returning an string for a given system property.
static java.lang.String stringForKeyWithDefault(java.lang.String s, java.lang.String defaultValue)
          Returning an string for a given system property.
static void systemPropertiesChanged()
           
 void takeValueForKey(java.lang.Object anObject, java.lang.String aKey)
          KVC implementation.
 java.lang.Object toExternalForm()
          Returns the properties as a String in Property file format.
static void transferPropertiesFromSourceToDest(java.util.Properties source, java.util.Properties dest)
          Copies all properties from source to dest.
 java.lang.Object valueForKey(java.lang.String aKey)
          KVC implementation.
static java.lang.String variantPropertiesInBundle(java.lang.String userName, java.lang.String bundleName)
          Returns the application-specific variant properties for the given bundle.
static java.lang.String versionStringForApplication()
          Returns the version string of the application.
static java.lang.String versionStringForFrameworkNamed(java.lang.String frameworkName)
          Returns the version string of the given framework.
static java.lang.String webObjectsVersion()
          Returns WebObjects version as string.
static double webObjectsVersionAsDouble()
          Returns WebObjects version as double.
static boolean webObjectsVersionIs522OrHigher()
          Quick convience method used to determine if the current webobjects version is 5.22 or higher.
static boolean webObjectsVersionIs52OrHigher()
          Quick convience method used to determine if the current webobjects version is 5.2 or higher.
 
Methods inherited from class java.util.Properties
getProperty, list, list, load, load, loadFromXML, propertyNames, save, setProperty, store, store, storeToXML, storeToXML, stringPropertyNames
 
Methods inherited from class java.util.Hashtable
clear, clone, contains, containsKey, containsValue, elements, entrySet, equals, get, hashCode, isEmpty, keys, keySet, put, putAll, rehash, remove, size, toString, values
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

DefaultString

public static final java.lang.String DefaultString
default string

See Also:
Constant Field Values

log

public static final org.apache.log4j.Logger log
logging support


applicationNameForAppending

protected java.lang.String applicationNameForAppending
caches the application name that is appended to the key for lookup

Constructor Detail

ERXProperties

public ERXProperties()
Method Detail

populateSystemProperties

public static void populateSystemProperties()
Puts handy properties such as com.webobjects.version into the system properties. This method is called when the framework is initialized (when WOApplication.ApplicationWillFinishLaunchingNotification is posted.)


versionStringForApplication

public static java.lang.String versionStringForApplication()
Returns the version string of the application. It checks CFBundleShortVersionString property in the info.plist resource and returns a trimmed version of the value.

Returns:
version number as string; can be a null-string when the applicaiton doesn't have the value of CFBundleShortVersionString in its info.plist resource.
See Also:
versionStringForFrameworkNamed(java.lang.String), webObjectsVersion()

versionStringForFrameworkNamed

public static java.lang.String versionStringForFrameworkNamed(java.lang.String frameworkName)
Returns the version string of the given framework. It checks CFBundleShortVersionString property in the info.plist resource and returns a trimmed version of the value.

Parameters:
frameworkName - name
Returns:
version number as string; can be null-string when the framework is not found or the framework doesn't have the value of CFBundleShortVersionString in its info.plist resource.
See Also:
versionStringForApplication(), webObjectsVersion(), ERXStringUtilities#removeExtraDotsFromVersionString

sourceVersionString

public static java.lang.String sourceVersionString()
Returns the version string of the given framework. It checks SourceVersion property in the version.plist resource and returns a trimmed version of the value.

Returns:
version number as string; can be null-string when the framework is not found or the framework doesn't have the value of SourceVersion in its info.plist resource.
See Also:
versionStringForApplication(), webObjectsVersion()

webObjectsVersion

public static java.lang.String webObjectsVersion()
Returns WebObjects version as string. If it's one of those version 5.1s (5.1, 5.1.1, 5.1.2...), this method will only return 5.1. If it's 5.2s, this mothod will return more precise version numbers such as 5.2.1. Note that version 5.0 series is not supported and may return incorrect version numbers (it will return 5.1).

Returns:
WebObjects version number as string
See Also:
webObjectsVersionAsDouble(), ERXStringUtilities#removeExtraDotsFromVersionString

webObjectsVersionAsDouble

public static double webObjectsVersionAsDouble()
Returns WebObjects version as double. If it's one of those version 5.1s (5.1, 5.1.1, 5.1.2...), this method will only return 5.1. If it's 5.2s, this mothod will return more precise version numbers such as 5.2.1. Note that version 5.0 series is not supported and may return incorrect version numbers (it will return 5.1).

Returns:
WebObjects version number as double
See Also:
webObjectsVersion()

webObjectsVersionIs52OrHigher

public static boolean webObjectsVersionIs52OrHigher()
Quick convience method used to determine if the current webobjects version is 5.2 or higher.

Returns:
if the version of webobjects is 5.2 or better

webObjectsVersionIs522OrHigher

public static boolean webObjectsVersionIs522OrHigher()
Quick convience method used to determine if the current webobjects version is 5.22 or higher.

Returns:
if the version of webobjects is 5.22 or better

arrayForKey

public static com.webobjects.foundation.NSArray arrayForKey(java.lang.String s)
Cover method for returning an NSArray for a given system property.

Parameters:
s - system property
Returns:
array de-serialized from the string in the system properties

arrayForKeyWithDefault

public static com.webobjects.foundation.NSArray arrayForKeyWithDefault(java.lang.String s,
                                                                       com.webobjects.foundation.NSArray defaultValue)
Cover method for returning an NSArray for a given system property and set a default value if not given.

Parameters:
s - system property
defaultValue - default value
Returns:
array de-serialized from the string in the system properties or default value

booleanForKey

public static boolean booleanForKey(java.lang.String s)
Cover method for returning a boolean for a given system property. This method uses the method booleanValue from ERXUtilities.

Parameters:
s - system property
Returns:
boolean value of the string in the system properties.

booleanForKeyWithDefault

public static boolean booleanForKeyWithDefault(java.lang.String s,
                                               boolean defaultValue)
Cover method for returning a boolean for a given system property or a default value. This method uses the method booleanValue from ERXUtilities.

Parameters:
s - system property
defaultValue - default value
Returns:
boolean value of the string in the system properties.

dictionaryForKey

public static com.webobjects.foundation.NSDictionary dictionaryForKey(java.lang.String s)
Cover method for returning an NSDictionary for a given system property.

Parameters:
s - system property
Returns:
dictionary de-serialized from the string in the system properties

dictionaryForKeyWithDefault

public static com.webobjects.foundation.NSDictionary dictionaryForKeyWithDefault(java.lang.String s,
                                                                                 com.webobjects.foundation.NSDictionary defaultValue)
Cover method for returning an NSDictionary for a given system property or the default value.

Parameters:
s - system property
defaultValue - default value
Returns:
dictionary de-serialized from the string in the system properties

intForKey

public static int intForKey(java.lang.String s)
Cover method for returning an int for a given system property.

Parameters:
s - system property
Returns:
int value of the system property or 0

longForKey

public static long longForKey(java.lang.String s)
Cover method for returning a long for a given system property.

Parameters:
s - system property
Returns:
long value of the system property or 0

floatForKey

public static float floatForKey(java.lang.String s)
Cover method for returning a float for a given system property.

Parameters:
s - system property
Returns:
float value of the system property or 0

doubleForKey

public static double doubleForKey(java.lang.String s)
Cover method for returning a double for a given system property.

Parameters:
s - system property
Returns:
double value of the system property or 0

bigDecimalForKey

public static java.math.BigDecimal bigDecimalForKey(java.lang.String s)
Cover method for returning a BigDecimal for a given system property. This method uses the method bigDecimalValueWithDefault from ERXValueUtilities.

Parameters:
s - system property
Returns:
bigDecimal value of the string in the system properties. Scale is controlled by the string, ie "4.400" will have a scale of 3.

bigDecimalForKeyWithDefault

public static java.math.BigDecimal bigDecimalForKeyWithDefault(java.lang.String s,
                                                               java.math.BigDecimal defaultValue)
Cover method for returning a BigDecimal for a given system property or a default value. This method uses the method bigDecimalValueWithDefault from ERXValueUtilities.

Parameters:
s - system property
defaultValue - default value
Returns:
BigDecimal value of the string in the system properties. Scale is controlled by the string, ie "4.400" will have a scale of 3.

intForKeyWithDefault

public static int intForKeyWithDefault(java.lang.String s,
                                       int defaultValue)
Cover method for returning an int for a given system property with a default value.

Parameters:
s - system property
defaultValue - default value
Returns:
int value of the system property or the default value

longForKeyWithDefault

public static long longForKeyWithDefault(java.lang.String s,
                                         long defaultValue)
Cover method for returning a long for a given system property with a default value.

Parameters:
s - system property
defaultValue - default value
Returns:
long value of the system property or the default value

floatForKeyWithDefault

public static float floatForKeyWithDefault(java.lang.String s,
                                           float defaultValue)
Cover method for returning a float for a given system property with a default value.

Parameters:
s - system property
defaultValue - default value
Returns:
float value of the system property or the default value

doubleForKeyWithDefault

public static double doubleForKeyWithDefault(java.lang.String s,
                                             double defaultValue)
Cover method for returning a double for a given system property with a default value.

Parameters:
s - system property
defaultValue - default value
Returns:
double value of the system property or the default value

stringForKey

public static java.lang.String stringForKey(java.lang.String s)
Returning an string for a given system property. This is a cover method of System.getProperty(java.lang.String)

Parameters:
s - system property
Returns:
string value of the system propery or null

stringForKeyWithDefault

public static java.lang.String stringForKeyWithDefault(java.lang.String s,
                                                       java.lang.String defaultValue)
Returning an string for a given system property. This is a cover method of System.getProperty(java.lang.String)

Parameters:
s - system property
Returns:
string value of the system propery or null

decryptedStringForKey

public static java.lang.String decryptedStringForKey(java.lang.String propertyName)
Returns the decrypted value for the given property name using the default crypter if the property propertyName.encrypted=true. For instance, if you are requesting my.password, if my.password.encrypted=true the value of my.password will be passed to the default crypter's decrypt method.

Parameters:
propertyName - the property name to retrieve and optionally decrypt
Returns:
the decrypted property value

decryptedStringForKeyWithDefault

public static java.lang.String decryptedStringForKeyWithDefault(java.lang.String propertyName,
                                                                java.lang.String defaultValue)
If the propertyName.encrypted property is set to true, returns the plain text value of the given property name, after decrypting it with the ERXCrypto.defaultCrypter. For instance, if you are requesting my.password and my.password.encrypted is set to true, the value of my.password will be sent to the default crypter's decrypt() method.

Parameters:
propertyName - the property name to retrieve and optionally decrypt
defaultValue - the default value to return if there is no password
Returns:
the decrypted property value

decryptedStringForKeyWithEncryptedDefault

public static java.lang.String decryptedStringForKeyWithEncryptedDefault(java.lang.String propertyName,
                                                                         java.lang.String defaultValue)
Returns the decrypted value for the given property name using the ERXCrypto.defaultCrypter. This is slightly different than decryptedStringWithKeyWithDefault in that it does not require the encrypted property to be set.

Parameters:
propertyName - the name of the property to decrypt
defaultValue - the default encrypted value
Returns:
the decrypted value

componentsSeparatedByString

public static com.webobjects.foundation.NSArray<java.lang.String> componentsSeparatedByString(java.lang.String key,
                                                                                              java.lang.String separator)
Returns an array of strings separated with the given separator string.

Parameters:
key - the key to lookup
separator - the separator (",")
Returns:
the array of strings or NSArray.EmptyArray if not found

componentsSeparatedByStringWithDefault

public static com.webobjects.foundation.NSArray<java.lang.String> componentsSeparatedByStringWithDefault(java.lang.String key,
                                                                                                         java.lang.String separator,
                                                                                                         com.webobjects.foundation.NSArray<java.lang.String> defaultValue)
Returns an array of strings separated with the given separator string.

Parameters:
key - the key to lookup
separator - the separator (",")
defaultValue - the default array to return if there is no value
Returns:
the array of strings

setArrayForKey

public static void setArrayForKey(com.webobjects.foundation.NSArray array,
                                  java.lang.String key)
Sets an array in the System properties for a particular key.

Parameters:
array - to be set in the System properties
key - to be used to get the value

setDictionaryForKey

public static void setDictionaryForKey(com.webobjects.foundation.NSDictionary dictionary,
                                       java.lang.String key)
Sets a dictionary in the System properties for a particular key.

Parameters:
dictionary - to be set in the System properties
key - to be used to get the value

setStringForKey

public static void setStringForKey(java.lang.String string,
                                   java.lang.String key)
Sets a string in the System properties for another string.

Parameters:
string - to be set in the System properties
key - to be used to get the value

removeKey

public static void removeKey(java.lang.String key)

transferPropertiesFromSourceToDest

public static void transferPropertiesFromSourceToDest(java.util.Properties source,
                                                      java.util.Properties dest)
Copies all properties from source to dest.

Parameters:
source - properties copied from
dest - properties copied to

propertiesFromPath

public static java.util.Properties propertiesFromPath(java.lang.String path)
Reads a Java properties file at the given path and returns a Properties object as the result. If the file does not exist, returns an empty properties object.

Parameters:
path - file path to the properties file
Returns:
properties object with the values from the file specified.

propertiesFromFile

public static java.util.Properties propertiesFromFile(java.io.File file)
                                               throws java.io.IOException
Gets the properties for a given file.

Parameters:
file - the properties file
Returns:
properties from the given file
Throws:
java.io.IOException - if the file is not found or cannot be read

propertiesFromArgv

public static java.util.Properties propertiesFromArgv(java.lang.String[] argv)
Sets and returns properties object with the values from the given command line arguments string array.

Parameters:
argv - string array typically provided by the command line arguments
Returns:
properties object with the values from the argv

pathsForUserAndBundleProperties

public static com.webobjects.foundation.NSArray pathsForUserAndBundleProperties()
Returns an array of paths to the Properties and WebObjects.properties files contained in the application/framework bundles and home directory.

If ProjectBuilder (for Mac OS X) has the project opened, it will attempt to get the path to the one in the project directory instead of the one in the bundle.

This opened project detection feature is pretty fragile and will change between versions of the dev-tools.

Returns:
paths to Properties files

pathsForUserAndBundleProperties

public static com.webobjects.foundation.NSArray pathsForUserAndBundleProperties(boolean reportLoggingEnabled)

applyConfiguration

public static java.util.Properties applyConfiguration(java.util.Properties source,
                                                      java.util.Properties commandLine)
Apply the current configuration to the supplied properties.

Parameters:
source -
commandLine -

allPropertiesMap

public static java.util.Map<java.lang.String,java.lang.String> allPropertiesMap(boolean protectValues)
Returns all of the properties in the system mapped to their evaluated values, sorted by key.

Parameters:
protectValues - if true, keys with the word "password" in them will have their values removed
Returns:
all of the properties in the system mapped to their evaluated values, sorted by key

propertiesMap

public static java.util.Map<java.lang.String,java.lang.String> propertiesMap(java.util.Properties properties,
                                                                             boolean protectValues)
Returns all of the properties in the system mapped to their evaluated values, sorted by key.

Parameters:
protectValues - if true, keys with the word "password" in them will have their values removed
Returns:
all of the properties in the system mapped to their evaluated values, sorted by key

logString

public static java.lang.String logString(java.util.Properties properties)
Returns a string suitable for logging.

Parameters:
properties -

allProperties

public static com.webobjects.foundation.NSArray<ERXProperties.Property> allProperties()

pathForPropertiesUnderProjectPath

public static java.lang.String pathForPropertiesUnderProjectPath(java.lang.String projectPath)
Returns the full path to the Properties file under the given project path. At the current implementation, it looks for /Properties and /Resources/Properties. If the Properties file doesn't exist, returns null.

Parameters:
projectPath - string to the project root directory
Returns:
the path to the Properties file if it exists

applicationDeveloperProperties

public static java.lang.String applicationDeveloperProperties()
Returns the application-specific user properties.


variantPropertiesInBundle

public static java.lang.String variantPropertiesInBundle(java.lang.String userName,
                                                         java.lang.String bundleName)
Returns the application-specific variant properties for the given bundle.


applicationUserProperties

public static java.lang.String applicationUserProperties()
Returns the application-specific user properties.


applicationMachinePropertiesPath

public static java.lang.String applicationMachinePropertiesPath(java.lang.String fileName)
Returns the path to the application-specific system-wide file "fileName". By default this path is /etc/WebObjects, and the application name will be appended. For instance, if you are asking for the MyApp Properties file for the system, it would go in /etc/WebObjects/MyApp/Properties.

Returns:
the path, or null if the path does not exist

optionalConfigurationFiles

public static com.webobjects.foundation.NSArray optionalConfigurationFiles()
Gets an array of optionally defined configuration files. For each file, if it does not exist as an absolute path, ERXProperties will attempt to resolve it as an application resource and use that instead.

Returns:
array of configuration file names

getActualPath

public static java.lang.String getActualPath(java.lang.String path)
Returns actual full path to the given file system path that could contain symbolic links. For example: /Resources will be converted to /Versions/A/Resources when /Resources is a symbolic link.

Parameters:
path - path string to a resource that could contain symbolic links
Returns:
actual path to the resource

systemPropertiesChanged

public static void systemPropertiesChanged()

applicationNameForAppending

protected java.lang.String applicationNameForAppending()
Caches the application name for appending to the key. Note that for a period when the application is starting up application() will be null and name() will be null.

Returns:
application name used for appending, for example ".ERMailer" Note: this is redundant with the scheme checked in on March 21, 2005 by clloyd (ben holt did checkin). This scheme requires the user to swizzle the existing properties file with a new one of this type.

getProperty

public java.lang.String getProperty(java.lang.String key)
Overriding the default getProperty method to first check: key.<ApplicationName> before checking for key. If nothing is found then key.Default is checked.

Overrides:
getProperty in class java.util.Properties
Parameters:
key - to check
Returns:
property value

toExternalForm

public java.lang.Object toExternalForm()
                                throws java.io.IOException
Returns the properties as a String in Property file format. Useful when you use them as custom value types, you would set this as the conversion method name.

Throws:
java.io.IOException

fromExternalForm

public static ERXProperties fromExternalForm(java.lang.String string)
Load the properties from a String in Property file format. Useful when you use them as custom value types, you would set this as the factory method name.

Parameters:
string -

takeValueForKey

public void takeValueForKey(java.lang.Object anObject,
                            java.lang.String aKey)
KVC implementation.

Specified by:
takeValueForKey in interface com.webobjects.foundation.NSKeyValueCoding
Parameters:
anObject -
aKey -

valueForKey

public java.lang.Object valueForKey(java.lang.String aKey)
KVC implementation.

Specified by:
valueForKey in interface com.webobjects.foundation.NSKeyValueCoding
Parameters:
aKey -

setOperatorForKey

public static void setOperatorForKey(ERXProperties.Operator operator,
                                     java.lang.String key)
Registers a property operator for a particular key.

Parameters:
operator - the operator to register
key - the key name of the operator

evaluatePropertyOperators

public static void evaluatePropertyOperators(java.util.Properties originalProperties,
                                             java.util.Properties destinationProperties)
For each property in originalProperties, process the keys and avlues with the registered property operators and stores the converted value into destinationProperties.

Parameters:
originalProperties - the properties to convert
destinationProperties - the properties to copy into

setCommandLineArguments

public static void setCommandLineArguments(java.lang.String[] argv)

Last updated: Tue, Feb 21, 2017 • 05:45 PM CET

Copyright © 2002 – 2007 Project Wonder.