|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object de.fhg.igd.logging.ConfigurationParameters
This is a container class for all parameters needed by
the LoggingConfiguration
.
Notice: This class is not synchronized/thread-safe.
Nested Class Summary | |
static class |
ConfigurationParameters.BestMatch
This is wrapper class for a best matching configuration entry, which is for example the return type of LoggingConfiguration.getOutput(String) and
LoggingConfiguration.getLogLevel(String) . |
Field Summary | |
protected Map |
buffers_
The storage for user configured buffer sizes, URL objects are used as keys,
Integer objects as values |
protected static ConfigurationParameters |
default_
The default parameters |
static Integer |
DEFAULT_BUFFER_LOCAL
The default value of the buffer property (for local destination URL s) |
static Integer |
DEFAULT_BUFFER_NETWORK
The default value of the buffer property (for network destination URL s) |
static Long |
DEFAULT_INTERVAL
The default value of the interval property |
static String |
DEFAULT_LOGGER
The default value of the logger property |
static LogLevel |
DEFAULT_LOGLEVEL
The default value of the loglevel property |
static URL |
DEFAULT_OUTPUT
The default value of the output property |
protected Long |
interval_
The interval property value |
protected ConfigurationParameters |
last_
The undo information |
protected String |
logger_
The logger property value |
protected Map |
loglevels_
The storage for user configured log levels, class/package name String objects are used as keys,
LogLevel objects as values |
protected Map |
outputs_
The storage for user configured output URLs, class/package name String objects are used as keys,
URL objects as values |
static String |
PROPERTY_BUFFER
The name of the buffer property |
static String |
PROPERTY_INTERVAL
The name of the interval property |
static String |
PROPERTY_LOGGER
The name of the logger property |
static String |
PROPERTY_LOGLEVEL
The name of the loglevel property |
static String |
PROPERTY_OUTPUT
The name of the output property |
Constructor Summary | |
ConfigurationParameters()
Create an empty ConfigurationParameters container. |
Method Summary | |
boolean |
addOutput(String name,
URL output)
Add an output URL for the given name. |
Object |
clone()
|
static String |
convertBuffer(Integer buffer)
Convert an Integer value into a buffer
String as it might be used in the configuration file. |
static String |
convertInterval(Long interval)
Convert a Long value into an interval
String as it might be used in the configuration file. |
static ConfigurationParameters |
create(Properties properties)
Create a ConfigurationParameters container initialized
from a set of property values. |
boolean |
equals(Object obj)
|
protected static String |
findBestName(Map map,
String target)
Find the best matching key for the given name in the specified Map . |
String |
findBestName(String target)
Find the best matching name that has either an output or a loglevel configuration entry for the given target name. |
ConfigurationParameters.BestMatch |
getBestLogLevel(String name)
Get the best matching LogLevel for the given name. |
ConfigurationParameters.BestMatch |
getBestOutput(String name)
Get the best matching Set of output
URL s for the given name. |
Integer |
getBuffer(URL output)
Get the current buffer property value for the given output URL . |
Map |
getBufferMap()
Get all defined buffers. |
static ConfigurationParameters |
getDefault()
Get the default ConfigurationParameters . |
Long |
getInterval()
Get the current interval property value. |
String |
getLogger()
Get the current logger property value. |
LogLevel |
getLogLevel(String name)
Get the loglevel for the given name. |
Map |
getLoglevelMap()
Get all defined loglevels. |
Set |
getOutput(String name)
Get the output URL for the given name. |
Map |
getOutputMap()
Get all defined output URL s. |
int |
hashCode()
|
static Integer |
parseBuffer(String buffer)
Parse a buffer String as an
Integer value. |
static Long |
parseInterval(String interval)
Parse an interval String as a
Long value. |
static LogLevel |
parseLogLevel(String loglevel)
Parse a loglevel String as a
LogLevel object. |
static URL |
parseOutput(String output)
Parse an output String as an
Output value. |
boolean |
removeOutput(String name,
URL output)
Remove the output URL for the given name. |
void |
save(OutputStream os)
Save the current parameters into a stream. |
boolean |
setBuffer(URL output,
Integer buffer)
Define a buffer property value for a specific output URL . |
boolean |
setInterval(Long interval)
Set the interval property value. |
boolean |
setLogger(String logger)
Set the logger property value. |
boolean |
setLogLevel(String name,
LogLevel level)
Define a loglevel property value for a specific name. |
String |
toString()
|
void |
undo()
Undo the most recent property change. |
boolean |
unsetBuffer(URL output)
Delete a buffer property value for a specific output URL . |
boolean |
unsetLogLevel(String name)
Delete the loglevel property value for a specific name. |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final String PROPERTY_LOGGER
public static final String PROPERTY_INTERVAL
public static final String PROPERTY_BUFFER
public static final String PROPERTY_OUTPUT
public static final String PROPERTY_LOGLEVEL
public static final String DEFAULT_LOGGER
public static final Long DEFAULT_INTERVAL
public static final Integer DEFAULT_BUFFER_LOCAL
URL
s)
public static final Integer DEFAULT_BUFFER_NETWORK
URL
s)
public static final URL DEFAULT_OUTPUT
public static final LogLevel DEFAULT_LOGLEVEL
protected String logger_
protected Long interval_
protected Map buffers_
URL
objects are used as keys,
Integer
objects as values
protected Map outputs_
String
objects are used as keys,
URL
objects as values
protected Map loglevels_
String
objects are used as keys,
LogLevel
objects as values
protected ConfigurationParameters last_
protected static ConfigurationParameters default_
Constructor Detail |
public ConfigurationParameters()
ConfigurationParameters
container.
Method Detail |
public static ConfigurationParameters getDefault()
ConfigurationParameters
.
ConfigurationParameters
public static ConfigurationParameters create(Properties properties)
ConfigurationParameters
container initialized
from a set of property values.
properties
- The initialization properties
ConfigurationParameters
container
IllegalArgumentException
- if the given properties contain one or
more invalid entriespublic boolean setLogger(String logger)
logger
- The new logger property value
true
if the property value was changed successfully
NullPointerException
- if logger
is null
public String getLogger()
public boolean setInterval(Long interval)
interval
- The new interval property value
true
if the property value was changed successfully
NullPointerException
- if interval
is
null
public Long getInterval()
public boolean setBuffer(URL output, Integer buffer)
URL
.
output
- The output URL
to define the
buffer forbuffer
- The buffer value
true
if the property value was set successfully
NullPointerException
- if output
or
buffer
is null
public boolean unsetBuffer(URL output)
URL
.
output
- The output URL
to delete the
buffer for
true
if the property value was set successfully
NullPointerException
- if output
is null
public Integer getBuffer(URL output)
URL
.
Notice: In case there is no buffer value defined
for the given output URL
, the default
buffer size (which depends on the URL
protocol
identifier) will be returned.
output
- The output URL
URL
public Map getBufferMap()
URL
objects are used as keys,
Integer
objects as valuespublic boolean addOutput(String name, URL output)
URL
for the given name.
name
- The name to add the output URL
foroutput
- The new output URL
true
if the property value was set successfully
NullPointerException
- if name
or output
is null
public boolean removeOutput(String name, URL output)
URL
for the given name.
name
- The name to remove the output URL
foroutput
- The output URL
to remove
true
if the property value was set successfully
NullPointerException
- if name
or output
is null
public ConfigurationParameters.BestMatch getBestOutput(String name)
Set
of output
URL
s for the given name.
name
- The corresponding name of the output
URL
s
URL
s
for the given namepublic Set getOutput(String name)
URL
for the given name.
name
- The name to lookup the output URL
for
URL
for the given name or
an empty Set
if nothing could be foundpublic Map getOutputMap()
URL
s.
URL
mappings,
String
objects are used as keys,
Set
s of URL
objects as valuespublic boolean setLogLevel(String name, LogLevel level)
name
- The name to define the loglevel forlevel
- The loglevel value
true
if the property value was set successfully
NullPointerException
- if name
or level
is null
public boolean unsetLogLevel(String name)
name
- The name to delete the loglevel for
true
if the property value was set successfully
NullPointerException
- if name
is null
public ConfigurationParameters.BestMatch getBestLogLevel(String name)
LogLevel
for the given name.
name
- The corresponding name of the LogLevel
LogLevel
for the given namepublic LogLevel getLogLevel(String name)
name
- The name to lookup the loglevel for
public Map getLoglevelMap()
String
objects are used as keys,
LogLevel
objects as valuespublic void undo()
public void save(OutputStream os)
os
- The target output streampublic String findBestName(String target)
String
(representing the root name) will be
returned.
target
- The target name to be searched for
protected static String findBestName(Map map, String target)
Map
. If none of the keys matches the given name,
an empty String
(representing the root name) will be
returned.
map
- The Map
to be searchedtarget
- The target name
public static Long parseInterval(String interval)
String
as a
Long
value. The parser can read int
and
float
values with or without a trailing unit identifier:
interval
- The interval String
to be parsed
IllegalArgumentException
- if the given value could not be parsedpublic static String convertInterval(Long interval)
Long
value into an interval
String
as it might be used in the configuration file.
The long
value will be converted into the lowest possible
float
or int
value greater than 1, using
one of the following unit identifiers:
interval
- The interval value (in millis) to be converted
String
public static Integer parseBuffer(String buffer)
String
as an
Integer
value. The parser can read int
and
float
values with or without a trailing unit identifier:
buffer
- The buffer size String
to be parsed
IllegalArgumentException
- if the given value could not be parsedpublic static String convertBuffer(Integer buffer)
Integer
value into a buffer
String
as it might be used in the configuration file.
The int
value will be converted into the lowest possible
float
or int
value greater than 1, using
one of the following unit identifiers:
buffer
- The buffer value to be converted
String
public static URL parseOutput(String output)
String
as an
Output
value.
output
- The output String
to be parsed
IllegalArgumentException
- if the given value could not be parsedpublic static LogLevel parseLogLevel(String loglevel)
String
as a
LogLevel
object.
loglevel
- The loglevel String
to be parsed
IllegalArgumentException
- if the given value could not be parsedpublic Object clone()
public boolean equals(Object obj)
public int hashCode()
public String toString()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |