Package org.jpos.iso.channel
Class ChannelPool
- java.lang.Object
-
- org.jpos.iso.channel.ChannelPool
-
- All Implemented Interfaces:
java.lang.Cloneable
,Configurable
,ISOChannel
,ISOSource
,LogSource
public class ChannelPool extends java.lang.Object implements ISOChannel, LogSource, Configurable, java.lang.Cloneable
-
-
Field Summary
Fields Modifier and Type Field Description protected Logger
logger
protected java.lang.String
realm
-
Fields inherited from interface org.jpos.iso.ISOChannel
CONNECT, RX, SIZEOF_CNT, TX
-
-
Constructor Summary
Constructors Constructor Description ChannelPool()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addChannel(java.lang.String name)
void
addChannel(ISOChannel channel)
java.lang.Object
clone()
Expose channel clonning interfacevoid
connect()
Connects ISOChannelvoid
disconnect()
disconnects ISOChannelISOChannel
getCurrent()
Logger
getLogger()
java.lang.String
getName()
ISOPackager
getPackager()
java.lang.String
getRealm()
boolean
isConnected()
ISOMsg
receive()
Receives an ISOMsgvoid
reconnect()
Reconnect channelvoid
removeChannel(java.lang.String name)
void
removeChannel(ISOChannel channel)
void
send(byte[] b)
sends a byte[] over the TCP/IP sessionvoid
send(ISOMsg m)
sends an ISOMsg over the TCP/IP sessionvoid
setConfiguration(Configuration cfg)
void
setLogger(Logger logger, java.lang.String realm)
void
setName(java.lang.String name)
associates this ISOChannel with a name on NameRegistrarvoid
setPackager(ISOPackager p)
Associate a packager with this channelvoid
setUsable(boolean b)
int
size()
-
-
-
Constructor Detail
-
ChannelPool
public ChannelPool()
-
-
Method Detail
-
setPackager
public void setPackager(ISOPackager p)
Description copied from interface:ISOChannel
Associate a packager with this channel- Specified by:
setPackager
in interfaceISOChannel
- Parameters:
p
- an ISOPackager
-
connect
public void connect() throws java.io.IOException
Description copied from interface:ISOChannel
Connects ISOChannel- Specified by:
connect
in interfaceISOChannel
- Throws:
java.io.IOException
-
disconnect
public void disconnect() throws java.io.IOException
Description copied from interface:ISOChannel
disconnects ISOChannel- Specified by:
disconnect
in interfaceISOChannel
- Throws:
java.io.IOException
-
reconnect
public void reconnect() throws java.io.IOException
Description copied from interface:ISOChannel
Reconnect channel- Specified by:
reconnect
in interfaceISOChannel
- Throws:
java.io.IOException
-
isConnected
public boolean isConnected()
- Specified by:
isConnected
in interfaceISOChannel
- Specified by:
isConnected
in interfaceISOSource
- Returns:
- true if Channel is connected and usable
-
receive
public ISOMsg receive() throws java.io.IOException, ISOException
Description copied from interface:ISOChannel
Receives an ISOMsg- Specified by:
receive
in interfaceISOChannel
- Returns:
- the Message received
- Throws:
java.io.IOException
ISOException
-
send
public void send(ISOMsg m) throws java.io.IOException, ISOException
Description copied from interface:ISOChannel
sends an ISOMsg over the TCP/IP session- Specified by:
send
in interfaceISOChannel
- Specified by:
send
in interfaceISOSource
- Parameters:
m
- the Message to be sent- Throws:
java.io.IOException
ISOException
-
send
public void send(byte[] b) throws java.io.IOException, ISOException
Description copied from interface:ISOChannel
sends a byte[] over the TCP/IP session- Specified by:
send
in interfaceISOChannel
- Parameters:
b
- the byte array to be sent- Throws:
java.io.IOException
ISOException
-
setUsable
public void setUsable(boolean b)
- Specified by:
setUsable
in interfaceISOChannel
- Parameters:
b
- - usable state
-
setName
public void setName(java.lang.String name)
Description copied from interface:ISOChannel
associates this ISOChannel with a name on NameRegistrar- Specified by:
setName
in interfaceISOChannel
- Parameters:
name
- name to register- See Also:
NameRegistrar
-
getName
public java.lang.String getName()
- Specified by:
getName
in interfaceISOChannel
- Returns:
- this ISOChannel's name ("" if no name was set)
-
getPackager
public ISOPackager getPackager()
- Specified by:
getPackager
in interfaceISOChannel
- Returns:
- current packager
-
setConfiguration
public void setConfiguration(Configuration cfg) throws ConfigurationException
- Specified by:
setConfiguration
in interfaceConfigurable
- Parameters:
cfg
- Configuration object- Throws:
ConfigurationException
-
addChannel
public void addChannel(ISOChannel channel)
-
addChannel
public void addChannel(java.lang.String name) throws NameRegistrar.NotFoundException
- Throws:
NameRegistrar.NotFoundException
-
removeChannel
public void removeChannel(ISOChannel channel)
-
removeChannel
public void removeChannel(java.lang.String name) throws NameRegistrar.NotFoundException
- Throws:
NameRegistrar.NotFoundException
-
size
public int size()
-
getCurrent
public ISOChannel getCurrent() throws java.io.IOException
- Throws:
java.io.IOException
-
clone
public java.lang.Object clone()
Description copied from interface:ISOChannel
Expose channel clonning interface- Specified by:
clone
in interfaceISOChannel
- Overrides:
clone
in classjava.lang.Object
-
-