Source Code Cross Referenced for Options.java in  » Web-Services-AXIS2 » kernal » org » apache » axis2 » client » 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 » Web Services AXIS2 » kernal » org.apache.axis2.client 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


0001:        /*
0002:         * Licensed to the Apache Software Foundation (ASF) under one
0003:         * or more contributor license agreements. See the NOTICE file
0004:         * distributed with this work for additional information
0005:         * regarding copyright ownership. The ASF licenses this file
0006:         * to you under the Apache License, Version 2.0 (the
0007:         * "License"); you may not use this file except in compliance
0008:         * with the License. You may obtain a copy of the License at
0009:         *
0010:         * http://www.apache.org/licenses/LICENSE-2.0
0011:         *
0012:         * Unless required by applicable law or agreed to in writing,
0013:         * software distributed under the License is distributed on an
0014:         * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
0015:         * KIND, either express or implied. See the License for the
0016:         * specific language governing permissions and limitations
0017:         * under the License.
0018:         */
0019:        package org.apache.axis2.client;
0020:
0021:        import org.apache.axiom.om.OMElement;
0022:        import org.apache.axiom.om.util.UUIDGenerator;
0023:        import org.apache.axiom.soap.SOAP11Constants;
0024:        import org.apache.axis2.AxisFault;
0025:        import org.apache.axis2.Constants;
0026:        import org.apache.axis2.addressing.AddressingConstants;
0027:        import org.apache.axis2.addressing.EndpointReference;
0028:        import org.apache.axis2.addressing.RelatesTo;
0029:        import org.apache.axis2.context.ConfigurationContext;
0030:        import org.apache.axis2.description.TransportInDescription;
0031:        import org.apache.axis2.description.TransportOutDescription;
0032:        import org.apache.axis2.engine.AxisConfiguration;
0033:        import org.apache.axis2.i18n.Messages;
0034:        import org.apache.axis2.transport.TransportListener;
0035:        import org.apache.axis2.util.MetaDataEntry;
0036:        import org.apache.axis2.util.ObjectStateUtils;
0037:        import org.apache.commons.logging.Log;
0038:        import org.apache.commons.logging.LogFactory;
0039:
0040:        import javax.xml.namespace.QName;
0041:        import java.io.Externalizable;
0042:        import java.io.IOException;
0043:        import java.io.ObjectInput;
0044:        import java.io.ObjectOutput;
0045:        import java.util.ArrayList;
0046:        import java.util.Arrays;
0047:        import java.util.HashMap;
0048:        import java.util.List;
0049:        import java.util.Map;
0050:
0051:        /**
0052:         * Holder for operation client options. This is used by the other classes in
0053:         * this package to configure various aspects of how a client communicates with a
0054:         * service. It exposes a number of predefined properties as part of the API
0055:         * (with specific getXXX and setXXX methods), and also allows for arbitrary
0056:         * named properties to be passed using a properties map with the property name
0057:         * as the key value. Instances of this class can be chained together for
0058:         * property inheritance, so that if a property is not set in one instance it
0059:         * will check its parent for a setting.
0060:         */
0061:        public class Options implements  Externalizable {
0062:
0063:            /*
0064:             * setup for logging
0065:             */
0066:            private static final Log log = LogFactory.getLog(Options.class);
0067:
0068:            private static final String myClassName = "Options";
0069:
0070:            /**
0071:             * An ID which can be used to correlate operations on an instance of
0072:             * this object in the log files
0073:             */
0074:            private String logCorrelationIDString = null;
0075:
0076:            /**
0077:             * @serial The serialization version ID tracks the version of the class.
0078:             * If a class definition changes, then the serialization/externalization
0079:             * of the class is affected. If a change to the class is made which is
0080:             * not compatible with the serialization/externalization of the class,
0081:             * then the serialization version ID should be updated.
0082:             * Refer to the "serialVer" utility to compute a serialization
0083:             * version ID.
0084:             */
0085:            private static final long serialVersionUID = -8318751890845181507L;
0086:
0087:            /**
0088:             * @serial Tracks the revision level of a class to identify changes to the
0089:             * class definition that are compatible to serialization/externalization.
0090:             * If a class definition changes, then the serialization/externalization
0091:             * of the class is affected.
0092:             * Refer to the writeExternal() and readExternal() methods.
0093:             */
0094:            // supported revision levels, add a new level to manage compatible changes
0095:            private static final int REVISION_1 = 1;
0096:            // current revision level of this object
0097:            private static final int revisionID = REVISION_1;
0098:
0099:            /**
0100:             * Default blocking timeout value.
0101:             */
0102:            public static final int DEFAULT_TIMEOUT_MILLISECONDS = 30 * 1000;
0103:
0104:            /**
0105:             * @serial parent
0106:             */
0107:            private Options parent;
0108:
0109:            /**
0110:             * @serial properties
0111:             */
0112:            private Map properties;
0113:
0114:            // ==========================================================================
0115:            //                  Parameters that can be set via Options
0116:            // ==========================================================================
0117:
0118:            private String soapVersionURI; // defaults to
0119:            // SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI;
0120:
0121:            private Boolean isExceptionToBeThrownOnSOAPFault; // defaults to true;
0122:
0123:            private long timeOutInMilliSeconds = -1; // =
0124:            // DEFAULT_TIMEOUT_MILLISECONDS;
0125:
0126:            private Boolean useSeparateListener; // defaults to false
0127:
0128:            // Addressing specific properties
0129:            private String action;
0130:
0131:            private EndpointReference faultTo;
0132:
0133:            private EndpointReference from;
0134:
0135:            private TransportListener listener;
0136:
0137:            private TransportInDescription transportIn;
0138:
0139:            private String transportInProtocol;
0140:
0141:            private String messageId;
0142:
0143:            // Array of RelatesTo objects
0144:            private List relationships;
0145:
0146:            private EndpointReference replyTo;
0147:
0148:            private ArrayList referenceParameters;
0149:
0150:            /**
0151:             * This is used for sending and receiving messages.
0152:             */
0153:            protected TransportOutDescription transportOut;
0154:
0155:            private EndpointReference to;
0156:
0157:            //To control , session management , default is set to true , if user wants he can set that to true
0158:            // The operation client will manage session using ServiceGroupID if it is there in the response
0159:            private boolean manageSession = false;
0160:
0161:            //----------------------------------------------------------------
0162:            // MetaData for data to be restored in activate after readExternal
0163:            //----------------------------------------------------------------
0164:
0165:            /**
0166:             * Indicates whether this object has been reconstituted
0167:             * and needs to have its object references reconciled
0168:             */
0169:            private transient boolean needsToBeReconciled = false;
0170:
0171:            /**
0172:             * The TransportOutDescription metadata will be used during
0173:             * activate to match up with an existing object
0174:             */
0175:            private transient MetaDataEntry metaTransportOut = null;
0176:
0177:            /**
0178:             * The TransportInDescription metadata will be used during
0179:             * activate to match up with an existing object
0180:             */
0181:            private transient MetaDataEntry metaTransportIn = null;
0182:
0183:            /**
0184:             * The TransportListener metadata will be used during
0185:             * activate to match up with an existing object, if possible
0186:             */
0187:            private transient MetaDataEntry metaListener = null;
0188:
0189:            //This property can be used to specify to call the auto transport clean up
0190:            private transient boolean callTransportCleanup;
0191:
0192:            private transient String userName;
0193:            private transient String password;
0194:
0195:            //----------------------------------------------------------------
0196:            // end MetaData section
0197:            //----------------------------------------------------------------
0198:
0199:            /**
0200:             * Default constructor
0201:             */
0202:            public Options() {
0203:            }
0204:
0205:            /**
0206:             * In normal mode operation, this options will try to fulfil the request
0207:             * from its values. If that is not possible, this options will request those
0208:             * information from its parent.
0209:             *
0210:             * @param parent
0211:             */
0212:            public Options(Options parent) {
0213:                this .parent = parent;
0214:            }
0215:
0216:            /**
0217:             * Get WS-Addressing Action / SOAP Action string.
0218:             *
0219:             * @return action
0220:             */
0221:            public String getAction() {
0222:                if (action == null && parent != null) {
0223:                    return parent.getAction();
0224:                }
0225:                return action;
0226:            }
0227:
0228:            /**
0229:             * Get WS-Addressing FaultTo endpoint reference.
0230:             *
0231:             * @return endpoint
0232:             */
0233:            public EndpointReference getFaultTo() {
0234:                if (faultTo == null && parent != null) {
0235:                    return parent.getFaultTo();
0236:                }
0237:                return faultTo;
0238:            }
0239:
0240:            /**
0241:             * Set WS-Addressing From endpoint reference.
0242:             *
0243:             * @return endpoint
0244:             */
0245:            public EndpointReference getFrom() {
0246:                if (from == null && parent != null) {
0247:                    return parent.getFrom();
0248:                }
0249:                return from;
0250:            }
0251:
0252:            /**
0253:             * Get listener used for incoming message.
0254:             *
0255:             * @return listener
0256:             */
0257:            public TransportListener getListener() {
0258:                checkActivateWarning("getListener");
0259:                if (listener == null && parent != null) {
0260:                    return parent.getListener();
0261:                }
0262:                return listener;
0263:            }
0264:
0265:            /**
0266:             * Get transport used for incoming message.
0267:             *
0268:             * @return transport information
0269:             */
0270:            public TransportInDescription getTransportIn() {
0271:                checkActivateWarning("getTransportIn");
0272:                if (transportIn == null && parent != null) {
0273:                    return parent.getTransportIn();
0274:                }
0275:                return transportIn;
0276:            }
0277:
0278:            /**
0279:             * Get transport protocol used for incoming message.
0280:             *
0281:             * @return name protocol name ("http", "tcp", etc.)
0282:             */
0283:            public String getTransportInProtocol() {
0284:                if (transportInProtocol == null && parent != null) {
0285:                    return parent.getTransportInProtocol();
0286:                }
0287:                return transportInProtocol;
0288:            }
0289:
0290:            /**
0291:             * Get WS-Addressing MessageId.
0292:             *
0293:             * @return uri string
0294:             */
0295:            public String getMessageId() {
0296:                if (messageId == null && parent != null) {
0297:                    return parent.getMessageId();
0298:                }
0299:
0300:                return messageId;
0301:            }
0302:
0303:            /**
0304:             * Get a copy of the general option properties. Because of the way options
0305:             * are stored this does not include properties with specific get/set
0306:             * methods, only the general properties identified by a text string. The
0307:             * returned map merges properties inherited from parent options, if any, to
0308:             * give a complete set of property definitions as seen by users of this
0309:             * options instance. The returned copy is not "live", so changes you make to
0310:             * the copy are not reflected in the actual option settings. However, you
0311:             * can make the modified values take effect with a call to {@link
0312:             * #setProperties(Map)},
0313:             *
0314:             * @return copy of general properties
0315:             */
0316:            public Map getProperties() {
0317:                // make sure that the Options properties exists
0318:                if (this .properties == null) {
0319:                    this .properties = new HashMap();
0320:                }
0321:
0322:                if (parent == null) {
0323:                    return new HashMap(properties);
0324:                } else {
0325:                    Map props = parent.getProperties();
0326:                    props.putAll(properties);
0327:                    return props;
0328:                }
0329:            }
0330:
0331:            /**
0332:             * Get named property value.
0333:             *
0334:             * @param key
0335:             * @return the value related to this key. <code>null</code>, if not found.
0336:             */
0337:            public Object getProperty(String key) {
0338:                Object myPropValue = null;
0339:                if (this .properties != null) {
0340:                    myPropValue = properties.get(key);
0341:                }
0342:                if (myPropValue == null && parent != null) {
0343:                    return parent.getProperty(key);
0344:                }
0345:                return myPropValue;
0346:            }
0347:
0348:            /**
0349:             * Get WS-Addressing RelatesTo item with a specified type. If there are
0350:             * multiple RelatesTo items defined with the same type, the one returned
0351:             * by this method is arbitrary - if you need to handle this case, you can
0352:             * instead use the {@link #getRelationships()} to retrieve all the items
0353:             * and check for multiple matches.
0354:             *
0355:             * @param type relationship type (URI)
0356:             * @return item of specified type
0357:             */
0358:            public RelatesTo getRelatesTo(String type) {
0359:                if (relationships == null && parent != null) {
0360:                    return parent.getRelatesTo(type);
0361:                }
0362:                if (relationships == null) {
0363:                    return null;
0364:                }
0365:                for (int i = 0; i < relationships.size(); i++) {
0366:                    RelatesTo relatesTo = (RelatesTo) relationships.get(i);
0367:                    String relationshipType = relatesTo.getRelationshipType();
0368:                    if (relationshipType.equals(type)) {
0369:                        return relatesTo;
0370:                    }
0371:                }
0372:                return null;
0373:            }
0374:
0375:            /**
0376:             * Return a single instance of WS-Addressing RelatesTo that has a relationship
0377:             * type of either "http://www.w3.org/2005/08/addressing/reply" or "wsa:Reply".
0378:             * If no such instance of RelatesTo can be found then return <code>null</code>.
0379:             *
0380:             * @return an instance of {@link RelatesTo}
0381:             */
0382:            public RelatesTo getRelatesTo() {
0383:                if (relationships == null && parent != null) {
0384:                    return parent.getRelatesTo();
0385:                }
0386:                if (relationships == null) {
0387:                    return null;
0388:                }
0389:                for (int i = 0; i < relationships.size(); i++) {
0390:                    RelatesTo relatesTo = (RelatesTo) relationships.get(i);
0391:                    String relationshipType = relatesTo.getRelationshipType();
0392:                    if (relationshipType
0393:                            .equals(AddressingConstants.Final.WSA_DEFAULT_RELATIONSHIP_TYPE)
0394:                            || relationshipType
0395:                                    .equals(AddressingConstants.Submission.WSA_DEFAULT_RELATIONSHIP_TYPE)) {
0396:                        return relatesTo;
0397:                    }
0398:                }
0399:                return null;
0400:            }
0401:
0402:            /**
0403:             * Get all WS-Addressing RelatesTo items.
0404:             *
0405:             * @return array of items
0406:             */
0407:            public RelatesTo[] getRelationships() {
0408:                if (relationships == null && parent != null) {
0409:                    return parent.getRelationships();
0410:                }
0411:                if (relationships == null) {
0412:                    return null;
0413:                }
0414:                return (RelatesTo[]) relationships
0415:                        .toArray(new RelatesTo[relationships.size()]);
0416:            }
0417:
0418:            /**
0419:             * Set WS-Addressing RelatesTo items.
0420:             *
0421:             * @param list
0422:             */
0423:            public void setRelationships(RelatesTo[] list) {
0424:                relationships = list == null ? null : Arrays.asList(list);
0425:            }
0426:
0427:            /**
0428:             * Get WS-Addressing ReplyTo endpoint reference.
0429:             *
0430:             * @return endpoint
0431:             */
0432:            public EndpointReference getReplyTo() {
0433:                if (replyTo == null && parent != null) {
0434:                    return parent.getReplyTo();
0435:                }
0436:                return replyTo;
0437:            }
0438:
0439:            /**
0440:             * Get outbound transport description.
0441:             *
0442:             * @return description
0443:             */
0444:            public TransportOutDescription getTransportOut() {
0445:                checkActivateWarning("getTransportOut");
0446:                if (transportOut == null && parent != null) {
0447:                    return parent.getTransportOut();
0448:                }
0449:
0450:                return transportOut;
0451:            }
0452:
0453:            /**
0454:             * Get SOAP version being used.
0455:             *
0456:             * @return version
0457:             */
0458:            public String getSoapVersionURI() {
0459:                if (soapVersionURI == null && parent != null) {
0460:                    return parent.getSoapVersionURI();
0461:                }
0462:
0463:                return soapVersionURI == null ? SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI
0464:                        : soapVersionURI;
0465:            }
0466:
0467:            /**
0468:             * Gets the wait time after which a client times out in a blocking scenario.
0469:             * The default is Options#DEFAULT_TIMEOUT_MILLISECONDS
0470:             *
0471:             * @return timeOutInMilliSeconds
0472:             */
0473:            public long getTimeOutInMilliSeconds() {
0474:                if (timeOutInMilliSeconds == -1 && parent != null) {
0475:                    return parent.getTimeOutInMilliSeconds();
0476:                }
0477:
0478:                return timeOutInMilliSeconds == -1 ? DEFAULT_TIMEOUT_MILLISECONDS
0479:                        : timeOutInMilliSeconds;
0480:            }
0481:
0482:            /**
0483:             * Get WS-Addressing To endpoint reference.
0484:             *
0485:             * @return endpoint
0486:             */
0487:            public EndpointReference getTo() {
0488:                if (to == null && parent != null) {
0489:                    return parent.getTo();
0490:                }
0491:
0492:                return to;
0493:            }
0494:
0495:            /**
0496:             * If there is a SOAP Fault in the body of the incoming SOAP Message, system
0497:             * can be configured to throw an exception with the details extracted from
0498:             * the information from the fault message. This boolean variable will enable
0499:             * that facility. If this is false, the response message will just be
0500:             * returned to the application, irrespective of whether it has a Fault or
0501:             * not.
0502:             *
0503:             * @return <code>true</code> if exception to be thrown
0504:             */
0505:            public boolean isExceptionToBeThrownOnSOAPFault() {
0506:                if (isExceptionToBeThrownOnSOAPFault == null && parent != null) {
0507:                    isExceptionToBeThrownOnSOAPFault = parent.isExceptionToBeThrownOnSOAPFault;
0508:                }
0509:
0510:                return isExceptionToBeThrownOnSOAPFault == null
0511:                        || isExceptionToBeThrownOnSOAPFault.booleanValue();
0512:            }
0513:
0514:            /**
0515:             * Check whether the two SOAP Messages are be sent over same channel or over
0516:             * separate channels. Only duplex transports such as http and tcp support a
0517:             * <code>false</code> value.
0518:             *
0519:             * @return separate channel flag
0520:             */
0521:            public boolean isUseSeparateListener() {
0522:                if (useSeparateListener == null && parent != null) {
0523:                    useSeparateListener = new Boolean(parent
0524:                            .isUseSeparateListener());
0525:                }
0526:
0527:                return useSeparateListener != null
0528:                        && useSeparateListener.booleanValue();
0529:            }
0530:
0531:            /**
0532:             * Get parent instance providing default property values.
0533:             *
0534:             * @return parent (<code>null</code> if none)
0535:             */
0536:            public Options getParent() {
0537:                return parent;
0538:            }
0539:
0540:            /**
0541:             * Set parent instance providing default property values.
0542:             *
0543:             * @param parent (<code>null</code> if none)
0544:             */
0545:            public void setParent(Options parent) {
0546:                this .parent = parent;
0547:            }
0548:
0549:            /**
0550:             * Set WS-Addressing Action / SOAP Action string.
0551:             *
0552:             * @param action
0553:             */
0554:            public void setAction(String action) {
0555:                this .action = action;
0556:            }
0557:
0558:            /**
0559:             * If there is a SOAP Fault in the body of the incoming SOAP Message, system
0560:             * can be configured to throw an exception with the details extracted from
0561:             * the information from the fault message. This boolean variable will enable
0562:             * that facility. If this is false, the response message will just be
0563:             * returned to the application, irrespective of whether it has a Fault or
0564:             * not.
0565:             *
0566:             * @param exceptionToBeThrownOnSOAPFault
0567:             */
0568:            public void setExceptionToBeThrownOnSOAPFault(
0569:                    boolean exceptionToBeThrownOnSOAPFault) {
0570:                isExceptionToBeThrownOnSOAPFault = Boolean
0571:                        .valueOf(exceptionToBeThrownOnSOAPFault);
0572:            }
0573:
0574:            /**
0575:             * Set WS-Addressing FaultTo endpoint reference.
0576:             *
0577:             * @param faultTo endpoint
0578:             */
0579:            public void setFaultTo(EndpointReference faultTo) {
0580:                this .faultTo = faultTo;
0581:            }
0582:
0583:            /**
0584:             * Set WS-Addressing From endpoint reference.
0585:             *
0586:             * @param from endpoint
0587:             */
0588:            public void setFrom(EndpointReference from) {
0589:                this .from = from;
0590:            }
0591:
0592:            /**
0593:             * Set listener used for incoming message.
0594:             *
0595:             * @param listener
0596:             */
0597:            public void setListener(TransportListener listener) {
0598:                this .listener = listener;
0599:            }
0600:
0601:            /**
0602:             * Set transport used for incoming message.
0603:             *
0604:             * @param transportIn
0605:             */
0606:            public void setTransportIn(TransportInDescription transportIn) {
0607:                this .transportIn = transportIn;
0608:            }
0609:
0610:            /**
0611:             * Set transport protocol used for incoming message.
0612:             *
0613:             * @param transportInProtocol ("http", "tcp", etc.)
0614:             */
0615:            public void setTransportInProtocol(String transportInProtocol) {
0616:                this .transportInProtocol = transportInProtocol;
0617:            }
0618:
0619:            /**
0620:             * Set WS-Addressing MessageId.
0621:             *
0622:             * @param messageId URI string
0623:             */
0624:            public void setMessageId(String messageId) {
0625:                this .messageId = messageId;
0626:            }
0627:
0628:            /**
0629:             * Set the general property definitions. Due to the way properties are
0630:             * stored, this will not effect the values of predefined properties with
0631:             * specific get/set methods.
0632:             *
0633:             * @param properties
0634:             */
0635:            public void setProperties(Map properties) {
0636:                this .properties = properties;
0637:            }
0638:
0639:            /**
0640:             * General properties you need to pass in to the message context must be set
0641:             * via this method. This method can only be used for properties which do not
0642:             * have specific get/set methods.
0643:             * <p/>
0644:             * Here are some of the properties supported in Axis2.
0645:             * <p/>
0646:             * <a name="GenConst"></a></p>
0647:             * <h3>Generic Constants</h3>
0648:             * <ul>
0649:             * <a name="TRANSPORT_URL"></a></p>
0650:             * <p/>
0651:             * <li><strong>org.apache.axis2.Constants.Configuration.TRANSPORT_URL</strong>
0652:             * <p>Sometimes you want to send your SOAP message through a node, before it reaches to its destination. This means you want to give transport URL different from the URL of the ultimate destination. A typical example would be wanting to send this SOAP (or REST)message through a transparent proxy or through a message monitoring applet. How can that be done using the ServiceClient API?</p>
0653:             * <pre>
0654:             * options.setTo("http://destination.org");
0655:             * options.setProperty(MessageContextConstants.TRANSPORT_URL, "http://myProxy.org");
0656:             * </pre><p>This will send your SOAP message to "http://myProxy.org", but if WS-Addressing is enabled, wsa:To will contain "http://destination.org" as To address.</p>
0657:             * </li>
0658:             * <p>  <a name="CHARACTER_SET_ENCODING"></a></p>
0659:             * <li><b>org.apache.axis2.Constants.Configuration.CHARACTER_SET_ENCODING</b>
0660:             * <p>This will enable user to set the character set encoding scheme to be used when sending the message. Default is set to "UTF-8"</p></li>
0661:             * <p/>
0662:             * <p><a name="ENABLE_MTOM"></a></p>
0663:             * <li><b>org.apache.axis2.Constants.Configuration.ENABLE_MTOM</b>
0664:             * <p>This will enable/disable MTOM support for outgoing messages.</p>
0665:             * <p>Possible values are: </p>
0666:             * <pre>"true"/"false" or Boolean.TRUE/Boolean.FALSE</pre>
0667:             * </li>
0668:             * </ul>
0669:             * <p><a name="Addressing"></a></p>
0670:             * <h3>WS-Addressing Module Specific Constants</h3>
0671:             * <ul>
0672:             * <p/>
0673:             * <a name="WS_ADDRESSING_VERSION"></a></p>
0674:             * <li><b>org.apache.axis2.addressing.AddressingConstants.WS_ADDRESSING_VERSION</b>
0675:             * <p>This will enable to select one of the two WS-Addressing versions available, if WS-Addressing is engaged.</p>
0676:             * <p>Possible values are:</p>
0677:             * <pre>
0678:             * org.apache.axis2.addressing.AddressingConstants.Final.WSA_NAMESPACE
0679:             * and
0680:             * org.apache.axis2.addressing.AddressingConstants.Submission.WSA_NAMESPACE</pre>
0681:             * </li>
0682:             * <p>  <a name="REPLACE_ADDRESSING_HEADERS"></a></p>
0683:             * <li><b>org.apache.axis2.addressing.AddressingConstants.REPLACE_ADDRESSING_HEADERS</b>
0684:             * <p/>
0685:             * <p>AddressingOutHandler picks up the addressing information from the message context and set them to the outgoing message. But someone may have already put some addressing headers, before the AddressingOutHandler. This flag will notify the handler whether to override them or not.</p>
0686:             * <p>Possible values are: </p>
0687:             * <pre>"true"/"false" or Boolean.TRUE/Boolean.FALSE</pre>
0688:             * </li>
0689:             * <p>  <a name="DISABLE_ADDRESSING_FOR_OUT_MESSAGES"></a></p>
0690:             * <li><b>org.apache.axis2.addressing.AddressingConstants.<br />
0691:             * DISABLE_ADDRESSING_FOR_OUT_MESSAGES</b>
0692:             * <p>If WS-Addressing is engaged globally or some how in effect for this particular invocation, this will disable Axis2 from putting WS-Addressing headers in to the out going SOAP message. (Note that Axis2 will not put addressing headers to the outgoing message, irrespective of the above flag, if the incoming message did not contain addressing headers).</p>
0693:             * <p/>
0694:             * <p>Possible values are:</p>
0695:             * <pre>"true"/"false" or Boolean.TRUE/Boolean.FALSE</pre>
0696:             * </li>
0697:             * </ul>
0698:             * <p><a name="HTTPConstants"></a></p>
0699:             * <h3>HTTP Constants</h3>
0700:             * <ul>
0701:             * <a name="CHUNKED"></a></p>
0702:             * <li><b>org.apache.axis2.transport.http.HTTPConstants.CHUNKED</b>
0703:             * <p>This will enable/disable chunking support. </p>
0704:             * <p/>
0705:             * <p>Possible values are:</p>
0706:             * <pre>"true"/"false" or Boolean.TRUE/Boolean.FALSE</pre>
0707:             * </li>
0708:             * <p><a name="NTLM"></a></p>
0709:             * <li><b>org.apache.axis2.transport.http.HTTPConstants.NTLM_AUTHENTICATION</b>
0710:             * <p>This enables the user to pass in NTLM authentication information, such as host, port, realm, username, password to be used with HTTP transport sender. </p>
0711:             * <p>The value should always be an instance of:  </p>
0712:             * <pre>org.apache.axis2.transport.http.HttpTransportProperties.
0713:             * NTLMAuthentication</pre>
0714:             * </li>
0715:             * <p/>
0716:             * <p><a name="PROXY"></a></p>
0717:             * <li><b>org.apache.axis2.transport.http.HTTPConstants.PROXY</b>
0718:             * <p>This enables the user to pass in proxy information, such as proxy host name, port, domain, username, password to be used with HTTP transport sender. </p>
0719:             * <p>The value should always be an instance of:</p>
0720:             * <pre>org.apache.axis2.transport.http.HttpTransportProperties.ProxyProperties</pre>
0721:             * </li>
0722:             * <p>The value should always be an instance of: </p>
0723:             * <pre>org.apache.axis2.transport.http.HttpTransportProperties.BasicAuthentication</pre>
0724:             * </li>
0725:             * <p><a name="SO_TIMEOUT"></a></p>
0726:             * <li><b>org.apache.axis2.transport.http.HTTPConstants.SO_TIMEOUT</b>
0727:             * <p>This enables the user to pass in socket timeout value as an Integer. If nothing is set, the default value is 60000 milliseconds.</p>
0728:             * </li>
0729:             * <p><a name="CON_TIMEOUT"></a></p>
0730:             * <li><b>org.apache.axis2.transport.http.HTTPConstants.CONNECTION_TIMEOUT</b>
0731:             * <p/>
0732:             * <p>This enables the user to pass in connection timeout value as an Integer. If nothing is set, the default value is 60000 milliseconds.</p>
0733:             * </li>
0734:             * <p><a name="USER_AGENT"></a></p>
0735:             * <li><b>org.apache.axis2.transport.http.HTTPConstants.USER_AGENT</b>
0736:             * <p>This enables the user to set the user agent header in the outgoing HTTP request. Default value is "Axis2"</p>
0737:             * </li>
0738:             * <p><a name="GZIP"></a></p>
0739:             * <li><b>org.apache.axis2.transport.http.HTTPConstants.MC_GZIP_REQUEST</b>
0740:             * <p>If set this will GZip your request and send over to the destination. Before doing this, you must make sure that the receiving end supports GZip compressed streams. <br></p>
0741:             * <p/>
0742:             * <p>Possible values are: </p>
0743:             * <pre>"true"/"false" or Boolean.TRUE/Boolean.FALSE</pre>
0744:             * </li>
0745:             * <p><a name="ACCEPT_GZIP"></a></p>
0746:             * <li><b>org.apache.axis2.transport.http.HTTPConstants.MC_ACCEPT_GZIP</b>
0747:             * <p>Whether or not you send a gzip-ped request, you can choose to receive GZIP back from the server using this flag.</p>
0748:             * <p>Possible values are: </p>
0749:             * <pre>"true"/"false" or Boolean.TRUE/Boolean.FALSE</pre>
0750:             * </li>
0751:             * <p/>
0752:             * <p><a name="COOKIE"></a></p>
0753:             * <li><b>org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING</b>
0754:             * <p>This enables the user to set the cookie string header in the outgoing HTTP request.</p>
0755:             * </li>
0756:             * <p><a name="HTTP_PROTOCOL_VERSION"></a></p>
0757:             * <li><b>org.apache.axis2.transport.http.HTTPConstants.HTTP_PROTOCOL_VERSION</b>
0758:             * <p>This will set the HTTP protocol version to be used in sending the SOAP requests. </p>
0759:             * <p>Possible values are :</p>
0760:             * <pre>
0761:             * <p/>
0762:             * HTTP/1.1 - HTTPConstants.HEADER_PROTOCOL_11
0763:             * HTTP/1.0 - HTTPConstants.HEADER_PROTOCOL_10
0764:             * </pre><p>    Default is to use HTTP/1.1.</li>
0765:             * <p><a name="HTTP_HEADERS"></a></p>
0766:             * <li><b>org.apache.axis2.transport.http.HTTPConstants.HTTP_HEADERS</b>
0767:             * <p>You might sometimes want to send your own custom HTTP headers. You can set an ArrayList filled with </p>
0768:             * <pre>org.apache.commons.httpclient.Header</pre><p> objects using the above property. You must not try to override the Headers the Axis2 engine is setting to the outgoing message.</p>
0769:             * </li>
0770:             * <p><a name="REUSE_HTTP_CLIENT"></a></p>
0771:             * <p/>
0772:             * <li><b>org.apache.axis2.transport.http.HTTPConstants.REUSE_HTTP_CLIENT</b>
0773:             * <p>You might want to use the same HTTPClient instance for multiple invocations. This flag will notify the engine to use the same HTTPClient between invocations.</p>
0774:             * </li>
0775:             * <p><a name="CACHED_HTTP_CLIENT"></a></p>
0776:             * <li><b>org.apache.axis2.transport.http.HTTPConstants.CACHED_HTTP_CLIENT</b>
0777:             * <p>If user had requested to re-use an HTTPClient using the above property, this property can be used to set a custom HTTPClient to be re-used.</p>
0778:             * </li>
0779:             * </ul>
0780:             * <p><a name="REST"></a></p>
0781:             * <p/>
0782:             * <h3>Constants to be used in a REST Invocation</h3>
0783:             * <ul>
0784:             * <a name="ENABLE_REST"></a></p>
0785:             * <li><b>org.apache.axis2.transport.http.Constants.Configuration.ENABLE_REST</b>
0786:             * <p>Enabling REST using the above flag will send your request as a REST invocation. </p>
0787:             * <p>Possible values are: </p>
0788:             * <pre>"true"/"false" or Boolean.TRUE/Boolean.FALSE</pre>
0789:             * </li>
0790:             * <p><a name="HTTP_METHOD"></a></p>
0791:             * <li><b>org.apache.axis2.transport.http.Constants.Configuration.HTTP_METHOD</b>
0792:             * <p/>
0793:             * <p>This will help the user to pick the HTTP method to be used during a REST invocation. </p>
0794:             * <p>Possible values are :</p>
0795:             * <pre>
0796:             * org.apache.axis2.Constants.Configuration.HTTP_METHOD_GET
0797:             * and
0798:             * org.apache.axis2.Constants.Configuration.HTTP_METHOD_POST
0799:             * </pre><p>    Default is to use POST method.</li>
0800:             * <p><a name="CONTENT_TYPE"></a>  </p>
0801:             * <li><b>org.apache.axis2.transport.http.Constants.Configuration.CONTENT_TYPE</b>
0802:             * <p>This will help the user to pick the content type to be used during a REST<br />
0803:             * <p/>
0804:             * invocation. </p>
0805:             * <p>Possible values are :</p>
0806:             * <ul>
0807:             * <li>application/xml                   -<br />
0808:             * <pre>HTTPConstants.MEDIA_TYPE_APPLICATION_XML</pre></li>
0809:             * <li>application/x-www-form-urlencoded -<br />
0810:             * <pre>HTTPConstants.MEDIA_TYPE_X_WWW_FORM</pre></li>
0811:             * <li>text/xml                          -<br />
0812:             * <pre>MEDIA_TYPE_TEXT_XML</pre></li>
0813:             * <p/>
0814:             * <li>multipart/related                 -<br />
0815:             * <pre>MEDIA_TYPE_MULTIPART_RELATED</pre></li>
0816:             * </ul>
0817:             * </li>
0818:             * </ul>
0819:             *
0820:             * @param propertyKey
0821:             * @param property
0822:             */
0823:            public void setProperty(String propertyKey, Object property) {
0824:                // make sure that the Options properties exists
0825:                if (this .properties == null) {
0826:                    this .properties = new HashMap();
0827:                }
0828:                properties.put(propertyKey, property);
0829:            }
0830:
0831:            /**
0832:             * Add WS-Addressing RelatesTo item.
0833:             *
0834:             * @param relatesTo
0835:             */
0836:            public void addRelatesTo(RelatesTo relatesTo) {
0837:                if (relationships == null) {
0838:                    relationships = new ArrayList(5);
0839:                }
0840:                relationships.add(relatesTo);
0841:            }
0842:
0843:            /**
0844:             * Set WS-Addressing ReplyTo endpoint.
0845:             *
0846:             * @param replyTo endpoint
0847:             */
0848:            public void setReplyTo(EndpointReference replyTo) {
0849:                this .replyTo = replyTo;
0850:            }
0851:
0852:            /**
0853:             * Set transport used for outgoing message.
0854:             *
0855:             * @param transportOut
0856:             */
0857:            public void setTransportOut(TransportOutDescription transportOut) {
0858:                this .transportOut = transportOut;
0859:            }
0860:
0861:            /**
0862:             * Set transport used for outgoing message.
0863:             *
0864:             * @param senderTransport   transport name in Axis2 configuration
0865:             *                          ("http", "tcp", etc.)
0866:             * @param axisConfiguration
0867:             * @throws AxisFault if the transport is not found
0868:             */
0869:            public void setSenderTransport(String senderTransport,
0870:                    AxisConfiguration axisConfiguration) throws AxisFault {
0871:                this .transportOut = axisConfiguration
0872:                        .getTransportOut(senderTransport);
0873:
0874:                if (senderTransport == null) {
0875:                    throw new AxisFault(Messages.getMessage("unknownTransport",
0876:                            senderTransport));
0877:                }
0878:            }
0879:
0880:            /**
0881:             * Set the SOAP version to be used.
0882:             *
0883:             * @param soapVersionURI
0884:             * @see org.apache.axis2.namespace.Constants#URI_SOAP11_ENV
0885:             * @see org.apache.axis2.namespace.Constants#URI_SOAP12_ENV
0886:             */
0887:            public void setSoapVersionURI(String soapVersionURI) {
0888:                this .soapVersionURI = soapVersionURI;
0889:            }
0890:
0891:            /**
0892:             * This is used in blocking scenario. Client will time out after waiting
0893:             * this amount of time. The default is 2000 and must be provided in
0894:             * multiples of 100.
0895:             *
0896:             * @param timeOutInMilliSeconds
0897:             */
0898:            public void setTimeOutInMilliSeconds(long timeOutInMilliSeconds) {
0899:                this .timeOutInMilliSeconds = timeOutInMilliSeconds;
0900:            }
0901:
0902:            /**
0903:             * Set WS-Addressing To endpoint.
0904:             *
0905:             * @param to endpoint
0906:             */
0907:            public void setTo(EndpointReference to) {
0908:                this .to = to;
0909:            }
0910:
0911:            /**
0912:             * Sets transport information to the call. The scenarios supported are as
0913:             * follows: <blockquote>
0914:             * <p/>
0915:             * <pre>
0916:             *  [senderTransport, listenerTransport, useSeparateListener]
0917:             *  http, http, true
0918:             *  http, http, false
0919:             *  http, smtp, true
0920:             *  smtp, http, true
0921:             *  smtp, smtp, true
0922:             *  tcp,  tcp,  true
0923:             *  tcp,  tcp,  false
0924:             *  etc.
0925:             * </pre>
0926:             * <p/>
0927:             * </blockquote>
0928:             *
0929:             * @param senderTransport
0930:             * @param listenerTransport
0931:             * @param useSeparateListener
0932:             * @throws AxisFault
0933:             * @deprecated Use setTransportInProtocol(String) and
0934:             *             useSeparateListener(boolean) instead. You do not need to
0935:             *             setSenderTransportProtocol(String) as sender transport can be
0936:             *             inferred from the to EPR. But still you can
0937:             *             setTransportOut(TransportOutDescription).
0938:             */
0939:            public void setTransportInfo(String senderTransport,
0940:                    String listenerTransport, boolean useSeparateListener)
0941:                    throws AxisFault {
0942:
0943:                // here we check for a legal combination, for and example if the
0944:                // sendertransport is http and listener
0945:                // transport is smtp the invocation must using separate transport
0946:                if (!useSeparateListener) {
0947:                    boolean isTransportsEqual = senderTransport
0948:                            .equals(listenerTransport);
0949:                    boolean isATwoWaytransport = Constants.TRANSPORT_HTTP
0950:                            .equals(senderTransport)
0951:                            || Constants.TRANSPORT_TCP.equals(senderTransport);
0952:
0953:                    if ((!isTransportsEqual || !isATwoWaytransport)) {
0954:                        throw new AxisFault(Messages.getMessage(
0955:                                "useSeparateListenerLimited", senderTransport,
0956:                                listenerTransport));
0957:                    }
0958:                } else {
0959:                    setUseSeparateListener(useSeparateListener);
0960:                }
0961:
0962:                setTransportInProtocol(listenerTransport);
0963:            }
0964:
0965:            /**
0966:             * Used to specify whether the two SOAP Messages are be sent over same
0967:             * channel or over separate channels. The value of this variable depends on
0968:             * the transport specified. For e.g., if the transports are different this
0969:             * is true by default. HTTP transport supports both cases while SMTP
0970:             * transport supports only two channel case.
0971:             *
0972:             * @param useSeparateListener
0973:             */
0974:            public void setUseSeparateListener(boolean useSeparateListener) {
0975:                this .useSeparateListener = Boolean.valueOf(useSeparateListener);
0976:            }
0977:
0978:            /**
0979:             * Add WS-Addressing ReferenceParameter child element. Multiple child
0980:             * may be used.
0981:             * TODO Add get method, implement handling.
0982:             *
0983:             * @param referenceParameter
0984:             * @deprecated
0985:             */
0986:            public void addReferenceParameter(OMElement referenceParameter) {
0987:                if (referenceParameters == null) {
0988:                    referenceParameters = new ArrayList(5);
0989:                }
0990:
0991:                referenceParameters.add(referenceParameter);
0992:            }
0993:
0994:            /**
0995:             * Check if session management is enabled.
0996:             *
0997:             * @return <code>true</code> if enabled
0998:             */
0999:            public boolean isManageSession() {
1000:                return manageSession;
1001:            }
1002:
1003:            /**
1004:             * Set session management enabled state. When session management is enabled,
1005:             * the engine will automatically send session data (such as the service
1006:             * group id, or HTTP cookies) as part of requests.
1007:             *
1008:             * @param manageSession <code>true</code> if enabling sessions
1009:             */
1010:            public void setManageSession(boolean manageSession) {
1011:                this .manageSession = manageSession;
1012:            }
1013:
1014:            /* ===============================================================
1015:             * Externalizable support
1016:             * ===============================================================
1017:             */
1018:
1019:            /**
1020:             * Save the contents of this object.
1021:             * <p/>
1022:             * NOTE: Transient fields and static fields are not saved.
1023:             *
1024:             * @param out The stream to write the object contents to
1025:             * @throws IOException
1026:             */
1027:            public void writeExternal(ObjectOutput out) throws IOException {
1028:                String logCorrelationIDString = getLogCorrelationIDString();
1029:
1030:                // write out contents of this object
1031:
1032:                // NOTES: For each item, where appropriate,
1033:                //        write out the following information, IN ORDER:
1034:                //           the class name
1035:                //           the active or empty flag
1036:                //           the data length, if appropriate
1037:                //           the data
1038:
1039:                //---------------------------------------------------------
1040:                // in order to handle future changes to the message
1041:                // context definition, be sure to maintain the
1042:                // object level identifiers
1043:                //---------------------------------------------------------
1044:                // serialization version ID
1045:                out.writeLong(serialVersionUID);
1046:
1047:                // revision ID
1048:                out.writeInt(revisionID);
1049:
1050:                //---------------------------------------------------------
1051:                // various simple fields
1052:                //---------------------------------------------------------
1053:                out.writeLong(timeOutInMilliSeconds);
1054:
1055:                out.writeBoolean(manageSession);
1056:
1057:                // the following objects could be null
1058:                ObjectStateUtils.writeObject(out,
1059:                        isExceptionToBeThrownOnSOAPFault,
1060:                        logCorrelationIDString
1061:                                + ".isExceptionToBeThrownOnSOAPFault");
1062:                ObjectStateUtils.writeObject(out, useSeparateListener,
1063:                        logCorrelationIDString + ".useSeparateListener");
1064:
1065:                //---------------------------------------------------------
1066:                // various strings
1067:                //---------------------------------------------------------
1068:
1069:                // String soapVersionURI
1070:                ObjectStateUtils.writeString(out, soapVersionURI,
1071:                        logCorrelationIDString + ".soapVersionURI");
1072:
1073:                // String action
1074:                ObjectStateUtils.writeString(out, action,
1075:                        logCorrelationIDString + ".action");
1076:
1077:                // String transportInProtocol
1078:                ObjectStateUtils.writeString(out, transportInProtocol,
1079:                        logCorrelationIDString + ".transportInProtocol");
1080:
1081:                // String messageId
1082:                ObjectStateUtils.writeString(out, messageId,
1083:                        logCorrelationIDString + ".messageId");
1084:
1085:                // String object id
1086:                ObjectStateUtils.writeString(out, logCorrelationIDString,
1087:                        logCorrelationIDString + ".logCorrelationIDString");
1088:
1089:                //---------------------------------------------------------
1090:                // various objects
1091:                //---------------------------------------------------------
1092:
1093:                // put some try..catch blocks around the following objects
1094:                // so that the writing to the output stream continues
1095:                // even if one of the objects can't be serialized
1096:
1097:                try {
1098:                    // EndpointReference faultTo
1099:                    ObjectStateUtils.writeObject(out, faultTo,
1100:                            logCorrelationIDString + ".faultTo");
1101:                } catch (Exception e1) {
1102:                    // note that the utility class will provide the trace for the
1103:                    // exception so we won't have to
1104:                    // so just consume the exception for now
1105:                }
1106:
1107:                try {
1108:                    // EndpointReference from
1109:                    ObjectStateUtils.writeObject(out, from,
1110:                            logCorrelationIDString + ".from");
1111:                } catch (Exception e2) {
1112:                    // note that the utility class will provide the trace for the
1113:                    // exception so we won't have to
1114:                    // so just consume the exception for now
1115:                }
1116:
1117:                try {
1118:                    // EndpointReference replyTo
1119:                    ObjectStateUtils.writeObject(out, replyTo,
1120:                            logCorrelationIDString + ".replyTo");
1121:                } catch (Exception e3) {
1122:                    // note that the utility class will provide the trace for the
1123:                    // exception so we won't have to
1124:                    // so just consume the exception for now
1125:                }
1126:
1127:                try {
1128:                    // EndpointReference to
1129:                    ObjectStateUtils.writeObject(out, to,
1130:                            logCorrelationIDString + ".to");
1131:                } catch (Exception e4) {
1132:                    // note that the utility class will provide the trace for the
1133:                    // exception so we won't have to
1134:                    // so just consume the exception for now
1135:                }
1136:
1137:                // TransportListener listener
1138:                if (listener != null) {
1139:                    metaListener = new MetaDataEntry(listener.getClass()
1140:                            .getName(), null);
1141:                } else {
1142:                    metaListener = null;
1143:                }
1144:                ObjectStateUtils.writeObject(out, metaListener,
1145:                        logCorrelationIDString + ".listener");
1146:
1147:                // TransportInDescription transportIn
1148:                if (transportIn != null) {
1149:                    metaTransportIn = new MetaDataEntry(null, transportIn
1150:                            .getName().toString());
1151:                } else {
1152:                    metaTransportIn = null;
1153:                }
1154:                ObjectStateUtils.writeObject(out, metaTransportIn,
1155:                        logCorrelationIDString + ".transportIn");
1156:
1157:                // TransportOutDescription transportOut
1158:                if (transportOut != null) {
1159:                    metaTransportOut = new MetaDataEntry(null, transportOut
1160:                            .getName().toString());
1161:                } else {
1162:                    metaTransportOut = null;
1163:                }
1164:                ObjectStateUtils.writeObject(out, metaTransportOut,
1165:                        logCorrelationIDString + ".transportOut");
1166:
1167:                //---------------------------------------------------------
1168:                // collections and lists
1169:                //---------------------------------------------------------
1170:
1171:                // List relationships, which is an array of RelatesTo objects
1172:                ArrayList tmp = null;
1173:
1174:                if (relationships != null) {
1175:                    // make sure this is an array list
1176:                    tmp = new ArrayList(relationships);
1177:                }
1178:
1179:                ObjectStateUtils.writeArrayList(out, tmp,
1180:                        logCorrelationIDString + ".relationships");
1181:
1182:                // ArrayList referenceParameters
1183:                ObjectStateUtils.writeArrayList(out, referenceParameters,
1184:                        logCorrelationIDString + ".referenceParameters");
1185:
1186:                //---------------------------------------------------------
1187:                // properties
1188:                //---------------------------------------------------------
1189:
1190:                // HashMap properties
1191:                HashMap tmpHM = new HashMap(getProperties());
1192:
1193:                ObjectStateUtils.writeHashMap(out, tmpHM,
1194:                        logCorrelationIDString + ".properties");
1195:
1196:                //---------------------------------------------------------
1197:                // "nested"
1198:                //---------------------------------------------------------
1199:
1200:                try {
1201:                    // Options parent
1202:                    ObjectStateUtils.writeObject(out, parent,
1203:                            logCorrelationIDString + ".parent");
1204:                } catch (Exception e5) {
1205:                    // note that the utility class will provide the trace for the
1206:                    // exception so we won't have to
1207:                    // so just consume the exception for now
1208:                }
1209:
1210:            }
1211:
1212:            /**
1213:             * Restore the contents of the MessageContext that was
1214:             * previously saved.
1215:             * <p/>
1216:             * NOTE: The field data must read back in the same order and type
1217:             * as it was written.  Some data will need to be validated when
1218:             * resurrected.
1219:             *
1220:             * @param in The stream to read the object contents from
1221:             * @throws IOException
1222:             * @throws ClassNotFoundException
1223:             */
1224:            public void readExternal(ObjectInput in) throws IOException,
1225:                    ClassNotFoundException {
1226:                // serialization version ID
1227:                long suid = in.readLong();
1228:
1229:                // revision ID
1230:                int revID = in.readInt();
1231:
1232:                // make sure the object data is in a version we can handle
1233:                if (suid != serialVersionUID) {
1234:                    throw new ClassNotFoundException(
1235:                            ObjectStateUtils.UNSUPPORTED_SUID);
1236:                }
1237:
1238:                // make sure the object data is in a revision level we can handle
1239:                if (revID != REVISION_1) {
1240:                    throw new ClassNotFoundException(
1241:                            ObjectStateUtils.UNSUPPORTED_REVID);
1242:                }
1243:
1244:                //---------------------------------------------------------
1245:                // various simple fields
1246:                //---------------------------------------------------------
1247:                timeOutInMilliSeconds = in.readLong();
1248:
1249:                manageSession = in.readBoolean();
1250:
1251:                // the following objects could be null
1252:                Object tmp1 = ObjectStateUtils.readObject(in,
1253:                        "Options.isExceptionToBeThrownOnSOAPFault");
1254:                if (tmp1 != null) {
1255:                    isExceptionToBeThrownOnSOAPFault = (Boolean) tmp1;
1256:                }
1257:
1258:                Object tmp2 = ObjectStateUtils.readObject(in,
1259:                        "Options.useSeparateListener");
1260:                if (tmp2 != null) {
1261:                    useSeparateListener = (Boolean) tmp2;
1262:                }
1263:
1264:                //---------------------------------------------------------
1265:                // various strings
1266:                //---------------------------------------------------------
1267:
1268:                // String soapVersionURI
1269:                soapVersionURI = ObjectStateUtils.readString(in,
1270:                        "Options.soapVersionURI");
1271:
1272:                // String action
1273:                action = ObjectStateUtils.readString(in, "Options.action");
1274:
1275:                // String transportInProtocol
1276:                transportInProtocol = ObjectStateUtils.readString(in,
1277:                        "Options.transportInProtocol");
1278:
1279:                // String messageId
1280:                messageId = ObjectStateUtils
1281:                        .readString(in, "Options.messageId");
1282:
1283:                // String object id
1284:                logCorrelationIDString = ObjectStateUtils.readString(in,
1285:                        "Options.logCorrelationIDString");
1286:
1287:                // trace point
1288:                log.trace(myClassName
1289:                        + ":readExternal():  reading the input stream for  ["
1290:                        + logCorrelationIDString + "]");
1291:
1292:                //---------------------------------------------------------
1293:                // various objects
1294:                //---------------------------------------------------------
1295:
1296:                // EndpointReference faultTo
1297:                faultTo = (EndpointReference) ObjectStateUtils.readObject(in,
1298:                        "Options.faultTo");
1299:
1300:                // EndpointReference from
1301:                from = (EndpointReference) ObjectStateUtils.readObject(in,
1302:                        "Options.from");
1303:
1304:                // EndpointReference replyTo
1305:                replyTo = (EndpointReference) ObjectStateUtils.readObject(in,
1306:                        "Options.replyTo");
1307:
1308:                // EndpointReference to
1309:                to = (EndpointReference) ObjectStateUtils.readObject(in,
1310:                        "Options.to");
1311:
1312:                // TransportListener listener
1313:                // is not usable until the meta data has been reconciled
1314:                listener = null;
1315:                metaListener = (MetaDataEntry) ObjectStateUtils.readObject(in,
1316:                        "Options.metaListener");
1317:
1318:                // TransportInDescription transportIn
1319:                // is not usable until the meta data has been reconciled
1320:                transportIn = null;
1321:                metaTransportIn = (MetaDataEntry) ObjectStateUtils.readObject(
1322:                        in, "Options.metaTransportIn");
1323:
1324:                // TransportOutDescription transportOut
1325:                // is not usable until the meta data has been reconciled
1326:                transportOut = null;
1327:                metaTransportOut = (MetaDataEntry) ObjectStateUtils.readObject(
1328:                        in, "Options.metaTransportOut");
1329:
1330:                //---------------------------------------------------------
1331:                // collections and lists
1332:                //---------------------------------------------------------
1333:
1334:                // List relationships, which is an array of RelatesTo objects
1335:                ArrayList tmpAL1 = ObjectStateUtils.readArrayList(in,
1336:                        "Options.relationships");
1337:                if (tmpAL1 != null) {
1338:                    relationships = new ArrayList(tmpAL1);
1339:                } else {
1340:                    relationships = null;
1341:                }
1342:
1343:                // ArrayList referenceParameters
1344:                ArrayList tmpAL2 = ObjectStateUtils.readArrayList(in,
1345:                        "Options.referenceParameters");
1346:                if (tmpAL2 != null) {
1347:                    referenceParameters = new ArrayList(tmpAL2);
1348:                } else {
1349:                    referenceParameters = null;
1350:                }
1351:
1352:                //---------------------------------------------------------
1353:                // properties
1354:                //---------------------------------------------------------
1355:
1356:                // HashMap properties
1357:                HashMap tmpHM = ObjectStateUtils.readHashMap(in,
1358:                        "Options.properties");
1359:
1360:                if (tmpHM != null) {
1361:                    properties = new HashMap(tmpHM);
1362:                } else {
1363:                    properties = new HashMap();
1364:                }
1365:
1366:                //---------------------------------------------------------
1367:                // "nested"
1368:                //---------------------------------------------------------
1369:
1370:                // Options parent
1371:                Object tmpParent = ObjectStateUtils.readObject(in,
1372:                        "Options.parent");
1373:
1374:                if (tmpParent != null) {
1375:                    parent = (Options) tmpParent;
1376:                } else {
1377:                    parent = null;
1378:                }
1379:
1380:            }
1381:
1382:            /**
1383:             * This method checks to see if additional work needs to be
1384:             * done in order to complete the object reconstitution.
1385:             * Some parts of the object restored from the readExternal()
1386:             * cannot be completed until we have a configurationContext
1387:             * from the active engine. The configurationContext is used
1388:             * to help this object to plug back into the engine's
1389:             * configuration and deployment objects.
1390:             *
1391:             * @param cc The configuration context object representing the active configuration
1392:             */
1393:            public void activate(ConfigurationContext cc) {
1394:                // see if there's any work to do
1395:                if (!needsToBeReconciled) {
1396:                    // return quick
1397:                    return;
1398:                }
1399:
1400:                String logCorrelationIDString = getLogCorrelationIDString();
1401:                // use the supplied configuration context
1402:
1403:                // get the axis configuration
1404:                AxisConfiguration axisConfig = cc.getAxisConfiguration();
1405:
1406:                // We previously saved metaTransportIn; restore it
1407:                if (metaTransportIn != null) {
1408:                    QName qin = metaTransportIn.getQName();
1409:                    TransportInDescription tmpIn = null;
1410:                    try {
1411:                        tmpIn = axisConfig.getTransportIn(qin.getLocalPart());
1412:                    } catch (Exception exin) {
1413:                        // if a fault is thrown, log it and continue
1414:                        log
1415:                                .trace(logCorrelationIDString
1416:                                        + "activate():  exception caught when getting the TransportInDescription ["
1417:                                        + qin.toString()
1418:                                        + "]  from the AxisConfiguration ["
1419:                                        + exin.getClass().getName() + " : "
1420:                                        + exin.getMessage() + "]");
1421:                    }
1422:
1423:                    if (tmpIn != null) {
1424:                        transportIn = tmpIn;
1425:                    } else {
1426:                        log
1427:                                .trace(logCorrelationIDString
1428:                                        + "activate():  No TransportInDescription found for ["
1429:                                        + qin.toString() + "]");
1430:
1431:                        transportIn = null;
1432:                    }
1433:                } else {
1434:                    log.trace(logCorrelationIDString
1435:                            + "activate():  No TransportInDescription ");
1436:
1437:                    transportIn = null;
1438:                }
1439:
1440:                // We previously saved metaTransportOut; restore it
1441:                if (metaTransportOut != null) {
1442:                    QName qout = metaTransportOut.getQName();
1443:                    TransportOutDescription tmpOut = null;
1444:                    try {
1445:                        tmpOut = axisConfig
1446:                                .getTransportOut(qout.getLocalPart());
1447:                    } catch (Exception exout) {
1448:                        // if a fault is thrown, log it and continue
1449:                        log
1450:                                .trace(logCorrelationIDString
1451:                                        + "activate():  exception caught when getting the TransportOutDescription ["
1452:                                        + qout.toString()
1453:                                        + "]  from the AxisConfiguration ["
1454:                                        + exout.getClass().getName() + " : "
1455:                                        + exout.getMessage() + "]");
1456:                    }
1457:
1458:                    if (tmpOut != null) {
1459:                        transportOut = tmpOut;
1460:                    } else {
1461:                        log
1462:                                .trace(logCorrelationIDString
1463:                                        + "activate():  No TransportOutDescription found for ["
1464:                                        + qout.toString() + "]");
1465:
1466:                        transportOut = null;
1467:                    }
1468:                } else {
1469:                    log.trace(logCorrelationIDString
1470:                            + "activate():  No TransportOutDescription ");
1471:
1472:                    transportOut = null;
1473:                }
1474:
1475:                // We previously saved metaListener; restore it
1476:                if (metaListener != null) {
1477:                    // see if we can find an existing object
1478:                    String listenerClass = metaListener.getClassName();
1479:                    log.trace(logCorrelationIDString
1480:                            + "activate():  TransportListener found for ["
1481:                            + listenerClass + "] ");
1482:                } else {
1483:                    listener = null;
1484:
1485:                    log.trace(logCorrelationIDString
1486:                            + "activate():  No TransportListener ");
1487:                }
1488:
1489:                //-------------------------------------------------------
1490:                // done, reset the flag
1491:                //-------------------------------------------------------
1492:                needsToBeReconciled = false;
1493:            }
1494:
1495:            /**
1496:             * Compares key parts of the state from the current instance of
1497:             * this class with the specified instance to see if they are
1498:             * equivalent.
1499:             * <p/>
1500:             * This differs from the java.lang.Object.equals() method in
1501:             * that the equals() method generally looks at both the
1502:             * object identity (location in memory) and the object state
1503:             * (data).
1504:             * <p/>
1505:             *
1506:             * @param obj The object to compare with
1507:             * @return TRUE if this object is equivalent with the specified object
1508:             *         that is, key fields match
1509:             *         FALSE, otherwise
1510:             */
1511:            public boolean isEquivalent(Options obj) {
1512:                // NOTE: the input object is expected to exist (ie, be non-null)
1513:
1514:                if (this .timeOutInMilliSeconds != obj
1515:                        .getTimeOutInMilliSeconds()) {
1516:                    return false;
1517:                }
1518:
1519:                if (this .isExceptionToBeThrownOnSOAPFault.booleanValue() != obj
1520:                        .isExceptionToBeThrownOnSOAPFault()) {
1521:                    return false;
1522:                }
1523:
1524:                if (this .useSeparateListener.booleanValue() != obj
1525:                        .isUseSeparateListener()) {
1526:                    return false;
1527:                }
1528:
1529:                if (this .manageSession != obj.isManageSession()) {
1530:                    return false;
1531:                }
1532:
1533:                // --------------------------------------------------------------------
1534:
1535:                if ((this .soapVersionURI != null)
1536:                        && (obj.getSoapVersionURI() != null)) {
1537:                    if (!this .soapVersionURI.equals(obj.getSoapVersionURI())) {
1538:                        return false;
1539:                    }
1540:                } else if ((this .soapVersionURI == null)
1541:                        && (obj.getSoapVersionURI() == null)) {
1542:                    // continue
1543:                } else {
1544:                    // mismatch
1545:                    return false;
1546:                }
1547:
1548:                // --------------------------------------------------------------------
1549:
1550:                if ((this .action != null) && (obj.getAction() != null)) {
1551:                    if (!this .action.equals(obj.getAction())) {
1552:                        return false;
1553:                    }
1554:                } else if ((this .action == null) && (obj.getAction() == null)) {
1555:                    // continue
1556:                } else {
1557:                    // mismatch
1558:                    return false;
1559:                }
1560:
1561:                // --------------------------------------------------------------------
1562:
1563:                if ((this .transportInProtocol != null)
1564:                        && (obj.getTransportInProtocol() != null)) {
1565:                    if (!this .transportInProtocol.equals(obj
1566:                            .getTransportInProtocol())) {
1567:                        return false;
1568:                    }
1569:                } else if ((this .transportInProtocol == null)
1570:                        && (obj.getTransportInProtocol() == null)) {
1571:                    // continue
1572:                } else {
1573:                    // mismatch
1574:                    return false;
1575:                }
1576:
1577:                // --------------------------------------------------------------------
1578:
1579:                if ((this .messageId != null) && (obj.getMessageId() != null)) {
1580:                    if (!this .messageId.equals(obj.getMessageId())) {
1581:                        return false;
1582:                    }
1583:                } else if ((this .messageId == null)
1584:                        && (obj.getMessageId() == null)) {
1585:                    // continue
1586:                } else {
1587:                    // mismatch
1588:                    return false;
1589:                }
1590:
1591:                // --------------------------------------------------------------------
1592:
1593:                if ((this .faultTo != null) && (obj.getFaultTo() != null)) {
1594:                    if (!this .faultTo.isEquivalent(obj.getFaultTo())) {
1595:                        return false;
1596:                    }
1597:                } else if ((this .faultTo == null) && (obj.getFaultTo() == null)) {
1598:                    // continue
1599:                } else {
1600:                    // mismatch
1601:                    return false;
1602:                }
1603:
1604:                // --------------------------------------------------------------------
1605:
1606:                if ((this .from != null) && (obj.getFrom() != null)) {
1607:                    if (!this .from.isEquivalent(obj.getFrom())) {
1608:                        return false;
1609:                    }
1610:                } else if ((this .from == null) && (obj.getFrom() == null)) {
1611:                    // continue
1612:                } else {
1613:                    // mismatch
1614:                    return false;
1615:                }
1616:
1617:                // --------------------------------------------------------------------
1618:
1619:                if ((this .replyTo != null) && (obj.getReplyTo() != null)) {
1620:                    if (!this .replyTo.isEquivalent(obj.getReplyTo())) {
1621:                        return false;
1622:                    }
1623:                } else if ((this .replyTo == null) && (obj.getReplyTo() == null)) {
1624:                    // continue
1625:                } else {
1626:                    // mismatch
1627:                    return false;
1628:                }
1629:
1630:                // --------------------------------------------------------------------
1631:
1632:                if ((this .to != null) && (obj.getTo() != null)) {
1633:                    if (!this .to.isEquivalent(obj.getTo())) {
1634:                        return false;
1635:                    }
1636:                } else if ((this .to == null) && (obj.getTo() == null)) {
1637:                    // continue
1638:                } else {
1639:                    // mismatch
1640:                    return false;
1641:                }
1642:
1643:                // --------------------------------------------------------------------
1644:
1645:                if ((this .properties != null) && (obj.getProperties() != null)) {
1646:                    if (!this .properties.equals(obj.getProperties())) {
1647:                        // This is a strict test.
1648:                        // Returns true if the given object is also a map
1649:                        // and the two maps represent the same mappings.
1650:                        return false;
1651:                    }
1652:                } else if ((this .properties == null)
1653:                        && (obj.getProperties() == null)) {
1654:                    // continue
1655:                } else {
1656:                    // mismatch
1657:                    return false;
1658:                }
1659:
1660:                // --------------------------------------------------------------------
1661:
1662:                // TODO: consider checking the following objects for equivalency
1663:                //        List relationships;
1664:                //        ArrayList referenceParameters;
1665:                //        TransportListener listener;
1666:                //        TransportInDescription transportIn;
1667:                //        TransportOutDescription transportOut;
1668:
1669:                // TODO: consider checking the parent objects for equivalency
1670:
1671:                return true;
1672:            }
1673:
1674:            /**
1675:             * Get the ID associated with this object instance.
1676:             *
1677:             * @return A string that can be output to a log file as an identifier
1678:             *         for this object instance.  It is suitable for matching related log
1679:             *         entries.
1680:             */
1681:            public String getLogCorrelationIDString() {
1682:                if (logCorrelationIDString == null) {
1683:                    logCorrelationIDString = myClassName + "@"
1684:                            + UUIDGenerator.getUUID();
1685:                }
1686:                return logCorrelationIDString;
1687:            }
1688:
1689:            /**
1690:             * Trace a warning message, if needed, indicating that this
1691:             * object needs to be activated before accessing certain fields.
1692:             *
1693:             * @param methodname The method where the warning occurs
1694:             */
1695:            private void checkActivateWarning(String methodname) {
1696:                if (needsToBeReconciled) {
1697:                    log
1698:                            .warn(getLogCorrelationIDString()
1699:                                    + ":"
1700:                                    + methodname
1701:                                    + "(): ****WARNING**** "
1702:                                    + myClassName
1703:                                    + ".activate(configurationContext) needs to be invoked.");
1704:                }
1705:            }
1706:
1707:            public boolean isCallTransportCleanup() {
1708:                return callTransportCleanup;
1709:            }
1710:
1711:            public void setCallTransportCleanup(boolean callTransportCleanup) {
1712:                this .callTransportCleanup = callTransportCleanup;
1713:            }
1714:
1715:            public String getUserName() {
1716:                if (userName == null && parent != null) {
1717:                    return parent.getUserName();
1718:                }
1719:                return userName;
1720:            }
1721:
1722:            public void setUserName(String userName) {
1723:                this .userName = userName;
1724:            }
1725:
1726:            public String getPassword() {
1727:                if (password == null && parent != null) {
1728:                    return parent.getPassword();
1729:                }
1730:                return password;
1731:            }
1732:
1733:            public void setPassword(String password) {
1734:                this.password = password;
1735:            }
1736:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.