|
Project Wonder 2.0 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.util.Dictionary java.util.Hashtable java.util.Properties er.extensions.ERXProperties
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.
Field Summary | |
protected String |
applicationNameForAppending
caches the application name that is appended to the key for lookup |
static String |
DefaultString
default string |
static ERXLogger |
log
logging support |
Fields inherited from class java.util.Properties |
defaults |
Constructor Summary | |
ERXProperties()
|
Method Summary | |
protected String |
applicationNameForAppending()
Caches the application name for appending to the key. |
static NSArray |
arrayForKey(String s)
Cover method for returning an NSArray for a given system property. |
static NSArray |
arrayForKeyWithDefault(String s,
NSArray defaultValue)
Cover method for returning an NSArray for a given system property and set a default value if not given. |
static BigDecimal |
bigDecimalForKey(String s)
Cover method for returning a BigDecimal for a given system property. |
static BigDecimal |
bigDecimalForKeyWithDefault(String s,
BigDecimal defaultValue)
Cover method for returning a BigDecimal for a given system property or a default value. |
static boolean |
booleanForKey(String s)
Cover method for returning a boolean for a given system property. |
static boolean |
booleanForKeyWithDefault(String s,
boolean defaultValue)
Cover method for returning a boolean for a given system property or a default value. |
static NSDictionary |
dictionaryForKey(String s)
Cover method for returning an NSDictionary for a given system property. |
static NSDictionary |
dictionaryForKeyWithDefault(String s,
NSDictionary defaultValue)
Cover method for returning an NSDictionary for a given system property or the default value. |
static String |
getActualPath(String path)
Returns actual full path to the given file system path that could contain symbolic links. |
String |
getProperty(String key)
Overriding the default getProperty method to first check: key. |
static int |
intForKey(String s)
Cover method for returning an int for a given system property. |
static int |
intForKeyWithDefault(String s,
int defaultValue)
Cover method for returning an int for a given system property with a default value. |
static long |
longForKey(String s)
Cover method for returning a long for a given system property. |
static long |
longForKeyWithDefault(String s,
long defaultValue)
Cover method for returning a long for a given system property with a default value. |
static NSArray |
optionalConfigurationFiles()
Gets an array of optionally defined configuration files. |
static String |
pathForPropertiesUnderProjectPath(String projectPath)
Returns the full path to the Properties file under the given project path. |
static NSArray |
pathsForUserAndBundleProperties()
Returns an array of paths to the Properties and
WebObjects.properties files contained in the
application/framework bundles and home directory.
|
static NSArray |
pathsForUserAndBundleProperties(boolean reportLoggingEnabled)
|
static void |
populateSystemProperties()
Puts handy properties such as com.webobjects.version
into the system properties. |
static Properties |
propertiesFromArgv(String[] argv)
Sets and returns properties object with the values from the given command line arguments string array. |
static Properties |
propertiesFromFile(File file)
Gets the properties for a given file. |
static Properties |
propertiesFromPath(String path)
Reads a Java properties file at the given path and returns a Properties object
as the result. |
static void |
setArrayForKey(NSArray array,
String key)
Sets an array in the System properties for a particular key. |
static void |
setDictionaryForKey(NSDictionary dictionary,
String key)
Sets a dictionary in the System properties for a particular key. |
static void |
setStringForKey(String string,
String key)
Sets a string in the System properties for another string. |
static String |
sourceVersionString()
Returns the version string of the given framework. |
static String |
stringForKey(String s)
Returning an string for a given system property. |
static String |
stringForKeyWithDefault(String s,
String defaultValue)
Returning an string for a given system property. |
static void |
transferPropertiesFromSourceToDest(Properties source,
Properties dest)
Copies all properties from source to dest. |
static String |
versionStringForApplication()
Returns the version string of the application. |
static String |
versionStringForFrameworkNamed(String frameworkName)
Returns the version string of the given framework. |
static 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, propertyNames, save, setProperty, store |
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 |
public static final String DefaultString
public static final ERXLogger log
protected String applicationNameForAppending
Constructor Detail |
public ERXProperties()
Method Detail |
public static void populateSystemProperties()
com.webobjects.version
into the system properties. This method is called when
the framework is initialized
(when WOApplication.ApplicationWillFinishLaunchingNotification
is posted.)
public static String versionStringForApplication()
CFBundleShortVersionString
property
in the info.plist
resource and returns
a trimmed version of the value.
CFBundleShortVersionString
in its info.plist
resource.versionStringForFrameworkNamed(java.lang.String)
,
webObjectsVersion()
public static String versionStringForFrameworkNamed(String frameworkName)
CFBundleShortVersionString
property
in the info.plist
resource and returns
a trimmed version of the value.
frameworkName
- name
CFBundleShortVersionString
in its
info.plist
resource.versionStringForApplication()
,
webObjectsVersion()
,
ERXStringUtilities.removeExtraDotsFromVersionString(java.lang.String)
public static String sourceVersionString()
SourceVersion
property
in the info.plist
resource and returns
a trimmed version of the value.
SourceVersion
in its
info.plist
resource.versionStringForApplication()
,
webObjectsVersion()
public static String webObjectsVersion()
webObjectsVersionAsDouble()
,
ERXStringUtilities.removeExtraDotsFromVersionString(java.lang.String)
public static double webObjectsVersionAsDouble()
webObjectsVersion()
public static boolean webObjectsVersionIs52OrHigher()
public static boolean webObjectsVersionIs522OrHigher()
public static NSArray arrayForKey(String s)
s
- system property
public static NSArray arrayForKeyWithDefault(String s, NSArray defaultValue)
s
- system propertydefaultValue
- default value
public static boolean booleanForKey(String s)
booleanValue
from
ERXUtilities
.
s
- system property
public static boolean booleanForKeyWithDefault(String s, boolean defaultValue)
booleanValue
from
ERXUtilities
.
s
- system propertydefaultValue
- default value
public static NSDictionary dictionaryForKey(String s)
s
- system property
public static NSDictionary dictionaryForKeyWithDefault(String s, NSDictionary defaultValue)
s
- system propertydefaultValue
- default value
public static int intForKey(String s)
s
- system property
public static long longForKey(String s)
s
- system property
public static BigDecimal bigDecimalForKey(String s)
bigDecimalValueWithDefault
from
ERXValueUtilities
.
s
- system property
public static BigDecimal bigDecimalForKeyWithDefault(String s, BigDecimal defaultValue)
bigDecimalValueWithDefault
from
ERXValueUtilities
.
s
- system propertydefaultValue
- default value
public static int intForKeyWithDefault(String s, int defaultValue)
s
- system propertydefaultValue
- default value
public static long longForKeyWithDefault(String s, long defaultValue)
s
- system propertydefaultValue
- default value
public static String stringForKey(String s)
System.getProperty(java.lang.String)
s
- system property
public static String stringForKeyWithDefault(String s, String defaultValue)
System.getProperty(java.lang.String)
s
- system property
public static void setArrayForKey(NSArray array, String key)
array
- to be set in the System propertieskey
- to be used to get the valuepublic static void setDictionaryForKey(NSDictionary dictionary, String key)
dictionary
- to be set in the System propertieskey
- to be used to get the valuepublic static void setStringForKey(String string, String key)
string
- to be set in the System propertieskey
- to be used to get the valuepublic static void transferPropertiesFromSourceToDest(Properties source, Properties dest)
source
- proeprties copied fromdest
- properties copied topublic static Properties propertiesFromPath(String path)
Properties
object
as the result. If the file does not exist, returns
an empty properties object.
path
- file path to the properties file
public static Properties propertiesFromFile(File file) throws IOException
IOException
public static Properties propertiesFromArgv(String[] argv)
argv
- string array typically provided by
the command line arguments
public static NSArray pathsForUserAndBundleProperties()
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.
public static NSArray pathsForUserAndBundleProperties(boolean reportLoggingEnabled)
public static String pathForPropertiesUnderProjectPath(String projectPath)
projectPath
- string to the project root directory
public static NSArray optionalConfigurationFiles()
public static String getActualPath(String path)
path
- path string to a resource that could
contain symbolic links
protected String applicationNameForAppending()
public String getProperty(String key)
key
- to check
|
Last updated: Do, Dez 9, 2004 12:46 PM CET | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |