Source Code Cross Referenced for ProxyRemoteServiceStubManagerImpl.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.util.Iterator;
015:        import java.util.logging.Level;
016:        import java.util.logging.Logger;
017:
018:        import java.net.URL;
019:
020:        import javax.xml.rpc.Stub;
021:        import javax.xml.rpc.Service;
022:        import javax.xml.rpc.ServiceException;
023:        import javax.xml.rpc.ServiceFactory;
024:        import javax.xml.namespace.QName;
025:
026:        import com.sun.portal.wsrp.common.stubs.WSRP_v1_Markup_PortType;
027:        import com.sun.portal.wsrp.common.stubs.WSRP_v1_Registration_PortType;
028:        import com.sun.portal.wsrp.common.stubs.WSRP_v1_ServiceDescription_PortType;
029:        import com.sun.portal.wsrp.common.stubs.WSRP_v1_PortletManagement_PortType;
030:        import com.sun.portal.wsrp.common.stubs.WSRPService_Impl;
031:
032:        import com.sun.portal.wsrp.common.Timer;
033:
034:        import com.sun.portal.wsrp.consumer.common.RemoteServiceStubManager;
035:        import com.sun.portal.wsrp.consumer.common.WSRPConsumerException;
036:        import com.sun.portal.log.common.PortalLogger;
037:
038:        /**
039:         * This is an implementation that uses JAX-RPC's Dynamic Proxy mechanism
040:         * to retrieve endpoint.  Currently, due to some unknown reason, this
041:         * implementation has a major performance problem.
042:         */
043:        public class ProxyRemoteServiceStubManagerImpl implements 
044:                RemoteServiceStubManager {
045:
046:            //
047:            // TBD: this is a known bug.  we should not be looking up port type
048:            // by the port name.  instead, the binding name should be the
049:            // lookup criteria.  see WSRP spec. chapter 14.
050:            //
051:            public final static String MARKUP_PORT_NAME = "WSRPBaseService";
052:            public final static String SERVICE_DESCRIPTION_PORT_NAME = "WSRPServiceDescriptionService";
053:            public final static String REGISTRATION_PORT_NAME = "WSRPRegistrationService";
054:            public final static String PORTLET_MANAGEMENT_PORT_NAME = "WSRPPortletManagementService";
055:            public final static String NAMESPACE_URI = "urn:oasis:names:tc:wsrp:v1:wsdl";
056:
057:            //
058:            // debug
059:            //
060:            private static Logger logger = PortalLogger
061:                    .getLogger(ProxyRemoteServiceStubManagerImpl.class);
062:
063:            public WSRP_v1_Markup_PortType getMarkupPortType(String endpoint,
064:                    boolean isNew) throws WSRPConsumerException {
065:
066:                WSRP_v1_Markup_PortType port = null;
067:
068:                if (endpoint != null) {
069:                    port = (WSRP_v1_Markup_PortType) getPortType(
070:                            MARKUP_PORT_NAME, endpoint);
071:                }
072:
073:                if (port == null) {
074:                    throw new WSRPConsumerException(
075:                            "ProxyRSSM.getMarkupPortType(): Markup port type is not available.  isNew="
076:                                    + isNew);
077:                }
078:
079:                return port;
080:            }
081:
082:            public WSRP_v1_Registration_PortType getRegistrationPortType(
083:                    String endpoint) throws WSRPConsumerException {
084:
085:                WSRP_v1_Registration_PortType port = null;
086:
087:                if (endpoint != null) {
088:                    port = (WSRP_v1_Registration_PortType) getPortType(
089:                            REGISTRATION_PORT_NAME, endpoint);
090:                }
091:
092:                return port;
093:            }
094:
095:            public WSRP_v1_ServiceDescription_PortType getServiceDescriptionPortType(
096:                    String endpoint) throws WSRPConsumerException {
097:
098:                WSRP_v1_ServiceDescription_PortType port = null;
099:
100:                if (endpoint != null) {
101:                    port = (WSRP_v1_ServiceDescription_PortType) getPortType(
102:                            SERVICE_DESCRIPTION_PORT_NAME, endpoint);
103:                }
104:
105:                if (port == null) {
106:                    throw new WSRPConsumerException(
107:                            "ProxyRSSM.getServiceDescriptionPortType(): Service description port type is not available.");
108:                }
109:
110:                return port;
111:            }
112:
113:            public WSRP_v1_PortletManagement_PortType getPortletManagementPortType(
114:                    String endpoint) throws WSRPConsumerException {
115:
116:                WSRP_v1_PortletManagement_PortType port = null;
117:
118:                if (endpoint != null) {
119:                    port = (WSRP_v1_PortletManagement_PortType) getPortType(
120:                            PORTLET_MANAGEMENT_PORT_NAME, endpoint);
121:                }
122:
123:                if (port == null) {
124:                    throw new WSRPConsumerException(
125:                            "ProxyRSSM.getPortletManagementPortType(): portlet management port type is not available.");
126:                }
127:
128:                return port;
129:            }
130:
131:            public String getEndpoint(URL producerWsdl, String portName)
132:                    throws WSRPConsumerException {
133:
134:                Timer t = new Timer();
135:
136:                String endpoint = null;
137:
138:                Service wsrpService = null;
139:                try {
140:
141:                    ServiceFactory serviceFactory = ServiceFactory
142:                            .newInstance();
143:
144:                    QName wsrpServiceQname = new QName(NAMESPACE_URI,
145:                            WSRP_SERVICE_NAME);
146:
147:                    //
148:                    // TBD: this operation takes close to a minute.  find out why...
149:                    //
150:                    wsrpService = serviceFactory.createService(producerWsdl,
151:                            wsrpServiceQname);
152:
153:                } catch (ServiceException ex) {
154:                    throw new WSRPConsumerException(
155:                            "ProxyRSSM.getEndpoint(): failed to find WSRP service from the wsdl.  producerWsdl="
156:                                    + producerWsdl.toString(), ex);
157:                }
158:                if (logger.isLoggable(Level.FINEST)) {
159:                    Object[] param = { "producerWsdl", producerWsdl };
160:                    logger.log(Level.FINEST, "PSWS_CSPWCCI0001");
161:                    param[0] = "elaqpsed time";
162:                    param[1] = "" + t.getElapsed();
163:                }
164:
165:                t = new Timer();
166:
167:                if (wsrpService == null) {
168:                    throw new WSRPConsumerException(
169:                            "ProxyRSSM.getEndpoint(): failed to find WSRP service from the wsdl.  producerWsdl="
170:                                    + producerWsdl.toString());
171:                }
172:
173:                Class portTypeClass = null;
174:                if (portName.equals(MARKUP_PORT_NAME)) {
175:                    portTypeClass = WSRP_v1_Markup_PortType.class;
176:                } else if (portName.equals(SERVICE_DESCRIPTION_PORT_NAME)) {
177:                    portTypeClass = WSRP_v1_ServiceDescription_PortType.class;
178:                } else if (portName.equals(REGISTRATION_PORT_NAME)) {
179:                    portTypeClass = WSRP_v1_Registration_PortType.class;
180:                }
181:
182:                //
183:                // TBD: this is a known bug.  we should not be looking up port type
184:                // by the port name.  instead, the binding name should be the
185:                // lookup criteria.  see WSRP spec. chapter 14.
186:                // JAXRPC currently does not allow such mechanism so we use the
187:                // name. 
188:                //
189:                try {
190:                    Stub port = (Stub) wsrpService.getPort(new QName(
191:                            NAMESPACE_URI, portName), portTypeClass);
192:                    if (port != null) {
193:                        endpoint = (String) port
194:                                ._getProperty(Stub.ENDPOINT_ADDRESS_PROPERTY);
195:                    }
196:
197:                } catch (ServiceException ex) {
198:                    //
199:                    // producer can opt to not expose registration port type in
200:                    // case of out-of-band registration.  handle it gracefully.  
201:                    //
202:                    if (!portName.equals(REGISTRATION_PORT_NAME)) {
203:                        throw new WSRPConsumerException(
204:                                "ProxyRSSM.getEndpoint(): failed to find endpoint from the wsdl.  producerWsdl="
205:                                        + producerWsdl.toString()
206:                                        + ", portName=" + portName, ex);
207:                    }
208:                }
209:
210:                if (logger.isLoggable(Level.FINEST)) {
211:                    String[] param = { "end point took", "" + t.getElapsed() };
212:                    logger.log(Level.FINEST, "PSWS_CSPWCCI0001", param);
213:                }
214:
215:                if (logger.isLoggable(Level.FINEST)) {
216:                    Object[] param = { "producerWsdl", producerWsdl };
217:                    logger.log(Level.FINEST, "PSWS_CSPWCCI0001", param);
218:                    param[0] = "endpoint";
219:                    param[1] = endpoint;
220:                    logger.log(Level.FINEST, "PSWS_CSPWCCI0001", param);
221:                }
222:
223:                return endpoint;
224:            }
225:
226:            protected Stub getPortType(String portBinding, String endpoint)
227:                    throws WSRPConsumerException {
228:
229:                Stub getNonDynamicStub = null;
230:
231:                if (endpoint != null) {
232:                    if (portBinding.equals(MARKUP_PORT_NAME)) {
233:                        getNonDynamicStub = (Stub) (new WSRPService_Impl()
234:                                .getWSRPBaseService());
235:                    } else if (portBinding
236:                            .equals(SERVICE_DESCRIPTION_PORT_NAME)) {
237:                        getNonDynamicStub = (Stub) (new WSRPService_Impl()
238:                                .getWSRPServiceDescriptionService());
239:                    } else if (portBinding.equals(REGISTRATION_PORT_NAME)) {
240:                        getNonDynamicStub = (Stub) (new WSRPService_Impl()
241:                                .getWSRPRegistrationService());
242:                    } else if (portBinding.equals(PORTLET_MANAGEMENT_PORT_NAME)) {
243:                        getNonDynamicStub = (Stub) (new WSRPService_Impl()
244:                                .getWSRPPortletManagementService());
245:                    }
246:                    getNonDynamicStub._setProperty(
247:                            Stub.ENDPOINT_ADDRESS_PROPERTY, endpoint);
248:                }
249:
250:                return getNonDynamicStub;
251:            }
252:        }
w_w_w___.__jav_a2__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.