cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r611868 - in /incubator/cxf/branches/2.0.x-fixes: api/src/main/java/org/apache/cxf/wsdl/ common/common/src/main/java/org/apache/cxf/common/xmlschema/ rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/ systests/src/test/java...
Date Mon, 14 Jan 2008 17:56:41 GMT
Author: dkulp
Date: Mon Jan 14 09:56:34 2008
New Revision: 611868

URL: http://svn.apache.org/viewvc?rev=611868&view=rev
Log:
Fix build failures for latest set of merges

Added:
    incubator/cxf/branches/2.0.x-fixes/common/common/src/main/java/org/apache/cxf/common/xmlschema/XmlSchemaConstants.java
  (with props)
Modified:
    incubator/cxf/branches/2.0.x-fixes/api/src/main/java/org/apache/cxf/wsdl/EndpointReferenceUtils.java
    incubator/cxf/branches/2.0.x-fixes/common/common/src/main/java/org/apache/cxf/common/xmlschema/SchemaCollection.java
    incubator/cxf/branches/2.0.x-fixes/common/common/src/main/java/org/apache/cxf/common/xmlschema/XmlSchemaTools.java
    incubator/cxf/branches/2.0.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/ArrayType.java
    incubator/cxf/branches/2.0.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/BeanType.java
    incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/ws/policy/RMPolicyTest.java

Modified: incubator/cxf/branches/2.0.x-fixes/api/src/main/java/org/apache/cxf/wsdl/EndpointReferenceUtils.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/api/src/main/java/org/apache/cxf/wsdl/EndpointReferenceUtils.java?rev=611868&r1=611867&r2=611868&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/api/src/main/java/org/apache/cxf/wsdl/EndpointReferenceUtils.java
(original)
+++ incubator/cxf/branches/2.0.x-fixes/api/src/main/java/org/apache/cxf/wsdl/EndpointReferenceUtils.java
Mon Jan 14 09:56:34 2008
@@ -44,6 +44,7 @@
 import javax.xml.transform.TransformerFactory;
 import javax.xml.transform.dom.DOMResult;
 import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
 import javax.xml.transform.stream.StreamSource;
 import javax.xml.validation.Schema;
 import javax.xml.validation.SchemaFactory;
@@ -292,6 +293,11 @@
             }
         }
         return null;
