Source Code Cross Referenced for NistSipMessageFactoryImpl.java in  » 6.0-JDK-Modules » j2me » gov » nist » siplite » 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 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Portions Copyright  2000-2007 Sun Microsystems, Inc. All Rights
003:         * Reserved.  Use is subject to license terms.
004:         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
005:         * 
006:         * This program is free software; you can redistribute it and/or
007:         * modify it under the terms of the GNU General Public License version
008:         * 2 only, as published by the Free Software Foundation.
009:         * 
010:         * This program is distributed in the hope that it will be useful, but
011:         * WITHOUT ANY WARRANTY; without even the implied warranty of
012:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
013:         * General Public License version 2 for more details (a copy is
014:         * included at /legal/license.txt).
015:         * 
016:         * You should have received a copy of the GNU General Public License
017:         * version 2 along with this work; if not, write to the Free Software
018:         * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
019:         * 02110-1301 USA
020:         * 
021:         * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
022:         * Clara, CA 95054 or visit www.sun.com if you need additional
023:         * information or have any questions.
024:         */
025:        /*
026:         */
027:
028:        package gov.nist.siplite;
029:
030:        import gov.nist.siplite.stack.*;
031:        import gov.nist.siplite.message.*;
032:        import gov.nist.core.*;
033:
034:        import com.sun.midp.log.Logging;
035:        import com.sun.midp.log.LogChannels;
036:
037:        /**
038:         * Implements all the support classes that are necessary for the nist-sip
039:         * stack on which the jain-sip stack has been based.
040:         * This is a mapping class to map from the NIST-SIP abstractions to
041:         * the JAIN abstractions. (i.e. It is the glue code that ties
042:         * the NIST-SIP event model and the JAIN-SIP event model together.
043:         * When a SIP Request or SIP Response is read from the corresponding
044:         * messageChannel, the NIST-SIP stack calls the SIPStackMessageFactory
045:         * implementation that has been registered with it to process the request.)
046:         *
047:         * @version  JAIN-SIP-1.1
048:         *
049:         *
050:         * <a href="{@docRoot}/uncopyright.html">This code is in the public domain.</a>
051:         *
052:         */
053:        public class NistSipMessageFactoryImpl implements 
054:                SIPStackMessageFactory {
055:            /** Current SIP stack context. */
056:            private SipStack sipStackImpl;
057:
058:            /**
059:             * Constructs a new SIP Server Request.
060:             * @param sipRequest is the Request from which the SIPServerRequest
061:             * is to be constructed.
062:             * @param messageChannel is the MessageChannel abstraction for this
063:             * 	SIPServerRequest.
064:             * @return a new SIP Server Request handle
065:             */
066:            public SIPServerRequestInterface newSIPServerRequest(
067:                    Request sipRequest, MessageChannel messageChannel)
068:                    throws IllegalArgumentException {
069:
070:                if (messageChannel == null || sipRequest == null) {
071:                    throw new IllegalArgumentException("Null Arg!");
072:                }
073:
074:                NistSipMessageHandlerImpl retval = new NistSipMessageHandlerImpl();
075:                if (messageChannel instanceof  Transaction) {
076:                    // If the transaction has already been created
077:                    // then set the transaction channel.
078:                    retval.transactionChannel = (Transaction) messageChannel;
079:                }
080:                SIPTransactionStack theStack = (SIPTransactionStack) messageChannel
081:                        .getSIPStack();
082:
083:                /*
084:                 * IMPL_NOTE :
085:                 * May not need to initialize listeningPoint like this. Please refer to
086:                 * processRequest() method in NistSipMessageHandlerImpl
087:                 */
088:                retval.listeningPoint = messageChannel.getMessageProcessor()
089:                        .getListeningPoint();
090:
091:                if (Logging.REPORT_LEVEL <= Logging.INFORMATION) {
092:                    Logging.report(Logging.INFORMATION, LogChannels.LC_JSR180,
093:                            "Returning request interface for "
094:                                    + sipRequest.getFirstLine() + " " + retval
095:                                    + " messageChannel = " + messageChannel);
096:                }
097:
098:                return retval;
099:            }
100:
101:            /**
102:             * Generates a new server response for the stack.
103:             * @param sipResponse is the Request from which the SIPServerRequest
104:             * is to be constructed.
105:             * @param messageChannel is the MessageChannel abstraction for this
106:             * 	SIPServerResponse
107:             * @return a new SIP Server Response handle
108:             */
109:            public SIPServerResponseInterface newSIPServerResponse(
110:                    Response sipResponse, MessageChannel messageChannel) {
111:                try {
112:                    NistSipMessageHandlerImpl retval = new NistSipMessageHandlerImpl();
113:                    SIPTransactionStack theStack = (SIPTransactionStack) messageChannel
114:                            .getSIPStack();
115:                    SipStack sipStackImpl = (SipStack) theStack;
116:                    // Tr is null if a transaction is not mapped.
117:                    Transaction tr = (Transaction) ((SIPTransactionStack) theStack)
118:                            .findTransaction(sipResponse, false);
119:
120:                    retval.transactionChannel = tr;
121:
122:                    if (Logging.REPORT_LEVEL <= Logging.INFORMATION) {
123:                        Logging.report(Logging.INFORMATION,
124:                                LogChannels.LC_JSR180, "Found Transaction "
125:                                        + tr + " for " + sipResponse);
126:                        Logging.report(Logging.INFORMATION,
127:                                LogChannels.LC_JSR180, "MessageProcessor = "
128:                                        + messageChannel.getMessageProcessor()
129:                                        + "/"
130:                                        + messageChannel.getMessageProcessor()
131:                                                .getListeningPoint());
132:                    }
133:
134:                    ListeningPoint lp = messageChannel.getMessageProcessor()
135:                            .getListeningPoint();
136:
137:                    retval.listeningPoint = lp;
138:                    return retval;
139:
140:                } catch (RuntimeException ex) {
141:                    if (Logging.REPORT_LEVEL <= Logging.ERROR) {
142:                        Logging.report(Logging.ERROR, LogChannels.LC_JSR180,
143:                                "runtime exception caught!");
144:                        ex.printStackTrace();
145:                    }
146:                    return null;
147:                }
148:
149:            }
150:
151:            /**
152:             * Contrictor.
153:             * @param sipStackImpl current SIP stack context
154:             */
155:            public NistSipMessageFactoryImpl(SipStack sipStackImpl) {
156:                this.sipStackImpl = sipStackImpl;
157:            }
158:
159:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.