cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From asold...@apache.org
Subject [2/2] cxf git commit: [CXF-6227] Avoid building tons of ArrayList instances due to AbstractMessageContainer::getMessageParts() being called only for counting the parts or getting the first one
Date Tue, 03 Feb 2015 10:54:18 GMT
[CXF-6227] Avoid building tons of ArrayList instances due to AbstractMessageContainer::getMessageParts() being called only for counting the parts or getting the first one


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/2895b7b0
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/2895b7b0
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/2895b7b0

Branch: refs/heads/master
Commit: 2895b7b052e6c96d192abf39d472737b54fcd9c2
Parents: 68a5676
Author: Alessio Soldano <asoldano@redhat.com>
Authored: Tue Feb 3 11:50:31 2015 +0100
Committer: Alessio Soldano <asoldano@redhat.com>
Committed: Tue Feb 3 11:50:31 2015 +0100

----------------------------------------------------------------------
 .../cxf/interceptor/FaultOutInterceptor.java    |  2 +-
 .../service/model/AbstractMessageContainer.java | 15 ++++++++
 .../soap/interceptor/SoapOutInterceptor.java    |  3 +-
 .../cxf/binding/xml/XMLFormatValidator.java     |  8 ++---
 .../interceptor/XMLMessageOutInterceptor.java   |  5 +--
 .../apache/cxf/jaxb/JAXBContextInitializer.java |  2 +-
 .../apache/cxf/jaxb/JAXBSchemaInitializer.java  |  2 +-
 .../java/org/apache/cxf/jaxws/DispatchImpl.java |  2 +-
 .../apache/cxf/jaxws/WrapperClassGenerator.java |  4 +--
 .../interceptors/WrapperClassInInterceptor.java |  2 +-
 .../WrapperClassOutInterceptor.java             | 12 +++----
 .../jaxws/support/JaxWsServiceFactoryBean.java  | 28 +++++++++------
 .../endpoint/dynamic/TypeClassInitializer.java  |  4 +--
 .../apache/cxf/transport/http/HTTPConduit.java  | 16 ++++++---
 .../addressing/impl/InternalContextUtils.java   |  2 +-
 .../ws/security/trust/AbstractSTSClient.java    |  4 +--
 .../PolicyBasedWSS4JStaxInInterceptor.java      | 16 +++++----
 .../wsdl/interceptors/BareInInterceptor.java    |  2 +-
 .../interceptors/DocLiteralInInterceptor.java   | 19 +++++-----
 .../interceptors/WrappedOutInterceptor.java     |  4 +--
 .../factory/DefaultServiceConfiguration.java    |  2 +-
 .../factory/ReflectionServiceFactoryBean.java   | 38 +++++++++++---------
 .../internal/jaxws/RequestWrapper.java          |  5 +--
 .../internal/jaxws/ResponseWrapper.java         |  6 ++--
 .../processor/internal/OperationProcessor.java  |  8 ++---
 .../processor/internal/ParameterProcessor.java  | 38 ++++++++++----------
 .../processor/internal/ServiceProcessor.java    |  2 +-
 .../jaxws/validator/UniqueBodyValidator.java    |  6 ++--
 .../WrapperStyleNameCollisionValidator.java     |  8 ++---
 29 files changed, 152 insertions(+), 113 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/2895b7b0/core/src/main/java/org/apache/cxf/interceptor/FaultOutInterceptor.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/cxf/interceptor/FaultOutInterceptor.java b/core/src/main/java/org/apache/cxf/interceptor/FaultOutInterceptor.java
