Java Doc for SIPMessageStack.java in  » 6.0-JDK-Modules » j2me » gov » nist » siplite » stack » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » 6.0 JDK Modules » j2me » gov.nist.siplite.stack 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   gov.nist.siplite.stack.SIPMessageStack

All known Subclasses:   gov.nist.siplite.stack.SIPTransactionStack,
SIPMessageStack
abstract public class SIPMessageStack (Code)
This class defines a SIP Stack. In order to build a SIP server (UAS/UAC or Proxy etc.) you need to extend this class and instantiate it in your application. After you have done so, call SIPMessageStack.createMessageProcessor to create message processors and then start these message processors to get the stack the process messages. This will start the necessary threads that wait for incoming SIP messages. A general note about the handler structures -- handlers are expected to returnResponse for successful message processing and throw SIPServerException for unsuccessful message processing. This code is in the public domain.


Field Summary
protected  StringbadMessageLog
     Bad message log.
protected  booleandebugFlag
    
protected  intmaxConnections
     Max number of simultaneous connections.
protected  intoutboundPort
     The outbound proxy server port.
protected  StringoutboundProxy
     The outbound proxy location.
protected  Routerrouter
     Router to determine where to forward the request.
protected  SecurityTokensecurityToken
    
protected  SIPStackMessageFactorysipMessageFactory
     Request factory interface (to be provided by the application).
protected  StringstackAddress
     IP address of stack.
protected  StringstackName
     Name of the stack.
protected  booleantcpFlag
     Flag indicating tcp connection in use.
protected  intthreadPoolSize
     Starts a single processing thread for all UDP messages (otherwise, the stack will start a new thread for each UDP message).
protected  booleantoExit
     Flag that indicates that the stack is active.
protected  booleanudpFlag
     Flag indicating udp connection in use.

Constructor Summary
public  SIPMessageStack(SIPStackMessageFactory messageFactory, String stackAddress, String stackName)
     Construcor for the stack.
public  SIPMessageStack()
     Default constructor.

Method Summary
public  voidaddMessageProcessor(MessageProcessor newMessageProcessor)
     Adds a new MessageProcessor to the list of running processors for this SIPMessageStack and starts it.
public  MessageChannelcreateMessageChannel(Hop nextHop)
     Creates a new MessageChannel for a given Hop.
Parameters:
  nextHop - Hop to create a MessageChannel to.
public  MessageProcessorcreateMessageProcessor(int port, String transport)
     Creates the equivalent of a JAIN listening point and attaches to the stack.
public  StringgetBadMessageLog()
     Gets the file name of the bad message log.
public  HopgetDefaultRoute()
     Gets the default route.
public  RouteHeadergetDefaultRouteHeader()
     Gets the route header corresponding to the default route.
public  StringgetHostAddress()
     Gets my address.
public  MessageProcessorgetMessageProcessor(String transport)
     Gets a message processor for the given transport.
public  VectorgetMessageProcessors()
     Gets an array of running MessageProcessors on this SIPMessageStack.
public  HopgetNextHop()
     Gets the default next hop from the router.
public  intgetPort(String transport)
     Gets port of the message processor (based on the transport).
public  RouteHeadergetRouteHeader(Hop hop)
     Gets the route header for this hop.
public  RoutergetRouter()
     Gets the router algorithm.
protected  SecurityTokengetSecurityToken()
    
public  StringgetStackName()
     Gets the Stack name.
public synchronized  booleanisAlive()
     Returns the status of the toExit flag.
public  booleanisTransportEnabled(String transport)
     Returns true if a transport is enabled.
Parameters:
  transport - is the transport to check.
public  booleanisTransportEnabled(String transport, int port)
     Returns true if the transport is enabled for a given port.
Parameters:
  transport - transport to check
Parameters:
  port - port to check transport at.
public  voidlogBadMessage(String message)
     Logs a bad message (invoked when a parse exception arises).
protected  SIPServerRequestInterfacenewSIPServerRequest(Request siprequest, MessageChannel msgchan)
     Generates a new SIPSeverRequest from the given Request.
 SIPServerResponseInterfacenewSIPServerResponse(Response sipresponse, MessageChannel msgchan)
     Generates a new SIPSeverResponse from the given Response.
Parameters:
  sipresponse - Response from which the SIPServerResponseis to be generated.
public  voidremoveMessageProcessor(MessageProcessor oldMessageProcessor)
     Removes a MessageProcessor from this SIPMessageStack.
public  voidsetHostAddress(String stackAddress)
     Sets my address.
public  voidsetMaxConnections(int nconnections)
     Sets the max # of simultaneously handled TCP connections.
protected  voidsetMessageFactory(SIPStackMessageFactory messageFactory)
     Sets the message factory.
