public class JackieDataSourceConfiguration extends org.diirt.datasource.DataSourceConfiguration<JackieDataSource> implements java.lang.Cloneable
Configuration for the JackieDataSource
. This class parses the
configuration file in a way so that a configuration file originally written
for the JCA-based data source is accepted.
The EPICS Jackie client usually gets its configuration from the standard
EPICS_CA_*
environment variables. Configuring the library
through environment variables is the preferred method. However, for the few
configuration options that cannot be set through environment variables or if
using environment variables is not feasible (e.g. because different
configuration shall be used within the same JVM), a configuration can be read
from an XML file or it can be initialized programmatically.
When creating a data source with the AbstractJackieDataSourceProvider
and there is a file datasources/<name>/<name>.xml
(where <name>
is the name of the provider, e.g.
ca
or jackie
) in the DIIRT configuration directory,
the configuration is initialized using that file and only settings not
specified in that file are read from the environment.
When creating a configuration programmatically, setting a value to
null
has the effect that its corresponding environment variable
is used. The default value for the setting is only used if the environment
variable is not set or if there is no environment variable corresponding to
the setting.
Environment variable | Method name | XML path | Default value |
---|---|---|---|
EPICS_CA_ADDR_LIST |
addressList(Collection) |
/ca/jcaContext/@addr_list | empty |
EPICS_CA_AUTO_ADDR_LIST |
autoAddressList(Boolean) |
/ca/jcaContext/@auto_addr_list | true |
EPICS_CA_AUTO_ARRAY_BYTES |
maxArrayBytes |
/ca/jcaContext/@auto_array_bytes | true |
EPICS_CA_CONN_TMO |
connectionTimeout(Double) |
/ca/jcaContext/@connection_timeout | 30.0 |
EPICS_CA_MAX_ARRAY_BYTES |
maxArrayBytes |
/ca/jcaContext/@max_array_bytes | n/a |
EPICS_CA_MAX_SEARCH_PERIOD |
maxSearchPeriod(Double) |
/ca/jcaContext/@max_search_period | 300.0 |
EPICS_CA_MCAST_TTL |
multicastTtl(Integer) |
/ca/jcaContext/@mcast_ttl | 1 |
EPICS_CA_NAME_SERVERS |
nameServers(Collection) |
/ca/jcaContext/@name_servers | empty |
EPICS_CA_REPEATER_PORT |
repeaterPort(Integer) |
/ca/jcaContext/@repeater_port | 5065 |
EPICS_CA_SERVER_PORT |
serverPort(Integer) |
/ca/jcaContext/@server_port | 5064 |
OS dependent | hostname(String) |
/ca/jcaContext/@hostname | n/a |
OS dependent | username(String) |
/ca/jcaContext/@username | n/a |
n/a | cidBlockReuseTime(Long) |
/ca/jcaContext/@cid_block_reuse_time | 900000 |
n/a | dbePropertySupported(Boolean) |
/ca/dataSourceOptions/@dbePropertySupported | true |
n/a | honorZeroPrecision(Boolean) |
/ca/dataSourceOptions/@honorZeroPrecision | true |
n/a | monitorMask(ChannelAccessEventMask) |
/ca/dataSourceOptions/@monitorMask | DBE_VALUE | DBE_ALARM |
n/a | rtypValueOnly(Boolean) |
/ca/dataSourceOptions/@rtypValueOnly | false |
The hostname and username differ from the other options because the way how their value is determined if they are not set explicitly, depends on the platform. In general, the library checks various different sources (including Java system properties, environment variables, and the DNS) in order to retrieve the real hostname and username, so that the behavior should be as close to the C library as reasonably possible.
Instances of this class are immutable and thus inherently thread-safe.
Constructor and Description |
---|
JackieDataSourceConfiguration()
Creates a configuration using default values.
|
Modifier and Type | Method and Description |
---|---|
JackieDataSourceConfiguration |
addressList(java.util.Collection<org.apache.commons.lang3.tuple.Pair<java.net.Inet4Address,java.lang.Integer>> addressList)
Returns a new configuration with its address list set to the specified
value.
|
JackieDataSourceConfiguration |
autoAddressList(java.lang.Boolean autoAddressList)
Returns a new configuration with its auto address list flag set to the
specified value.
|
JackieDataSourceConfiguration |
autoArrayBytes(java.lang.Boolean autoArrayBytes)
Returns a new configuration with its auto array bytes flag set to the
specified value.
|
JackieDataSourceConfiguration |
cidBlockReuseTime(java.lang.Long cidBlockReuseTime)
Returns a new configuration with its CID block-reuse time set to the
specified value.
|
protected JackieDataSourceConfiguration |
clone() |
JackieDataSourceConfiguration |
connectionTimeout(java.lang.Double connectionTimeout)
Returns a new configuration with its connection timeout set to the
specified value.
|
JackieDataSource |
create() |
JackieDataSourceConfiguration |
dbePropertySupported(java.lang.Boolean dbePropertySupported)
Returns a new configuration with its DBE_PROPERTY supported flag set to
the specified value.
|
JackieDataSourceConfiguration |
honorZeroPrecision(java.lang.Boolean honorZeroPrecision)
Returns a new configuration with its honor-zero-precision flag set to the
specified value.
|
JackieDataSourceConfiguration |
hostname(java.lang.String hostname)
Returns a new configuration with its hostname set to the specified value.
|
boolean |
isDbePropertySupported()
Tells whether to create a meta-data monitor using the
DBE_PROPERTY event mask. |
boolean |
isHonorZeroPrecision()
Tells whether a precision of zero should actually be used when formatting
floating point numbers.
|
boolean |
isRtypValueOnly()
Tells whether channels with names ending with ".RTYP" should receive
special treatment.
|
JackieDataSourceConfiguration |
maxArrayBytes(java.lang.Integer maxArrayBytes)
Returns a new configuration with its max.
|
JackieDataSourceConfiguration |
maxSearchPeriod(java.lang.Double maxSearchPeriod)
Returns a new configuration with its max.
|
JackieDataSourceConfiguration |
monitorMask(ChannelAccessEventMask monitorMask)
Returns a new configuration with its monitor mask set to the specified
value.
|
JackieDataSourceConfiguration |
multicastTtl(java.lang.Integer multicastTtl)
Returns a new configuration with its multicast TTL set to the specified
value.
|
JackieDataSourceConfiguration |
nameServers(java.util.Collection<org.apache.commons.lang3.tuple.Pair<java.net.Inet4Address,java.lang.Integer>> nameServers)
Returns a new configuration with its name servers list set to the
specified value.
|
JackieDataSourceConfiguration |
read(org.w3c.dom.Document document)
Returns a new configuration that is the result of this configuration
being updated with the settings from the specified document.
|
org.diirt.datasource.DataSourceConfiguration<JackieDataSource> |
read(java.io.InputStream stream) |
JackieDataSourceConfiguration |
repeaterPort(java.lang.Integer repeaterPort)
Returns a new configuration with its repeater port set to the specified
value.
|
JackieDataSourceConfiguration |
rtypValueOnly(java.lang.Boolean rtypValueOnly)
Returns a new configuration with its RTYP value-only flag set to the
specified value.
|
JackieDataSourceConfiguration |
serverPort(java.lang.Integer serverPort)
Returns a new configuration with its server port set to the specified
value.
|
ChannelAccessClientConfiguration |
toChannelAccessClientConfiguration()
Return the client configuration generated from this configuration.
|
JackieDataSourceConfiguration |
username(java.lang.String username)
Returns a new configuration with its username set to the specified value.
|
public JackieDataSourceConfiguration()
public JackieDataSourceConfiguration addressList(java.util.Collection<org.apache.commons.lang3.tuple.Pair<java.net.Inet4Address,java.lang.Integer>> addressList)
addressList
- new address list value (may be null
in order to
reset the value back to its default).java.lang.IllegalArgumentException
- if the address list contains null
elements.public JackieDataSourceConfiguration autoAddressList(java.lang.Boolean autoAddressList)
autoAddressList
- new flag value (may be null
in order to reset the
value back to its default).public JackieDataSourceConfiguration autoArrayBytes(java.lang.Boolean autoArrayBytes)
autoArrayBytes
- new flag value (may be null
in order to reset the
value back to its default).public JackieDataSourceConfiguration cidBlockReuseTime(java.lang.Long cidBlockReuseTime)
cidBlockReuseTime
- new CID block-reuse time value (may be null
in
order to reset the value back to its default).public JackieDataSourceConfiguration connectionTimeout(java.lang.Double connectionTimeout)
connectionTimeout
- new connection timeout value (may be null
in
order to reset the value back to its default).java.lang.IllegalArgumentException
- if the connection timeout is NaN.public JackieDataSource create()
create
in class org.diirt.datasource.DataSourceConfiguration<JackieDataSource>
public JackieDataSourceConfiguration dbePropertySupported(java.lang.Boolean dbePropertySupported)
dbePropertySupported
- new flag value (may be null
in order to reset the
value back to its default).isDbePropertySupported()
public JackieDataSourceConfiguration honorZeroPrecision(java.lang.Boolean honorZeroPrecision)
honorZeroPrecision
- new flag value (may be null
in order to reset the
value back to its default).isHonorZeroPrecision()
public JackieDataSourceConfiguration hostname(java.lang.String hostname)
hostname
- new hostname (may be null
in order to reset the
value back to its default).public boolean isDbePropertySupported()
DBE_PROPERTY
event mask. If true
, each channel gets
a second monitor using the DBE_PROPERTY
event mask, so that the
meta-data is updated when it changes. If false
, the
meta-data is only read once when the channel is connected. The default is
true
.true
if meta-data should be monitored using the
DBE_PROPERTY
event mask, false
otherwise.public boolean isHonorZeroPrecision()
true
a value with a precision of
zeros is formatted without any decimal digits. If false
it
is formatted using the default number of digits for floating point
numbers.true
if a precision of zero shall be considered
valid, false
if it shall be considered to mean "use
default precision".public boolean isRtypValueOnly()
true
the monitor created for such a
channel uses the type DBR_STRING instead of DBR_TIME_STRING. If
false
, a regular DBR_TIME_STRING monitor is used. This
option exists to work around a bug in some version of EPICS where
monitoring the RTYP field with DBR_TIME_STRING leads to invalid data
being returned.true
if monitors for the RTYP field should receive
special treatment, false
otherwise.public JackieDataSourceConfiguration maxArrayBytes(java.lang.Integer maxArrayBytes)
EPICS_CA_MAX_ARRAY_BYTES
environment variable would be
ignored because EPICS_CA_AUTO_ARRAY_BYTES
is not set to
NO
. This configuration object is not changed.maxArrayBytes
- new max. array bytes value (may be null
in order
to reset the value back to its default).public JackieDataSourceConfiguration maxSearchPeriod(java.lang.Double maxSearchPeriod)
maxSearchPeriod
- new max. search period value (may be null
in
order to reset the value back to its default).java.lang.IllegalArgumentException
- if max. search period is NaN.public JackieDataSourceConfiguration multicastTtl(java.lang.Integer multicastTtl)
multicastTtl
- new multicast TTL value (may be null
in order to
reset the value back to its default).public JackieDataSourceConfiguration nameServers(java.util.Collection<org.apache.commons.lang3.tuple.Pair<java.net.Inet4Address,java.lang.Integer>> nameServers)
nameServers
- new address list value (may be null
in order to
reset the value back to its default).public JackieDataSourceConfiguration monitorMask(ChannelAccessEventMask monitorMask)
monitorMask
- new monitor mask value (may be null
in order to
reset the value back to its default).java.lang.IllegalArgumentException
- if the mask is DBE_NONE
.public JackieDataSourceConfiguration read(org.w3c.dom.Document document)
document
- document from which the new settings are read.java.lang.IllegalArgumentException
- if the specified document is not a valid configuration.public org.diirt.datasource.DataSourceConfiguration<JackieDataSource> read(java.io.InputStream stream)
read
in class org.diirt.datasource.DataSourceConfiguration<JackieDataSource>
public JackieDataSourceConfiguration repeaterPort(java.lang.Integer repeaterPort)
repeaterPort
- new repeater port value (may be null
in order to
reset the value back to its default).public JackieDataSourceConfiguration rtypValueOnly(java.lang.Boolean rtypValueOnly)
rtypValueOnly
- new flag value (may be null
in order to reset the
value back to its default).isRtypValueOnly()
public JackieDataSourceConfiguration serverPort(java.lang.Integer serverPort)
serverPort
- new server port value (may be null
in order to
reset the value back to its default).public ChannelAccessClientConfiguration toChannelAccessClientConfiguration()
public JackieDataSourceConfiguration username(java.lang.String username)
username
- new username (may be null
in order to reset the
value back to its default).protected JackieDataSourceConfiguration clone()
clone
in class java.lang.Object
Copyright © 2017–2017 aquenos GmbH. All rights reserved.