org.cafesip.jiplet
Class SipConnector

java.lang.Object
  extended by java.util.TimerTask
      extended by org.cafesip.jiplet.SipConnector
All Implemented Interfaces:
java.lang.Runnable, java.util.EventListener, javax.sip.SipListener

public class SipConnector
extends java.util.TimerTask
implements javax.sip.SipListener

This class encapsulates a SIP connector. A connector identifies one or more server "ports" that the jiplet container listens to for connections and SIP messages. A port is identified by a host name/IP address, protocol (UDP/TCP) and port number. A connector can have more than one IP address in its port list. The jiplet container supports multiple connectors. A jiplet context may be associated with more than one connector. A jiplet within a context is associated with only one connector.

For each unique address + port combination in a connector's port list, a 'SIP Provider' is created. Within that, for each transport (type) configured for that address + port combination, a 'Listening Point' is created and associated with the SIP provider.

The connectors are described in the descriptor file server.xml. One of the connectors can be set as a default connector (see the descriptor file server.xml). When set as a default connector, a context is assigned to the connector if no connectors are specified in the jip.xml descriptor for the context.


Constructor Summary
protected SipConnector(JipConnector c)
          A constructor for this class.
 
Method Summary
protected  java.lang.String addMapping(Mapping mapping, JipletContext context)
           
protected  int addToTransactionsList(JipletTransaction transaction)
           
protected  void cancelTransaction(JipletTransaction transaction)
           
protected  void destroy()
           
protected  javax.sip.SipProvider findSipProvider(java.lang.String address, int port)
          Returns the SipProvider corresponding to the given address and port.
 javax.sip.address.AddressFactory getAddressFactory()
           
protected  JipConnector getConnectorProperty()
           
 javax.sip.header.HeaderFactory getHeaderFactory()
           
 int getMaxThreadCount()
           
 javax.sip.message.MessageFactory getMessageFactory()
           
 int getMinThreadCount()
           
 java.lang.String getName()
           
protected  java.util.ArrayList getPortInfo()
           
protected  java.util.ArrayList getPortList()
           
protected  java.util.Properties getProperties()
           
protected  java.lang.String getProviderId(javax.sip.SipProvider p)
           
 java.util.ArrayList getSipProviders()
           
protected  java.lang.String getStackImpl()
           
protected  java.util.Timer getTimer()
           
protected  void init(JipConnector c)
           
protected  boolean portListContains(java.lang.String host, int port)
           
 void processDialogTerminated(javax.sip.DialogTerminatedEvent arg0)
           
 void processIOException(javax.sip.IOExceptionEvent arg0)
           
 void processRequest(javax.sip.RequestEvent ev)
           
 void processResponse(javax.sip.ResponseEvent ev)
           
protected  boolean processSignal(Jiplet jiplet, JipletSignal signal)
           
 void processTimeout(javax.sip.TimeoutEvent ev)
           
 void processTimer(TimerEvent e)
           
 void processTransactionTerminated(javax.sip.TransactionTerminatedEvent arg0)
           
protected  boolean providerSupportsProtocol(javax.sip.SipProvider provider, java.lang.String proto)
           
protected  void removeMapping(JipletContext context)
           
 void run()
           
 void setMaxThreadCount(int maxThreadCount)
           
 void setMinThreadCount(int minThreadCount)
           
 
Methods inherited from class java.util.TimerTask
cancel, scheduledExecutionTime
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SipConnector

protected SipConnector(JipConnector c)
                throws java.lang.Exception
A constructor for this class.

Parameters:
c -
Throws:
java.lang.Exception
Method Detail

getSipProviders

public java.util.ArrayList getSipProviders()
Returns:
Returns the SipProviders associated with this connector.

findSipProvider

protected javax.sip.SipProvider findSipProvider(java.lang.String address,
                                                int port)
Returns the SipProvider corresponding to the given address and port.

Parameters:
address - IP address
port - signaling port
Returns:
the corresponding SipProvider or null if it doesn't exist or has no listening points.

providerSupportsProtocol

protected boolean providerSupportsProtocol(javax.sip.SipProvider provider,
                                           java.lang.String proto)

portListContains

protected boolean portListContains(java.lang.String host,
                                   int port)

getName

public java.lang.String getName()
Returns:
Returns the name.

init

protected void init(JipConnector c)
             throws java.lang.Exception
Throws:
java.lang.Exception

getAddressFactory

public javax.sip.address.AddressFactory getAddressFactory()
Returns:
Returns the addressFactory.

getHeaderFactory

public javax.sip.header.HeaderFactory getHeaderFactory()
Returns:
Returns the headerFactory.

getMessageFactory

public javax.sip.message.MessageFactory getMessageFactory()
Returns:
Returns the messageFactory.

addMapping

protected java.lang.String addMapping(Mapping mapping,
                                      JipletContext context)
                               throws JipletException
Throws:
JipletException

removeMapping

protected void removeMapping(JipletContext context)

getProviderId

protected java.lang.String getProviderId(javax.sip.SipProvider p)

processTimer

public void processTimer(TimerEvent e)

processRequest

public void processRequest(javax.sip.RequestEvent ev)
Specified by:
processRequest in interface javax.sip.SipListener

processResponse

public void processResponse(javax.sip.ResponseEvent ev)
Specified by:
processResponse in interface javax.sip.SipListener

processTimeout

public void processTimeout(javax.sip.TimeoutEvent ev)
Specified by:
processTimeout in interface javax.sip.SipListener

destroy

protected void destroy()

getTimer

protected java.util.Timer getTimer()
Returns:
Returns the timer.

addToTransactionsList

protected int addToTransactionsList(JipletTransaction transaction)

run

public void run()
Specified by:
run in interface java.lang.Runnable
Specified by:
run in class java.util.TimerTask

cancelTransaction

protected void cancelTransaction(JipletTransaction transaction)

getConnectorProperty

protected JipConnector getConnectorProperty()
Returns:
Returns the connectorProperty.

getProperties

protected java.util.Properties getProperties()
Returns:
Returns the properties.

getStackImpl

protected java.lang.String getStackImpl()
Returns:
Returns the stackImpl.

getPortInfo

protected java.util.ArrayList getPortInfo()
Returns:
Returns the portInfo as an ArrayList of String.

getPortList

protected java.util.ArrayList getPortList()
Returns:
Returns the portList.

processSignal

protected boolean processSignal(Jiplet jiplet,
                                JipletSignal signal)

getMinThreadCount

public int getMinThreadCount()
Returns:
Returns the minThreadCount.

setMinThreadCount

public void setMinThreadCount(int minThreadCount)
Parameters:
minThreadCount - The minThreadCount to set.

getMaxThreadCount

public int getMaxThreadCount()
Returns:
Returns the maxThreadCount.

setMaxThreadCount

public void setMaxThreadCount(int maxThreadCount)
Parameters:
maxThreadCount - The maxThreadCount to set.

processIOException

public void processIOException(javax.sip.IOExceptionEvent arg0)
Specified by:
processIOException in interface javax.sip.SipListener

processTransactionTerminated

public void processTransactionTerminated(javax.sip.TransactionTerminatedEvent arg0)
Specified by:
processTransactionTerminated in interface javax.sip.SipListener

processDialogTerminated

public void processDialogTerminated(javax.sip.DialogTerminatedEvent arg0)
Specified by:
processDialogTerminated in interface javax.sip.SipListener


http://www.cafesip.org