public  voidsetRouter(Router router)
     Sets the router algorithm.
protected  voidsetSecurityToken(SecurityToken token)
    
public  voidsetSingleThreaded()
     Sets the flag that instructs the stack to only start a single thread for sequentially processing incoming udp messages (thus serializing the processing).
public  voidsetStackMessageFactory(SIPStackMessageFactory messageFactory)
     Sets the server Request and response factories.
public  voidsetStackName(String stackName)
     Sets the descriptive name of the stack.
public  voidsetThreadPoolSize(int size)
     Sets the thread pool size for processing incoming UDP messages.
public  voidstopStack()
     Makes the stack close all accept connections and return.

Field Detail
badMessageLog
protected String badMessageLog(Code)
Bad message log. The name of a file that stores bum messages for debugging.



debugFlag
protected boolean debugFlag(Code)
Internal flag for debugging



maxConnections
protected int maxConnections(Code)
Max number of simultaneous connections.



outboundPort
protected int outboundPort(Code)
The outbound proxy server port.



outboundProxy
protected String outboundProxy(Code)
The outbound proxy location.



router
protected Router router(Code)
Router to determine where to forward the request.



securityToken
protected SecurityToken securityToken(Code)
Security token for SIP/SIPS protocol class



sipMessageFactory
protected SIPStackMessageFactory sipMessageFactory(Code)
Request factory interface (to be provided by the application).



stackAddress
protected String stackAddress(Code)
IP address of stack.



stackName
protected String stackName(Code)
Name of the stack.



tcpFlag
protected boolean tcpFlag(Code)
Flag indicating tcp connection in use.



threadPoolSize
protected int threadPoolSize(Code)
Starts a single processing thread for all UDP messages (otherwise, the stack will start a new thread for each UDP message).



toExit
protected boolean toExit(Code)
Flag that indicates that the stack is active.



udpFlag
protected boolean udpFlag(Code)
Flag indicating udp connection in use.




Constructor Detail
SIPMessageStack
public SIPMessageStack(SIPStackMessageFactory messageFactory, String stackAddress, String stackName) throws IllegalArgumentException(Code)
Construcor for the stack. Registers the request and response factories for the stack.
Parameters:
  messageFactory - User-implemented factory for processingmessages.
Parameters:
  stackAddress - -- IP address or host name of the stack.
Parameters:
  stackName - -- descriptive name for the stack.



SIPMessageStack
public SIPMessageStack()(Code)
Default constructor.




Method Detail
addMessageProcessor
public void addMessageProcessor(MessageProcessor newMessageProcessor) throws IOException(Code)
Adds a new MessageProcessor to the list of running processors for this SIPMessageStack and starts it. You can use this method for dynamic stack configuration. Acknowledgement: This code is contributed by Jeff Keyser.
Parameters:
  newMessageProcessor - the new message processor toregister



createMessageChannel
public MessageChannel createMessageChannel(Hop nextHop)(Code)
Creates a new MessageChannel for a given Hop.
Parameters:
  nextHop - Hop to create a MessageChannel to. A MessageChannel to the specified Hop, or null ifno MessageProcessors support contacting that Hop.
throws:
  UnknwonHostException - If the host in the Hop doesn'texist.



createMessageProcessor
public MessageProcessor createMessageProcessor(int port, String transport) throws java.io.IOException, IllegalArgumentException(Code)
Creates the equivalent of a JAIN listening point and attaches to the stack.
Parameters:
  port - the message processor port address
Parameters:
  transport - the message processor transport type the requested message processor



getBadMessageLog
public String getBadMessageLog()(Code)
Gets the file name of the bad message log. the file where bad messages are logged.



getDefaultRoute
public Hop getDefaultRoute()(Code)
Gets the default route. the default route



getDefaultRouteHeader
public RouteHeader getDefaultRouteHeader()(Code)
Gets the route header corresponding to the default route. the default route header



getHostAddress
public String getHostAddress()(Code)
Gets my address. hostAddress - my host address.



getMessageProcessor
public MessageProcessor getMessageProcessor(String transport)(Code)
Gets a message processor for the given transport.
Parameters:
  transport - the transport to be checked the message processor for the transport



getMessageProcessors
public Vector getMessageProcessors()(Code)
Gets an array of running MessageProcessors on this SIPMessageStack. Acknowledgement: Jeff Keyser suggested that applications should have access to the running message processors and contributed this code. an array of running message processors.



getNextHop
public Hop getNextHop()(Code)
Gets the default next hop from the router. the default next hop