index ef9bf02..b57e487 100644
--- a/core/src/main/java/org/apache/cxf/interceptor/FaultOutInterceptor.java
+++ b/core/src/main/java/org/apache/cxf/interceptor/FaultOutInterceptor.java
@@ -79,7 +79,7 @@ public class FaultOutInterceptor extends AbstractPhaseInterceptor<Message> {
             Object bean = getFaultBean(cause, fi, message);
             Service service = message.getExchange().get(Service.class);
 
-            MessagePartInfo part = fi.getMessageParts().iterator().next();
+            MessagePartInfo part = fi.getFirstMessagePart();
             DataBinding db = service.getDataBinding();
 
             try {

http://git-wip-us.apache.org/repos/asf/cxf/blob/2895b7b0/core/src/main/java/org/apache/cxf/service/model/AbstractMessageContainer.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/cxf/service/model/AbstractMessageContainer.java b/core/src/main/java/org/apache/cxf/service/model/AbstractMessageContainer.java
index 38d5bc3..ba36e1b 100644
--- a/core/src/main/java/org/apache/cxf/service/model/AbstractMessageContainer.java
+++ b/core/src/main/java/org/apache/cxf/service/model/AbstractMessageContainer.java
@@ -221,6 +221,21 @@ public abstract class AbstractMessageContainer extends AbstractPropertiesHolder
         parts.addAll(outOfBandParts);
         return parts;
     }
+    public int getMessagePartsNumber() {
+        if (outOfBandParts == null) {
+            return messageParts.size();
+        }
+        return messageParts.size() + outOfBandParts.size();
+    }
+    public MessagePartInfo getFirstMessagePart() {
+        if (!messageParts.isEmpty()) {
+            return messageParts.values().iterator().next();
+        } else  if (outOfBandParts != null && !outOfBandParts.isEmpty()) {
+            return outOfBandParts.get(0);
+        } else {
+            return null;
+        }
+    }
     public List<MessagePartInfo> getOutOfBandParts() {
         if (outOfBandParts == null) {
             return Collections.emptyList();

http://git-wip-us.apache.org/repos/asf/cxf/blob/2895b7b0/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapOutInterceptor.java
----------------------------------------------------------------------
diff --git a/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapOutInterceptor.java b/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapOutInterceptor.java
index df17631..6666c2a 100644
--- a/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapOutInterceptor.java
+++ b/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapOutInterceptor.java
@@ -214,8 +214,7 @@ public class SoapOutInterceptor extends AbstractSoapInterceptor {
             return endedHeader;
         }
         
-        List<MessagePartInfo> parts = wrappedBmi.getMessageInfo().getMessageParts();
-        if (parts.size() > 0) {
+        if (wrappedBmi.getMessageInfo().getMessagePartsNumber() > 0) {
             MessageContentsList objs = MessageContentsList.getContentsList(message);
             if (objs == null) {
                 return endedHeader;

http://git-wip-us.apache.org/repos/asf/cxf/blob/2895b7b0/rt/bindings/xml/src/main/java/org/apache/cxf/binding/xml/XMLFormatValidator.java
----------------------------------------------------------------------
diff --git a/rt/bindings/xml/src/main/java/org/apache/cxf/binding/xml/XMLFormatValidator.java b/rt/bindings/xml/src/main/java/org/apache/cxf/binding/xml/XMLFormatValidator.java
index b8f34dc..38ad110 100644
--- a/rt/bindings/xml/src/main/java/org/apache/cxf/binding/xml/XMLFormatValidator.java
+++ b/rt/bindings/xml/src/main/java/org/apache/cxf/binding/xml/XMLFormatValidator.java
@@ -67,8 +67,8 @@ public class XMLFormatValidator extends ServiceValidator {
         for (BindingOperationInfo bo : bos) {
             OperationInfo op = binding.getInterface().getOperation(bo.getName());
             needRootNode = false;
-            if (op.getInput().getMessageParts().size() == 0
-                || op.getInput().getMessageParts().size() > 1) {
+            final int inputPartsNum = op.getInput().getMessagePartsNumber();
+            if (inputPartsNum == 0 || inputPartsNum > 1) {
                 needRootNode = true;
             }
             if (needRootNode) {
@@ -86,8 +86,8 @@ public class XMLFormatValidator extends ServiceValidator {
                 // Input check correct, continue to check output binding
                 if (op.getOutput() != null) {
                     needRootNode = false;
-                    if (op.getOutput().getMessageParts().size() == 0
-                        || op.getOutput().getMessageParts().size() > 1) {
+                    final int outputPartsNum = op.getOutput().getMessagePartsNumber();
+                    if (outputPartsNum == 0 || outputPartsNum > 1) {
                         needRootNode = true;
                     }
                     if (needRootNode) {

http://git-wip-us.apache.org/repos/asf/cxf/blob/2895b7b0/rt/bindings/xml/src/main/java/org/apache/cxf/binding/xml/interceptor/XMLMessageOutInterceptor.java
----------------------------------------------------------------------
diff --git a/rt/bindings/xml/src/main/java/org/apache/cxf/binding/xml/interceptor/XMLMessageOutInterceptor.java b/rt/bindings/xml/src/main/java/org/apache/cxf/binding/xml/interceptor/XMLMessageOutInterceptor.java
index 9daf6af..ed3a8e1 100644
--- a/rt/bindings/xml/src/main/java/org/apache/cxf/binding/xml/interceptor/XMLMessageOutInterceptor.java
+++ b/rt/bindings/xml/src/main/java/org/apache/cxf/binding/xml/interceptor/XMLMessageOutInterceptor.java
@@ -67,8 +67,9 @@ public class XMLMessageOutInterceptor extends AbstractOutDatabindingInterceptor
         if (xmf != null) {
             rootInModel = xmf.getRootNode();
         }
+        final int mpn = mi.getMessagePartsNumber();
         if (boi.isUnwrapped() 
-            || mi.getMessageParts().size() == 1) {
+            || mpn == 1) {
             // wrapper out interceptor created the wrapper
             // or if bare-one-param
             new BareOutInterceptor().handleMessage(message);
@@ -76,7 +77,7 @@ public class XMLMessageOutInterceptor extends AbstractOutDatabindingInterceptor
             if (rootInModel == null) {
                 rootInModel = boi.getName();
             }
-            if (mi.getMessageParts().size() == 0 && !boi.isUnwrapped()) {
+            if (mpn == 0 && !boi.isUnwrapped()) {
                 // write empty operation qname
                 writeMessage(message, rootInModel, false);
             } else {

http://git-wip-us.apache.org/repos/asf/cxf/blob/2895b7b0/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBContextInitializer.java
----------------------------------------------------------------------
diff --git a/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBContextInitializer.java b/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBContextInitializer.java
index a95a3d2..27f7a74 100644
--- a/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBContextInitializer.java
+++ b/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBContextInitializer.java
@@ -105,7 +105,7 @@ class JAXBContextInitializer extends ServiceModelVisitor {
                 inf = op.getOutput();
             }
             if (inf != null
-                && inf.getMessagePart(0).getTypeClass() != null) {
+                && inf.getFirstMessagePart().getTypeClass() != null) {
                 //if the wrapper has a type class, we don't need to do anything
                 //as everything would have been discovered when walking the
                 //wrapper type (unless it's a header which wouldn't be in the wrapper)

http://git-wip-us.apache.org/repos/asf/cxf/blob/2895b7b0/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBSchemaInitializer.java
----------------------------------------------------------------------
diff --git a/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBSchemaInitializer.java b/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBSchemaInitializer.java
index dbaefcf..64baa93 100644
--- a/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBSchemaInitializer.java
+++ b/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBSchemaInitializer.java
@@ -382,7 +382,7 @@ class JAXBSchemaInitializer extends ServiceModelVisitor {
     }
 
     public void end(FaultInfo fault) {
-        MessagePartInfo part = fault.getMessageParts().get(0);
+        MessagePartInfo part = fault.getFirstMessagePart();
         Class<?> cls = part.getTypeClass();
         Class<?> cl2 = (Class<?>)fault.getProperty(Class.class.getName());
         if (cls != cl2) {

http://git-wip-us.apache.org/repos/asf/cxf/blob/2895b7b0/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java
----------------------------------------------------------------------
diff --git a/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java b/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java
index 0a46dc8..f194548 100644
--- a/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java
+++ b/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java
@@ -562,7 +562,7 @@ public class DispatchImpl<T> implements Dispatch<T>, BindingProvider, Closeable
                 if ("document".equals(operationStyle)) {
                     // if doc
                     if (bop.getOperationInfo().getInput() != null
-                        && !bop.getOperationInfo().getInput().getMessageParts().isEmpty()) {
+                        && bop.getOperationInfo().getInput().getMessagePartsNumber() > 0) {
                         QName qn = bop.getOperationInfo().getInput().getMessagePartByIndex(0)
                             .getElementQName();
                         QName op = bop.getOperationInfo().getName();

http://git-wip-us.apache.org/repos/asf/cxf/blob/2895b7b0/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/WrapperClassGenerator.java
----------------------------------------------------------------------
diff --git a/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/WrapperClassGenerator.java b/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/WrapperClassGenerator.java
index 586f3cc..977b7dd 100644
--- a/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/WrapperClassGenerator.java
+++ b/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/WrapperClassGenerator.java
@@ -116,7 +116,7 @@ public final class WrapperClassGenerator extends ASMHelper {
                 if (method == null) {
                     continue;
                 }
-                MessagePartInfo inf = opInfo.getInput().getMessageParts().get(0);
+                MessagePartInfo inf = opInfo.getInput().getFirstMessagePart();
                 if (inf.getTypeClass() == null) {
                     MessageInfo messageInfo = opInfo.getUnwrappedOperation().getInput();
                     createWrapperClass(inf,
@@ -127,7 +127,7 @@ public final class WrapperClassGenerator extends ASMHelper {
                 }
                 MessageInfo messageInfo = opInfo.getUnwrappedOperation().getOutput();
                 if (messageInfo != null) {
-                    inf = opInfo.getOutput().getMessageParts().get(0);
+                    inf = opInfo.getOutput().getFirstMessagePart();
                     if (inf.getTypeClass() == null) {
                         createWrapperClass(inf,
                                            messageInfo,

http://git-wip-us.apache.org/repos/asf/cxf/blob/2895b7b0/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/WrapperClassInInterceptor.java
----------------------------------------------------------------------
diff --git a/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/WrapperClassInInterceptor.java b/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/WrapperClassInInterceptor.java
index 880a6a9..9e29115 100644
--- a/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/WrapperClassInInterceptor.java
+++ b/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/WrapperClassInInterceptor.java
@@ -105,7 +105,7 @@ public class WrapperClassInInterceptor extends AbstractPhaseInterceptor<Message>
                 return;
             }
             
-            MessagePartInfo wrapperPart = wrappedMessageInfo.getMessagePart(0);
+            MessagePartInfo wrapperPart = wrappedMessageInfo.getFirstMessagePart();
             Class<?> wrapperClass = wrapperPart.getTypeClass();
             Object wrappedObject = lst.get(wrapperPart.getIndex());
             if (wrapperClass != null && !wrapperClass.isInstance(wrappedObject)) {

http://git-wip-us.apache.org/repos/asf/cxf/blob/2895b7b0/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/WrapperClassOutInterceptor.java
----------------------------------------------------------------------
diff --git a/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/WrapperClassOutInterceptor.java b/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/WrapperClassOutInterceptor.java
index 04ca353..8c2a889 100644
--- a/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/WrapperClassOutInterceptor.java
+++ b/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/WrapperClassOutInterceptor.java
@@ -68,16 +68,16 @@ public class WrapperClassOutInterceptor extends AbstractPhaseInterceptor<Message
         }
              
         Class<?> wrapped = null;
-        List<MessagePartInfo> parts = wrappedMsgInfo.getMessageParts();
-        if (parts.size() > 0) {
-            wrapped = parts.get(0).getTypeClass();
+        if (wrappedMsgInfo.getMessagePartsNumber() > 0) {
+            wrapped = wrappedMsgInfo.getFirstMessagePart().getTypeClass();
         }
 
         if (wrapped != null) {
+            MessagePartInfo firstMessagePart = wrappedMsgInfo.getFirstMessagePart();
             MessageContentsList objs = MessageContentsList.getContentsList(message);
-            WrapperHelper helper = parts.get(0).getProperty("WRAPPER_CLASS", WrapperHelper.class);
+            WrapperHelper helper = firstMessagePart.getProperty("WRAPPER_CLASS", WrapperHelper.class);
             if (helper == null) {
-                helper = getWrapperHelper(message, messageInfo, wrappedMsgInfo, wrapped, parts.get(0));
+                helper = getWrapperHelper(message, messageInfo, wrappedMsgInfo, wrapped, firstMessagePart);
             }
             if (helper == null) {
                 return;
@@ -99,7 +99,7 @@ public class WrapperClassOutInterceptor extends AbstractPhaseInterceptor<Message
                     }
                 }
                 Object o2 = helper.createWrapperObject(objs);
-                newObjs.put(parts.get(0), o2);
+                newObjs.put(firstMessagePart, o2);
                 
                 for (MessagePartInfo p : messageInfo.getMessageParts()) {
                     if (Boolean.TRUE.equals(p.getProperty(ReflectionServiceFactoryBean.HEADER))) {

http://git-wip-us.apache.org/repos/asf/cxf/blob/2895b7b0/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceFactoryBean.java
----------------------------------------------------------------------
diff --git a/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceFactoryBean.java b/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceFactoryBean.java
index 4d19e06..0524e9e 100644
--- a/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceFactoryBean.java
+++ b/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceFactoryBean.java
@@ -349,24 +349,32 @@ public class JaxWsServiceFactoryBean extends ReflectionServiceFactoryBean {
                             bop.setUnwrappedOperation(null);
                         }
                         if (o.getInput() != null) {
-                            if (o.getInput().getMessageParts().isEmpty()) {
+                            final List<MessagePartInfo> messageParts;
+                            if (o.getInput().getMessagePartsNumber() == 0) {
                                 MessagePartInfo inf = o.getInput().addMessagePart(o.getName());
                                 inf.setConcreteName(o.getName());
-                                bop.getInput().setMessageParts(o.getInput().getMessageParts());
+                                messageParts = o.getInput().getMessageParts();
+                                bop.getInput().setMessageParts(messageParts);
+                            } else {
+                                messageParts = o.getInput().getMessageParts();
                             }
-                            for (MessagePartInfo inf : o.getInput().getMessageParts()) {
+                            for (MessagePartInfo inf : messageParts) {
                                 inf.setTypeClass(c);
                                 break;
                             }
                         }
                         if (o.getOutput() != null) {
-                            if (o.getOutput().getMessageParts().isEmpty()) {
+                            final List<MessagePartInfo> messageParts;
+                            if (o.getOutput().getMessagePartsNumber() == 0) {
                                 MessagePartInfo inf = o.getOutput().addMessagePart(o.getName());
                                 inf.setConcreteName(new QName(o.getName().getNamespaceURI(),
                                                               o.getName().getLocalPart() + "Response"));
-                                bop.getOutput().setMessageParts(o.getOutput().getMessageParts());
+                                messageParts = o.getOutput().getMessageParts();
+                                bop.getOutput().setMessageParts(messageParts);
+                            } else {
+                                messageParts = o.getOutput().getMessageParts();
                             }
-                            for (MessagePartInfo inf : o.getOutput().getMessageParts()) {
+                            for (MessagePartInfo inf : messageParts) {
                                 inf.setTypeClass(c);
                                 break;
                             }
@@ -435,18 +443,18 @@ public class JaxWsServiceFactoryBean extends ReflectionServiceFactoryBean {
     void initializeWrapping(OperationInfo o, Method selected) {
         Class<?> responseWrapper = getResponseWrapper(selected);
         if (responseWrapper != null) {
-            o.getOutput().getMessageParts().get(0).setTypeClass(responseWrapper);
+            o.getOutput().getFirstMessagePart().setTypeClass(responseWrapper);
         }
         if (getResponseWrapperClassName(selected) != null) {
-            o.getOutput().getMessageParts().get(0).setProperty("RESPONSE.WRAPPER.CLASSNAME",
+            o.getOutput().getFirstMessagePart().setProperty("RESPONSE.WRAPPER.CLASSNAME",
                                                            getResponseWrapperClassName(selected));
         }
         Class<?> requestWrapper = getRequestWrapper(selected);
         if (requestWrapper != null) {
-            o.getInput().getMessageParts().get(0).setTypeClass(requestWrapper);
+            o.getInput().getFirstMessagePart().setTypeClass(requestWrapper);
         }
         if (getRequestWrapperClassName(selected) != null) {
-            o.getInput().getMessageParts().get(0).setProperty("REQUEST.WRAPPER.CLASSNAME",
+            o.getInput().getFirstMessagePart().setProperty("REQUEST.WRAPPER.CLASSNAME",
                                                            getRequestWrapperClassName(selected));
         }
     }

http://git-wip-us.apache.org/repos/asf/cxf/blob/2895b7b0/rt/frontend/simple/src/main/java/org/apache/cxf/endpoint/dynamic/TypeClassInitializer.java
----------------------------------------------------------------------
diff --git a/rt/frontend/simple/src/main/java/org/apache/cxf/endpoint/dynamic/TypeClassInitializer.java b/rt/frontend/simple/src/main/java/org/apache/cxf/endpoint/dynamic/TypeClassInitializer.java
index f5105e7..9d75953 100644
--- a/rt/frontend/simple/src/main/java/org/apache/cxf/endpoint/dynamic/TypeClassInitializer.java
+++ b/rt/frontend/simple/src/main/java/org/apache/cxf/endpoint/dynamic/TypeClassInitializer.java
@@ -93,9 +93,9 @@ public class TypeClassInitializer extends ServiceModelVisitor {
             op = oInfo.getWrappedOperation();
             
             if (part.getMessageInfo() == oInfo.getInput()) {
-                mapping = model.get(op.getInput().getMessagePart(0).getElementQName());
+                mapping = model.get(op.getInput().getFirstMessagePart().getElementQName());
             } else {
-                mapping = model.get(op.getOutput().getMessagePart(0).getElementQName());
+                mapping = model.get(op.getOutput().getFirstMessagePart().getElementQName());
             }
             if (mapping != null) {
                 jType = mapping.getType().getTypeClass();

http://git-wip-us.apache.org/repos/asf/cxf/blob/2895b7b0/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
----------------------------------------------------------------------
diff --git a/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java b/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
index 4c81fb8..050c609 100644
--- a/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
+++ b/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
@@ -326,6 +326,17 @@ public abstract class HTTPConduit
         }
         clientSidePolicyCalced = true;
     }
+    
+    private void updateClientPolicy() {
+        if (!clientSidePolicyCalced) {
+            //do no spend time on building Message and Exchange (which basically
+            //are ConcurrentHashMap instances) if the policy is already available
+            Message m = new MessageImpl();
+            m.setExchange(new ExchangeImpl());
+            m.getExchange().put(EndpointInfo.class, this.endpointInfo);
+            updateClientPolicy(m);
+        }
+    }
 
     /**
      * This method returns the registered Logger for this conduit.
@@ -846,10 +857,7 @@ public abstract class HTTPConduit
      * HTTPConduit.
      */
     public HTTPClientPolicy getClient() {
-        Message m = new MessageImpl();
-        m.setExchange(new ExchangeImpl());
-        m.getExchange().put(EndpointInfo.class, this.endpointInfo);
-        updateClientPolicy(m);
+        updateClientPolicy();
         return clientSidePolicy;
     }
 

http://git-wip-us.apache.org/repos/asf/cxf/blob/2895b7b0/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/impl/InternalContextUtils.java
----------------------------------------------------------------------
diff --git a/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/impl/InternalContextUtils.java b/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/impl/InternalContextUtils.java
index c01012b..cfe08c4 100644
--- a/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/impl/InternalContextUtils.java
+++ b/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/impl/InternalContextUtils.java
@@ -445,7 +445,7 @@ final class InternalContextUtils {
                     if (fi.size() == 0) {
                         continue;
                     }
-                    Class<?> fiTypeClass = fi.getMessagePart(0).getTypeClass();
+                    Class<?> fiTypeClass = fi.getFirstMessagePart().getTypeClass();
                     if (t != null 
                             && fiTypeClass != null
                             && t.getClass().isAssignableFrom(fiTypeClass)) {

http://git-wip-us.apache.org/repos/asf/cxf/blob/2895b7b0/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/AbstractSTSClient.java
----------------------------------------------------------------------
diff --git a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/AbstractSTSClient.java b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/AbstractSTSClient.java
index 21298b2..4b4630e 100755
--- a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/AbstractSTSClient.java
+++ b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/AbstractSTSClient.java
@@ -714,8 +714,8 @@ public abstract class AbstractSTSClient implements Configurable, InterceptorProv
         }        
         //Still didn't find anything useful
         for (BindingOperationInfo boi : bi.getOperations()) {
-            if (boi.getInput().getMessageInfo().getMessageParts().size() > 0) {
-                MessagePartInfo mpi = boi.getInput().getMessageInfo().getMessagePart(0);
+            if (boi.getInput().getMessageInfo().getMessagePartsNumber() > 0) {
+                MessagePartInfo mpi = boi.getInput().getMessageInfo().getFirstMessagePart();
                 if ("RequestSecurityToken".equals(mpi.getConcreteName().getLocalPart())) {
                     return boi;
                 }

http://git-wip-us.apache.org/repos/asf/cxf/blob/2895b7b0/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/PolicyBasedWSS4JStaxInInterceptor.java
----------------------------------------------------------------------
diff --git a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/PolicyBasedWSS4JStaxInInterceptor.java b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/PolicyBasedWSS4JStaxInInterceptor.java
index 1a4dfe1..65b87b3 100644
--- a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/PolicyBasedWSS4JStaxInInterceptor.java
+++ b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/PolicyBasedWSS4JStaxInInterceptor.java
@@ -368,18 +368,22 @@ public class PolicyBasedWSS4JStaxInInterceptor extends WSS4JStaxInInterceptor {
                 if (bindingOperationInfo.getOutput() != null) {
                     MessageInfo messageInfo = bindingOperationInfo.getOutput().getMessageInfo();
                     operationName = messageInfo.getName();
-                    if (!messageInfo.getMessageParts().isEmpty()
-                        && messageInfo.getMessagePart(0).getConcreteName() != null) {
-                        operationName = messageInfo.getMessagePart(0).getConcreteName();
+                    if (messageInfo.getMessagePartsNumber() > 0) {
+                        QName cn = messageInfo.getFirstMessagePart().getConcreteName();
+                        if (cn != null) {
+                            operationName = cn;
+                        }
                     }
                 }
             } else {
                 if (bindingOperationInfo.getInput() != null) {
                     MessageInfo messageInfo = bindingOperationInfo.getInput().getMessageInfo();
                     operationName = messageInfo.getName();
-                    if (!messageInfo.getMessageParts().isEmpty()
-                        && messageInfo.getMessagePart(0).getConcreteName() != null) {
-                        operationName = messageInfo.getMessagePart(0).getConcreteName();
+                    if (messageInfo.getMessagePartsNumber() > 0) {
+                        QName cn = messageInfo.getFirstMessagePart().getConcreteName();
+                        if (cn != null) {
+                            operationName = cn;
+                        }
                     }
                 }
             }

http://git-wip-us.apache.org/repos/asf/cxf/blob/2895b7b0/rt/wsdl/src/main/java/org/apache/cxf/wsdl/interceptors/BareInInterceptor.java
----------------------------------------------------------------------
diff --git a/rt/wsdl/src/main/java/org/apache/cxf/wsdl/interceptors/BareInInterceptor.java b/rt/wsdl/src/main/java/org/apache/cxf/wsdl/interceptors/BareInInterceptor.java
index 314138b..cae911d 100644
--- a/rt/wsdl/src/main/java/org/apache/cxf/wsdl/interceptors/BareInInterceptor.java
+++ b/rt/wsdl/src/main/java/org/apache/cxf/wsdl/interceptors/BareInInterceptor.java
@@ -92,7 +92,7 @@ public class BareInInterceptor extends AbstractInDatabindingInterceptor {
                 //TO DO : check duplicate operation with no input
                 for (OperationInfo op : ops) {
                     MessageInfo bmsg = op.getInput();
-                    if (bmsg.getMessageParts().size() == 0) {
+                    if (bmsg.getMessagePartsNumber() == 0) {
                         BindingOperationInfo boi = ep.getEndpointInfo().getBinding().getOperation(op);
                         exchange.put(BindingOperationInfo.class, boi);
                         exchange.put(OperationInfo.class, op);

http://git-wip-us.apache.org/repos/asf/cxf/blob/2895b7b0/rt/wsdl/src/main/java/org/apache/cxf/wsdl/interceptors/DocLiteralInInterceptor.java
----------------------------------------------------------------------
diff --git a/rt/wsdl/src/main/java/org/apache/cxf/wsdl/interceptors/DocLiteralInInterceptor.java b/rt/wsdl/src/main/java/org/apache/cxf/wsdl/interceptors/DocLiteralInInterceptor.java
index 3fad677..45442cf 100644
--- a/rt/wsdl/src/main/java/org/apache/cxf/wsdl/interceptors/DocLiteralInInterceptor.java
+++ b/rt/wsdl/src/main/java/org/apache/cxf/wsdl/interceptors/DocLiteralInInterceptor.java
@@ -101,12 +101,13 @@ public class DocLiteralInInterceptor extends AbstractInDatabindingInterceptor {
                 // Determine if we should keep the parameters wrapper
                 if (shouldWrapParameters(msgInfo, message)) {
                     QName startQName = xmlReader.getName();
-                    if (!msgInfo.getMessageParts().get(0).getConcreteName().equals(startQName)) {
+                    MessagePartInfo mpi = msgInfo.getFirstMessagePart();
+                    if (!mpi.getConcreteName().equals(startQName)) {
                         throw new Fault("UNEXPECTED_WRAPPER_ELEMENT", LOG, null, startQName,
-                                        msgInfo.getMessageParts().get(0).getConcreteName());
+                                        mpi.getConcreteName());
                     }
-                    Object wrappedObject = dr.read(msgInfo.getMessageParts().get(0), xmlReader);
-                    parameters.put(msgInfo.getMessageParts().get(0), wrappedObject);
+                    Object wrappedObject = dr.read(mpi, xmlReader);
+                    parameters.put(mpi, wrappedObject);
                 } else {
                     // Unwrap each part individually if we don't have a wrapper
     
@@ -219,10 +220,10 @@ public class DocLiteralInInterceptor extends AbstractInDatabindingInterceptor {
         // TO DO : check duplicate operation with no input and also check if the action matches 
         for (OperationInfo op : operations) {
             MessageInfo bmsg = op.getInput();
-            List<MessagePartInfo> bparts = bmsg.getMessageParts();
-            if (bparts.size() == 0
-                || (bparts.size() == 1 
-                    && Constants.XSD_ANYTYPE.equals(bparts.get(0).getTypeQName()))) {
+            int bPartsNum = bmsg.getMessagePartsNumber();
+            if (bPartsNum == 0
+                || (bPartsNum == 1 
+                    && Constants.XSD_ANYTYPE.equals(bmsg.getFirstMessagePart().getTypeQName()))) {
                 BindingOperationInfo boi = ep.getEndpointInfo().getBinding().getOperation(op);
                 exchange.put(BindingOperationInfo.class, boi);
                 exchange.put(OperationInfo.class, op);
@@ -354,7 +355,7 @@ public class DocLiteralInInterceptor extends AbstractInDatabindingInterceptor {
     protected boolean shouldWrapParameters(MessageInfo msgInfo, Message message) {
         Object keepParametersWrapperFlag = message.get(KEEP_PARAMETERS_WRAPPER);
         if (keepParametersWrapperFlag == null) {
-            return msgInfo.getMessageParts().get(0).getTypeClass() != null;
+            return msgInfo.getFirstMessagePart().getTypeClass() != null;
         } else {
             return Boolean.parseBoolean(keepParametersWrapperFlag.toString());
         }

http://git-wip-us.apache.org/repos/asf/cxf/blob/2895b7b0/rt/wsdl/src/main/java/org/apache/cxf/wsdl/interceptors/WrappedOutInterceptor.java
----------------------------------------------------------------------
diff --git a/rt/wsdl/src/main/java/org/apache/cxf/wsdl/interceptors/WrappedOutInterceptor.java b/rt/wsdl/src/main/java/org/apache/cxf/wsdl/interceptors/WrappedOutInterceptor.java
index 48da4a4..c2f5f44 100644
--- a/rt/wsdl/src/main/java/org/apache/cxf/wsdl/interceptors/WrappedOutInterceptor.java
+++ b/rt/wsdl/src/main/java/org/apache/cxf/wsdl/interceptors/WrappedOutInterceptor.java
@@ -34,7 +34,6 @@ import org.apache.cxf.phase.Phase;
 import org.apache.cxf.service.Service;
 import org.apache.cxf.service.model.BindingOperationInfo;
 import org.apache.cxf.service.model.MessageInfo;
-import org.apache.cxf.service.model.MessagePartInfo;
 import org.apache.cxf.staxutils.StaxUtils;
 
 public class WrappedOutInterceptor extends AbstractOutDatabindingInterceptor {
@@ -64,8 +63,7 @@ public class WrappedOutInterceptor extends AbstractOutDatabindingInterceptor {
                 messageInfo = bop.getWrappedOperation().getOperationInfo().getOutput();
             }
 
-            MessagePartInfo part = messageInfo.getMessageParts().get(0);
-            QName name = part.getConcreteName();
+            QName name = messageInfo.getFirstMessagePart().getConcreteName();
 
             try {
                 String pfx = null;

http://git-wip-us.apache.org/repos/asf/cxf/blob/2895b7b0/rt/wsdl/src/main/java/org/apache/cxf/wsdl/service/factory/DefaultServiceConfiguration.java
----------------------------------------------------------------------
diff --git a/rt/wsdl/src/main/java/org/apache/cxf/wsdl/service/factory/DefaultServiceConfiguration.java b/rt/wsdl/src/main/java/org/apache/cxf/wsdl/service/factory/DefaultServiceConfiguration.java
index 1e93722..dd6521c 100644
--- a/rt/wsdl/src/main/java/org/apache/cxf/wsdl/service/factory/DefaultServiceConfiguration.java
+++ b/rt/wsdl/src/main/java/org/apache/cxf/wsdl/service/factory/DefaultServiceConfiguration.java
@@ -117,7 +117,7 @@ public class DefaultServiceConfiguration extends AbstractServiceConfiguration {
         }
         
         return DefaultServiceConfiguration.createName(method, paramNumber, op.getInput()
-            .getMessageParts().size(), false, prefix);
+            .getMessagePartsNumber(), false, prefix);
     }
 
     public static String createName(final Method method, final int paramNumber, final int currentSize,

http://git-wip-us.apache.org/repos/asf/cxf/blob/2895b7b0/rt/wsdl/src/main/java/org/apache/cxf/wsdl/service/factory/ReflectionServiceFactoryBean.java
----------------------------------------------------------------------
diff --git a/rt/wsdl/src/main/java/org/apache/cxf/wsdl/service/factory/ReflectionServiceFactoryBean.java b/rt/wsdl/src/main/java/org/apache/cxf/wsdl/service/factory/ReflectionServiceFactoryBean.java
index 46062d6..23b84fa 100644
--- a/rt/wsdl/src/main/java/org/apache/cxf/wsdl/service/factory/ReflectionServiceFactoryBean.java
+++ b/rt/wsdl/src/main/java/org/apache/cxf/wsdl/service/factory/ReflectionServiceFactoryBean.java
@@ -485,7 +485,7 @@ public class ReflectionServiceFactoryBean extends org.apache.cxf.service.factory
                 // check to make sure the faults are elements
                 for (FaultInfo fault : opInfo.getFaults()) {
                     QName qn = (QName)fault.getProperty("elementName");
-                    MessagePartInfo part = fault.getMessagePart(0);
+                    MessagePartInfo part = fault.getFirstMessagePart();
                     if (!part.isElement()) {
                         part.setElement(true);
                         part.setElementQName(qn);
@@ -582,7 +582,7 @@ public class ReflectionServiceFactoryBean extends org.apache.cxf.service.factory
                 if (opInfo.hasFaults()) {
                     // check to make sure the faults are elements
                     for (FaultInfo fault : opInfo.getFaults()) {
-                        MessagePartInfo mpi = fault.getMessagePart(0);
+                        MessagePartInfo mpi = fault.getFirstMessagePart();
                         assert mpi != null;
                         assert mpi.getXmlSchema() != null;
                         assert mpi.isElement();
@@ -721,7 +721,7 @@ public class ReflectionServiceFactoryBean extends org.apache.cxf.service.factory
             if (o.getUnwrappedOperation() != null) {
                 if (o.hasInput()) {
                     MessageInfo input = o.getInput();
-                    MessagePartInfo part = input.getMessageParts().get(0);
+                    MessagePartInfo part = input.getFirstMessagePart();
                     part.setTypeClass(getRequestWrapper(method));
                     part.setProperty("REQUEST.WRAPPER.CLASSNAME", getRequestWrapperClassName(method));
                     part.setIndex(0);
@@ -729,7 +729,7 @@ public class ReflectionServiceFactoryBean extends org.apache.cxf.service.factory
 
                 if (o.hasOutput()) {
                     MessageInfo input = o.getOutput();
-                    MessagePartInfo part = input.getMessageParts().get(0);
+                    MessagePartInfo part = input.getFirstMessagePart();
                     part.setTypeClass(getResponseWrapper(method));
                     part.setProperty("RESPONSE.WRAPPER.CLASSNAME", getResponseWrapperClassName(method));
                     part.setIndex(0);
@@ -1029,14 +1029,15 @@ public class ReflectionServiceFactoryBean extends org.apache.cxf.service.factory
         for (OperationInfo op : serviceInfo.getInterface().getOperations()) {
             if (op.getUnwrappedOperation() != null) {
                 if (op.hasInput()) {
-                    if (op.getInput().getMessageParts().get(0).getTypeClass() == null) {
+                    MessagePartInfo fmpi = op.getInput().getFirstMessagePart();
+                    if (fmpi.getTypeClass() == null) {
 
-                        QName wrapperBeanName = op.getInput().getMessageParts().get(0).getElementQName();
+                        QName wrapperBeanName = fmpi.getElementQName();
                         XmlSchemaElement e = null;
                         for (SchemaInfo s : serviceInfo.getSchemas()) {
                             e = s.getElementByQName(wrapperBeanName);
                             if (e != null) {
-                                op.getInput().getMessageParts().get(0).setXmlSchema(e);
+                                fmpi.setXmlSchema(e);
                                 break;
                             }
                         }
@@ -1058,9 +1059,10 @@ public class ReflectionServiceFactoryBean extends org.apache.cxf.service.factory
 
                 }
                 if (op.hasOutput()) {
-                    if (op.getOutput().getMessageParts().get(0).getTypeClass() == null) {
+                    MessagePartInfo fmpi = op.getOutput().getFirstMessagePart();
+                    if (fmpi.getTypeClass() == null) {
 
-                        QName wrapperBeanName = op.getOutput().getMessageParts().get(0).getElementQName();
+                        QName wrapperBeanName = fmpi.getElementQName();
                         XmlSchemaElement e = null;
                         for (SchemaInfo s : serviceInfo.getSchemas()) {
                             e = s.getElementByQName(wrapperBeanName);
@@ -1150,18 +1152,19 @@ public class ReflectionServiceFactoryBean extends org.apache.cxf.service.factory
 
         MessageInfo message = isOut ? opInfo.getOutput() : opInfo.getInput();
 
-        if (message.getMessageParts().size() == 0) {
+        final List<MessagePartInfo> messageParts = message.getMessageParts();
+        if (messageParts.size() == 0) {
             return;
         }
 
         Method method = (Method)opInfo.getProperty(METHOD);
         int paraNumber = 0;
-        for (MessagePartInfo mpi : message.getMessageParts()) {
+        for (MessagePartInfo mpi : messageParts) {
             SchemaInfo schemaInfo = null;
             XmlSchema schema = null;
 
             QName qname = (QName)mpi.getProperty(ELEMENT_NAME);
-            if (message.getMessageParts().size() == 1 && qname == null) {
+            if (messageParts.size() == 1 && qname == null) {
                 qname = !isOut ? getInParameterName(opInfo, method, -1) 
                         : getOutParameterName(opInfo, method, -1);
                 
@@ -1170,7 +1173,7 @@ public class ReflectionServiceFactoryBean extends org.apache.cxf.service.factory
                         ? new QName(qname.getNamespaceURI(), method.getName() + "Response") : new QName(qname
                             .getNamespaceURI(), method.getName());
                 }
-            } else if (isOut && message.getMessageParts().size() > 1 && qname == null) {
+            } else if (isOut && messageParts.size() > 1 && qname == null) {
                 while (!isOutParam(method, paraNumber)) {
                     paraNumber++;
                 }
@@ -1292,7 +1295,7 @@ public class ReflectionServiceFactoryBean extends org.apache.cxf.service.factory
         XmlSchemaElement el = new XmlSchemaElement(schema, true);
         el.setName(wrapperName.getLocalPart());
 
-        wrappedMessage.getMessageParts().get(0).setXmlSchema(el);
+        wrappedMessage.getFirstMessagePart().setXmlSchema(el);
 
         XmlSchemaComplexType ct = new XmlSchemaComplexType(schema, true);
 
@@ -1575,10 +1578,11 @@ public class ReflectionServiceFactoryBean extends org.apache.cxf.service.factory
                     QName q2 = getOutParameterName(op, method, j);
 
                     if (isInParam(method, j)) {
-                        q = op.getInput().getMessagePartByIndex(j).getName();
-                        q2 = (QName)op.getInput().getMessagePartByIndex(j).getProperty(ELEMENT_NAME);
+                        MessagePartInfo mpi = op.getInput().getMessagePartByIndex(j);
+                        q = mpi.getName();
+                        q2 = (QName)mpi.getProperty(ELEMENT_NAME);
                         if (q2 == null) {
-                            q2 = op.getInput().getMessagePartByIndex(j).getElementQName();
+                            q2 = mpi.getElementQName();
                         }
                     }
 

http://git-wip-us.apache.org/repos/asf/cxf/blob/2895b7b0/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/RequestWrapper.java
----------------------------------------------------------------------
diff --git a/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/RequestWrapper.java b/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/RequestWrapper.java
index 7d9be1a..6eb570a 100644
--- a/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/RequestWrapper.java
+++ b/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/RequestWrapper.java
@@ -38,8 +38,9 @@ public class RequestWrapper extends Wrapper {
     @Override
     public void setOperationInfo(final OperationInfo op) {
         super.setOperationInfo(op);
-        setName(op.getInput().getMessageParts().get(0).getElementQName());
-        setClassName((String)op.getInput().getMessageParts().get(0).getProperty("REQUEST.WRAPPER.CLASSNAME"));
+        MessagePartInfo mpi = op.getInput().getFirstMessagePart();
+        setName(mpi.getElementQName());
+        setClassName((String)mpi.getProperty("REQUEST.WRAPPER.CLASSNAME"));
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/cxf/blob/2895b7b0/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/ResponseWrapper.java
----------------------------------------------------------------------
diff --git a/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/ResponseWrapper.java b/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/ResponseWrapper.java
index 5b27693..08c8682 100644
--- a/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/ResponseWrapper.java
+++ b/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/ResponseWrapper.java
@@ -43,9 +43,9 @@ public final class ResponseWrapper extends Wrapper {
     @Override
     public void setOperationInfo(final OperationInfo op) {
         super.setOperationInfo(op);
-        setName(op.getOutput().getMessageParts().get(0).getElementQName());
-        setClassName((String)op.getOutput().getMessageParts().get(0)
-                         .getProperty("RESPONSE.WRAPPER.CLASSNAME"));
+        MessagePartInfo mpi = op.getOutput().getFirstMessagePart();
+        setName(mpi.getElementQName());
+        setClassName((String)mpi.getProperty("RESPONSE.WRAPPER.CLASSNAME"));
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/cxf/blob/2895b7b0/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/OperationProcessor.java
----------------------------------------------------------------------
diff --git a/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/OperationProcessor.java b/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/OperationProcessor.java
index 996b0f0..59c2474 100644
--- a/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/OperationProcessor.java
+++ b/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/OperationProcessor.java
@@ -203,12 +203,12 @@ public class OperationProcessor  extends AbstractProcessor {
 
     private void setWrapper(OperationInfo operation) {
         MessagePartInfo inputPart = null;
-        if (operation.getInput() != null && operation.getInput().getMessageParts() != null) {
-            inputPart = operation.getInput().getMessageParts().iterator().next();
+        if (operation.getInput() != null) {
+            inputPart = operation.getInput().getFirstMessagePart();
         }
         MessagePartInfo outputPart = null;
-        if (operation.getOutput() != null && operation.getOutput().getMessageParts() != null) {
-            outputPart = operation.getOutput().getMessageParts().iterator().next();
+        if (operation.getOutput() != null) {
+            outputPart = operation.getOutput().getFirstMessagePart();
         }
 
         if (inputPart != null) {

http://git-wip-us.apache.org/repos/asf/cxf/blob/2895b7b0/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ParameterProcessor.java
----------------------------------------------------------------------
diff --git a/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ParameterProcessor.java b/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ParameterProcessor.java
index afa45cb..4bf2145 100644
--- a/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ParameterProcessor.java
+++ b/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ParameterProcessor.java
@@ -20,6 +20,7 @@
 package org.apache.cxf.tools.wsdlto.frontend.jaxws.processor.internal;
 
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.Iterator;
 import java.util.LinkedHashMap;
 import java.util.List;
@@ -199,7 +200,7 @@ public class ParameterProcessor extends AbstractProcessor {
 
     private boolean messagePartsNotUnique(final MessageInfo message) {
         int count = countOutOfBandHeader(message);
-        return message.getMessageParts().size() - count > 1;
+        return message.getMessagePartsNumber() - count > 1;
     }
 
     private void processInput(JavaMethod method, MessageInfo inputMessage) throws ToolException {
@@ -229,15 +230,13 @@ public class ParameterProcessor extends AbstractProcessor {
     }
 
     private void processWrappedInput(JavaMethod method, MessageInfo inputMessage) throws ToolException {
-        List<MessagePartInfo> inputParts = inputMessage.getMessageParts();
-
         if (messagePartsNotUnique(inputMessage)) {
             processInput(method, inputMessage);
             return;
-        } else if (inputParts.isEmpty()) {
+        } else if (inputMessage.getMessagePartsNumber() == 0) {
             return;
         }
-        MessagePartInfo part = inputParts.iterator().next();
+        MessagePartInfo part = inputMessage.getFirstMessagePart();
 
         List<QName> wrappedElements = ProcessorUtil.getWrappedElementQNames(context, part.getElementQName());
         if ((wrappedElements == null || wrappedElements.size() == 0) 
@@ -375,20 +374,19 @@ public class ParameterProcessor extends AbstractProcessor {
                                               MessageInfo inputMessage,
                                               MessageInfo outputMessage) throws ToolException {
 
-        List<MessagePartInfo> outputParts = outputMessage.getMessageParts();
-        List<MessagePartInfo> inputParts = inputMessage.getMessageParts();
-
         if (messagePartsNotUnique(inputMessage) || messagePartsNotUnique(outputMessage)) {
             processOutput(method, inputMessage, outputMessage);
             return;
         }
-        if (outputParts.size() == 0) {
+        if (outputMessage.getMessagePartsNumber() == 0) {
             addVoidReturn(method);
             return;
         }
 
-        MessagePartInfo inputPart = inputParts.size() > 0 ? inputParts.iterator().next() : null;
-        MessagePartInfo outputPart = outputParts.size() > 0 ? outputParts.iterator().next() : null;
+        MessagePartInfo inputPart = inputMessage.getMessagePartsNumber() > 0 ? inputMessage
+            .getFirstMessagePart() : null;
+        MessagePartInfo outputPart = outputMessage.getMessagePartsNumber() > 0 ? outputMessage
+            .getFirstMessagePart() : null;
 
         List<QName> inputWrapElement = null;
         List<QName> outputWrapElement = null;
@@ -671,19 +669,19 @@ public class ParameterProcessor extends AbstractProcessor {
                                               MessageInfo outputMessage,
                                               List<String> parameterList) throws ToolException {
         Map<QName, MessagePartInfo> inputPartsMap = inputMessage.getMessagePartsMap();
+        Collection<MessagePartInfo> inputParts = inputPartsMap.values();
 
-        Map<QName, MessagePartInfo> outputPartsMap = new LinkedHashMap<QName, MessagePartInfo>();
+        final Map<QName, MessagePartInfo> outputPartsMap;
+        final Collection<MessagePartInfo> outputParts;
         
         if (outputMessage != null) {
             outputPartsMap = outputMessage.getMessagePartsMap();
+            outputParts = outputPartsMap.values();
+        } else {
+            outputPartsMap = new LinkedHashMap<QName, MessagePartInfo>();
+            outputParts = new ArrayList<MessagePartInfo>();
         }
 
-        List<MessagePartInfo> inputParts = inputMessage.getMessageParts();
-        List<MessagePartInfo> outputParts = new ArrayList<MessagePartInfo>();
-
-        if (outputMessage != null) {
-            outputParts = outputMessage.getMessageParts();
-        }
 
         List<MessagePartInfo> inputUnlistedParts = new ArrayList<MessagePartInfo>();
         List<MessagePartInfo> outputUnlistedParts = new ArrayList<MessagePartInfo>();
@@ -766,10 +764,12 @@ public class ParameterProcessor extends AbstractProcessor {
         Iterator<String> params = parameterOrder.iterator();
 
         List<MessagePartInfo> inputParts = inputMessage.getMessageParts();
-        List<MessagePartInfo> outputParts = new ArrayList<MessagePartInfo>();
+        List<MessagePartInfo> outputParts;
 
         if (outputMessage != null) {
             outputParts = outputMessage.getMessageParts();
+        } else {
+            outputParts = new ArrayList<MessagePartInfo>();
         }
 
         while (params.hasNext()) {

http://git-wip-us.apache.org/repos/asf/cxf/blob/2895b7b0/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ServiceProcessor.java
----------------------------------------------------------------------
diff --git a/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ServiceProcessor.java b/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ServiceProcessor.java
index 25292f2..c941aba 100644
--- a/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ServiceProcessor.java
+++ b/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ServiceProcessor.java
@@ -740,7 +740,7 @@ public class ServiceProcessor extends AbstractProcessor {
                 && headerMessage.getNamespaceURI().equalsIgnoreCase(bodyMessage.getName().getNamespaceURI())
                 && headerMessage.getLocalPart().equalsIgnoreCase(bodyMessage.getName().getLocalPart())) {
                 isSameMessage = true;
-                if (bodyMessage.getMessageParts().size() == 1) {
+                if (bodyMessage.getMessagePartsNumber() == 1) {
                     allPartsHeader = true;
                 }
 

http://git-wip-us.apache.org/repos/asf/cxf/blob/2895b7b0/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/validator/UniqueBodyValidator.java
----------------------------------------------------------------------
diff --git a/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/validator/UniqueBodyValidator.java b/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/validator/UniqueBodyValidator.java
index 3b65aa0..276b702 100644
--- a/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/validator/UniqueBodyValidator.java
+++ b/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/validator/UniqueBodyValidator.java
@@ -75,8 +75,8 @@ public class UniqueBodyValidator extends ServiceValidator {
         for (BindingOperationInfo bo : bos) {
             OperationInfo op = binding.getInterface().getOperation(bo.getName());
             if (op.getInput() != null
-                && op.getInput().getMessageParts().size() == 1) {
-                MessagePartInfo part = op.getInput().getMessageParts().iterator().next();
+                && op.getInput().getMessagePartsNumber() == 1) {
+                MessagePartInfo part = op.getInput().getFirstMessagePart();
                 if (part.getElementQName() == null) {
                     continue;
                 }
@@ -105,7 +105,7 @@ public class UniqueBodyValidator extends ServiceValidator {
             }
             
             for (BindingFaultInfo fault : bo.getFaults()) {
-                if (fault.getFaultInfo().getMessageParts().size() > 1) {
+                if (fault.getFaultInfo().getMessagePartsNumber() > 1) {
                     Message msg = new Message("FAULT_WITH_MULTIPLE_PARTS", LOG, 
                                               fault.getFaultInfo().getName()
                                                   .getLocalPart());

http://git-wip-us.apache.org/repos/asf/cxf/blob/2895b7b0/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/validator/WrapperStyleNameCollisionValidator.java
----------------------------------------------------------------------
diff --git a/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/validator/WrapperStyleNameCollisionValidator.java b/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/validator/WrapperStyleNameCollisionValidator.java
index c8e6141..aaecf44 100644
--- a/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/validator/WrapperStyleNameCollisionValidator.java
+++ b/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/validator/WrapperStyleNameCollisionValidator.java
@@ -135,13 +135,13 @@ public class WrapperStyleNameCollisionValidator extends ServiceValidator {
         MessagePartInfo input = null;
         MessagePartInfo output = null;
         if (operation.getInput() != null
-            && operation.getInput().getMessageParts().size() == 1) {
-            input = operation.getInput().getMessageParts().iterator().next();
+            && operation.getInput().getMessagePartsNumber() == 1) {
+            input = operation.getInput().getFirstMessagePart();
         }
 
         if (operation.getOutput() != null
-            && operation.getOutput().getMessageParts().size() == 1) {
-            output = operation.getOutput().getMessageParts().iterator().next();
+            && operation.getOutput().getMessagePartsNumber() == 1) {
+            output = operation.getOutput().getFirstMessagePart();
         }
         if (!c) {
             Map<String, QName> names = new HashMap<String, QName>();


Mime
View raw message