org.jpos.q2.iso
Class ChannelAdaptor

java.lang.Object
  extended by org.jpos.q2.QBeanSupport
      extended by org.jpos.q2.iso.ChannelAdaptor
All Implemented Interfaces:
Configurable, Channel, ChannelAdaptorMBean, QBean, QBeanSupportMBean, QPersist, Loggeable
Direct Known Subclasses:
MultiSessionChannelAdaptor

public class ChannelAdaptor
extends QBeanSupport
implements ChannelAdaptorMBean, Channel, Loggeable

Author:
Alejandro Revilla

Nested Class Summary
 class ChannelAdaptor.Receiver
           
 class ChannelAdaptor.Sender
           
 
Field Summary
 
Fields inherited from class org.jpos.q2.QBeanSupport
cfg, log
 
Fields inherited from interface org.jpos.q2.QBean
DESTROYED, FAILED, STARTED, STARTING, stateString, STOPPED, STOPPING
 
Constructor Summary
ChannelAdaptor()
           
 
Method Summary
protected  void addFilters(FilteredChannel channel, org.jdom.Element e, QFactory fact)
           
protected  void append(StringBuffer sb, String name, int value)
           
protected  void checkConnection()
           
 void destroyService()
           
protected  void disconnect()
           
 void dump(PrintStream p, String indent)
           
 int getConnectsCounter()
           
 String getCountersAsString()
           
 String getHost()
           
 long getIdleTimeInMillis()
           
 String getInQueue()
           
 long getLastTxnTimestampInMillis()
           
 String getOutQueue()
           
 int getPort()
           
 long getReconnectDelay()
           
 int getRXCounter()
           
 String getSocketFactory()
           
 int getTXCounter()
           
protected  Space grabSpace(org.jdom.Element e)
           
protected  ISOChannel initChannel()
           
 void initService()
           
protected  void initSpaceAndQueues()
           
 boolean isConnected()
           
 ISOChannel newChannel(org.jdom.Element e, QFactory f)
           
 ISOMsg receive()
          Receive message
 ISOMsg receive(long timeout)
          Receive message
 void resetCounters()
           
 void send(ISOMsg m)
          Queue a message to be transmitted by this adaptor
 void send(ISOMsg m, long timeout)
          Queue a message to be transmitted by this adaptor
 void setHost(String host)
           
 void setInQueue(String in)
           
 void setOutQueue(String out)
           
 void setPort(int port)
           
 void setReconnectDelay(long delay)
           
 void setSocketFactory(String sFac)
           
 void startService()
           
 void stopService()
           
 
Methods inherited from class org.jpos.q2.QBeanSupport
addAttr, createElement, destroy, getAttrs, getAttrs, getConfiguration, getFactory, getLoader, getLoaderURLS, getLog, getLogger, getName, getPersist, getProperties, getProperty, getRealm, getServer, getState, getStateAsString, init, isModified, running, setAttr, setConfiguration, setLogger, setModified, setName, setPersist, setProperty, setRealm, setServer, setState, shutdownQ2, start, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jpos.q2.QBeanSupportMBean
getLoader, getLoaderURLS, getLogger, getName, getRealm, getServer, setLogger, setName, setPersist, setRealm, setServer, shutdownQ2
 
Methods inherited from interface org.jpos.q2.QBean
destroy, getState, getStateAsString, init, start, stop
 
Methods inherited from interface org.jpos.q2.QPersist
getPersist, isModified
 

Constructor Detail

ChannelAdaptor

public ChannelAdaptor()
Method Detail

initService

public void initService()
                 throws ConfigurationException
Overrides:
initService in class QBeanSupport
Throws:
ConfigurationException

startService

public void startService()
Overrides:
startService in class QBeanSupport

stopService

public void stopService()
Overrides:
stopService in class QBeanSupport

destroyService

public void destroyService()
Overrides:
destroyService in class QBeanSupport

setReconnectDelay