getPort
public int getPort(String transport) throws IllegalArgumentException(Code)
Gets port of the message processor (based on the transport). If multiple ports are enabled for the same transport then the first one is retrieved.
Parameters:
  transport - is the transport for which to get the port. the message processor port
exception:
  IllegalArgumentException - if the transport is notsupported



getRouteHeader
public RouteHeader getRouteHeader(Hop hop)(Code)
Gets the route header for this hop.
Parameters:
  hop - the hop to be processed the route header for the hop.



getRouter
public Router getRouter()(Code)
Gets the router algorithm. Router router



getSecurityToken
protected SecurityToken getSecurityToken()(Code)
Return a security token associated with the protocol class Security token



getStackName
public String getStackName()(Code)
Gets the Stack name. name of the stack.



isAlive
public synchronized boolean isAlive()(Code)
Returns the status of the toExit flag. true if the stack object is alive and false otherwise.



isTransportEnabled
public boolean isTransportEnabled(String transport)(Code)
Returns true if a transport is enabled.
Parameters:
  transport - is the transport to check. true if transport is enabled



isTransportEnabled
public boolean isTransportEnabled(String transport, int port)(Code)
Returns true if the transport is enabled for a given port.
Parameters:
  transport - transport to check
Parameters:
  port - port to check transport at. true if transport is enabled



logBadMessage
public void logBadMessage(String message)(Code)
Logs a bad message (invoked when a parse exception arises).
Parameters:
  message - is a string that contains the bad message to log.



newSIPServerRequest
protected SIPServerRequestInterface newSIPServerRequest(Request siprequest, MessageChannel msgchan)(Code)
Generates a new SIPSeverRequest from the given Request. A SIPServerRequest is generated by the application SIPServerRequestFactoryImpl. The application registers the factory implementation at the time the stack is initialized.
Parameters:
  siprequest - Request for which we want to generatethsi SIPServerRequest.
Parameters:
  msgchan - Message channel for the request for whichwe want to generate the SIPServerRequest Generated SIPServerRequest.



newSIPServerResponse
SIPServerResponseInterface newSIPServerResponse(Response sipresponse, MessageChannel msgchan)(Code)
Generates a new SIPSeverResponse from the given Response.
Parameters:
  sipresponse - Response from which the SIPServerResponseis to be generated. Note - this just calls the factory interfaceto do its work. The factory interface is provided by the user.
Parameters:
  msgchan - Message channel for the SIPServerResponse SIPServerResponse generated from this SIPResponse



removeMessageProcessor
public void removeMessageProcessor(MessageProcessor oldMessageProcessor)(Code)
Removes a MessageProcessor from this SIPMessageStack. Acknowledgement: Code contributed by Jeff Keyser.
Parameters:
  oldMessageProcessor -



setHostAddress
public void setHostAddress(String stackAddress)(Code)
Sets my address.
Parameters:
  stackAddress - -- A string containing the stack address.



setMaxConnections
public void setMaxConnections(int nconnections)(Code)
Sets the max # of simultaneously handled TCP connections.
Parameters:
  nconnections - the new max connections



setMessageFactory
protected void setMessageFactory(SIPStackMessageFactory messageFactory)(Code)
Sets the message factory.
Parameters:
  messageFactory - -- messageFactory to set.



setRouter
public void setRouter(Router router)(Code)
Sets the router algorithm.
Parameters:
  router - A class that implements the Router interface.



setSecurityToken
protected void setSecurityToken(SecurityToken token)(Code)
Set the security token associated with the protocol class
Parameters:
  token - Security token from SIP/SIPS Protocol class



setSingleThreaded
public void setSingleThreaded()(Code)
Sets the flag that instructs the stack to only start a single thread for sequentially processing incoming udp messages (thus serializing the processing). Caution: If the user-defined function called by the processing thread blocks, then the entire server will block.



setStackMessageFactory
public void setStackMessageFactory(SIPStackMessageFactory messageFactory)(Code)
Sets the server Request and response factories.
Parameters:
  messageFactory - User-implemented factory for processingmessages.



setStackName
public void setStackName(String stackName)(Code)
Sets the descriptive name of the stack.
Parameters:
  stackName - -- descriptive name of the stack.



setThreadPoolSize
public void setThreadPoolSize(int size)(Code)
Sets the thread pool size for processing incoming UDP messages. Limit the total number of threads for processing udp messages. Caution: If the user-defined function called by the processing thread blocks, then the entire server will block.
Parameters:
  size - the new thread pool size



stopStack
public void stopStack()(Code)
Makes the stack close all accept connections and return. This is useful if you want to start/stop the stack several times from your application. Caution : use of this function could cause peculiar bugs as messages are prcessed asynchronously by the stack.



Methods inherited from java.lang.Object
public boolean equals(Object obj)(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.