Class BaseChannel
java.lang.Object
java.util.Observable
org.jpos.iso.BaseChannel
- All Implemented Interfaces:
Cloneable, Configurable, ExceptionHandlerAware, BaseChannelMBean, ClientChannel, FactoryChannel, FilteredChannel, ISOChannel, ISOSource, ServerChannel, ISOMsgMetrics.Source, LogSource
- Direct Known Subclasses:
AmexChannel, ASCIIChannel, BASE24Channel, BASE24TCPChannel, BCDChannel, CMFChannel, CSChannel, GICCChannel, GZIPChannel, HEXChannel, LogChannel, NACChannel, NCCChannel, PADChannel, PostChannel, RawChannel, RBPChannel, TelnetXMLChannel, VAPChannel, X25Channel, XMLChannel
public abstract class BaseChannel
extends Observable
implements FilteredChannel, ClientChannel, ServerChannel, FactoryChannel, ISOMsgMetrics.Source, LogSource, Configurable, BaseChannelMBean, Cloneable, ExceptionHandlerAware
ISOChannel is an abstract class that provides functionality that
allows the transmission and reception of ISO 8583 Messages
over a TCP/IP session.
This class is not thread-safe.
ISOChannel is Observable in order to support GUI components
such as ISOChannelPanel.
It now support the new Logger architecture so we will
probably setup ISOChannelPanel to be a LogListener instead
of being an Observer in future releases.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected int[]Message counters array.protected byte[]Message header bytes.Incoming and outgoing filter chains.protected LoggerThe logger for this channel.protected StringThe original realm before any override.Incoming and outgoing filter chains.protected booleanWhen true, this channel's own header overrides the message's header.protected ISOPackagerThe packager used to pack/unpack ISO messages.protected StringThe realm string for this channel.protected DataInputStreamInput stream for reading from the connected socket.protected LockLock guardingserverInand read operations.protected DataOutputStreamOutput stream for writing to the connected socket.protected LockLock guardingserverOutand write operations.protected ServerSocketServer socket used when this channel acts as a server.protected ISOClientSocketFactoryOptional factory for creating client sockets.protected booleanWhether this channel is in a usable state.Fields inherited from interface ISOChannel
CONNECT, RX, SIZEOF_CNT, TXModifier and TypeFieldDescriptionstatic final intCounter index for connection events.static final intCounter index for received messages.static final intNumber of counters maintained by this channel.static final intCounter index for transmitted messages. -
Constructor Summary
ConstructorsConstructorDescriptionconstructor shared by server and client ISOChannels (which have different signatures)BaseChannel(String host, int port, ISOPackager p) constructs a client ISOChannelconstructs a server ISOChannelBaseChannel(ISOPackager p, ServerSocket serverSocket) constructs a server ISOChannel associated with a Server Socket -
Method Summary
Modifier and TypeMethodDescriptionvoidAccepts connectionvoidAdds a filter to this channel.voidAdds a filter to this channel.voidaddIncomingFilter(ISOFilter filter) Adds a filter to the incoming filter chain.voidaddOutgoingFilter(ISOFilter filter) Adds a filter to the outgoing filter chain.protected ISOMsgapplyIncomingFilters(ISOMsg m, byte[] header, byte[] image, LogEvent evt) Applies all registered incoming filters with the raw message header and image.protected ISOMsgapplyIncomingFilters(ISOMsg m, LogEvent evt) Applies all registered incoming filters to the given message.protected ISOMsgapplyOutgoingFilters(ISOMsg m, LogEvent evt) Applies all registered outgoing filters to the given message.protected voidsets timeout, and also keep aliveclone()Returns a clone of this channel.protected voidCloses the underlying socket.voidconnect()Connects client ISOChannel to serverprotected voidsetup I/O Streams from socketprotected ISOMsgCreates a new ISOMsg instance; may be overridden to return a subclass.protected ISOMsgsupport old factory method name for backward compatibilityvoiddisconnects the TCP/IP session.intgetBytes(byte[] b) Low level receivestatic ISOChannelgetChannel(String name) Retrieves a channel instance by name from the NameRegistrar.Returns the current configuration for this channel.int[]Returns the message counters array.protected ISOHeadergetDynamicHeader(byte[] image) Allow subclasses to override the Default header on incoming messages.protected ISOPackagergetDynamicPackager(byte[] image) allow subclasses to override default packager on incoming messagesprotected ISOPackagergetDynamicPackager(byte[] header, byte[] image) allow subclasses to override default packager on incoming messagesprotected ISOPackagerallow subclasses to override default packager on outgoing messagesMap<Class<? extends Exception>, List<ExceptionHandler>> Returns the map of targeted exception handlers, keyed by exception class.byte[]Returns the message header bytes.protected intReturns the fixed header length for this channel.protected intgetHeaderLength(byte[] b) Returns the header length for the given raw message bytes.protected intReturns the header length for the given ISO message.getHost()Returns the remote host this client channel connects to.Returns all filters in the incoming filter chain.Returns the attached ISOMsgMetrics.Returns the Logger associated with this source.intReturns the maximum packet length accepted by this channel.protected voidgetMessage(byte[] b, int offset, int len) Reads raw message bytes from the stream into the given buffer.protected intReads and returns the message length prefix from the stream.protected voidReads the message trailer from the stream and optionally stores it in the given message.protected voidDeprecated.getName()Returns this channel's registered name.Returns the original realm before any override was applied.Returns all filters in the outgoing filter chain.Returns the packager used to pack/unpack ISO messages on this channel.intgetPort()Returns the remote port this client channel connects to.getRealm()Returns the log realm associated with this source.Returns the current server socket.Returns the current connected socket.Gets the ISOClientSocketFactory (may be null)intReturns the SO_LINGER timeout in seconds.intReturns the socket read timeout in milliseconds.protected voidIncrements the incoming message counter for the given message.protected voidIncrements the outgoing message counter for the given message.booleanIndicates whether this source is currently connected and able to send messages.booleanReturns whether this channel expects keep-alive messages.booleanReturns whether the channel header overrides the message header.protected booleanisRejected(byte[] b) Returns whether the given raw message should be rejected.booleanReturns whether SO_LINGER is enabled on the socket.protected SocketCreates a new socket connected to one of the given hosts/ports.protected Socketfactory method pattern (as suggested by Vincent.Greene@amo.com)protected byte[]Packs the given ISOMsg into raw bytes using this channel's packager.protected voidHook called after a successful connection.protected byte[]readHeader(int hLen) Reads in a message header.receive()Waits and receive an ISOMsg over the TCP/IP sessionvoidIssues a disconnect followed by a connectvoidremoveFilter(ISOFilter filter) Removes a filter from this channel.voidremoveFilter(ISOFilter filter, int direction) Removes a filter from this channel.voidremoveIncomingFilter(ISOFilter filter) Removes a filter from the incoming filter chain.voidremoveOutgoingFilter(ISOFilter filter) Removes a filter from the outgoing filter chain.voidreset stat infovoidsend(byte[] b) sends a byte[] over the TCP/IP sessionvoidSends the specifiedISOMsgover this ISOChannel.voidSends a high-level keep-alive message (zero length)protected voidsendMessage(byte[] b, int offset, int len) Writes the given bytes to the output stream.protected voidsendMessageHeader(ISOMsg m, int len) Sends the message header bytes.protected voidsendMessageLength(int len) Sends the message length prefix; default implementation is a no-op.protected voidsendMessageTrailer(ISOMsg m, byte[] b) Sends the message trailer bytes.protected voidsendMessageTrailler(ISOMsg m, byte[] b) Deprecated.usesendMessageTrailer(ISOMsg, byte[])instead.protected voidsendMessageTrailler(ISOMsg m, int len) Deprecated.use sendMessageTrailer(ISOMsg m, byte[] b) instead.voidImplements Configurable
Properties:
host - destination host (if ClientChannel) port - port number (if ClientChannel) local-iface - local interfase to use (if ClientChannel) local-port - local port to bind (if ClientChannel) (host not present indicates a ServerChannel)voidsetHeader(byte[] header) Sets the message header bytes for this channel.voidSets the message header from a hex string.voidSets the remote host name or address.voidinitialize an ISOChannelvoidsetIncomingFilters(Collection filters) Replaces the entire incoming filter chain with the given collection.voidsetISOMsgMetrics(ISOMsgMetrics metrics) Sets the ISOMsgMetrics instance.voidsetLocalAddress(String iface, int port) initialize an ISOChannelvoidAttaches aLoggerand realm to this log source.voidsetMaxPacketLength(int maxPacketLength) Sets the maximum packet length accepted by this channel.voidassociates this ISOChannel with a name using NameRegistrarvoidsetOutgoingFilters(Collection filters) Replaces the entire outgoing filter chain with the given collection.voidsetOverrideHeader(boolean overrideHeader) Controls whether this channel's own header overrides the message header.voidset Packager for channelvoidsetPort(int port) Sets the remote port number.voidsetServerSocket(ServerSocket sock) Associates this ISOChannel with a server socketvoidsetSocketFactory(ISOClientSocketFactory socketFactory) Sets the specified Socket Factory to create socketsvoidsetSoLinger(boolean on, int linger) Socket SO_LINGER option to use when closing the socket.voidsetTimeout(int timeout) sets socket timeout (as suggested by Leonard Thomas <leonard@rhinosystemsinc.com>)voidsetUsable(boolean b) Marks this channel as usable or not; a non-usable channel will not accept messages.protected booleanshouldIgnore(byte[] b) Returns whether the given raw message should be silently ignored.protected byte[]Reads raw bytes from the stream for protocols without explicit length framing.protected StringtoEndpoint(Socket socket) Returns a human-readable endpoint string for the given socket.protected voidUnpacks raw bytes into the given ISOMsg using this channel's packager.Methods inherited from class Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChangedMethods inherited from class Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ExceptionHandlerAware
addHandler, addHandler, handle, removeHandler, removeHandler, removeHandlersModifier and TypeMethodDescriptiondefault voidaddHandler(ExceptionHandler handler) Add a handler to the default pipeline.default voidaddHandler(ExceptionHandler handler, Class<? extends Exception> clazz) Add a handler to an exception specific pipeline.default ExceptionExecute the pipeline by starting with the specific pipeline for the exception followed by the default pipeline.default voidremoveHandler(ExceptionHandler handler) Remove a handler from the default pipeline.default voidremoveHandler(ExceptionHandler handler, Class<? extends Exception> clazz) Remove a handler from an exception specific handler pipeline.default voidremoveHandlers(Class<? extends Exception> clazz) Remove all handler for a specific exception handling pipeline.
-
Field Details
-
usable
Whether this channel is in a usable state. -
overrideHeader
When true, this channel's own header overrides the message's header. -
serverIn
Input stream for reading from the connected socket. -
serverOut
Output stream for writing to the connected socket. -
serverInLock
Lock guardingserverInand read operations. -
serverOutLock
Lock guardingserverOutand write operations. -
packager
The packager used to pack/unpack ISO messages. -
serverSocket
Server socket used when this channel acts as a server. -
incomingFilters
Incoming and outgoing filter chains. -
outgoingFilters
Incoming and outgoing filter chains. -
socketFactory
Optional factory for creating client sockets. -
cnt
Message counters array. -
logger
-
realm
-
originalRealm
The original realm before any override. -
header
Message header bytes.
-
-
Constructor Details
-
BaseChannel
public BaseChannel()constructor shared by server and client ISOChannels (which have different signatures) -
BaseChannel
constructs a client ISOChannel- Parameters:
host- server TCP Addressport- server port numberp- an ISOPackager- See Also:
-
BaseChannel
constructs a server ISOChannel- Parameters:
p- an ISOPackager- Throws:
IOException- on error on I/O error on I/O error- See Also:
-
BaseChannel
constructs a server ISOChannel associated with a Server Socket- Parameters:
p- an ISOPackagerserverSocket- where to accept a connection- Throws:
IOException- on error on I/O error on I/O error- See Also:
-
-
Method Details
-
setHost
initialize an ISOChannel- Specified by:
setHostin interfaceClientChannel- Parameters:
host- server TCP Addressport- server port number
-
setLocalAddress
initialize an ISOChannel- Parameters:
iface- server TCP Addressport- server port number
-
setHost
Description copied from interface:BaseChannelMBeanSets the remote host name or address.- Specified by:
setHostin interfaceBaseChannelMBean- Parameters:
host- to connect (client ISOChannel)
-
setPort
Description copied from interface:BaseChannelMBeanSets the remote port number.- Specified by:
setPortin interfaceBaseChannelMBean- Parameters:
port- to connect (client ISOChannel)
-
getHost
Description copied from interface:ClientChannelReturns the remote host this client channel connects to.- Specified by:
getHostin interfaceBaseChannelMBean- Specified by:
getHostin interfaceClientChannel- Returns:
- hostname (may be null)
-
getPort
Description copied from interface:ClientChannelReturns the remote port this client channel connects to.- Specified by:
getPortin interfaceBaseChannelMBean- Specified by:
getPortin interfaceClientChannel- Returns:
- port number
-
setPackager
set Packager for channel- Specified by:
setPackagerin interfaceISOChannel- Parameters:
p- an ISOPackager- See Also:
-
getPackager
Description copied from interface:ISOChannelReturns the packager used to pack/unpack ISO messages on this channel.- Specified by:
getPackagerin interfaceISOChannel- Returns:
- current packager
-
setServerSocket
Associates this ISOChannel with a server socket- Parameters:
sock- where to accept a connection
-
getExceptionHandlers
Description copied from interface:ExceptionHandlerAwareReturns the map of targeted exception handlers, keyed by exception class.- Specified by:
getExceptionHandlersin interfaceExceptionHandlerAware- Returns:
- A map of exception classes to exception handlers. These handlers only execute if the exception matches.
-
resetCounters
reset stat info -
getCounters
-
isConnected
Description copied from interface:ISOSourceIndicates whether this source is currently connected and able to send messages.- Specified by:
isConnectedin interfaceBaseChannelMBean- Specified by:
isConnectedin interfaceISOChannel- Specified by:
isConnectedin interfaceISOSource- Returns:
- the connection state
-
setISOMsgMetrics
Description copied from interface:ISOMsgMetrics.SourceSets the ISOMsgMetrics instance.- Specified by:
setISOMsgMetricsin interfaceISOMsgMetrics.Source- Parameters:
metrics- the ISOMsgMetrics to attach
-
getISOMsgMetrics
Description copied from interface:ISOMsgMetrics.SourceReturns the attached ISOMsgMetrics.- Specified by:
getISOMsgMetricsin interfaceISOMsgMetrics.Source- Returns:
- the ISOMsgMetrics, or null
-
connect
setup I/O Streams from socket- Parameters:
socket- a Socket (client or server)- Throws:
IOException- on error on I/O error on I/O error
-
postConnectHook
Hook called after a successful connection. May be overridden by subclasses.- Throws:
IOException- on I/O error
-
newSocket
factory method pattern (as suggested by Vincent.Greene@amo.com)- Parameters:
host- remote hostport- remote port- Returns:
- newly created socket
- Throws:
IOException- on error Use Socket factory if exists. If it is missing create a normal socket- See Also:
-
newSocket
Creates a new socket connected to one of the given hosts/ports.- Parameters:
hosts- array of host names to tryports- corresponding array of port numbersevt- log event for connection diagnostics- Returns:
- the connected socket
- Throws:
IOException- on connection failure
-
getSocket
-
getServerSocket
Returns the current server socket.- Returns:
- current serverSocket
-
setTimeout
sets socket timeout (as suggested by Leonard Thomas <leonard@rhinosystemsinc.com>)- Parameters:
timeout- in milliseconds- Throws:
SocketException- on error
-
getTimeout
Returns the socket read timeout in milliseconds.- Returns:
- socket timeout in milliseconds
-
applyTimeout
sets timeout, and also keep alive- Throws:
SocketException- on error setting the timeout
-
setSoLinger
Socket SO_LINGER option to use when closing the socket.- Parameters:
on- if true, enable SO_LINGERlinger- SO_LINGER timeout in seconds- See Also:
-
isSoLingerOn
Returns whether SO_LINGER is enabled on the socket.- Returns:
- true if SO_LINGER is enabled
-
getSoLingerSeconds
Returns the SO_LINGER timeout in seconds.- Returns:
- SO_LINGER timeout in seconds
-
connect
Connects client ISOChannel to server- Specified by:
connectin interfaceBaseChannelMBean- Specified by:
connectin interfaceISOChannel- Throws:
IOException- on I/O error on I/O error on I/O error
-
accept
Accepts connection- Specified by:
acceptin interfaceServerChannel- Parameters:
s- the server socket to accept on- Throws:
IOException- on I/O error on I/O error on I/O error
-
setUsable
Description copied from interface:ISOChannelMarks this channel as usable or not; a non-usable channel will not accept messages.- Specified by:
setUsablein interfaceISOChannel- Parameters:
b- - new Usable state (used by ISOMUX internals to flag as unusable in order to force a reconnection)
-
getDynamicPackager
allow subclasses to override default packager on outgoing messages- Parameters:
m- outgoing ISOMsg- Returns:
- ISOPackager
-
getDynamicPackager
allow subclasses to override default packager on incoming messages- Parameters:
image- incoming message image- Returns:
- ISOPackager
-
getDynamicPackager
allow subclasses to override default packager on incoming messages- Parameters:
header- message headerimage- incoming message image- Returns:
- ISOPackager
-
getDynamicHeader
Allow subclasses to override the Default header on incoming messages.- Parameters:
image- message image- Returns:
- ISOHeader instance
-
sendMessageLength
Sends the message length prefix; default implementation is a no-op.- Parameters:
len- the message length to send- Throws:
IOException- on I/O error
-
sendMessageHeader
Sends the message header bytes.- Parameters:
m- the ISO message being sentlen- the message length- Throws:
IOException- on I/O error
-
sendMessageTrailler
Deprecated.use sendMessageTrailer(ISOMsg m, byte[] b) instead.- Parameters:
m- a reference to the ISOMsglen- the packed image length- Throws:
IOException- on error
-
sendMessageTrailler
Deprecated.usesendMessageTrailer(ISOMsg, byte[])instead.- Parameters:
m- the ISO message being sentb- the trailer bytes to send- Throws:
IOException- on I/O error
-
sendMessageTrailer
Sends the message trailer bytes.- Parameters:
m- the unpacked ISO messageb- the packed message image- Throws:
IOException- on I/O error
-
getMessageTrailler
Deprecated.usegetMessageTrailer(ISOMsg)instead.- Throws:
IOException- on I/O error
-
getMessageTrailer
Reads the message trailer from the stream and optionally stores it in the given message.- Parameters:
m- the ISOMessage to store the trailer data in- Throws:
IOException- on I/O error- See Also:
-
getMessage
Reads raw message bytes from the stream into the given buffer.- Parameters:
b- the destination bufferoffset- starting offset in the bufferlen- number of bytes to read- Throws:
IOException- on I/O errorISOException- on protocol error
-
getMessageLength
Reads and returns the message length prefix from the stream.- Returns:
- the message length
- Throws:
IOException- on I/O errorISOException- on protocol error
-
getHeaderLength
Returns the fixed header length for this channel.- Returns:
- header length in bytes
-
getHeaderLength
Returns the header length for the given raw message bytes.- Parameters:
b- the raw message bytes- Returns:
- header length in bytes
-
getHeaderLength
Returns the header length for the given ISO message.- Parameters:
m- the ISO message- Returns:
- header length in bytes
-
streamReceive
Reads raw bytes from the stream for protocols without explicit length framing.- Returns:
- the received bytes
- Throws:
IOException- on I/O error
-
sendMessage
Writes the given bytes to the output stream.- Parameters:
b- the byte array to sendoffset- starting offsetlen- number of bytes to send- Throws:
IOException- on I/O error
-
send
Sends the specifiedISOMsgover this ISOChannel.This method performs the following steps:
- Verifies the channel is connected.
- Sets the message direction to
ISOMsg.OUTGOING. - Retrieves and sets a dynamic packager for the message.
- Applies all registered outgoing filters, allowing them to modify or veto the message.
- Packs the message and writes its length, header, body, and trailer to the underlying stream, protected by a locking mechanism to ensure thread safety.
- Flushes the output stream and increments message counters.
- Notifies observers of the sent message.
- Logs both the message and the send operation through
ChannelEventandLogEvent.
ISOFilter.VetoExceptionis thrown by a filter, the message is not sent, and the exception is logged.- Specified by:
sendin interfaceISOChannel- Specified by:
sendin interfaceISOSource- Parameters:
m- the ISO message to be sent. The message will be modified in-place: its direction and packager will be updated, and filters may alter its content.- Throws:
IOException- if the channel is not connected, if the output stream fails, if locking times out, or if an unexpected I/O error occurs.ISOException- if packing the message fails or other ISO-specific issues occur.ISOFilter.VetoException- if an outgoing filter vetoes the message.- See Also:
-
send
sends a byte[] over the TCP/IP session- Specified by:
sendin interfaceISOChannel- Parameters:
b- the byte array to be sent- Throws:
IOException- on I/O error on I/O error on I/O errorISOException- on ISO processing errorISOFilter.VetoException- if a filter vetoes the message
-
sendKeepAlive
Sends a high-level keep-alive message (zero length)- Throws:
IOException- on exception
-
isExpectKeepAlive
Returns whether this channel expects keep-alive messages.- Returns:
- true if keep-alive is expected
-
isRejected
Returns whether the given raw message should be rejected.- Parameters:
b- the raw message bytes- Returns:
- true if the message should be rejected
-
shouldIgnore
Returns whether the given raw message should be silently ignored.- Parameters:
b- the raw message bytes- Returns:
- true if the message should be ignored
-
createMsg
-
createISOMsg
Creates a new ISOMsg instance; may be overridden to return a subclass.- Returns:
- a new ISOMsg
-
readHeader
Reads in a message header.- Parameters:
hLen- The Length og the reader to read- Returns:
- The header bytes that were read in
- Throws:
IOException- on error
-
receive
Waits and receive an ISOMsg over the TCP/IP session- Specified by:
receivein interfaceISOChannel- Returns:
- the Message received
- Throws:
IOException- on I/O errorISOException- on ISO processing error
-
getBytes
Low level receive- Parameters:
b- byte array- Returns:
- the total number of bytes read into the buffer, or -1 if there is no more data because the end of the stream has been reached.
- Throws:
IOException- on error
-
disconnect
disconnects the TCP/IP session. The instance is ready for a reconnection. There is no need to create a new ISOChannel- Specified by:
disconnectin interfaceBaseChannelMBean- Specified by:
disconnectin interfaceISOChannel- Throws:
IOException- on I/O error on I/O error on I/O error
-
reconnect
Issues a disconnect followed by a connect- Specified by:
reconnectin interfaceBaseChannelMBean- Specified by:
reconnectin interfaceISOChannel- Throws:
IOException- on I/O error on I/O error on I/O error
-
setLogger
-
getRealm
-
getLogger
-
toEndpoint
Returns a human-readable endpoint string for the given socket.- Parameters:
socket- the connected socket- Returns:
- endpoint string in the form host:port
-
getOriginalRealm
Returns the original realm before any override was applied.- Returns:
- the original realm string
-
setName
associates this ISOChannel with a name using NameRegistrar- Specified by:
setNamein interfaceISOChannel- Parameters:
name- name to register- See Also:
-
getName
Description copied from interface:ISOChannelReturns this channel's registered name.- Specified by:
getNamein interfaceISOChannel- Returns:
- this ISOChannel's name ("" if no name was set)
-
addFilter
-
addIncomingFilter
Description copied from interface:FilteredChannelAdds a filter to the incoming filter chain.- Specified by:
addIncomingFilterin interfaceFilteredChannel- Parameters:
filter- incoming filter to add
-
addOutgoingFilter
Description copied from interface:FilteredChannelAdds a filter to the outgoing filter chain.- Specified by:
addOutgoingFilterin interfaceFilteredChannel- Parameters:
filter- outgoing filter to add
-
addFilter
Adds a filter to this channel.- Specified by:
addFilterin interfaceFilteredChannel- Parameters:
filter- filter to add (both directions, incoming/outgoing)
-
removeFilter
Removes a filter from this channel.- Parameters:
filter- filter to removedirection- ISOMsg.INCOMING, ISOMsg.OUTGOING, 0 for both
-
removeFilter
Removes a filter from this channel.- Specified by:
removeFilterin interfaceFilteredChannel- Parameters:
filter- filter to remove (both directions)
-
removeIncomingFilter
Description copied from interface:FilteredChannelRemoves a filter from the incoming filter chain.- Specified by:
removeIncomingFilterin interfaceFilteredChannel- Parameters:
filter- incoming filter to remove
-
removeOutgoingFilter
Description copied from interface:FilteredChannelRemoves a filter from the outgoing filter chain.- Specified by:
removeOutgoingFilterin interfaceFilteredChannel- Parameters:
filter- outgoing filter to remove
-
applyOutgoingFilters
Applies all registered outgoing filters to the given message.- Parameters:
m- the message to filterevt- the log event for diagnostics- Returns:
- the filtered message
- Throws:
ISOFilter.VetoException- if a filter vetoes the message
-
applyIncomingFilters
Applies all registered incoming filters to the given message.- Parameters:
m- the message to filterevt- the log event for diagnostics- Returns:
- the filtered message
- Throws:
ISOFilter.VetoException- if a filter vetoes the message
-
applyIncomingFilters
protected ISOMsg applyIncomingFilters(ISOMsg m, byte[] header, byte[] image, LogEvent evt) throws ISOFilter.VetoException Applies all registered incoming filters with the raw message header and image.- Parameters:
m- the decoded messageheader- the message header bytesimage- the raw message bytesevt- the log event for diagnostics- Returns:
- the filtered message
- Throws:
ISOFilter.VetoException- if a filter vetoes the message
-
unpack
Unpacks raw bytes into the given ISOMsg using this channel's packager.- Parameters:
m- the message to populateb- the raw bytes to unpack- Throws:
ISOException- on unpack error
-
pack
Packs the given ISOMsg into raw bytes using this channel's packager.- Parameters:
m- the message to pack- Returns:
- the packed byte array
- Throws:
ISOException- on pack error
-
setConfiguration
Implements Configurable
Properties:
- host - destination host (if ClientChannel)
- port - port number (if ClientChannel)
- local-iface - local interfase to use (if ClientChannel)
- local-port - local port to bind (if ClientChannel)
- Specified by:
setConfigurationin interfaceConfigurable- Parameters:
cfg- Configuration- Throws:
ConfigurationException- if configuration is invalid
-
getConfiguration
Returns the current configuration for this channel.- Returns:
- the current
Configuration
-
getIncomingFilters
Description copied from interface:FilteredChannelReturns all filters in the incoming filter chain.- Specified by:
getIncomingFiltersin interfaceFilteredChannel- Returns:
- Collection containing all incoming filters
-
getOutgoingFilters
Description copied from interface:FilteredChannelReturns all filters in the outgoing filter chain.- Specified by:
getOutgoingFiltersin interfaceFilteredChannel- Returns:
- Collection containing all outgoing filters
-
setIncomingFilters
Description copied from interface:FilteredChannelReplaces the entire incoming filter chain with the given collection.- Specified by:
setIncomingFiltersin interfaceFilteredChannel- Parameters:
filters- incoming filter set
-
setOutgoingFilters
Description copied from interface:FilteredChannelReplaces the entire outgoing filter chain with the given collection.- Specified by:
setOutgoingFiltersin interfaceFilteredChannel- Parameters:
filters- outgoing filter set
-
setHeader
Sets the message header bytes for this channel.- Parameters:
header- the header bytes
-
setHeader
-
getHeader
Returns the message header bytes.- Returns:
- the header bytes, or null if not set
-
setOverrideHeader
Controls whether this channel's own header overrides the message header.- Parameters:
overrideHeader- if true, the channel header takes precedence
-
isOverrideHeader
Returns whether the channel header overrides the message header.- Returns:
- true if override is active
-
getChannel
Retrieves a channel instance by name from the NameRegistrar.- Parameters:
name- the Channel's name (without the "channel." prefix)- Returns:
- ISOChannel instance with given name.
- Throws:
NameRegistrar.NotFoundException- if no channel with that name is registered- See Also:
-
getSocketFactory
Gets the ISOClientSocketFactory (may be null)- Returns:
- ISOClientSocketFactory
- Since:
- 1.3.3 \
- See Also:
-
setSocketFactory
Sets the specified Socket Factory to create sockets- Specified by:
setSocketFactoryin interfaceFactoryChannel- Parameters:
socketFactory- the ISOClientSocketFactory- Since:
- 1.3.3
- See Also:
-
getMaxPacketLength
Returns the maximum packet length accepted by this channel.- Returns:
- maximum packet length in bytes
-
setMaxPacketLength
Sets the maximum packet length accepted by this channel.- Parameters:
maxPacketLength- maximum packet length in bytes
-
closeSocket
Closes the underlying socket.- Throws:
IOException- on I/O error
-
clone
Description copied from interface:ISOChannelReturns a clone of this channel.- Specified by:
clonein interfaceISOChannel- Overrides:
clonein classObject- Returns:
- a deep copy of this ISOChannel
-
incrementMsgInCounter
Increments the incoming message counter for the given message.- Parameters:
m- the received message- Throws:
ISOException- on error
-
incrementMsgOutCounter
Increments the outgoing message counter for the given message.- Parameters:
m- the sent message- Throws:
ISOException- on error
-
getMessageTrailer(ISOMsg)instead.