+    }
+    
+    public static QName getPortQName(EndpointReferenceType ref) {
+        QName serviceName = getServiceName(ref); 
+        return new QName(serviceName.getNamespaceURI(), getPortName(ref));
     }
     
     public static void setPortName(EndpointReferenceType ref, String portName) {

Modified: incubator/cxf/branches/2.0.x-fixes/common/common/src/main/java/org/apache/cxf/common/xmlschema/SchemaCollection.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/common/common/src/main/java/org/apache/cxf/common/xmlschema/SchemaCollection.java?rev=611868&r1=611867&r2=611868&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/common/common/src/main/java/org/apache/cxf/common/xmlschema/SchemaCollection.java
(original)
+++ incubator/cxf/branches/2.0.x-fixes/common/common/src/main/java/org/apache/cxf/common/xmlschema/SchemaCollection.java
Mon Jan 14 09:56:34 2008
@@ -37,6 +37,7 @@
 import org.apache.ws.commons.schema.XmlSchemaType;
 import org.apache.ws.commons.schema.extensions.ExtensionRegistry;
 import org.apache.ws.commons.schema.resolver.URIResolver;
+import org.apache.ws.commons.schema.utils.NamespaceMap;
 import org.apache.ws.commons.schema.utils.NamespacePrefixList;
 import org.apache.ws.commons.schema.utils.TargetNamespaceValidator;
 
@@ -55,6 +56,10 @@
     public SchemaCollection(XmlSchemaCollection col) {
         schemaCollection = col;
         col.getExtReg().setDefaultExtensionDeserializer(new FixedExtensionDeserializer());
+        if (schemaCollection.getNamespaceContext() == null) {
+        //      an empty prefix map avoids extra checks for null.
+            schemaCollection.setNamespaceContext(new NamespaceMap());
+        }
     }
 
     public boolean equals(Object obj) {
@@ -141,6 +146,20 @@
     public void setSchemaResolver(URIResolver schemaResolver) {
         schemaCollection.setSchemaResolver(schemaResolver);
     }
+    
+    /**
+     * This function is not part of the XmlSchema API. Who knows why?
+     * @param namespaceURI targetNamespace
+     * @return schema, or null.
+     */
+    public XmlSchema getSchemaByTargetNamespace(String namespaceURI) {
+        for (XmlSchema schema : schemaCollection.getXmlSchemas()) {
+            if (schema.getTargetNamespace().equals(namespaceURI)) {
+                return schema;
+            }
+        }
+        return null;
+    }
 
     /**
      * This is a really ugly trick to get around a bug or oversight in XmlSchema, which is
that
@@ -157,7 +176,7 @@
         StringReader reader = new StringReader(tinyXmlSchemaDocument.toString());
         return schemaCollection.read(reader, new ValidationEventHandler() { });
     }
-
+    
     /**
      * Validate that a qualified name points to some namespace in the schema.
      * @param qname
@@ -191,6 +210,16 @@
                                                          + " references type "
                                                          + typeQName);
         }
+    }
+    
+    public void addGlobalElementToSchema(XmlSchemaElement element) {
+        XmlSchema schema = getSchemaByTargetNamespace(element.getQName().getNamespaceURI());
+        if (schema == null) {
+            schema = newXmlSchemaInCollection(element.getQName().getNamespaceURI());
+        }
+        schema.getItems().add(element);
+        // believe it or not, it is up to us to do both of these adds!
+        schema.getElements().add(element.getQName(), element);
     }
     
     public static void addGlobalElementToSchema(XmlSchema schema, XmlSchemaElement element)
{

Added: incubator/cxf/branches/2.0.x-fixes/common/common/src/main/java/org/apache/cxf/common/xmlschema/XmlSchemaConstants.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/common/common/src/main/java/org/apache/cxf/common/xmlschema/XmlSchemaConstants.java?rev=611868&view=auto
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/common/common/src/main/java/org/apache/cxf/common/xmlschema/XmlSchemaConstants.java
(added)
+++ incubator/cxf/branches/2.0.x-fixes/common/common/src/main/java/org/apache/cxf/common/xmlschema/XmlSchemaConstants.java
Mon Jan 14 09:56:34 2008
@@ -0,0 +1,77 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.common.xmlschema;
+
+import javax.xml.namespace.QName;
+
+/**
+ * This class holds constants related to XML Schema. Over time, some of the contents
+ * of WSDLConstants should move here.
+ */
+public final class XmlSchemaConstants {
+    
+    public static final String XSD_NAMESPACE_URI = "http://www.w3.org/2001/XMLSchema";
+    public static final QName ANY_TYPE_QNAME = new QName(XSD_NAMESPACE_URI, "anyType");
+    public static final QName ANY_URI_QNAME = new QName(XSD_NAMESPACE_URI, "anyURI");
+    public static final QName BASE64BINARY_QNAME = new QName(XSD_NAMESPACE_URI, "base64Binary");
+    public static final QName BOOLEAN_QNAME = new QName(XSD_NAMESPACE_URI, "boolean");
+    public static final QName BYTE_QNAME = new QName(XSD_NAMESPACE_URI, "byte");
+    public static final QName DATE_QNAME = new QName(XSD_NAMESPACE_URI, "date");
+    public static final QName DATETIME_QNAME = new QName(XSD_NAMESPACE_URI, "dateTime");
+    public static final QName DOUBLE_QNAME = new QName(XSD_NAMESPACE_URI, "double");
+    public static final QName DURATION_QNAME = new QName(XSD_NAMESPACE_URI, "duration");
+    public static final QName ENTITIES_QNAME = new QName(XSD_NAMESPACE_URI, "ENTITIES");
+    public static final QName ENTITY_QNAME = new QName(XSD_NAMESPACE_URI, "ENTITY");
+    public static final QName FLOAT_QNAME = new QName(XSD_NAMESPACE_URI, "float");
+    public static final QName GDAY_QNAME = new QName(XSD_NAMESPACE_URI, "gDay");
+    public static final QName GMONTH_QNAME = new QName(XSD_NAMESPACE_URI, "gMonth");
+    public static final QName GMONTHDAY_QNAME = new QName(XSD_NAMESPACE_URI, "gMonthDay");
+    public static final QName GYEAR_QNAME = new QName(XSD_NAMESPACE_URI, "gYear");
+    public static final QName GYEARMONTH_QNAME = new QName(XSD_NAMESPACE_URI, "gYearMonth");
+    public static final QName HEX_BINARY_QNAME = new QName(XSD_NAMESPACE_URI, "hexBinary");
+    public static final QName ID_QNAME = new QName(XSD_NAMESPACE_URI, "ID");
+    public static final QName IDREF_QNAME = new QName(XSD_NAMESPACE_URI, "IDREF");
+    public static final QName IDREFS_QNAME = new QName(XSD_NAMESPACE_URI, "IDREFS");
+    public static final QName INT_QNAME = new QName(XSD_NAMESPACE_URI, "int");
+    public static final QName INTEGER_QNAME = new QName(XSD_NAMESPACE_URI, "integer");
+    public static final QName LANGUAGE_QNAME = new QName(XSD_NAMESPACE_URI, "language");
+    public static final QName LONG_QNAME = new QName(XSD_NAMESPACE_URI, "long");
+    public static final QName NAME_QNAME = new QName(XSD_NAMESPACE_URI, "Name");
+    public static final QName NCNAME_QNAME = new QName(XSD_NAMESPACE_URI, "NCName");
+    public static final QName NEGATIVEINTEGER_QNAME = new QName(XSD_NAMESPACE_URI, "negativeInteger");
+    public static final QName NMTOKEN_QNAME = new QName(XSD_NAMESPACE_URI, "NMTOKEN");
+    public static final QName NMTOKENS_QNAME = new QName(XSD_NAMESPACE_URI, "NMTOKENS");
+    public static final QName NONNEGATIVEINTEGER_QNAME = new QName(XSD_NAMESPACE_URI, "nonNegativeInteger");
+    public static final QName NONPOSITIVEINTEGER_QNAME = new QName(XSD_NAMESPACE_URI, "nonPositiveInteger");
+    public static final QName NORMALIZEDSTRING_QNAME = 
+        new QName(XSD_NAMESPACE_URI, "normalizedStringInteger");
+    public static final QName NOTATION_QNAME = new QName(XSD_NAMESPACE_URI, "NOTATION");
+    public static final QName POSITIVEINTEGER_QNAME = new QName(XSD_NAMESPACE_URI, "positiveInteger");
+    public static final QName QNAME_QNAME = new QName(XSD_NAMESPACE_URI, "QName");
+    public static final QName SHORT_QNAME = new QName(XSD_NAMESPACE_URI, "short");
+    public static final QName STRING_QNAME = new QName(XSD_NAMESPACE_URI, "string");
+    public static final QName TIME_QNAME = new QName(XSD_NAMESPACE_URI, "time");
+    public static final QName TOKEN_QNAME = new QName(XSD_NAMESPACE_URI, "token");
+    public static final QName UNSIGNEDBYTE_QNAME = new QName(XSD_NAMESPACE_URI, "unsignedByte");
+    public static final QName UNSIGNEDINT_QNAME = new QName(XSD_NAMESPACE_URI, "unsignedInt");
+    public static final QName UNSIGNEDLONG_QNAME = new QName(XSD_NAMESPACE_URI, "unsignedLong");
+    public static final QName UNSIGNEDSHORT_QNAME = new QName(XSD_NAMESPACE_URI, "unsignedShort");
+
+}

Propchange: incubator/cxf/branches/2.0.x-fixes/common/common/src/main/java/org/apache/cxf/common/xmlschema/XmlSchemaConstants.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/branches/2.0.x-fixes/common/common/src/main/java/org/apache/cxf/common/xmlschema/XmlSchemaConstants.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: incubator/cxf/branches/2.0.x-fixes/common/common/src/main/java/org/apache/cxf/common/xmlschema/XmlSchemaTools.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/common/common/src/main/java/org/apache/cxf/common/xmlschema/XmlSchemaTools.java?rev=611868&r1=611867&r2=611868&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/common/common/src/main/java/org/apache/cxf/common/xmlschema/XmlSchemaTools.java
(original)
+++ incubator/cxf/branches/2.0.x-fixes/common/common/src/main/java/org/apache/cxf/common/xmlschema/XmlSchemaTools.java
Mon Jan 14 09:56:34 2008
@@ -19,12 +19,20 @@
 
 package org.apache.cxf.common.xmlschema;
 
+import java.util.ArrayList;
+import java.util.List;
 import java.util.logging.Logger;
 
 import javax.xml.namespace.QName;
 
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.ws.commons.schema.XmlSchemaElement;
+import org.apache.ws.commons.schema.XmlSchemaEnumerationFacet;
+import org.apache.ws.commons.schema.XmlSchemaFacet;
+import org.apache.ws.commons.schema.XmlSchemaObjectCollection;
+import org.apache.ws.commons.schema.XmlSchemaSimpleType;
+import org.apache.ws.commons.schema.XmlSchemaSimpleTypeContent;
+import org.apache.ws.commons.schema.XmlSchemaSimpleTypeRestriction;
 
 /**
  * Some functions that avoid problems with Commons XML Schema.  
@@ -98,5 +106,46 @@
         element.setRefName(name);
         // cxf conventionally keeps something in the name slot.
         setNameFromQName(element, name);
+    }
+    
+    /**
+     * Return true if a simple type is a straightforward XML Schema representation of an
enumeration.
+     * If we discover schemas that are 'enum-like' with more complex structures, we might
+     * make this deal with them.
+     * @param type Simple type, possible an enumeration.
+     * @return true for an enumeration.
+     */
+    public static boolean isEumeration(XmlSchemaSimpleType type) {
+        XmlSchemaSimpleTypeContent content = type.getContent();
+        if (!(content instanceof XmlSchemaSimpleTypeRestriction)) {
+            return false;
+        }
+        XmlSchemaSimpleTypeRestriction restriction = (XmlSchemaSimpleTypeRestriction) content;
+        XmlSchemaObjectCollection facets = restriction.getFacets();
+        for (int x = 0; x < facets.getCount(); x++) {
+            XmlSchemaFacet facet = (XmlSchemaFacet) facets.getItem(x);
+            if (!(facet instanceof XmlSchemaEnumerationFacet)) {
+                return false;
+            }
+        }
+        return true;
+    }
+    
+    /**
+     * Retrieve the string values for an enumeration.
+     * @param type
+     * @return
+     */
+    public static List<String> enumeratorValues(XmlSchemaSimpleType type) {
+        XmlSchemaSimpleTypeContent content = type.getContent();
+        XmlSchemaSimpleTypeRestriction restriction = (XmlSchemaSimpleTypeRestriction) content;
+        XmlSchemaObjectCollection facets = restriction.getFacets();
+        List<String> values = new ArrayList<String>(); 
+        for (int x = 0; x < facets.getCount(); x++) {
+            XmlSchemaFacet facet = (XmlSchemaFacet) facets.getItem(x);
+            XmlSchemaEnumerationFacet enumFacet = (XmlSchemaEnumerationFacet) facet;
+            values.add(enumFacet.getValue().toString());
+        }
+        return values;
     }
 }

Modified: incubator/cxf/branches/2.0.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/ArrayType.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/ArrayType.java?rev=611868&r1=611867&r2=611868&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/ArrayType.java
(original)
+++ incubator/cxf/branches/2.0.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/ArrayType.java
Mon Jan 14 09:56:34 2008
@@ -192,10 +192,10 @@
 
         Class arrayType = type.getTypeClass();
 
-        boolean oldXsiWrite = context.getGlobalContext().isWriteXsiTypes();
+        boolean oldXsiWrite = context.isWriteXsiTypes();
         try {
             if (forceXsiWrite) {
-                context.getGlobalContext().setWriteXsiTypes(true);
+                context.setWriteXsiTypes(true);
             }
 
             int i;
@@ -247,7 +247,7 @@
                 }
             }
         } finally {
-            context.getGlobalContext().setWriteXsiTypes(oldXsiWrite);
+            context.setWriteXsiTypes(oldXsiWrite);
         }
     }
 

Modified: incubator/cxf/branches/2.0.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/BeanType.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/BeanType.java?rev=611868&r1=611867&r2=611868&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/BeanType.java
(original)
+++ incubator/cxf/branches/2.0.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/BeanType.java
Mon Jan 14 09:56:34 2008
@@ -297,7 +297,6 @@
 
         BeanTypeInfo inf = getTypeInfo();
 
-        if (object.getClass() == getTypeClass() 
         if (!wroteXsiType 
             && object.getClass() == getTypeClass()
             && context.isWriteXsiTypes()) {

Modified: incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/ws/policy/RMPolicyTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/ws/policy/RMPolicyTest.java?rev=611868&r1=611867&r2=611868&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/ws/policy/RMPolicyTest.java
(original)
+++ incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/ws/policy/RMPolicyTest.java
Mon Jan 14 09:56:34 2008
@@ -39,7 +39,6 @@
 import org.apache.cxf.systest.ws.util.OutMessageRecorder;
 import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
 import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
-import org.apache.cxf.ws.addressing.Names;
 import org.apache.cxf.ws.rm.RMConstants;
 
 import org.junit.BeforeClass;



Mime
View raw message