Class ConnectorUtilities
This class expects specifc keywords in configuration properties, which define which plugs are present and which instances can be used for particular plug.
- Author:
- igor@scictrl.com
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringOptional system configuration property which tells to plug implementations what is expected timeout for remote operations in milliseconds.static final StringKeyword used in System properties to configure DAL logging.static final longDAL default connection timeout value in milliseconds.static final longDAL default initial connection timeout value in milliseconds.static final StringOptional system configuration property, which defines the timeout for establishing or initializing the connections in milliseconds. -
Method Summary
Modifier and TypeMethodDescriptionstatic final StringformatConnectionMessage(String conn, String message, Throwable t) formatConnectionMessage.static final StringformatConnectionMessage(Connection<?, ?, ?> conn, String message, Throwable t) formatConnectionMessage.static final longConvenience method which tries to get connection timeout first from provided properties, then from system properties and if both fails returns DAL default value.static final longgetConnectionTimeout(Properties p, long def) Convenience method which tries to get connection timeout first from provided properties, then from system properties and if both fails returns provided default value.static final org.apache.logging.log4j.LoggergetConnectorLogger(String type) Returns logger for particular DAL plug, this logger shuld be used for general messages about plug activity.static final longConvenience method which tries to get initial connection timeout first from provided properties, then from system properties and if both fails returns DAL default value.static final longgetInitialConnectionTimeout(Properties p, long def) Convenience method which tries to get initial connection timeout first from provided properties, then from system properties and if both fails returns provided default value.static final org.apache.logging.log4j.LoggerReturn logger, which is parent for all DAL plug loggers.
-
Field Details
-
CSSHELL_LOGGING
Keyword used in System properties to configure DAL logging. Valie values are:- true - DAL will call basic log4j configuration, which enables logging to console.
- false - DAL will not configure logging to console.
Regardless of this setting an application can configure own appenders for DAL logging. See
getLogger()for details.- See Also:
-
CONNECTION_TIMEOUT
Optional system configuration property which tells to plug implementations what is expected timeout for remote operations in milliseconds.- See Also:
-
INITIAL_CONNECTION_TIMEOUT
Optional system configuration property, which defines the timeout for establishing or initializing the connections in milliseconds.- See Also:
-
DEFAULT_CONNECTION_TIMEOUT
public static final long DEFAULT_CONNECTION_TIMEOUTDAL default connection timeout value in milliseconds. Used if CONNECTION_TIMEOUT is not defined.- See Also:
-
DEFAULT_INITIAL_CONNECTION_TIMEOUT
public static final long DEFAULT_INITIAL_CONNECTION_TIMEOUTDAL default initial connection timeout value in milliseconds. Used if INITIAL_CONNECTION_TIMEOUT is not defined.- See Also:
-
-
Method Details
-
getConnectionTimeout
Convenience method which tries to get connection timeout first from provided properties, then from system properties and if both fails returns provided default value.- Parameters:
p- properties, may be nulldef- default fallback values- Returns:
- connection timeout propety value
-
getConnectionTimeout
Convenience method which tries to get connection timeout first from provided properties, then from system properties and if both fails returns DAL default value.- Parameters:
p- properties, may be null- Returns:
- connection timeout propety value
-
getInitialConnectionTimeout
Convenience method which tries to get initial connection timeout first from provided properties, then from system properties and if both fails returns provided default value.- Parameters:
p- properties, may be nulldef- default fallback values- Returns:
- connection timeout property value
-
getInitialConnectionTimeout
Convenience method which tries to get initial connection timeout first from provided properties, then from system properties and if both fails returns DAL default value.- Parameters:
p- properties, may be null- Returns:
- initial connection timeout property value
-
getLogger
public static final org.apache.logging.log4j.Logger getLogger()Return logger, which is parent for all DAL plug loggers.DAL Plug loggers collect and distribute messages, which are intended for general plublic. E.g. application which is not interested in internal structure, but wants to display progress when some channel was connected or some user initiated action failed.
Parent DAL logger name is 'DAL'. Names of plug loggers are 'DAL.PLUG_NAME', for example 'DAL.EPICS'.
Default configuration of appenders is controlled with System parameter
CSSHELL_LOGGING.- Returns:
- parent logger for all DAL plug loggers.
- See Also:
-
getConnectorLogger
Returns logger for particular DAL plug, this logger shuld be used for general messages about plug activity.- Parameters:
type- aStringobject- Returns:
- logger for DAL plug
-
formatConnectionMessage
public static final String formatConnectionMessage(Connection<?, ?, ?> conn, String message, Throwable t) formatConnectionMessage.
- Parameters:
conn- aConnectionobjectmessage- aStringobjectt- aThrowableobject- Returns:
- a
Stringobject
-
formatConnectionMessage
formatConnectionMessage.
-