Package net.sf.eBus.config
Class EConfigure.Service
- java.lang.Object
-
- net.sf.eBus.config.EConfigure.AbstractConfig
-
- net.sf.eBus.config.EConfigure.Service
-
- All Implemented Interfaces:
Comparable<EConfigure.Service>
- Enclosing class:
- EConfigure
public static final class EConfigure.Service extends EConfigure.AbstractConfig implements Comparable<EConfigure.Service>
This immutable class stores the configuration for an eBus service. The service properties are:Service JSON Properties Property Required? Type Default Description nameYes StringNA Unique service name. Duplicate names with the services array are not allowed. connectionTypeNo EConfigure.ConnectionTypeEConfigure.ConnectionType.TCPServer and accepted connection type. EConfigure.ConnectionType.SECURE_TCPandEConfigure.ConnectionType.SECURE_UDPare not allowed when defined in a configuration file since this requires placing sensitive information in the clear in this file.hostNo StringWildcard address Server socket host name or dotted IP address. portYes int> zero and < 65,536NA Server socket port. addressFilterNo AddressFilternullOptional address filter used to decide if a remote eBus is allowed to connect to this eBus service. inputBufferSizeNo intENetConfigure.DEFAULT_BUFFER_SIZEAccepted socket input buffer size. Limits number of bytes received at one time. outputBufferSizeNo intENetConfigure.DEFAULT_BUFFER_SIZEAccepted socket output buffer size. Limits number of bytes transmitted at one time. byteOrderNo ByteOrderEConfigure.DEFAULT_BYTE_ORDERAccepted socket encodes/decodes eBus messages using this byte ordering. messageQueueSizeNo intEConfigure.DEFAULT_QUEUE_SIZEAccepted socket outbound message queue size. A zero queue size means the queue size is unlimited. Used only for TCP connection types. serviceSelectorNo StringDefault eBus selector thread Service socket is monitored by this selector thread. connectionSelectorNo StringDefault eBus selector thread Accepted sockets are monitored by this selector thread. heartbeatDelayNo intfollowed by time unit. Example:30 secondsZero (no heartbeating} Accepted socket heartbeat rate. A zero heartbeat rate means accepted sockets do not send heartbeat messages to peer. heartbeatReplyDelayNo intfollowed by time unit. Example:500 milliseconds.Zero (wait indefinitely for reply) Accepted sockets wait this long for reply to heartbeat message. A zero heartbeat reply delay means wait indefinitely. This setting is ignored in heartbeat rate is zero. canPauseNo booleanfalseIf trueaccepted sockets support pause requests from peer according toEConfigure.PauseConfigsettings.Example service configuration.
name : service1 port : 12345 addressFilter : [ "127.0.0.1", "127.0.0.1:54321" ] serviceSelector : selector1 connectionSelector : selector1 byteOrder : LITTLE_ENDIAN inputBufferSize : 8192 outputBufferSize : 65536 messageQueueSize : 100 canPause : false
-
-
Field Summary
-
Fields inherited from class net.sf.eBus.config.EConfigure.AbstractConfig
mByteOrder, mCanPause, mConnectionType, mHbDelay, mHbReplyDelay, mInputBufferSize, mMsgQueueSize, mName, mOutputBufferSize, mPauseConfig, mRetransmitDelay, mRetransmitLimit, mSSLContext
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description InetSocketAddressaddress()Returns the service host and port address.AddressFilteraddressFilter()Returns the address filter.intcompareTo(EConfigure.Service service)Compares this service configuration withservicebased on the service ports.StringconnectionSelector()Returns the selector information to which accepted connections are registered.booleanequals(Object o)Returnstrueifois aServiceinstance with the same address andfalseotherwise.inthashCode()Returns the service address.StringserviceSelector()Returns the selector information to which the service socket channel is registered.StringtoString()Returns a text representation of this eBus service.-
Methods inherited from class net.sf.eBus.config.EConfigure.AbstractConfig
byteOrder, canPause, connectionType, heartbeatDelay, heartbeatReplyDelay, inputBufferSize, messageQueueSize, name, outputBufferSize, pauseConfiguration, retransmitDelay, retransmitLimit, sslContext
-
-
-
-
Method Detail
-
compareTo
public int compareTo(EConfigure.Service service)
Compares this service configuration withservicebased on the service ports.- Specified by:
compareToin interfaceComparable<EConfigure.Service>- Parameters:
service- compare this service instance.- Returns:
- an integer value.
-
equals
public boolean equals(Object o)
Returnstrueifois aServiceinstance with the same address andfalseotherwise.
-
hashCode
public int hashCode()
Returns the service address.
-
toString
public String toString()
Returns a text representation of this eBus service.
-
address
public InetSocketAddress address()
Returns the service host and port address.- Returns:
- the service host and port address.
-
addressFilter
public AddressFilter addressFilter()
Returns the address filter. May returnnul.- Returns:
- the address filter.
-
serviceSelector
public String serviceSelector()
Returns the selector information to which the service socket channel is registered.- Returns:
- service socket channel selector.
-
connectionSelector
public String connectionSelector()
Returns the selector information to which accepted connections are registered.- Returns:
- accepted connection selector information.
-
-