public class SessionSettings extends Object
Modifier and Type | Field and Description |
---|---|
static String |
BEGINSTRING |
static String |
SENDERCOMPID |
static String |
SENDERLOCID |
static String |
SENDERSUBID |
static String |
SESSION_QUALIFIER |
static String |
TARGETCOMPID |
static String |
TARGETLOCID |
static String |
TARGETSUBID |
Constructor and Description |
---|
SessionSettings()
Creates an empty session settings object.
|
SessionSettings(InputStream stream)
Loads session settings from an input stream.
|
SessionSettings(InputStream stream,
Properties variableValues)
Loads session settings from an input stream with custom source of variable values in the settings.
|
SessionSettings(List<String> listValues)
Loads session settings from a list of strings.
|
SessionSettings(List<String> listValues,
Properties variableValues)
Loads session settings from a list of strings with custom source of variable values in the settings.
|
SessionSettings(Properties variableValues)
Creates an empty session settings object with custom source of variable values in the settings.
|
SessionSettings(String filename)
Loads session settings from a file.
|
SessionSettings(String filename,
Properties variableValues)
Loads session settings from a file with custom source of variable values in the settings.
|
Modifier and Type | Method and Description |
---|---|
Dictionary |
get() |
Dictionary |
get(SessionID sessionID) |
boolean |
getBool(SessionID sessionID,
String key)
Get a settings value as a boolean value.
|
boolean |
getBool(String key)
Gets a boolean value from the default section of the settings.
|
Properties |
getDefaultProperties()
Returns the defaults for the session-level settings.
|
double |
getDouble(SessionID sessionID,
String key)
Get a settings value as a double number.
|
double |
getDouble(String key)
Gets a double value from the default section of the settings.
|
int |
getInt(SessionID sessionID,
String key)
Get a settings value as an integer.
|
int |
getInt(String key)
Gets an int from the default section of settings.
|
long |
getLong(SessionID sessionID,
String key)
Get a settings value as a long integer.
|
long |
getLong(String key)
Gets a long from the default section of settings.
|
Properties |
getSessionProperties(SessionID sessionID)
Return the settings for a session as a Properties object.
|
Properties |
getSessionProperties(SessionID sessionID,
boolean includeDefaults)
Return the settings for a session as a Properties object.
|
String |
getString(SessionID sessionID,
String key)
Get a settings string.
|
String |
getString(String key)
Gets a string from the default section of the settings.
|
boolean |
isSetting(SessionID sessionID,
String key)
Predicate for determining if a setting exists.
|
boolean |
isSetting(String key)
Predicate for determining if a setting is in the default section.
|
static Set<InetAddress> |
parseRemoteAddresses(String raw) |
static int[] |
parseSettingReconnectInterval(String raw) |
void |
removeSetting(SessionID sessionID,
String key) |
Iterator<SessionID> |
sectionIterator() |
void |
set(Dictionary dictionary) |
void |
set(Map<Object,Object> defaults)
Adds defaults to the settings.
|
void |
set(SessionID sessionID,
Dictionary dictionary) |
void |
setBool(SessionID sessionID,
String key,
boolean value)
Sets a boolean-valued session setting.
|
void |
setBool(String key,
boolean value)
Set a default boolean parameter.
|
void |
setDouble(SessionID sessionID,
String key,
double value)
Sets a double-valued session setting.
|
void |
setDouble(String key,
double value)
Set a default double parameter.
|
void |
setLong(SessionID sessionID,
String key,
long value)
Sets a long integer-valued session setting.
|
void |
setLong(String key,
long value)
Set a default long parameter.
|
void |
setString(SessionID sessionID,
String key,
String value)
Sets a string-valued session setting.
|
void |
setString(String key,
String value)
Set a default string parameter.
|
void |
setVariableValues(Properties variableValues)
Set properties that will be the source of variable values in the settings.
|
int |
size() |
void |
toStream(OutputStream out) |
String |
toString() |
void |
toString(PrintWriter writer) |
public static final String BEGINSTRING
public static final String SENDERCOMPID
public static final String SENDERSUBID
public static final String SENDERLOCID
public static final String TARGETCOMPID
public static final String TARGETSUBID
public static final String TARGETLOCID
public static final String SESSION_QUALIFIER
public SessionSettings()
public SessionSettings(Properties variableValues)
variableValues
- custom source of variable values in the settingspublic SessionSettings(String filename, Properties variableValues) throws ConfigError
filename
- the path to the file containing the session settingsvariableValues
- custom source of variable values in the settingsConfigError
- when file could not be loadedpublic SessionSettings(String filename) throws ConfigError
filename
- the path to the file containing the session settingsConfigError
- when file could not be loadedpublic SessionSettings(InputStream stream) throws ConfigError
stream
- the input streamConfigError
public SessionSettings(InputStream stream, Properties variableValues) throws ConfigError
stream
- the input streamvariableValues
- custom source of variable values in the settingsConfigError
public SessionSettings(List<String> listValues) throws ConfigError
listValues
- the list of stringsConfigError
public SessionSettings(List<String> listValues, Properties variableValues) throws ConfigError
listValues
- the list of stringsvariableValues
- custom source of variable values in the settingsConfigError
public String getString(String key) throws ConfigError
key
- ConfigError
public String getString(SessionID sessionID, String key) throws ConfigError
sessionID
- the session IDkey
- the settings keyConfigError
- configuration error, probably a missing setting.public Properties getSessionProperties(SessionID sessionID, boolean includeDefaults) throws ConfigError
sessionID
- includeDefaults
- if true, include settings defaults in propertiesConfigError
Properties
public Properties getSessionProperties(SessionID sessionID) throws ConfigError
sessionID
- ConfigError
Properties
public Properties getDefaultProperties()
public long getLong(String key) throws ConfigError, FieldConvertError
key
- ConfigError
FieldConvertError
public long getLong(SessionID sessionID, String key) throws ConfigError, FieldConvertError
sessionID
- the session IDkey
- the settings keyConfigError
- configuration error, probably a missing setting.FieldConvertError
- error during field type conversion.public int getInt(String key) throws ConfigError, FieldConvertError
key
- ConfigError
FieldConvertError
public int getInt(SessionID sessionID, String key) throws ConfigError, FieldConvertError
sessionID
- the session IDkey
- the settings keyConfigError
- configuration error, probably a missing setting.FieldConvertError
- error during field type conversion.public double getDouble(String key) throws ConfigError, FieldConvertError
key
- ConfigError
FieldConvertError
public double getDouble(SessionID sessionID, String key) throws ConfigError, FieldConvertError
sessionID
- the session IDkey
- the settings keyConfigError
- configuration error, probably a missing setting.FieldConvertError
- error during field type conversion.public boolean getBool(String key) throws ConfigError, FieldConvertError
key
- ConfigError
FieldConvertError
public boolean getBool(SessionID sessionID, String key) throws ConfigError, FieldConvertError
sessionID
- the session IDkey
- the settings keyConfigError
- configuration error, probably a missing setting.FieldConvertError
- error during field type conversion.public void setString(SessionID sessionID, String key, String value)
sessionID
- the session IDkey
- the setting keyvalue
- the string valuepublic void setLong(SessionID sessionID, String key, long value)
sessionID
- the session IDkey
- the setting keyvalue
- the long integer valuepublic void setDouble(SessionID sessionID, String key, double value)
sessionID
- the session IDkey
- the setting keyvalue
- the double valuepublic void setBool(SessionID sessionID, String key, boolean value)
sessionID
- the session IDkey
- the setting keyvalue
- the boolean valuepublic boolean isSetting(String key)
key
- public boolean isSetting(SessionID sessionID, String key)
sessionID
- the session IDkey
- the setting keypublic void setVariableValues(Properties variableValues)
// Custom properties with System properties as default
Properties myprops = new Properties(System.getProperties());
myprops.load(getPropertiesInputStream());
settings.setVariableValues(myprops);
// Custom properties with System properties as override
Properties myprops = new Properties();
myprops.load(getPropertiesInputStream());
myprops.putAll(System.getProperties());
settings.setVariableValues(myprops);
variableValues
- Properties
,
System
public void set(Map<Object,Object> defaults)
defaults
- public void setBool(String key, boolean value)
key
- the settings keyvalue
- the settings valuepublic void setDouble(String key, double value)
key
- the settings keyvalue
- the settings valuepublic void setLong(String key, long value)
key
- the settings keyvalue
- the settings valuepublic void setString(String key, String value)
key
- the settings keyvalue
- the settings valuepublic int size()
public Dictionary get(SessionID sessionID) throws ConfigError
ConfigError
public void set(SessionID sessionID, Dictionary dictionary) throws ConfigError
ConfigError
public Dictionary get()
public void set(Dictionary dictionary) throws ConfigError
ConfigError
public void toString(PrintWriter writer)
public void toStream(OutputStream out)
public static int[] parseSettingReconnectInterval(String raw)
public static Set<InetAddress> parseRemoteAddresses(String raw)
Copyright © 2021. All rights reserved.