Source Code Cross Referenced for TunnelRemoteServiceStubManagerImpl.java in  » Portal » Open-Portal » com » sun » portal » wsrp » consumer » common » impl » 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 » Portal » Open Portal » com.sun.portal.wsrp.consumer.common.impl 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         * Copyright 2003 Sun Microsystems, Inc. All
003:         * rights reserved. Use of this product is subject
004:         * to license terms. Federal Acquisitions:
005:         * Commercial Software -- Government Users
006:         * Subject to Standard License Terms and
007:         * Conditions.
008:         *
009:         * Sun, Sun Microsystems, the Sun logo, and Sun ONE
010:         * are trademarks or registered trademarks of Sun Microsystems,
011:         * Inc. in the United States and other countries.
012:         */package com.sun.portal.wsrp.consumer.common.impl;
013:
014:        import java.lang.NumberFormatException;
015:
016:        import java.util.Properties;
017:        import java.util.Enumeration;
018:        import java.util.Map;
019:        import java.util.HashMap;
020:        import java.util.logging.Level;
021:        import java.util.logging.Logger;
022:
023:        import java.io.FileInputStream;
024:        import java.io.IOException;
025:
026:        import java.net.URL;
027:
028:        import java.net.MalformedURLException;
029:
030:        import com.sun.portal.wsrp.common.stubs.WSRP_v1_Markup_PortType;
031:        import com.sun.portal.wsrp.common.stubs.WSRP_v1_Registration_PortType;
032:        import com.sun.portal.wsrp.common.stubs.WSRP_v1_ServiceDescription_PortType;
033:
034:        import com.sun.portal.wsrp.consumer.common.WSRPConsumerException;
035:        import com.sun.portal.wsrp.consumer.common.WSRPConsumerConfig;
036:        import com.sun.portal.log.common.PortalLogger;
037:
038:        /**
039:         * This implementation of RSSM is based on StaticRSSMImpl.java.  The only difference is that
040:         * the endpoint of each port type is controlled by the config parameters set in the
041:         * wsrpconsumerconfig.properties.  When used in conjunction with TCPTunnel, this implementation
042:         * allows developers to snoop into each individual SOAP envelope sent in and out of the WSRP
043:         * consumer.
044:         * When there is no mapping found in the config, it defaults to StaticRSSMImpl.
045:         *
046:         * The format of parameters set in the wsrpconsumerconfig.properties is as follows:
047:         * tunnel_<target_host>:<target_port>=<listening_host>:<listening_port>
048:         *
049:         * Sample (please make a note of the character escaping):
050:         *           .....
051:         * soapDebugMethod=tunnel
052:         * tunnel_localhost\:80=localhost\:4000
053:         * tunnel_portalstandards.oracle.com\:80=localhost\:4001
054:         * tunnel_wsrp.dyndns.org\:9081=localhost\:4002
055:         * tunnel_wsrp.dyndns.org\:8080=localhost\:4003
056:         * tunnel_wsrp.avitek.com\:7001=localhost\:4004
057:         * tunnel_andrek.dyndns.org\:80=localhost\:4005
058:         *           .....
059:         */
060:
061:        public class TunnelRemoteServiceStubManagerImpl extends
062:                StaticRemoteServiceStubManagerImpl {
063:
064:            private static Logger logger = PortalLogger
065:                    .getLogger(TunnelRemoteServiceStubManagerImpl.class);
066:
067:            public TunnelRemoteServiceStubManagerImpl() {
068:            }
069:
070:            public WSRP_v1_Markup_PortType getMarkupPortType(String endpoint,
071:                    boolean isNew) throws WSRPConsumerException {
072:
073:                endpoint = tunnelEndpoint(endpoint);
074:                return super .getMarkupPortType(endpoint, isNew);
075:            }
076:
077:            public WSRP_v1_Registration_PortType getRegistrationPortType(
078:                    String endpoint) throws WSRPConsumerException {
079:
080:                endpoint = tunnelEndpoint(endpoint);
081:                return super .getRegistrationPortType(endpoint);
082:            }
083:
084:            public WSRP_v1_ServiceDescription_PortType getServiceDescriptionPortType(
085:                    String endpoint) throws WSRPConsumerException {
086:
087:                endpoint = tunnelEndpoint(endpoint);
088:                return super .getServiceDescriptionPortType(endpoint);
089:            }
090:
091:            public String getEndpoint(URL producerWsdl, String portBinding)
092:                    throws WSRPConsumerException {
093:
094:                String endpoint = super .getEndpoint(producerWsdl, portBinding);
095:                return tunnelEndpoint(endpoint);
096:            }
097:
098:            public String tunnelEndpoint(String endpoint)
099:                    throws WSRPConsumerException {
100:
101:                if (endpoint == null) {
102:                    return null;
103:                }
104:
105:                URL url = null;
106:                try {
107:                    url = new URL(endpoint);
108:                } catch (MalformedURLException mue) {
109:                    throw new WSRPConsumerException(
110:                            "TunnelRemoteServiceStubManagerImple.tunnelEndpoint(): failed to parse endpoint. ",
111:                            mue);
112:                }
113:
114:                URL tURL = null;
115:                String key = url.getHost() + ":"
116:                        + (url.getPort() < 0 ? 80 : url.getPort());
117:                String tEndpoint = null;
118:
119:                Map tunnelMap = WSRPConsumerConfig.getInstance().getTunnelMap();
120:
121:                if (tunnelMap.containsKey(key)) {
122:                    String hostPort = (String) tunnelMap.get(key);
123:                    if (!hostPort.startsWith("http://")) {
124:                        hostPort = "http://" + hostPort;
125:                    }
126:
127:                    try {
128:                        tURL = new URL(hostPort);
129:                        //
130:                        // attach filepath
131:                        //
132:                        tURL = new URL(url.getProtocol(), tURL.getHost(), tURL
133:                                .getPort(), url.getFile());
134:                    } catch (MalformedURLException mue) {
135:                        throw new WSRPConsumerException(
136:                                "TunnelRSSMImpl.tunnelEndpoint(): failed to construct url. ",
137:                                mue);
138:                    }
139:
140:                    if (logger.isLoggable(Level.FINEST)) {
141:                        String[] param = { "tunneling through", tURL.toString() };
142:                        logger.log(Level.FINEST, "PSWS_CSPWCCI0001");
143:                    }
144:
145:                    tEndpoint = tURL.toString();
146:
147:                } else {
148:
149:                    if (logger.isLoggable(Level.SEVERE))
150:                        logger.log(Level.SEVERE, "PSWS_CSPWCCI0002", key);
151:
152:                    tEndpoint = endpoint;
153:                }
154:
155:                return tEndpoint;
156:            }
157:        }
w__ww.__j__a__v___a_2___s__.c__o_m__ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.