public void setReconnectDelay(long delay)
Specified by:
setReconnectDelay in interface ChannelAdaptorMBean

getReconnectDelay

public long getReconnectDelay()
Specified by:
getReconnectDelay in interface ChannelAdaptorMBean

setInQueue

public void setInQueue(String in)
Specified by:
setInQueue in interface ChannelAdaptorMBean

getInQueue

public String getInQueue()
Specified by:
getInQueue in interface ChannelAdaptorMBean

setOutQueue

public void setOutQueue(String out)
Specified by:
setOutQueue in interface ChannelAdaptorMBean

send

public void send(ISOMsg m)
Queue a message to be transmitted by this adaptor

Specified by:
send in interface Channel
Parameters:
m - message to send

send

public void send(ISOMsg m,
                 long timeout)
Queue a message to be transmitted by this adaptor

Parameters:
m - message to send
timeout -

receive

public ISOMsg receive()
Receive message

Specified by:
receive in interface Channel
Returns:
received message

receive

public ISOMsg receive(long timeout)
Receive message

Specified by:
receive in interface Channel
Parameters:
timeout - time to wait for an incoming message
Returns:
received message or null

isConnected

public boolean isConnected()
Specified by:
isConnected in interface ChannelAdaptorMBean
Returns:
true if channel is connected

getOutQueue

public String getOutQueue()
Specified by:
getOutQueue in interface ChannelAdaptorMBean

newChannel

public ISOChannel newChannel(org.jdom.Element e,
                             QFactory f)
                      throws ConfigurationException
Throws:
ConfigurationException

addFilters

protected void addFilters(FilteredChannel channel,
                          org.jdom.Element e,
                          QFactory fact)
                   throws ConfigurationException
Throws:
ConfigurationException

initChannel

protected ISOChannel initChannel()
                          throws ConfigurationException
Throws:
ConfigurationException

initSpaceAndQueues

protected void initSpaceAndQueues()
                           throws ConfigurationException
Throws:
ConfigurationException

checkConnection

protected void checkConnection()

disconnect

protected void disconnect()

setHost

public void setHost(String host)
Specified by:
setHost in interface ChannelAdaptorMBean

getHost

public String getHost()
Specified by:
getHost in interface ChannelAdaptorMBean

setPort

public void setPort(int port)
Specified by:
setPort in interface ChannelAdaptorMBean

getPort

public int getPort()
Specified by:
getPort in interface ChannelAdaptorMBean

setSocketFactory

public void setSocketFactory(String sFac)
Specified by:
setSocketFactory in interface ChannelAdaptorMBean

resetCounters

public void resetCounters()
Specified by:
resetCounters in interface ChannelAdaptorMBean

getCountersAsString

public String getCountersAsString()
Specified by:
getCountersAsString in interface ChannelAdaptorMBean

getTXCounter

public int getTXCounter()
Specified by:
getTXCounter in interface ChannelAdaptorMBean

getRXCounter

public int getRXCounter()
Specified by:
getRXCounter in interface ChannelAdaptorMBean

getConnectsCounter

public int getConnectsCounter()
Specified by:
getConnectsCounter in interface ChannelAdaptorMBean

getLastTxnTimestampInMillis

public long getLastTxnTimestampInMillis()
Specified by:
getLastTxnTimestampInMillis in interface ChannelAdaptorMBean

getIdleTimeInMillis

public long getIdleTimeInMillis()
Specified by:
getIdleTimeInMillis in interface ChannelAdaptorMBean

getSocketFactory

public String getSocketFactory()
Specified by:
getSocketFactory in interface ChannelAdaptorMBean

dump

public void dump(PrintStream p,
                 String indent)
Specified by:
dump in interface Loggeable

grabSpace

protected Space grabSpace(org.jdom.Element e)

append

protected void append(StringBuffer sb,
                      String name,
                      int value)


Copyright © 1998-2012 jPOS.org. All Rights Reserved.