Class PADChannel
java.lang.Object
java.util.Observable
org.jpos.iso.BaseChannel
org.jpos.iso.channel.PADChannel
- All Implemented Interfaces:
Cloneable, Configurable, ExceptionHandlerAware, BaseChannelMBean, ClientChannel, FactoryChannel, FilteredChannel, ISOChannel, ISOSource, ServerChannel, ISOMsgMetrics.Source, LogSource
Implements an ISOChannel suitable to be used to connect to an X.25 PAD.
- See Also:
-
Field Summary
Fields inherited from class BaseChannel
cnt, header, incomingFilters, logger, originalRealm, outgoingFilters, overrideHeader, packager, realm, serverIn, serverInLock, serverOut, serverOutLock, serverSocket, socketFactory, usableFields inherited from interface ISOChannel
CONNECT, RX, SIZEOF_CNT, TX -
Constructor Summary
ConstructorsConstructorDescriptionNo-args constructorPADChannel(String host, int port, ISOPackager p) Constructs client ISOChannelConstruct server ISOChannelPADChannel(ISOPackager p, ServerSocket serverSocket) constructs a server ISOChannel associated with a Server Socket -
Method Summary
Modifier and TypeMethodDescriptionreceive()Waits and receive an ISOMsg over the TCP/IP sessionvoidSends the specifiedISOMsgover this ISOChannel.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)voidMethods inherited from class BaseChannel
accept, addFilter, addFilter, addIncomingFilter, addOutgoingFilter, applyIncomingFilters, applyIncomingFilters, applyOutgoingFilters, applyTimeout, clone, closeSocket, connect, connect, createISOMsg, createMsg, disconnect, getBytes, getChannel, getConfiguration, getCounters, getDynamicHeader, getDynamicPackager, getDynamicPackager, getDynamicPackager, getExceptionHandlers, getHeader, getHeaderLength, getHeaderLength, getHeaderLength, getHost, getIncomingFilters, getISOMsgMetrics, getLogger, getMaxPacketLength, getMessage, getMessageLength, getMessageTrailer, getMessageTrailler, getName, getOriginalRealm, getOutgoingFilters, getPackager, getPort, getRealm, getServerSocket, getSocket, getSocketFactory, getSoLingerSeconds, getTimeout, incrementMsgInCounter, incrementMsgOutCounter, isConnected, isExpectKeepAlive, isOverrideHeader, isRejected, isSoLingerOn, newSocket, newSocket, pack, postConnectHook, readHeader, reconnect, removeFilter, removeFilter, removeIncomingFilter, removeOutgoingFilter, resetCounters, send, sendKeepAlive, sendMessage, sendMessageHeader, sendMessageLength, sendMessageTrailer, sendMessageTrailler, sendMessageTrailler, setHeader, setHost, setHost, setIncomingFilters, setISOMsgMetrics, setLocalAddress, setLogger, setMaxPacketLength, setName, setOutgoingFilters, setOverrideHeader, setPackager, setPort, setServerSocket, setSocketFactory, setSoLinger, setTimeout, setUsable, shouldIgnore, streamReceive, unpackMethods 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, removeHandlers
-
Constructor Details
-
PADChannel
public PADChannel()No-args constructor -
PADChannel
Constructs client ISOChannel- Parameters:
host- server TCP Addressport- server port numberp- an ISOPackager- See Also:
-
PADChannel
Construct server ISOChannel- Parameters:
p- an ISOPackager- Throws:
IOException- See Also:
-
PADChannel
constructs a server ISOChannel associated with a Server Socket- Parameters:
p- an ISOPackagerserverSocket- where to accept a connection- Throws:
IOException- See Also:
-
-
Method Details
-
receive
Description copied from class:BaseChannelWaits and receive an ISOMsg over the TCP/IP session- Specified by:
receivein interfaceISOChannel- Overrides:
receivein classBaseChannel- Returns:
- the Message received
- Throws:
IOExceptionISOException
-
send
Description copied from class:BaseChannelSends 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- Overrides:
sendin classBaseChannel- 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.- See Also:
-
setConfiguration
Description copied from class:BaseChannelImplements 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- Overrides:
setConfigurationin classBaseChannel- Parameters:
cfg- Configuration- Throws:
ConfigurationException
-
setHeader
- Overrides:
setHeaderin classBaseChannel- Parameters:
header- Hex representation of header
-