|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.javaseis.properties.SeisProperties
public class SeisProperties
Title: JavaSeis Properties
Description: Provides property support for JavaSeis classes
Copyright: Copyright (c) 2003
Company: JavaSeis.com
Field Summary | |
---|---|
(package private) char |
endChar
|
(package private) java.nio.channels.FileChannel |
fc
|
(package private) java.util.Properties |
fileProperties
|
(package private) ISeisLock |
fl
|
(package private) java.io.FileOutputStream |
fo
|
(package private) java.io.File |
fpropFile
|
(package private) java.lang.String |
header
|
(package private) long |
ioTime
|
(package private) boolean |
isChanged
|
(package private) int |
lockCount
|
(package private) java.lang.String |
path
|
(package private) boolean |
readOnly
|
(package private) java.lang.String |
sepChar
|
(package private) char |
startChar
|
(package private) long |
t0
|
(package private) boolean |
trackTime
|
(package private) boolean |
useLocking
|
(package private) boolean |
useNativeLock
|
Constructor Summary | |
---|---|
SeisProperties()
Create a new JavaSeis properties object |
|
SeisProperties(java.lang.String path,
java.lang.String mode)
|
|
SeisProperties(java.lang.String path,
java.lang.String mode,
boolean useLocking,
boolean nativeLocking)
Create a file for subsequent JavaSeis properties load/store operations |
Method Summary | |
---|---|
static SeisProperties |
argsToProperties(java.lang.String[] args)
Convert a set of program arguments to Properties object Convention used is "-arg1 value1 -arg2 value2" translates to "arg1" = "value1", "arg2 = "value2", etc. |
void |
broadcast(IParallelContext pc)
Broadcast properties contents to all tasks in the parallel context |
void |
clear()
|
void |
close()
|
void |
create(java.lang.String path,
java.lang.String header)
|
double |
getDouble(java.lang.String key)
Get float property value from JavaSeis FileProperties object. |
double |
getDouble(java.lang.String key,
double defaultDouble)
Get double property value from JavaSeis FileProperties object. |
int |
getDoubleArray(java.lang.String key,
double[] values)
Get an array of doubles from the JavaSeis FileProperties object. |
int |
getDoubleArray(java.lang.String key,
double[] values,
double[] defaults)
Get an array of doubles from the JavaSeis FileProperties object. |
float |
getFloat(java.lang.String key)
Get float property value from JavaSeis FileProperties object. |
float |
getFloat(java.lang.String key,
java.lang.Float defaultFloat)
Get float property value from JavaSeis FileProperties object. |
int |
getFloatArray(java.lang.String key,
float[] values)
Get an array of floats from the JavaSeis FileProperties object. |
int |
getFloatArray(java.lang.String key,
float[] values,
float[] defaults)
Get an array of floats from the JavaSeis FileProperties object. |
java.lang.String |
getHeader()
Read the "header" line from the properties file |
int |
getInt(java.lang.String key)
Get int property value from JavaSeis properties object. |
int |
getInt(java.lang.String key,
int defaultInt)
Get int property value from JavaSeis properties object. |
int |
getIntArray(java.lang.String key,
int[] values)
Get an array of integers from the JavaSeis FileProperties object. |
int |
getIntArray(java.lang.String key,
int[] values,
int[] defaults)
Get an array of integers from the JavaSeis FileProperties object. |
float |
getIoTime()
Return time spent in I/O operations |
float |
getLockTime()
Return time spent in lock operations |
long |
getLong(java.lang.String key)
Get long property value from JavaSeis properties object. |
long |
getLong(java.lang.String key,
long defaultLong)
Get int property value from JavaSeis properties object. |
int |
getLongArray(java.lang.String key,
long[] values)
Get an array of longs from the JavaSeis FileProperties object. |
int |
getLongArray(java.lang.String key,
long[] values,
long[] defaults)
Get an array of longs from the JavaSeis FileProperties object. |
java.lang.String |
getPath()
|
java.lang.String |
getString(java.lang.String key)
Get String property value from JavaSeis FileProperties object. |
java.lang.String |
getString(java.lang.String key,
java.lang.String defaultString)
Get String property value from JavaSeis FileProperties object. |
java.lang.String[] |
getStringArray(java.lang.String key)
Retrieve an array of Strings as a property value |
java.lang.String[] |
getStringArray(java.lang.String key,
java.lang.String defaults)
Retrieve an array of Strings as a property value |
void |
load()
Load a JavaSeis properties object from the associated file |
void |
lock()
Obtain a lock on the properties file |
static java.util.Properties |
mergeProperties(java.util.Properties oldProps,
java.util.Properties newProps,
boolean preserve)
Merges 2 sets of properties. |
void |
open(java.lang.String path,
java.lang.String mode)
Open properties file |
void |
open(java.lang.String path,
java.lang.String mode,
boolean fileLocking,
boolean nativeLocking)
Open a file for subsequent JavaSeis properties load/store operations |
void |
putDouble(java.lang.String key,
double value)
Store a double value in the JavaSeis FileProperties object. |
void |
putDoubleArray(java.lang.String key,
double[] values)
Store an array of doubles in the JavaSeis FileProperties object. |
void |
putFloat(java.lang.String key,
float value)
Store a float value in the JavaSeis FileProperties object. |
void |
putFloatArray(java.lang.String key,
float[] values)
Store an array of floats in the JavaSeis FileProperties object. |
void |
putInt(java.lang.String key,
int value)
Store a integer value in the JavaSeis FileProperties object. |
void |
putIntArray(java.lang.String key,
int[] values)
Store an array of integers in the JavaSeis FileProperties object. |
void |
putLong(java.lang.String key,
long value)
Store a long value in the JavaSeis FileProperties object. |
void |
putLongArray(java.lang.String key,
long[] values)
Store an array of longs in the JavaSeis FileProperties object. |
void |
putString(java.lang.String key,
java.lang.String value)
Store a String property value in the JavaSeis FileProperties object. |
void |
putStringArray(java.lang.String key,
java.lang.String[] values)
Store an array of Strings as a property value |
void |
setSeparators(java.lang.String sep,
char start,
char end)
Create a file for subsequent JavaSeis properties load/store operations |
void |
store()
Store JavaSeis properties to the associated file |
static java.lang.String[] |
stringToArray(java.lang.String s,
java.lang.String sep,
char start,
char end)
Convert a string to an array of strings based on a separator |
void |
trackTime(boolean trackTime)
Set flag for I/O time tracking |
void |
unlock()
Release a lock on the properties file |
protected void |
update(java.lang.String header)
Updates properties. |
void |
useLock(boolean lock)
|
void |
useNativeLock(boolean useNative)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
char endChar
java.nio.channels.FileChannel fc
java.util.Properties fileProperties
ISeisLock fl
java.io.FileOutputStream fo
java.io.File fpropFile
java.lang.String header
long ioTime
boolean isChanged
int lockCount
java.lang.String path
boolean readOnly
java.lang.String sepChar
char startChar
long t0
boolean trackTime
boolean useLocking
boolean useNativeLock
Constructor Detail |
---|
public SeisProperties()
public SeisProperties(java.lang.String path, java.lang.String mode) throws SeisException
SeisException
public SeisProperties(java.lang.String path, java.lang.String mode, boolean useLocking, boolean nativeLocking) throws SeisException
path
- path to use for loading/storing properties
SeisException
Method Detail |
---|
public static SeisProperties argsToProperties(java.lang.String[] args)
args
- input program argument strings
public void broadcast(IParallelContext pc)
pc
- parallel context to be used for the broadcastpublic void clear()
public void close() throws SeisException
SeisException
public void create(java.lang.String path, java.lang.String header) throws SeisException
SeisException
public double getDouble(java.lang.String key) throws SeisException
key
- name of property
SeisException
- null property or number format error.public double getDouble(java.lang.String key, double defaultDouble)
key
- name of propertydefaultDouble
- default value if matching key is not found
public int getDoubleArray(java.lang.String key, double[] values) throws SeisException
key
- string used as key in property filevalues
- array that will be read from the properties file
SeisException
public int getDoubleArray(java.lang.String key, double[] values, double[] defaults)
key
- string used as key in property filevalues
- array that will be read from the properties file
SeisException
public float getFloat(java.lang.String key) throws SeisException
key
- name of property
SeisException
- null property or number format error.public float getFloat(java.lang.String key, java.lang.Float defaultFloat)
key
- name of propertydefaultFloat
- default value if property is not found
public int getFloatArray(java.lang.String key, float[] values) throws SeisException
key
- string used as key in property filevalues
- array that will be read from the properties file
SeisException
public int getFloatArray(java.lang.String key, float[] values, float[] defaults)
key
- string used as key in property filevalues
- array that will be read from the properties file
SeisException
public java.lang.String getHeader() throws SeisException
SeisException
- if file cannot be readpublic int getInt(java.lang.String key) throws SeisException
key
- name of property
SeisException
- null property or number format error.public int getInt(java.lang.String key, int defaultInt)
key
- name of propertydefaultInt
- default integer value if matching key not found
public int getIntArray(java.lang.String key, int[] values) throws SeisException
key
- (in) property to retrievevalues
- (out) array of values returned
SeisException
- if property is missingpublic int getIntArray(java.lang.String key, int[] values, int[] defaults)
key
- (in) property to retrievevalues
- (out) array of values returned
SeisException
- if property is missingpublic float getIoTime()
public float getLockTime()
public long getLong(java.lang.String key) throws SeisException
key
- name of property
SeisException
- null property or number format error.public long getLong(java.lang.String key, long defaultLong)
key
- name of propertydefaultInt
- default integer value if matching key not found
public int getLongArray(java.lang.String key, long[] values) throws SeisException
key
- (in) property to retrievevalues
- (out) array of values returned
SeisException
public int getLongArray(java.lang.String key, long[] values, long[] defaults)
key
- (in) property to retrievevalues
- (out) array of values returned
SeisException
public java.lang.String getPath()
public java.lang.String getString(java.lang.String key) throws SeisException
key
- name of property
SeisException
- null property or number format error.public java.lang.String getString(java.lang.String key, java.lang.String defaultString)
key
- name of property
public java.lang.String[] getStringArray(java.lang.String key)
key
- string used as key in property file
public java.lang.String[] getStringArray(java.lang.String key, java.lang.String defaults)
key
- string used as key in property filedefaults
- default value for string array
public void load() throws SeisException
SeisException
public void lock() throws SeisException
SeisException
- if already locked or lock failurepublic static java.util.Properties mergeProperties(java.util.Properties oldProps, java.util.Properties newProps, boolean preserve) throws SeisException
oldProps
- The old set of properties.newProps
- The new set of properties.preserve
- true to preserve old properties; otherwise false.
SeisException
- Thrown on property merge error.public void open(java.lang.String path, java.lang.String mode) throws SeisException
path
- mode
-
SeisException
public void open(java.lang.String path, java.lang.String mode, boolean fileLocking, boolean nativeLocking) throws SeisException
path
- path to use for loading/storing propertiesmode
- "rw" for read/write, "r" for read onlyuseLocking
- flag to indicate whether or not to use lockingnativeLocking
- false indicates to use java nio locking
SeisException
public void putDouble(java.lang.String key, double value)
key
- string used as key in property filevalue
- string that will be stored in properties filepublic void putDoubleArray(java.lang.String key, double[] values)
key
- string used as key in property filevalues
- array that will be stored in properties filepublic void putFloat(java.lang.String key, float value)
key
- string used as key in property filevalue
- string that will be stored in properties filepublic void putFloatArray(java.lang.String key, float[] values)
key
- string used as key in property filevalues
- array that will be stored in properties filepublic void putInt(java.lang.String key, int value)
key
- string used as key in property filevalue
- string that will be stored in properties filepublic void putIntArray(java.lang.String key, int[] values)
key
- string used as key in property filevalues
- array that will be stored in properties filepublic void putLong(java.lang.String key, long value)
key
- string used as key in property filevalue
- string that will be stored in properties filepublic void putLongArray(java.lang.String key, long[] values)
key
- string used as key in property filevalues
- array that will be stored in properties filepublic void putString(java.lang.String key, java.lang.String value)
key
- string used as key in property filevalue
- string that will be stored in properties filepublic void putStringArray(java.lang.String key, java.lang.String[] values)
key
- string used as key in property filevalues
- arrayh of strings that will be stored in properties filepublic void setSeparators(java.lang.String sep, char start, char end)
path
- path to use for loading/storing properties
SeisException
public void store() throws SeisException
header
- string to use in header for properties file
SeisException
SeisException
public static java.lang.String[] stringToArray(java.lang.String s, java.lang.String sep, char start, char end)
s
- input string to be converted to an arraysep
- separator between array elements in the stringstart
- character used to delimit start of string (i.e. ",} )end
- character used to delimit end of string
public void trackTime(boolean trackTime)
trackTime
- set to true to turn on I/O time trackingpublic void unlock() throws SeisException
SeisException
- if not locked or unlock failureprotected void update(java.lang.String header) throws SeisException
SeisException
- Thrown on property update errors.public void useLock(boolean lock) throws SeisException
SeisException
public void useNativeLock(boolean useNative) throws SeisException
SeisException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |