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 2007/10/31 13:09:59 UTC

svn commit: r590637 - in /incubator/cxf/branches/2.0.x-fixes: ./ common/common/src/main/java/org/apache/cxf/common/injection/ResourceInjector.java rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java

Author: dkulp
Date: Wed Oct 31 05:09:58 2007
New Revision: 590637

URL: http://svn.apache.org/viewvc?rev=590637&view=rev
Log:
Merged revisions 590532 via svnmerge from 
https://svn.apache.org/repos/asf/incubator/cxf/trunk

........
  r590532 | bimargulies | 2007-10-30 21:41:40 -0400 (Tue, 30 Oct 2007) | 7 lines
  
  Arrange for schemas created by the ReflectionServiceFactoryBean to be
  added to the XmlSchemaCollection for the ServiceInfo. 
  
  FINE a common log message instead of INFO.
........

Modified:
    incubator/cxf/branches/2.0.x-fixes/   (props changed)
    incubator/cxf/branches/2.0.x-fixes/common/common/src/main/java/org/apache/cxf/common/injection/ResourceInjector.java
    incubator/cxf/branches/2.0.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java

Propchange: incubator/cxf/branches/2.0.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: incubator/cxf/branches/2.0.x-fixes/common/common/src/main/java/org/apache/cxf/common/injection/ResourceInjector.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/common/common/src/main/java/org/apache/cxf/common/injection/ResourceInjector.java?rev=590637&r1=590636&r2=590637&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/common/common/src/main/java/org/apache/cxf/common/injection/ResourceInjector.java (original)
+++ incubator/cxf/branches/2.0.x-fixes/common/common/src/main/java/org/apache/cxf/common/injection/ResourceInjector.java Wed Oct 31 05:09:58 2007
@@ -189,7 +189,7 @@
         } else {
             resource = resolveResource(resourceName, clz);
             
-            LOG.log(Level.INFO, "RESOURCE_RESOLVE_FAILED", new Object[] {resourceName, clz});
+            LOG.log(Level.FINE, "RESOURCE_RESOLVE_FAILED", new Object[] {resourceName, clz});
         }
     }
 

Modified: incubator/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/incubator/cxf/branches/2.0.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java?rev=590637&r1=590636&r2=590637&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java (original)
+++ incubator/cxf/branches/2.0.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java Wed Oct 31 05:09:58 2007
@@ -19,6 +19,8 @@
 
 package org.apache.cxf.service.factory;
 
+import java.io.StringReader;
+import java.lang.annotation.Annotation;
 import java.lang.reflect.Array;
 import java.lang.reflect.Field;
 import java.lang.reflect.GenericArrayType;
@@ -76,6 +78,7 @@
 import org.apache.cxf.service.model.UnwrappedOperationInfo;
 import org.apache.cxf.wsdl.WSDLConstants;
 import org.apache.cxf.wsdl11.WSDLServiceFactory;
+import org.apache.ws.commons.schema.ValidationEventHandler;
 import org.apache.ws.commons.schema.XmlSchema;
 import org.apache.ws.commons.schema.XmlSchemaCollection;
 import org.apache.ws.commons.schema.XmlSchemaComplexType;
@@ -867,6 +870,22 @@
 
     }
 
+    
+    /**
+     * This is a really ugly trick to get around a bug or oversight in XmlSchema, which is that
+     * there is no way to programmatically construct an XmlSchema instance that ends up cataloged
+     * in a collection. If there is a fix to WSCOMMONS-272, this can go away.
+     * @param collection collection to contain new schema
+     * @return new schema
+     */
+    private XmlSchema newXmlSchemaInCollection(XmlSchemaCollection collection, String namespaceURI) {
+        StringBuffer tinyXmlSchemaDocument = new StringBuffer();
+        tinyXmlSchemaDocument.append("<xsd:schema xmlns:xsd='http://www.w3.org/2001/XMLSchema' ");
+        tinyXmlSchemaDocument.append("targetNamespace='" + namespaceURI + "'/>");
+        StringReader reader = new StringReader(tinyXmlSchemaDocument.toString());
+        return collection.read(reader, new ValidationEventHandler() { });
+    }
+
     private SchemaInfo getOrCreateSchema(ServiceInfo serviceInfo,
                                          String namespaceURI, 
                                          boolean qualified) {
@@ -879,7 +898,7 @@
         SchemaInfo schemaInfo = new SchemaInfo(serviceInfo, namespaceURI);
         XmlSchemaCollection col = serviceInfo.getXmlSchemaCollection();
 
-        XmlSchema schema = new XmlSchema(namespaceURI, col);
+        XmlSchema schema = newXmlSchemaInCollection(col, namespaceURI);
         if (qualified) {
             schema.setElementFormDefault(new XmlSchemaForm(XmlSchemaForm.QUALIFIED));
         }