You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2008/08/05 23:39:45 UTC
svn commit: r682966 - in /cxf/branches/2.0.x-fixes: ./
rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/
Author: dkulp
Date: Tue Aug 5 14:39:44 2008
New Revision: 682966
URL: http://svn.apache.org/viewvc?rev=682966&view=rev
Log:
Merged revisions 681813 via svnmerge from
https://svn.apache.org/repos/asf/cxf/trunk
........
r681813 | dkulp | 2008-08-01 16:35:52 -0400 (Fri, 01 Aug 2008) | 2 lines
Add flags to service configuration stuff to allow controlling the nillable/minOccurs/maxOccurs of the wrapper parts.
........
Modified:
cxf/branches/2.0.x-fixes/ (props changed)
cxf/branches/2.0.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/AbstractServiceConfiguration.java
cxf/branches/2.0.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/DefaultServiceConfiguration.java
cxf/branches/2.0.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
Propchange: cxf/branches/2.0.x-fixes/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Aug 5 14:39:44 2008
@@ -1 +1 @@
-/cxf/trunk:673548,674485,674547,674551,674562,674601,674649,674764,674887,675644,675653,677048,677385,678004,678009,678559,678629,678808,678852,678891,678893,679248,679597,680435,681060,681165
+/cxf/trunk:673548,674485,674547,674551,674562,674601,674649,674764,674887,675644,675653,677048,677385,678004,678009,678559,678629,678808,678852,678891,678893,679248,679597,680435,681060,681165,681813
Propchange: cxf/branches/2.0.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Modified: cxf/branches/2.0.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/AbstractServiceConfiguration.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.0.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/AbstractServiceConfiguration.java?rev=682966&r1=682965&r2=682966&view=diff
==============================================================================
--- cxf/branches/2.0.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/AbstractServiceConfiguration.java (original)
+++ cxf/branches/2.0.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/AbstractServiceConfiguration.java Tue Aug 5 14:39:44 2008
@@ -25,6 +25,7 @@
import javax.xml.namespace.QName;
import org.apache.cxf.service.model.InterfaceInfo;
+import org.apache.cxf.service.model.MessagePartInfo;
import org.apache.cxf.service.model.OperationInfo;
public abstract class AbstractServiceConfiguration {
@@ -187,4 +188,15 @@
public Type getHolderType(Class<?> cls, Type type) {
return null;
}
+
+ public Boolean isWrapperPartNillable(MessagePartInfo mpi) {
+ return null;
+ }
+ public Long getWrapperPartMaxOccurs(MessagePartInfo mpi) {
+ //return Long.MAX_VALUE for unbounded
+ return null;
+ }
+ public Long getWrapperPartMinOccurs(MessagePartInfo mpi) {
+ return null;
+ }
}
Modified: cxf/branches/2.0.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/DefaultServiceConfiguration.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.0.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/DefaultServiceConfiguration.java?rev=682966&r1=682965&r2=682966&view=diff
==============================================================================
--- cxf/branches/2.0.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/DefaultServiceConfiguration.java (original)
+++ cxf/branches/2.0.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/DefaultServiceConfiguration.java Tue Aug 5 14:39:44 2008
@@ -33,6 +33,7 @@
import org.apache.cxf.helpers.ServiceUtils;
import org.apache.cxf.message.Exchange;
import org.apache.cxf.service.model.InterfaceInfo;
+import org.apache.cxf.service.model.MessagePartInfo;
import org.apache.cxf.service.model.OperationInfo;
public class DefaultServiceConfiguration extends AbstractServiceConfiguration {
@@ -282,6 +283,32 @@
}
return rawClass;
}
+
+
+ public Boolean isWrapperPartNillable(MessagePartInfo mpi) {
+ return (Boolean)mpi.getProperty("nillable");
+ }
+ public Long getWrapperPartMaxOccurs(MessagePartInfo mpi) {
+ String max = (String)mpi.getProperty("maxOccurs");
+ long maxi = 1;
+ if (max == null) {
+ if (mpi.getTypeClass() != null && mpi.getTypeClass().isArray()
+ && !Byte.TYPE.equals(mpi.getTypeClass().getComponentType())) {
+ maxi = Long.MAX_VALUE;
+ }
+ } else {
+ maxi = "unbounded".equals(max) ? Long.MAX_VALUE : Long.parseLong(max);
+ }
+ return maxi;
+ }
+ public Long getWrapperPartMinOccurs(MessagePartInfo mpi) {
+ String min = (String)mpi.getProperty("minOccurs");
+ long mini = 1;
+ if (min == null && mpi.getTypeClass() != null && !mpi.getTypeClass().isPrimitive()) {
+ mini = 0;
+ }
+ return mini;
+ }
}
Modified: cxf/branches/2.0.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.0.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java?rev=682966&r1=682965&r2=682966&view=diff
==============================================================================
--- cxf/branches/2.0.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java (original)
+++ cxf/branches/2.0.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java Tue Aug 5 14:39:44 2008
@@ -1075,38 +1075,25 @@
}
mpi.setXmlSchema(el);
- if (mpi.getTypeClass() != null && mpi.getTypeClass().isArray()
- && !Byte.TYPE.equals(mpi.getTypeClass().getComponentType())) {
- String min = (String)mpi.getProperty("minOccurs");
- String max = (String)mpi.getProperty("maxOccurs");
- if (min == null) {
- min = "0";
- }
- if (max == null) {
- max = "unbounded";
- }
- el.setMinOccurs(Long.parseLong(min));
- el.setMaxOccurs("unbounded".equals(max) ? Long.MAX_VALUE : Long.parseLong(max));
- Boolean b = (Boolean)mpi.getProperty("nillable");
- if (b != null && b.booleanValue()) {
- el.setNillable(b.booleanValue());
- }
- } else if (Collection.class.isAssignableFrom(mpi.getTypeClass())
+ long min = getWrapperPartMinOccurs(mpi);
+ long max = getWrapperPartMaxOccurs(mpi);
+ boolean nillable = isWrapperPartNillable(mpi);
+
+ if (Collection.class.isAssignableFrom(mpi.getTypeClass())
&& mpi.getTypeClass().isInterface()) {
Type type = (Type)mpi.getProperty(GENERIC_TYPE);
if (!(type instanceof java.lang.reflect.ParameterizedType)
&& el.getSchemaTypeName() == null
&& el.getSchemaType() == null) {
- el.setMinOccurs(0);
- el.setMaxOccurs(Long.MAX_VALUE);
+ max = Long.MAX_VALUE;
el.setSchemaTypeName(Constants.XSD_ANYTYPE);
}
- } else {
- el.setMaxOccurs(1);
- if (mpi.getTypeClass() != null && !mpi.getTypeClass().isPrimitive()) {
- el.setMinOccurs(0);
- }
+ }
+ el.setMinOccurs(min);
+ el.setMaxOccurs(max);
+ if (nillable) {
+ el.setNillable(nillable);
}
seq.getItems().add(el);
}
@@ -1840,6 +1827,34 @@
}
return null;
}
+
+ public boolean isWrapperPartNillable(MessagePartInfo mpi) {
+ for (AbstractServiceConfiguration c : serviceConfigurations) {
+ Boolean b = c.isWrapperPartNillable(mpi);
+ if (b != null) {
+ return b;
+ }
+ }
+ return false;
+ }
+ public long getWrapperPartMaxOccurs(MessagePartInfo mpi) {
+ for (AbstractServiceConfiguration c : serviceConfigurations) {
+ Long b = c.getWrapperPartMaxOccurs(mpi);
+ if (b != null) {
+ return b;
+ }
+ }
+ return 1;
+ }
+ public long getWrapperPartMinOccurs(MessagePartInfo mpi) {
+ for (AbstractServiceConfiguration c : serviceConfigurations) {
+ Long b = c.getWrapperPartMinOccurs(mpi);
+ if (b != null) {
+ return b;
+ }
+ }
+ return 1;
+ }
protected SimpleMethodDispatcher getMethodDispatcher() {
return methodDispatcher;