Source Code Cross Referenced for HttpEndpoint.java in  » ESB » cbesb-1.2 » com » bostechcorp » cbesb » runtime » component » http » 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 » ESB » cbesb 1.2 » com.bostechcorp.cbesb.runtime.component.http 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


0001:        /*
0002:         * ChainBuilder ESB
0003:         * 		Visual Enterprise Integration
0004:         * 
0005:         * Copyright (C) 2007 Bostech Corporation
0006:         * 
0007:         * This program is free software; you can redistribute it and/or modify it 
0008:         * under the terms of the GNU General Public License as published by the 
0009:         * Free Software Foundation; either version 2 of the License, or (at your option) 
0010:         * any later version.
0011:         *
0012:         * This program is distributed in the hope that it will be useful, 
0013:         * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 
0014:         * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 
0015:         * for more details.
0016:         * 
0017:         * You should have received a copy of the GNU General Public License along with 
0018:         * this program; if not, write to the Free Software Foundation, Inc., 
0019:         * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
0020:         *
0021:         *
0022:         * $Id: HttpEndpoint.java 12178 2008-03-03 07:57:52Z lzheng $
0023:         */
0024:        package com.bostechcorp.cbesb.runtime.component.http;
0025:
0026:        import java.io.File;
0027:        import java.util.ArrayList;
0028:        import java.util.Iterator;
0029:        import java.util.List;
0030:        import java.util.Map;
0031:        import java.util.Vector;
0032:
0033:        import javax.jbi.component.ComponentContext;
0034:        import javax.jbi.messaging.MessageExchange.Role;
0035:        import javax.wsdl.Definition;
0036:        import javax.wsdl.WSDLException;
0037:        import javax.wsdl.extensions.ExtensibilityElement;
0038:        import javax.wsdl.factory.WSDLFactory;
0039:        import javax.wsdl.xml.WSDLReader;
0040:        import javax.xml.namespace.QName;
0041:
0042:        import com.bostechcorp.cbesb.common.util.RuntimeClassLoader;
0043:        import com.bostechcorp.cbesb.runtime.ccsl.jbi.messaging.IComponentProcessor;
0044:        import com.bostechcorp.cbesb.runtime.ccsl.jbi.messaging.LifeCycleEndpoint;
0045:        import com.bostechcorp.cbesb.runtime.ccsl.jbi.messaging.ServiceDescriptionHandler;
0046:        import com.bostechcorp.cbesb.runtime.ccsl.jbi.messaging.ServiceInfo;
0047:        import com.bostechcorp.cbesb.runtime.ccsl.jbi.messaging.ServiceUnitDescriptor;
0048:        import com.bostechcorp.cbesb.runtime.ccsl.jbi.messaging.StatusConstants;
0049:        import com.bostechcorp.cbesb.runtime.ccsl.lib.CcslUtil;
0050:        import com.bostechcorp.cbesb.runtime.ccsl.lib.IHttpConsumerMarshaller;
0051:        import com.bostechcorp.cbesb.runtime.ccsl.lib.IHttpProviderMarshaller;
0052:        import com.bostechcorp.cbesb.runtime.ccsl.lib.ISoapConsumerMarshaller;
0053:        import com.bostechcorp.cbesb.runtime.ccsl.lib.ISoapProviderMarshaller;
0054:        import com.bostechcorp.cbesb.runtime.component.http.processors.ConsumerProcessor;
0055:        import com.bostechcorp.cbesb.runtime.component.http.processors.HttpProviderProcessor;
0056:        import com.bostechcorp.cbesb.runtime.component.http.processors.SoapProviderProcessor;
0057:        import com.bostechcorp.cbesb.runtime.component.http.server.IListener;
0058:
0059:        public class HttpEndpoint extends LifeCycleEndpoint {
0060:
0061:            public static final String DEFAULT_SOAP_CONSUMER_MARSHALLER = "com.bostechcorp.cbesb.runtime.component.http.marshallers.StandardSoapMarshaller";
0062:            public static final String SENDMESSAGE_SOAP_CONSUMER_MARSHALLER = "com.bostechcorp.cbesb.runtime.component.http.marshallers.SendMessageMarshaller";
0063:            public static final String DEFAULT_SOAP_PROVIDER_MARSHALLER = "com.bostechcorp.cbesb.runtime.component.http.marshallers.StandardSoapMarshaller";
0064:            public static final String DEFAULT_HTTP_CONSUMER_MARSHALLER = "com.bostechcorp.cbesb.runtime.component.http.marshallers.DefaultHttpConsumerMarshaller";
0065:            public static final String DEFAULT_HTTP_PROVIDER_MARSHALLER = "com.bostechcorp.cbesb.runtime.component.http.marshallers.DefaultHttpProviderMarshaller";
0066:
0067:            private HttpComponent httpComponent;
0068:            protected ServiceDescriptionHandler serviceDescriptionHandler;
0069:
0070:            private boolean soap;
0071:            private String locationURI;
0072:            private ExtensibilityElement binding;
0073:
0074:            private String sslProtocol;
0075:            private boolean usePrivateKey;
0076:            private String keyStoreFile;
0077:            private String keyStorePassword;
0078:            private boolean authenticateServer;
0079:            private boolean useDefaultTrustStore;
0080:            private String trustStoreFile;
0081:            private String trustStorePassword;
0082:            private boolean authenticateClient;
0083:            private boolean allowAnonymous;
0084:
0085:            private String soapVersion;
0086:            private String soapConsumerMarshaller;
0087:            private String soapProviderMarshaller;
0088:            private String httpConsumerMarshaller;
0089:            private String httpProviderMarshaller;
0090:            private String wsdlResource;
0091:            private Definition wsdlResourceDef = null;
0092:            private int timeout;
0093:            private String attachmentMode;
0094:
0095:            private String targetService;
0096:            private String targetPort;
0097:            private String targetOperation;
0098:
0099:            private String authMode;
0100:            private String authUser;
0101:            private String authPassword;
0102:
0103:            private String proxyHost;
0104:            private String proxyPort;
0105:            private String proxyUser;
0106:            private String proxyPassword;
0107:
0108:            private IListener listener = null;
0109:
0110:            /**
0111:             * 
0112:             */
0113:            public HttpEndpoint(HttpComponent httpComponent) {
0114:                this .httpComponent = httpComponent;
0115:            }
0116:
0117:            /**
0118:             * @return the binding
0119:             */
0120:            public ExtensibilityElement getBinding() {
0121:                return binding;
0122:            }
0123:
0124:            /**
0125:             * @param binding
0126:             *            the binding to set
0127:             */
0128:            public void setBinding(ExtensibilityElement binding) {
0129:                this .binding = binding;
0130:            }
0131:
0132:            /**
0133:             * @return the locationURI
0134:             */
0135:            public String getLocationURI() {
0136:                return locationURI;
0137:            }
0138:
0139:            /**
0140:             * @param locationURI
0141:             *            the locationURI to set
0142:             */
0143:            public void setLocationURI(String locationURI) {
0144:                if ("".equals(locationURI)) {
0145:                    this .locationURI = null;
0146:                } else {
0147:                    this .locationURI = locationURI;
0148:                }
0149:            }
0150:
0151:            /**
0152:             * @return the soap
0153:             */
0154:            public boolean isSoap() {
0155:                return soap;
0156:            }
0157:
0158:            /**
0159:             * @param soap
0160:             *            the soap to set
0161:             */
0162:            public void setSoap(boolean soap) {
0163:                this .soap = soap;
0164:            }
0165:
0166:            /**
0167:             * @return the soapVersion
0168:             */
0169:            public String getSoapVersion() {
0170:                return soapVersion;
0171:            }
0172:
0173:            /**
0174:             * @param soapVersion
0175:             *            the soapVersion to set
0176:             */
0177:            public void setSoapVersion(String soapVersion) {
0178:                if ("".equals(soapVersion)) {
0179:                    this .soapVersion = null;
0180:                } else {
0181:                    this .soapVersion = soapVersion;
0182:                }
0183:            }
0184:
0185:            /**
0186:             * @return the wsdlResource
0187:             */
0188:            public String getWsdlResource() {
0189:                return wsdlResource;
0190:            }
0191:
0192:            /**
0193:             * @param wsdlResource the wsdlResource to set
0194:             */
0195:            public void setWsdlResource(String wsdlResource) {
0196:                if ("".equals(wsdlResource)) {
0197:                    this .wsdlResource = null;
0198:                } else {
0199:                    this .wsdlResource = wsdlResource;
0200:                }
0201:            }
0202:
0203:            public void setMarshaller(String marshaller) {
0204:                logger.debug("Setting marshaller to: " + marshaller);
0205:                if (this .getRole().equals(Role.CONSUMER)) {
0206:                    if (this .isSoap()) {
0207:                        soapConsumerMarshaller = marshaller;
0208:                        logger.debug("soapConsumerMarshaller set to: "
0209:                                + marshaller);
0210:                    } else {
0211:                        httpConsumerMarshaller = marshaller;
0212:                        logger.debug("httpConsumerMarshaller set to: "
0213:                                + marshaller);
0214:                    }
0215:                } else {
0216:                    if (this .isSoap()) {
0217:                        soapProviderMarshaller = marshaller;
0218:                        logger.debug("soapProviderMarshaller set to: "
0219:                                + marshaller);
0220:                    } else {
0221:                        httpProviderMarshaller = marshaller;
0222:                        logger.debug("httpProviderMarshaller set to: "
0223:                                + marshaller);
0224:                    }
0225:                }
0226:
0227:            }
0228:
0229:            /**
0230:             * @return the authenticateClient
0231:             */
0232:            public boolean isAuthenticateClient() {
0233:                return authenticateClient;
0234:            }
0235:
0236:            /**
0237:             * @param authenticateClient the authenticateClient to set
0238:             */
0239:            public void setAuthenticateClient(boolean authenticateClient) {
0240:                this .authenticateClient = authenticateClient;
0241:            }
0242:
0243:            /**
0244:             * @return the authenticateServer
0245:             */
0246:            public boolean isAuthenticateServer() {
0247:                return authenticateServer;
0248:            }
0249:
0250:            /**
0251:             * @param authenticateServer the authenticateServer to set
0252:             */
0253:            public void setAuthenticateServer(boolean authenticateServer) {
0254:                this .authenticateServer = authenticateServer;
0255:            }
0256:
0257:            /**
0258:             * @return the allowAnonymous
0259:             */
0260:            public boolean isAllowAnonymous() {
0261:                return allowAnonymous;
0262:            }
0263:
0264:            /**
0265:             * @param allowAnonymous the allowAnonymous to set
0266:             */
0267:            public void setAllowAnonymous(boolean allowAnonymous) {
0268:                this .allowAnonymous = allowAnonymous;
0269:            }
0270:
0271:            public void setAttachmentMode(String attachmentMode) {
0272:                if ("MTOM".equals(attachmentMode)
0273:                        || "SwA".equals(attachmentMode)) {
0274:                    this .attachmentMode = attachmentMode;
0275:                } else {
0276:                    this .attachmentMode = "none";
0277:                }
0278:            }
0279:
0280:            public boolean isUsingMTOM() {
0281:                return "MTOM".equalsIgnoreCase(attachmentMode);
0282:            }
0283:
0284:            public boolean isUsingSwA() {
0285:                return "SwA".equalsIgnoreCase(attachmentMode);
0286:            }
0287:
0288:            /**
0289:             * @return the keyStoreFile
0290:             */
0291:            public String getKeyStoreFile() {
0292:                return keyStoreFile;
0293:            }
0294:
0295:            /**
0296:             * @param keyStoreFile the keyStoreFile to set
0297:             */
0298:            public void setKeyStoreFile(String keyStoreFile) {
0299:                if ("".equals(keyStoreFile)) {
0300:                    this .keyStoreFile = null;
0301:                } else {
0302:                    this .keyStoreFile = keyStoreFile;
0303:                }
0304:            }
0305:
0306:            /**
0307:             * @return the keyStorePassword
0308:             */
0309:            public String getKeyStorePassword() {
0310:                return keyStorePassword;
0311:            }
0312:
0313:            /**
0314:             * @param keyStorePassword the keyStorePassword to set
0315:             */
0316:            public void setKeyStorePassword(String keyStorePassword) {
0317:                if ("".equals(keyStorePassword)) {
0318:                    this .keyStorePassword = null;
0319:                } else {
0320:                    this .keyStorePassword = keyStorePassword;
0321:                }
0322:            }
0323:
0324:            /**
0325:             * @return the proxyHost
0326:             */
0327:            public String getProxyHost() {
0328:                return proxyHost;
0329:            }
0330:
0331:            /**
0332:             * @param proxyHost the proxyHost to set
0333:             */
0334:            public void setProxyHost(String proxyHost) {
0335:                if ("".equals(proxyHost)) {
0336:                    this .proxyHost = null;
0337:                } else {
0338:                    this .proxyHost = proxyHost;
0339:                }
0340:            }
0341:
0342:            /**
0343:             * @return the proxyPassword
0344:             */
0345:            public String getProxyPassword() {
0346:                return proxyPassword;
0347:            }
0348:
0349:            /**
0350:             * @param proxyPassword the proxyPassword to set
0351:             */
0352:            public void setProxyPassword(String proxyPassword) {
0353:                if ("".equals(proxyPassword)) {
0354:                    this .proxyPassword = null;
0355:                } else {
0356:                    this .proxyPassword = proxyPassword;
0357:                }
0358:            }
0359:
0360:            /**
0361:             * @return the proxyPort
0362:             */
0363:            public String getProxyPort() {
0364:                return proxyPort;
0365:            }
0366:
0367:            /**
0368:             * @param proxyPort the proxyPort to set
0369:             */
0370:            public void setProxyPort(String proxyPort) {
0371:                if ("".equals(proxyPort)) {
0372:                    this .proxyPort = null;
0373:                } else {
0374:                    this .proxyPort = proxyPort;
0375:                }
0376:            }
0377:
0378:            /**
0379:             * @return the proxyUser
0380:             */
0381:            public String getProxyUser() {
0382:                return proxyUser;
0383:            }
0384:
0385:            /**
0386:             * @param proxyUser the proxyUser to set
0387:             */
0388:            public void setProxyUser(String proxyUser) {
0389:                if ("".equals(proxyUser)) {
0390:                    this .proxyUser = null;
0391:                } else {
0392:                    this .proxyUser = proxyUser;
0393:                }
0394:            }
0395:
0396:            /**
0397:             * @return the sslProtocol
0398:             */
0399:            public String getSslProtocol() {
0400:                return sslProtocol;
0401:            }
0402:
0403:            /**
0404:             * @param sslProtocol the sslProtocol to set
0405:             */
0406:            public void setSslProtocol(String sslProtocol) {
0407:                if (sslProtocol == null || "".equals(sslProtocol)) {
0408:                    this .sslProtocol = "TLS";
0409:                } else {
0410:                    this .sslProtocol = sslProtocol;
0411:                }
0412:            }
0413:
0414:            /**
0415:             * @return the usePrivateKey
0416:             */
0417:            public boolean isUsePrivateKey() {
0418:                return usePrivateKey;
0419:            }
0420:
0421:            /**
0422:             * @param usePrivateKey the usePrivateKey to set
0423:             */
0424:            public void setUsePrivateKey(boolean usePrivateKey) {
0425:                this .usePrivateKey = usePrivateKey;
0426:            }
0427:
0428:            /**
0429:             * @return the timeout
0430:             */
0431:            public int getTimeout() {
0432:                return timeout;
0433:            }
0434:
0435:            /**
0436:             * @param timeout the timeout to set
0437:             */
0438:            public void setTimeout(int timeout) {
0439:                this .timeout = timeout;
0440:            }
0441:
0442:            /**
0443:             * @return the trustStoreFile
0444:             */
0445:            public String getTrustStoreFile() {
0446:                return trustStoreFile;
0447:            }
0448:
0449:            /**
0450:             * @param trustStoreFile the trustStoreFile to set
0451:             */
0452:            public void setTrustStoreFile(String trustStoreFile) {
0453:                if ("".equals(trustStoreFile)) {
0454:                    this .trustStoreFile = null;
0455:                } else {
0456:                    this .trustStoreFile = trustStoreFile;
0457:                }
0458:            }
0459:
0460:            /**
0461:             * @return the trustStorePassword
0462:             */
0463:            public String getTrustStorePassword() {
0464:                return trustStorePassword;
0465:            }
0466:
0467:            /**
0468:             * @param trustStorePassword the trustStorePassword to set
0469:             */
0470:            public void setTrustStorePassword(String trustStorePassword) {
0471:                if ("".equals(trustStorePassword)) {
0472:                    this .trustStorePassword = null;
0473:                } else {
0474:                    this .trustStorePassword = trustStorePassword;
0475:                }
0476:            }
0477:
0478:            /**
0479:             * @return the useDefaultTrustStore
0480:             */
0481:            public boolean isUseDefaultTrustStore() {
0482:                return useDefaultTrustStore;
0483:            }
0484:
0485:            /**
0486:             * @param useDefaultTrustStore the useDefaultTrustStore to set
0487:             */
0488:            public void setUseDefaultTrustStore(boolean useDefaultTrustStore) {
0489:                this .useDefaultTrustStore = useDefaultTrustStore;
0490:            }
0491:
0492:            /**
0493:             * @return the authMode
0494:             */
0495:            public String getAuthMode() {
0496:                return authMode;
0497:            }
0498:
0499:            /**
0500:             * @param authMode the authMode to set
0501:             */
0502:            public void setAuthMode(String authMode) {
0503:                if ("".equals(authMode)) {
0504:                    this .authMode = null;
0505:                } else {
0506:                    this .authMode = authMode;
0507:                }
0508:            }
0509:
0510:            /**
0511:             * @return the authPassword
0512:             */
0513:            public String getAuthPassword() {
0514:                return authPassword;
0515:            }
0516:
0517:            /**
0518:             * @param authPassword the authPassword to set
0519:             */
0520:            public void setAuthPassword(String authPassword) {
0521:                if ("".equals(authPassword)) {
0522:                    this .authPassword = null;
0523:                } else {
0524:                    this .authPassword = authPassword;
0525:                }
0526:            }
0527:
0528:            /**
0529:             * @return the authUser
0530:             */
0531:            public String getAuthUser() {
0532:                return authUser;
0533:            }
0534:
0535:            /**
0536:             * @param authUser the authUser to set
0537:             */
0538:            public void setAuthUser(String authUser) {
0539:                if ("".equals(authUser)) {
0540:                    this .authUser = null;
0541:                } else {
0542:                    this .authUser = authUser;
0543:                }
0544:            }
0545:
0546:            /**
0547:             * @return the targetOperation
0548:             */
0549:            public String getTargetOperation() {
0550:                return targetOperation;
0551:            }
0552:
0553:            /**
0554:             * @param targetOperation the targetOperation to set
0555:             */
0556:            public void setTargetOperation(String targetOperation) {
0557:                if ("".equals(targetOperation)) {
0558:                    this .targetOperation = null;
0559:                } else {
0560:                    this .targetOperation = targetOperation;
0561:                }
0562:            }
0563:
0564:            /**
0565:             * @return the targetPort
0566:             */
0567:            public String getTargetPort() {
0568:                return targetPort;
0569:            }
0570:
0571:            /**
0572:             * @param targetPort the targetPort to set
0573:             */
0574:            public void setTargetPort(String targetPort) {
0575:                if ("".equals(targetPort)) {
0576:                    this .targetPort = null;
0577:                } else {
0578:                    this .targetPort = targetPort;
0579:                }
0580:            }
0581:
0582:            /**
0583:             * @return the targetService
0584:             */
0585:            public String getTargetService() {
0586:                return targetService;
0587:            }
0588:
0589:            /**
0590:             * @param targetService the targetService to set
0591:             */
0592:            public void setTargetService(String targetService) {
0593:                if ("".equals(targetService)) {
0594:                    this .targetService = null;
0595:                } else {
0596:                    this .targetService = targetService;
0597:                }
0598:            }
0599:
0600:            /***************************************************************************
0601:             * These attributes and methods customize the LifeCycleEndpoint for this
0602:             * component
0603:             * *********************************************************************************
0604:             */
0605:
0606:            /*
0607:             * The display parameters are general information for the admin console to
0608:             * display.
0609:             */
0610:            public String[] getDisplayParameterTitles() {
0611:                return null;
0612:            }
0613:
0614:            /*
0615:             * The values returned here correspond to the titles above.
0616:             */
0617:            public String[] getDisplayParameters() {
0618:                return null;
0619:            }
0620:
0621:            /*
0622:             * This returns a list of properties that can be read.
0623:             */
0624:            public String[] getGetableProperties() {
0625:                HttpPropertiesEnumeration[] hps = HttpPropertiesEnumeration
0626:                        .values();
0627:                List<String> result = new ArrayList<String>();
0628:                for (int i = 0; i < hps.length; i++) {
0629:                    result.add(hps[i].name());
0630:                }
0631:                String[] sr = new String[result.size()];
0632:                return result.toArray(sr);
0633:            }
0634:
0635:            /*
0636:             * This gets one property from the list above.
0637:             */
0638:            public String getProperty(int index) {
0639:                return HttpPropertiesEnumeration.values()[index].getValue(this );
0640:            }
0641:
0642:            /*
0643:             * This gets one property from the list above.
0644:             */
0645:            public String getProperty(String property) {
0646:                return HttpPropertiesEnumeration.valueOf(property).getValue(
0647:                        this );
0648:            }
0649:
0650:            /*
0651:             * This returns a list of properties that can be set.
0652:             */
0653:            public String[] getSetableProperties() {
0654:                HttpPropertiesEnumeration[] hps = HttpPropertiesEnumeration
0655:                        .values();
0656:                List<String> result = new ArrayList<String>();
0657:                for (int i = 0; i < hps.length; i++) {
0658:                    if (hps[i].isSetable())
0659:                        result.add(hps[i].name());
0660:                }
0661:                String[] sr = new String[result.size()];
0662:                return result.toArray(sr);
0663:            }
0664:
0665:            /*
0666:             * This sets one property from the list above.
0667:             */
0668:            public void setProperty(int index, String value) {
0669:                HttpPropertiesEnumeration.values()[index].setValue(this , value);
0670:            }
0671:
0672:            /*
0673:             * This sets one property from the list above.
0674:             */
0675:            public void setProperty(String property, String value) {
0676:                HttpPropertiesEnumeration.valueOf(property).setValue(this ,
0677:                        value);
0678:            }
0679:
0680:            /***************************************************************************
0681:             * Done with LifeCycleEndpoint methods
0682:             **************************************************************************/
0683:
0684:            /*
0685:             * (non-Javadoc)
0686:             * 
0687:             * @see com.bostechcorp.cbesb.runtime.ccsl.jbi.messaging.EndpointProcessor#createConsumerProcessor()
0688:             */
0689:            @Override
0690:            protected IComponentProcessor createConsumerProcessor() {
0691:                return new ConsumerProcessor(this );
0692:            }
0693:
0694:            /*
0695:             * (non-Javadoc)
0696:             * 
0697:             * @see com.bostechcorp.cbesb.runtime.ccsl.jbi.messaging.EndpointProcessor#createProviderProcessor()
0698:             */
0699:            @Override
0700:            protected IComponentProcessor createProviderProcessor() {
0701:                if (this .isSoap()) {
0702:                    return new SoapProviderProcessor(this );
0703:                } else {
0704:                    return new HttpProviderProcessor(this );
0705:                }
0706:            }
0707:
0708:            public void start() throws Exception {
0709:                if (getRole().equals(Role.CONSUMER)) {
0710:                    setState(StatusConstants.STATUS_OPENING);
0711:                    if (listener == null) {
0712:                        listener = httpComponent.listenerFactory
0713:                                .createListener(this );
0714:                        listener.init();
0715:                    }
0716:                    listener.start();
0717:                    setState(StatusConstants.STATUS_UP);
0718:                } else
0719:                    setState(StatusConstants.STATUS_UP);
0720:            }
0721:
0722:            public void stop() {
0723:                if (getRole().equals(Role.CONSUMER)) {
0724:                    setState(StatusConstants.STATUS_CLOSING);
0725:                    if (listener != null) {
0726:                        try {
0727:                            //					listener.stop();
0728:                            listener.shutdown();
0729:                            listener = null;
0730:                        } catch (Exception e) {
0731:                            logger.error(
0732:                                    "Exception while stopping HTTP Endpoint.",
0733:                                    e);
0734:                        }
0735:                    }
0736:
0737:                    setState(StatusConstants.STATUS_DOWN);
0738:                }
0739:            }
0740:
0741:            public File getWsdlResourceAsFile() {
0742:                return new File(getServiceUnit().getRootPath() + File.separator
0743:                        + wsdlResource);
0744:            }
0745:
0746:            protected ClassLoader getClassLoader() {
0747:                try {
0748:                    // load the handler class
0749:                    String suRootPath = getServiceUnit().getRootPath();
0750:                    String serviceAssemblyName = CcslUtil
0751:                            .getAssemblyName(suRootPath);
0752:                    return RuntimeClassLoader.getClassLoader(
0753:                            serviceAssemblyName, this );
0754:                } catch (Exception e) {
0755:                    return this .getClass().getClassLoader();
0756:                }
0757:            }
0758:
0759:            public ISoapConsumerMarshaller getSoapConsumerMarshaller() {
0760:                if (soapConsumerMarshaller == null
0761:                        || soapConsumerMarshaller.length() == 0) {
0762:                    if (isSendMessageService()) {
0763:                        soapConsumerMarshaller = SENDMESSAGE_SOAP_CONSUMER_MARSHALLER;
0764:                    } else {
0765:                        soapConsumerMarshaller = DEFAULT_SOAP_CONSUMER_MARSHALLER;
0766:                    }
0767:                }
0768:                try {
0769:                    // load the handler class
0770:                    ClassLoader cl = getClassLoader();
0771:                    Class marshallerClass = Class.forName(
0772:                            soapConsumerMarshaller, true, cl);
0773:                    // verify the correct type here before we go too far
0774:                    Object temp = marshallerClass.newInstance();
0775:                    ISoapConsumerMarshaller temp1 = (ISoapConsumerMarshaller) temp;
0776:                    logger
0777:                            .debug("HttpEndpoint loaded Soap Consumer Marshaller "
0778:                                    + temp1);
0779:                    return temp1;
0780:                } catch (ClassNotFoundException e) {
0781:                    logger.error(
0782:                            "Could not find Soap Consumer Marshaller class "
0783:                                    + soapConsumerMarshaller, e);
0784:                } catch (InstantiationException e) {
0785:                    logger.error(
0786:                            "Could not instantiate Soap Consumer Marshaller class "
0787:                                    + soapConsumerMarshaller, e);
0788:                } catch (ClassCastException e) {
0789:                    logger
0790:                            .error(
0791:                                    "Soap Consumer Marshaller does not implement ISoapConsumerMarshaller ",
0792:                                    e);
0793:                } catch (Exception e) {
0794:                    logger.error(
0795:                            "Could not load Soap Consumer Marshaller class "
0796:                                    + soapConsumerMarshaller, e);
0797:                }
0798:                return null;
0799:            }
0800:
0801:            public boolean isSendMessageService() {
0802:                try {
0803:                    File wsdlFile = getWsdlResourceAsFile();
0804:                    WSDLFactory wsdlFactory = WSDLFactory.newInstance();
0805:                    WSDLReader reader = wsdlFactory.newWSDLReader();
0806:                    Definition definition = reader.readWSDL(null, wsdlFile
0807:                            .getAbsolutePath());
0808:                    Iterator iter = definition.getPortTypes().entrySet()
0809:                            .iterator();
0810:                    if (iter.hasNext()) {
0811:                        Map.Entry entry = (Map.Entry) iter.next();
0812:                        QName interfaceName = (QName) entry.getKey();
0813:                        if (interfaceName.getLocalPart().equals(
0814:                                "sendMessageInterface")) {
0815:                            return true;
0816:                        }
0817:                    }
0818:                    return false;
0819:                } catch (WSDLException e) {
0820:                    return false;
0821:                }
0822:            }
0823:
0824:            protected Definition loadWsdl(File wsdlLocation) {
0825:                try {
0826:                    Definition definition = null;
0827:                    WSDLFactory wsdlFactory = WSDLFactory.newInstance();
0828:                    WSDLReader reader = wsdlFactory.newWSDLReader();
0829:                    definition = reader.readWSDL(null, wsdlLocation
0830:                            .getAbsolutePath());
0831:                    return definition;
0832:                } catch (WSDLException e) {
0833:                    logger.error("Exception reading WSDL file: "
0834:                            + wsdlLocation.getAbsolutePath(), e);
0835:                    return null;
0836:                }
0837:            }
0838:
0839:            public ISoapProviderMarshaller getSoapProviderMarshaller() {
0840:                if (soapProviderMarshaller == null
0841:                        || soapProviderMarshaller.length() == 0) {
0842:                    soapProviderMarshaller = DEFAULT_SOAP_PROVIDER_MARSHALLER;
0843:                }
0844:                try {
0845:                    // load the handler class
0846:                    ClassLoader cl = getClassLoader();
0847:                    Class marshallerClass = Class.forName(
0848:                            soapProviderMarshaller, true, cl);
0849:                    // verify the correct type here before we go too far
0850:                    Object temp = marshallerClass.newInstance();
0851:                    ISoapProviderMarshaller temp1 = (ISoapProviderMarshaller) temp;
0852:                    logger
0853:                            .debug("HttpEndpoint loaded Soap Provider Marshaller "
0854:                                    + temp1);
0855:                    return temp1;
0856:                } catch (ClassNotFoundException e) {
0857:                    logger.error(
0858:                            "Could not find Soap Provider Marshaller class "
0859:                                    + soapProviderMarshaller, e);
0860:                } catch (InstantiationException e) {
0861:                    logger.error(
0862:                            "Could not instantiate Soap Provider Marshaller class "
0863:                                    + soapProviderMarshaller, e);
0864:                } catch (ClassCastException e) {
0865:                    logger
0866:                            .error(
0867:                                    "Soap Provider Marshaller does not implement ISoapProviderMarshaller ",
0868:                                    e);
0869:                } catch (Exception e) {
0870:                    logger.error(
0871:                            "Could not load Soap Provider Marshaller class "
0872:                                    + soapProviderMarshaller, e);
0873:                }
0874:                return null;
0875:            }
0876:
0877:            public IHttpConsumerMarshaller getHttpConsumerMarshaller() {
0878:                if (httpConsumerMarshaller == null
0879:                        || httpConsumerMarshaller.length() == 0) {
0880:                    httpConsumerMarshaller = DEFAULT_HTTP_CONSUMER_MARSHALLER;
0881:                }
0882:                try {
0883:                    // load the handler class
0884:                    ClassLoader cl = getClassLoader();
0885:                    Class marshallerClass = Class.forName(
0886:                            httpConsumerMarshaller, true, cl);
0887:                    // verify the correct type here before we go too far
0888:                    Object temp = marshallerClass.newInstance();
0889:                    IHttpConsumerMarshaller temp1 = (IHttpConsumerMarshaller) temp;
0890:                    logger
0891:                            .debug("HttpEndpoint loaded Http Consumer Marshaller "
0892:                                    + temp1);
0893:                    return temp1;
0894:                } catch (ClassNotFoundException e) {
0895:                    logger.error(
0896:                            "Could not find Http Consumer Marshaller class "
0897:                                    + httpConsumerMarshaller, e);
0898:                } catch (InstantiationException e) {
0899:                    logger.error(
0900:                            "Could not instantiate Http Consumer Marshaller class "
0901:                                    + httpConsumerMarshaller, e);
0902:                } catch (ClassCastException e) {
0903:                    logger
0904:                            .error(
0905:                                    "Http Consumer Marshaller does not implement IHttpConsumerMarshaller ",
0906:                                    e);
0907:                } catch (Exception e) {
0908:                    logger.error(
0909:                            "Could not load Consumer Marshaller Marshaller class "
0910:                                    + httpConsumerMarshaller, e);
0911:                }
0912:                return null;
0913:            }
0914:
0915:            public IHttpProviderMarshaller getHttpProviderMarshaller() {
0916:                if (httpProviderMarshaller == null
0917:                        || httpProviderMarshaller.length() == 0) {
0918:                    httpProviderMarshaller = DEFAULT_HTTP_PROVIDER_MARSHALLER;
0919:                }
0920:                try {
0921:                    // load the handler class
0922:                    ClassLoader cl = getClassLoader();
0923:                    Class marshallerClass = Class.forName(
0924:                            httpProviderMarshaller, true, cl);
0925:                    // verify the correct type here before we go too far
0926:                    Object temp = marshallerClass.newInstance();
0927:                    IHttpProviderMarshaller temp1 = (IHttpProviderMarshaller) temp;
0928:                    logger
0929:                            .debug("HttpEndpoint loaded Http Provider Marshaller "
0930:                                    + temp1);
0931:                    return temp1;
0932:                } catch (ClassNotFoundException e) {
0933:                    logger.error(
0934:                            "Could not find Http Provider Marshaller class "
0935:                                    + httpProviderMarshaller, e);
0936:                } catch (InstantiationException e) {
0937:                    logger.error(
0938:                            "Could not instantiate Http Provider Marshaller class "
0939:                                    + httpProviderMarshaller, e);
0940:                } catch (ClassCastException e) {
0941:                    logger
0942:                            .error(
0943:                                    "Http Provider Marshaller does not implement IHttpConsumerMarshaller ",
0944:                                    e);
0945:                } catch (Exception e) {
0946:                    logger.error(
0947:                            "Could not load Provider Marshaller Marshaller class "
0948:                                    + httpProviderMarshaller, e);
0949:                }
0950:                return null;
0951:            }
0952:
0953:            public ServiceDescriptionHandler getSvcDescHandler() {
0954:                if (serviceDescriptionHandler == null) {
0955:                    if (getRole().equals(Role.PROVIDER)) {
0956:                        if (getDescription() != null) {
0957:                            serviceDescriptionHandler = ServiceDescriptionHandler
0958:                                    .getInstance(getDescription());
0959:                        }
0960:                    } else {
0961:                        logger
0962:                                .debug("Attempting to retreive Service Unit Descriptor");
0963:                        ServiceUnitDescriptor suDescriptor = getServiceUnit()
0964:                                .getServiceUnitDescriptor();
0965:                        if (suDescriptor != null) {
0966:                            Vector<ServiceInfo> consumes = suDescriptor
0967:                                    .getConsumes();
0968:                            if (consumes.size() > 0) {
0969:                                ServiceInfo svcInfo = consumes.elementAt(0);
0970:                                logger.debug("Target Service Info: "
0971:                                        + svcInfo.toString());
0972:                                ComponentContext context = getServiceUnit()
0973:                                        .getComponent().getComponentContext();
0974:                                serviceDescriptionHandler = ServiceDescriptionHandler
0975:                                        .getInstance(svcInfo, context);
0976:                            }
0977:                        }
0978:                    }
0979:                } else {
0980:
0981:                }
0982:                return serviceDescriptionHandler;
0983:            }
0984:
0985:            public synchronized Definition getWsdlResourceAsDefinition() {
0986:                try {
0987:                    if (wsdlResourceDef == null) {
0988:                        WSDLFactory wsdlFactory = WSDLFactory.newInstance();
0989:                        WSDLReader reader = wsdlFactory.newWSDLReader();
0990:                        wsdlResourceDef = reader.readWSDL(null,
0991:                                getWsdlResourceAsFile().getAbsolutePath());
0992:                    }
0993:                    return wsdlResourceDef;
0994:                } catch (WSDLException e) {
0995:                    logger.error("Exception reading WSDL file: "
0996:                            + getWsdlResourceAsFile().getAbsolutePath(), e);
0997:                    return null;
0998:                }
0999:            }
1000:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.