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/09/15 17:14:57 UTC
svn commit: r695498 - in /cxf/branches/2.1.x-fixes: ./
rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/
rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/
rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/encode...
Author: dkulp
Date: Mon Sep 15 08:14:56 2008
New Revision: 695498
URL: http://svn.apache.org/viewvc?rev=695498&view=rev
Log:
Merged revisions 695096 via svnmerge from
https://svn.apache.org/repos/asf/cxf/trunk
........
r695096 | bimargulies | 2008-09-13 20:42:54 -0400 (Sat, 13 Sep 2008) | 2 lines
Fix CXF-1788.
........
Added:
cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/custom/
- copied from r695096, cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/custom/
cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/custom/CustomMappingTest.java
- copied unchanged from r695096, cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/custom/CustomMappingTest.java
Modified:
cxf/branches/2.1.x-fixes/ (props changed)
cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/DefaultTypeMapping.java
cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/TypeMapping.java
cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/BeanType.java
cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/encoded/StructType.java
Propchange: cxf/branches/2.1.x-fixes/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Sep 15 08:14:56 2008
@@ -1 +1 @@
-/cxf/trunk:686333-686363,686764,686820,687096,687194,687363,687387,687463,687543,687722,687798,687814,687817,687891,687910,687914,688086,688102,688133,688596,688735,688870,689572,689596,689855,689924,690067,690289,691246,691271,691295,691355,691488,691602,691646,691706,691728,692116,692157,692310,692466,692499,693653,693819,694179,694263,694417,694716,694744,694747,694795,694869,694981,694987,694993,695041
+/cxf/trunk:686333-686363,686764,686820,687096,687194,687363,687387,687463,687543,687722,687798,687814,687817,687891,687910,687914,688086,688102,688133,688596,688735,688870,689572,689596,689855,689924,690067,690289,691246,691271,691295,691355,691488,691602,691646,691706,691728,692116,692157,692310,692466,692499,693653,693819,694179,694263,694417,694716,694744,694747,694795,694869,694981,694987,694993,695041,695096
Propchange: cxf/branches/2.1.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Modified: cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/DefaultTypeMapping.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/DefaultTypeMapping.java?rev=695498&r1=695497&r2=695498&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/DefaultTypeMapping.java (original)
+++ cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/DefaultTypeMapping.java Mon Sep 15 08:14:56 2008
@@ -127,6 +127,9 @@
register(type);
}
+ /**
+ * {@inheritDoc}
+ */
public void register(Type type) {
type.setTypeMapping(this);
/*
Modified: cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/TypeMapping.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/TypeMapping.java?rev=695498&r1=695497&r2=695498&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/TypeMapping.java (original)
+++ cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/TypeMapping.java Mon Sep 15 08:14:56 2008
@@ -26,21 +26,34 @@
*/
public interface TypeMapping {
/**
- * Checks whether or not type mapping between specified XML type and Java
- * type is registered.
- *
- * @param javaType Class of the Java type
- * @param xmlType Qualified name of the XML data type
- * @return boolean; <code>true</code> if type mapping between the
- * specified XML type and Java type is registered; otherwise
- * <code>false</code>
+ * Returns a flag indicating if this type mapping has a mapping for a particular Java class.
+ * @param javaType the class.
+ * @return <code>true</code> if there is a mapping for the type.
*/
boolean isRegistered(Class javaType);
+ /**
+ * Returns a flag indicating if this type mapping has a mapping for a particular
+ * XML Schema QName.
+ * @param xmlType the QName.
+ * @return <code>true</code> if there is a mapping for the type.
+ */
boolean isRegistered(QName xmlType);
+ /**
+ * Register a type, manually specifying the java class, the schema type,
+ * and the Aegis type object that provides serialization, deserialization,
+ * and schema.
+ * @param javaType Java class.
+ * @param xmlType XML Schema type QName.
+ * @param type Aegis type object.
+ */
void register(Class javaType, QName xmlType, Type type);
+ /**
+ * Register a type that self-describes the schema type and the Java class.
+ * @param type Aegis type object that
+ */
void register(Type type);
void removeType(Type type);
Modified: cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/BeanType.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/BeanType.java?rev=695498&r1=695497&r2=695498&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/BeanType.java (original)
+++ cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/BeanType.java Mon Sep 15 08:14:56 2008
@@ -652,7 +652,14 @@
type = beanType.getTypeInfo().getType(name);
if (type == null) {
- beanType = beanType.getSuperType();
+ Type superType = beanType.getSuperType(); /* The class might inherit from, say, 'Integer'.
+ In which case we've got no BeanType
+ to work with. */
+ if (superType instanceof BeanType) {
+ beanType = (BeanType) superType;
+ } else {
+ break; // give up.
+ }
}
}
@@ -660,13 +667,13 @@
if (beanType != null) {
elementTypeInfo = beanType.getTypeInfo();
} else {
- // didn't find a bean type so just use this bean't type info
+ // didn't find a bean type so just use this bean's type info
elementTypeInfo = getTypeInfo();
}
return elementTypeInfo;
}
- public BeanType getSuperType() {
+ public Type getSuperType() {
BeanTypeInfo inf = getTypeInfo();
Class c = inf.getTypeClass().getSuperclass();
/*
@@ -674,12 +681,13 @@
*/
if (c != null && c != Object.class && c != Exception.class && c != RuntimeException.class) {
TypeMapping tm = inf.getTypeMapping();
- BeanType superType = (BeanType)tm.getType(c);
+ Type superType = tm.getType(c);
if (superType == null) {
+ // if we call createType, we know that we'll get a BeanType. */
superType = (BeanType)getTypeMapping().getTypeCreator().createType(c);
Class cParent = c.getSuperclass();
if (cParent != null && cParent != Object.class) {
- superType.getTypeInfo().setExtension(true);
+ ((BeanType)superType).getTypeInfo().setExtension(true);
}
tm.register(superType);
}
@@ -770,4 +778,12 @@
public boolean hasMinOccurs() {
return true;
}
+
+ @Override
+ public void setTypeMapping(TypeMapping typeMapping) {
+ super.setTypeMapping(typeMapping);
+ if (info != null) {
+ info.setTypeMapping(typeMapping);
+ }
+ }
}
Modified: cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/encoded/StructType.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/encoded/StructType.java?rev=695498&r1=695497&r2=695498&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/encoded/StructType.java (original)
+++ cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/encoded/StructType.java Mon Sep 15 08:14:56 2008
@@ -140,7 +140,7 @@
}
// find the matching property and get it's name
- for (BeanType sooper = this; sooper != null; sooper = sooper.getSuperType()) {
+ for (BeanType sooper = this; sooper != null; sooper = superBeanType(sooper)) {
QName qualifiedName = new QName(sooper.getTypeInfo().getDefaultNamespace(), name.getLocalPart());
if (sooper.getTypeInfo().getType(qualifiedName) != null) {
@@ -150,6 +150,17 @@
return name;
}
+
+ private BeanType superBeanType(Type t) {
+ if (t instanceof BeanType) {
+ BeanType bt = (BeanType)t;
+ Type supertype = bt.getSuperType();
+ if (supertype instanceof BeanType) {
+ return (BeanType)supertype;
+ }
+ }
+ return null;
+ }
/**
* When the SoapRef is resolved write the matching property on the target object.