cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bimargul...@apache.org
Subject svn commit: r1023402 [3/9] - in /cxf/trunk: api/src/main/java/org/apache/cxf/databinding/ api/src/main/java/org/apache/cxf/service/model/ common/common/src/main/java/org/apache/cxf/common/xmlschema/ common/common/src/test/java/org/apache/cxf/common/xml...
Date Sun, 17 Oct 2010 02:26:08 GMT
Modified: cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBSchemaInitializer.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBSchemaInitializer.java?rev=1023402&r1=1023401&r2=1023402&view=diff
==============================================================================
--- cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBSchemaInitializer.java (original)
+++ cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBSchemaInitializer.java Sun Oct 17 02:26:06 2010
@@ -53,7 +53,6 @@ import org.apache.ws.commons.schema.XmlS
 import org.apache.ws.commons.schema.XmlSchemaComplexType;
 import org.apache.ws.commons.schema.XmlSchemaElement;
 import org.apache.ws.commons.schema.XmlSchemaForm;
-import org.apache.ws.commons.schema.XmlSchemaObject;
 import org.apache.ws.commons.schema.XmlSchemaSequence;
 import org.apache.ws.commons.schema.XmlSchemaSimpleType;
 import org.apache.ws.commons.schema.XmlSchemaSimpleTypeList;
@@ -69,10 +68,10 @@ class JAXBSchemaInitializer extends Serv
     private SchemaCollection schemas;
     private JAXBContextProxy context;
     private final boolean qualifiedSchemas;
-    
-    public JAXBSchemaInitializer(ServiceInfo serviceInfo, 
-                                 SchemaCollection col, 
-                                 JAXBContext context, 
+
+    public JAXBSchemaInitializer(ServiceInfo serviceInfo,
+                                 SchemaCollection col,
+                                 JAXBContext context,
                                  boolean q) {
         super(serviceInfo);
         schemas = col;
@@ -98,7 +97,7 @@ class JAXBSchemaInitializer extends Serv
         }
         return null;
     }
-    
+
     public JAXBBeanInfo getBeanInfo(Type cls) {
         if (cls instanceof Class) {
             if (((Class)cls).isArray()) {
@@ -117,18 +116,18 @@ class JAXBSchemaInitializer extends Serv
 
             return getBeanInfo(ct);
         }
-        
+
         return null;
     }
-    
+
     public JAXBBeanInfo getBeanInfo(Class<?> cls) {
         return getBeanInfo(context, cls);
     }
-    
+
     public static JAXBBeanInfo getBeanInfo(JAXBContextProxy context, Class<?> cls) {
         return JAXBUtils.getBeanInfo(context, cls);
     }
-    
+
     @Override
     public void begin(MessagePartInfo part) {
         // Check to see if the WSDL information has been filled in for us.
@@ -136,7 +135,7 @@ class JAXBSchemaInitializer extends Serv
             checkForExistence(part);
             return;
         }
-        
+
         Class<?> clazz = part.getTypeClass();
         if (clazz == null) {
             return;
@@ -193,25 +192,25 @@ class JAXBSchemaInitializer extends Serv
             }
             return;
         }
-        boolean isElement = beanInfo.isElement() 
+        boolean isElement = beanInfo.isElement()
             && !Boolean.TRUE.equals(part.getMessageInfo().getOperation()
                                         .getProperty("operation.force.types"));
         boolean hasType = !beanInfo.getTypeNames().isEmpty();
         if (isElement && isFromWrapper && hasType) {
             //if there is both a Global element and a global type, AND we are in a wrapper,
-            //make sure we use the type instead of a ref to the element to 
+            //make sure we use the type instead of a ref to the element to
             //match the rules for wrapped/unwrapped
             isElement = false;
         }
 
         part.setElement(isElement);
-        
+
         if (isElement) {
-            QName name = new QName(beanInfo.getElementNamespaceURI(null), 
+            QName name = new QName(beanInfo.getElementNamespaceURI(null),
                                    beanInfo.getElementLocalName(null));
             XmlSchemaElement el = schemas.getElementByQName(name);
-            if (el != null && el.getRefName() != null) {
-                part.setTypeQName(el.getRefName());
+            if (el != null && el.getRef().getTarget() != null) {
+                part.setTypeQName(el.getRef().getTargetQName());
             } else {
                 part.setElementQName(name);
             }
@@ -221,7 +220,7 @@ class JAXBSchemaInitializer extends Serv
             if (typeName != null) {
                 XmlSchemaType type = schemas.getTypeByQName(typeName);
                 if  (isList && type instanceof XmlSchemaSimpleType) {
-                    XmlSchemaSimpleType simpleType = new XmlSchemaSimpleType(null);
+                    XmlSchemaSimpleType simpleType = new XmlSchemaSimpleType(type.getParent(), false);
                     XmlSchemaSimpleTypeList list = new XmlSchemaSimpleTypeList();
                     XmlSchemaSimpleType stype = (XmlSchemaSimpleType)type;
                     list.setItemTypeName(stype.getQName());
@@ -281,9 +280,9 @@ class JAXBSchemaInitializer extends Serv
         if (!itr.hasNext()) {
             return null;
         }
-        
+
         return itr.next();
-    } 
+    }
     public void checkForExistence(MessagePartInfo part) {
         QName qn = part.getElementQName();
         if (qn != null) {
@@ -307,7 +306,7 @@ class JAXBSchemaInitializer extends Serv
                     }
                     return;
                 }
-                
+
                 QName typeName = getTypeName(beanInfo);
 
                 createBridgeXsElement(part, qn, typeName);
@@ -323,39 +322,36 @@ class JAXBSchemaInitializer extends Serv
         if (schemaInfo != null) {
             el = schemaInfo.getElementByQName(qn);
             if (el == null) {
-                el = createXsElement(part, typeName, schemaInfo);
+                el = createXsElement(schemaInfo.getSchema(), part, typeName, schemaInfo);
 
-                schemaInfo.getSchema().getElements().add(el.getQName(), el);
-                schemaInfo.getSchema().getItems().add(el);
             } else if (!typeName.equals(el.getSchemaTypeName())) {
-                throw new Fault(new Message("CANNOT_CREATE_ELEMENT", LOG, 
+                throw new Fault(new Message("CANNOT_CREATE_ELEMENT", LOG,
                                             qn, typeName, el.getSchemaTypeName()));
             }
             return;
         }
-        
-        schemaInfo = new SchemaInfo(qn.getNamespaceURI(), qualifiedSchemas, false);
-        
-        el = createXsElement(part, typeName, schemaInfo);
 
         XmlSchema schema = schemas.newXmlSchemaInCollection(qn.getNamespaceURI());
         if (qualifiedSchemas) {
-            schema.setElementFormDefault(new XmlSchemaForm(XmlSchemaForm.QUALIFIED));
+            schema.setElementFormDefault(XmlSchemaForm.QUALIFIED);
         }
+        schemaInfo = new SchemaInfo(qn.getNamespaceURI(), qualifiedSchemas, false);
         schemaInfo.setSchema(schema);
-        schema.getElements().add(el.getQName(), el);
-        schema.getItems().add(el);
+
+        el = createXsElement(schema, part, typeName, schemaInfo);
 
         NamespaceMap nsMap = new NamespaceMap();
         nsMap.add(WSDLConstants.CONVENTIONAL_TNS_PREFIX, schema.getTargetNamespace());
         nsMap.add(WSDLConstants.NP_SCHEMA_XSD, WSDLConstants.NS_SCHEMA_XSD);
         schema.setNamespaceContext(nsMap);
-        
+
         serviceInfo.addSchema(schemaInfo);
     }
 
-    private XmlSchemaElement createXsElement(MessagePartInfo part, QName typeName, SchemaInfo schemaInfo) {
-        XmlSchemaElement el = new XmlSchemaElement();
+    private XmlSchemaElement createXsElement(XmlSchema schema,
+                                             MessagePartInfo part,
+                                             QName typeName, SchemaInfo schemaInfo) {
+        XmlSchemaElement el = new XmlSchemaElement(schema, true);
         XmlSchemaUtils.setElementQName(el, part.getElementQName());
         el.setNillable(true);
         el.setSchemaTypeName(typeName);
@@ -363,14 +359,14 @@ class JAXBSchemaInitializer extends Serv
         schemaInfo.setElement(null);
         return el;
     }
-    
+
     public void end(FaultInfo fault) {
-        MessagePartInfo part = fault.getMessageParts().get(0); 
+        MessagePartInfo part = fault.getMessageParts().get(0);
         Class<?> cls = part.getTypeClass();
         Class<?> cl2 = (Class)fault.getProperty(Class.class.getName());
-        if (cls != cl2) {            
+        if (cls != cl2) {
             QName name = (QName)fault.getProperty("elementName");
-            part.setElementQName(name);           
+            part.setElementQName(name);
             JAXBBeanInfo beanInfo = getBeanInfo(cls);
             if (beanInfo == null) {
                 throw new Fault(new Message("NO_BEAN_INFO", LOG, cls.getName()));
@@ -378,13 +374,11 @@ class JAXBSchemaInitializer extends Serv
             SchemaInfo schemaInfo = serviceInfo.getSchema(part.getElementQName().getNamespaceURI());
             if (schemaInfo != null
                 && !isExistSchemaElement(schemaInfo.getSchema(), part.getElementQName())) {
-                
-                XmlSchemaElement el = new XmlSchemaElement();
+
+                XmlSchemaElement el = new XmlSchemaElement(schemaInfo.getSchema(), true);
                 XmlSchemaUtils.setElementQName(el, part.getElementQName());
                 el.setNillable(true);
-                
-                schemaInfo.getSchema().getItems().add(el);
-                schemaInfo.getSchema().getElements().add(el.getQName(), el);
+
                 schemaInfo.setElement(null);
 
                 Iterator<QName> itr = beanInfo.getTypeNames().iterator();
@@ -404,29 +398,27 @@ class JAXBSchemaInitializer extends Serv
                     //no String or default constructor, we cannot use it
                     return;
                 }
-            }            
-            
+            }
+
             //not mappable in JAXBContext directly, we'll have to do it manually :-(
             SchemaInfo schemaInfo = serviceInfo.getSchema(part.getElementQName().getNamespaceURI());
             if (schemaInfo == null
                 || isExistSchemaElement(schemaInfo.getSchema(), part.getElementQName())) {
                 return;
             }
-                
-            XmlSchemaElement el = new XmlSchemaElement();
+
+            XmlSchemaElement el = new XmlSchemaElement(schemaInfo.getSchema(), true);
             XmlSchemaUtils.setElementQName(el, part.getElementQName());
-            
-            schemaInfo.getSchema().getItems().add(el);
-            schemaInfo.getSchema().getElements().add(el.getQName(), el);
+
             schemaInfo.setElement(null);
 
             part.setXmlSchema(el);
 
-            XmlSchemaComplexType ct = new XmlSchemaComplexType(schemaInfo.getSchema());
+            XmlSchemaComplexType ct = new XmlSchemaComplexType(schemaInfo.getSchema(), false);
             el.setSchemaType(ct);
             XmlSchemaSequence seq = new XmlSchemaSequence();
             ct.setParticle(seq);
-                
+
             Method methods[] = cls.getMethods();
             for (Method m : methods) {
                 if (m.getName().startsWith("get")
@@ -435,16 +427,16 @@ class JAXBSchemaInitializer extends Serv
                     try {
                         m.getDeclaringClass().getMethod("set" + m.getName().substring(beginIdx),
                                                         m.getReturnType());
-                        
+
                         JAXBBeanInfo beanInfo = getBeanInfo(m.getReturnType());
                         if (beanInfo != null) {
-                            el = new XmlSchemaElement();
+                            el = new XmlSchemaElement(schemaInfo.getSchema(), false);
                             el.setName(m.getName().substring(beginIdx));
-                            
+
                             String ns = schemaInfo.getSchema().getElementFormDefault()
-                                .getValue().equals(XmlSchemaForm.UNQUALIFIED) 
+                                .equals(XmlSchemaForm.UNQUALIFIED)
                                 ? "" : part.getElementQName().getLocalPart();
-                            XmlSchemaUtils.setElementQName(el, 
+                            XmlSchemaUtils.setElementQName(el,
                                                            new QName(ns, m.getName().substring(beginIdx)));
                             Iterator<QName> itr = beanInfo.getTypeNames().iterator();
                             if (!itr.hasNext()) {
@@ -453,7 +445,7 @@ class JAXBSchemaInitializer extends Serv
                             QName typeName = itr.next();
                             el.setSchemaTypeName(typeName);
                         }
-                        
+
                         seq.getItems().add(el);
                     } catch (Exception e) {
                         //not mappable
@@ -463,12 +455,12 @@ class JAXBSchemaInitializer extends Serv
         }
     }
 
-    
+
     private void buildExceptionType(MessagePartInfo part, Class<?> cls) {
         SchemaInfo schemaInfo = null;
         for (SchemaInfo s : serviceInfo.getSchemas()) {
             if (s.getNamespaceURI().equals(part.getElementQName().getNamespaceURI())) {
-                schemaInfo = s;                
+                schemaInfo = s;
                 break;
             }
         }
@@ -477,7 +469,7 @@ class JAXBSchemaInitializer extends Serv
             schema = schemas.newXmlSchemaInCollection(part.getElementQName().getNamespaceURI());
 
             if (qualifiedSchemas) {
-                schema.setElementFormDefault(new XmlSchemaForm(XmlSchemaForm.QUALIFIED));
+                schema.setElementFormDefault(XmlSchemaForm.QUALIFIED);
             }
 
             NamespaceMap nsMap = new NamespaceMap();
@@ -485,53 +477,51 @@ class JAXBSchemaInitializer extends Serv
             nsMap.add(WSDLConstants.NP_SCHEMA_XSD, WSDLConstants.NS_SCHEMA_XSD);
             schema.setNamespaceContext(nsMap);
 
-            
+
             schemaInfo = new SchemaInfo(part.getElementQName().getNamespaceURI());
             schemaInfo.setSchema(schema);
             serviceInfo.addSchema(schemaInfo);
         } else {
             schema = schemaInfo.getSchema();
         }
-        
-        XmlSchemaComplexType ct = new XmlSchemaComplexType(schema);
+
+        XmlSchemaComplexType ct = new XmlSchemaComplexType(schema, false);
         ct.setName(part.getElementQName().getLocalPart());
-        // Before updating everything, make sure we haven't added this 
-        // type yet.  Multiple methods that throw the same exception 
-        // types will cause duplicates. 
+        // Before updating everything, make sure we haven't added this
+        // type yet.  Multiple methods that throw the same exception
+        // types will cause duplicates.
         if (schema.getTypeByName(ct.getQName()) != null) {
-            return; 
+            return;
         }
-        
-        XmlSchemaElement el = new XmlSchemaElement();
+
+        XmlSchemaElement el = new XmlSchemaElement(schema, true);
         XmlSchemaUtils.setElementQName(el, part.getElementQName());
-        schema.getItems().add(el);
-        schema.getElements().add(el.getQName(), el);
         part.setXmlSchema(el);
-        
+
         schema.getItems().add(ct);
         schema.addType(ct);
         schemaInfo.setElement(null);
         el.setSchemaTypeName(part.getElementQName());
-        
+
         XmlSchemaSequence seq = new XmlSchemaSequence();
         ct.setParticle(seq);
         String namespace = part.getElementQName().getNamespaceURI();
-        
+
         XmlAccessorType accessorType = cls.getAnnotation(XmlAccessorType.class);
         if (accessorType == null && cls.getPackage() != null) {
             accessorType = cls.getPackage().getAnnotation(XmlAccessorType.class);
         }
         XmlAccessType accessType = accessorType != null ? accessorType.value() : XmlAccessType.PUBLIC_MEMBER;
 
-        
+
         for (Field f : cls.getDeclaredFields()) {
             if (JAXBContextInitializer.isFieldAccepted(f, accessType)) {
                 //map field
                 Type type = f.getGenericType();
                 JAXBBeanInfo beanInfo = getBeanInfo(type);
                 if (beanInfo != null) {
-                    addElement(seq, beanInfo, new QName(namespace, f.getName()), isArray(type));
-                }                
+                    addElement(schema, seq, beanInfo, new QName(namespace, f.getName()), isArray(type));
+                }
             }
         }
         for (Method m : cls.getMethods()) {
@@ -543,13 +533,13 @@ class JAXBSchemaInitializer extends Serv
                     int idx = m.getName().startsWith("get") ? 3 : 2;
                     String name = m.getName().substring(idx);
                     name = Character.toLowerCase(name.charAt(0)) + name.substring(1);
-                    addElement(seq, beanInfo, new QName(namespace, name), isArray(type));
-                }                
+                    addElement(schema, seq, beanInfo, new QName(namespace, name), isArray(type));
+                }
             }
         }
         part.setProperty(JAXBDataBinding.class.getName() + ".CUSTOM_EXCEPTION", Boolean.TRUE);
     }
-    
+
     static boolean isArray(Type cls) {
         if (cls instanceof Class) {
             return ((Class)cls).isArray();
@@ -561,9 +551,10 @@ class JAXBSchemaInitializer extends Serv
         return false;
     }
 
-    public void addElement(XmlSchemaSequence seq, JAXBBeanInfo beanInfo,
-                           QName name, boolean isArray) {    
-        XmlSchemaElement el = new XmlSchemaElement();
+    protected void addElement(XmlSchema schema,
+                              XmlSchemaSequence seq, JAXBBeanInfo beanInfo,
+                              QName name, boolean isArray) {
+        XmlSchemaElement el = new XmlSchemaElement(schema, false);
         el.setName(name.getLocalPart());
         XmlSchemaUtils.setElementQName(el, name);
 
@@ -577,11 +568,11 @@ class JAXBSchemaInitializer extends Serv
         }
 
         if (beanInfo.isElement()) {
-            QName ename = new QName(beanInfo.getElementNamespaceURI(null), 
+            QName ename = new QName(beanInfo.getElementNamespaceURI(null),
                                    beanInfo.getElementLocalName(null));
             XmlSchemaElement el2 = schemas.getElementByQName(ename);
             XmlSchemaUtils.setElementQName(el, null);
-            XmlSchemaUtils.setElementRefName(el, el2.getRefName());
+            el.getRef().setTargetQName(el2.getRef().getTargetQName());
         } else {
             Iterator<QName> itr = beanInfo.getTypeNames().iterator();
             if (!itr.hasNext()) {
@@ -590,23 +581,12 @@ class JAXBSchemaInitializer extends Serv
             QName typeName = itr.next();
             el.setSchemaTypeName(typeName);
         }
-        
+
         seq.getItems().add(el);
     }
-    
-    
+
+
     private boolean isExistSchemaElement(XmlSchema schema, QName qn) {
-        boolean isExist = false;
-        for (Iterator ite = schema.getItems().getIterator(); ite.hasNext();) {
-            XmlSchemaObject obj = (XmlSchemaObject)ite.next();
-            if (obj instanceof XmlSchemaElement) {
-                XmlSchemaElement xsEle = (XmlSchemaElement)obj;
-                if (xsEle.getQName().equals(qn)) {
-                    isExist = true;
-                    break;
-                }
-            }
-        }
-        return isExist;
+        return schema.getElementByName(qn) != null;
     }
 }

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/wadl/WadlGenerator.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/wadl/WadlGenerator.java?rev=1023402&r1=1023401&r2=1023402&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/wadl/WadlGenerator.java (original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/wadl/WadlGenerator.java Sun Oct 17 02:26:06 2010
@@ -102,33 +102,33 @@ import org.apache.ws.commons.schema.XmlS
 
 public class WadlGenerator implements RequestHandler {
 
-    public static final String WADL_QUERY = "_wadl"; 
-    public static final MediaType WADL_TYPE = MediaType.valueOf("application/vnd.sun.wadl+xml"); 
-    public static final String WADL_NS = "http://wadl.dev.java.net/2009/02";    
-    
+    public static final String WADL_QUERY = "_wadl";
+    public static final MediaType WADL_TYPE = MediaType.valueOf("application/vnd.sun.wadl+xml");
+    public static final String WADL_NS = "http://wadl.dev.java.net/2009/02";
+
     private static final Logger LOG = LogUtils.getL7dLogger(WadlGenerator.class);
     private static final String JAXB_DEFAULT_NAMESPACE = "##default";
     private static final String JAXB_DEFAULT_NAME = "##default";
     private static final String CLASSPATH_PREFIX = "classpath:";
-    
+
     private String wadlNamespace;
     private boolean ignoreMessageWriters = true;
     private boolean singleResourceMultipleMethods = true;
     private boolean useSingleSlashResource;
     private boolean addResourceAndMethodIds;
-    
+
     private boolean useJaxbContextForQnames = true;
-    
+
     private List<String> externalSchemasCache;
     private List<URI> externalSchemaLinks;
-    private Map<String, List<String>> externalQnamesMap; 
+    private Map<String, List<String>> externalQnamesMap;
     private ElementQNameResolver resolver;
     private List<String> privateAddresses;
-    
+
     public WadlGenerator() {
-        
+
     }
-    
+
     public WadlGenerator(WadlGenerator other) {
         this.wadlNamespace = other.wadlNamespace;
         this.externalQnamesMap = other.externalQnamesMap;
@@ -142,41 +142,41 @@ public class WadlGenerator implements Re
         this.useJaxbContextForQnames = other.useJaxbContextForQnames;
         this.useSingleSlashResource = other.useSingleSlashResource;
     }
-    
+
     public Response handleRequest(Message m, ClassResourceInfo resource) {
-        
+
         if (!"GET".equals(m.get(Message.HTTP_REQUEST_METHOD))) {
             return null;
         }
-        
+
         UriInfo ui = new UriInfoImpl(m);
         if (!ui.getQueryParameters().containsKey(WADL_QUERY)) {
             return null;
         }
-        
+
         if (isPrivate(m)) {
             return Response.status(401).build();
         }
-        
+
         StringBuilder sbMain = new StringBuilder();
         sbMain.append("<application xmlns=\"").append(getNamespace())
               .append("\" xmlns:xs=\"").append(XmlSchemaConstants.XSD_NAMESPACE_URI).append("\"");
         StringBuilder sbGrammars = new StringBuilder();
         sbGrammars.append("<grammars>");
-        
+
         StringBuilder sbResources = new StringBuilder();
         sbResources.append("<resources base=\"").append(ui.getBaseUri().toString()).append("\">");
-        
+
         List<ClassResourceInfo> cris = getResourcesList(m, resource);
-        
-        Set<Class<?>> allTypes = 
+
+        Set<Class<?>> allTypes =
             ResourceUtils.getAllRequestResponseTypes(cris, useJaxbContextForQnames).keySet();
-        
+
         JAXBContext context = createJaxbContext(allTypes);
         SchemaWriter schemaWriter = createSchemaWriter(context, ui);
-        ElementQNameResolver qnameResolver = 
+        ElementQNameResolver qnameResolver =
             schemaWriter == null ? null : createElementQNameResolver(context);
-        
+
         Map<Class<?>, QName> clsMap = new IdentityHashMap<Class<?>, QName>();
         Set<ClassResourceInfo> visitedResources = new HashSet<ClassResourceInfo>();
         for (ClassResourceInfo cri : cris) {
@@ -186,29 +186,29 @@ public class WadlGenerator implements Re
             sbResources.append("</resource>");
         }
         sbResources.append("</resources>");
-        
+
         handleGrammars(sbMain, sbGrammars, schemaWriter, clsMap);
-        
+
         sbGrammars.append("</grammars>");
         sbMain.append(">");
         sbMain.append(sbGrammars.toString());
         sbMain.append(sbResources.toString());
         sbMain.append("</application>");
-        
+
         m.getExchange().put(JAXRSUtils.IGNORE_MESSAGE_WRITERS, ignoreMessageWriters);
-        
+
         HttpHeaders headers = new HttpHeadersImpl(m);
         MediaType type = headers.getAcceptableMediaTypes().contains(MediaType.APPLICATION_XML_TYPE)
-                      ? MediaType.APPLICATION_XML_TYPE : WADL_TYPE;  
+                      ? MediaType.APPLICATION_XML_TYPE : WADL_TYPE;
         return Response.ok().type(type).entity(sbMain.toString()).build();
     }
 
-    private void handleGrammars(StringBuilder sbApp, StringBuilder sbGrammars, 
+    private void handleGrammars(StringBuilder sbApp, StringBuilder sbGrammars,
                                 SchemaWriter writer, Map<Class<?>, QName> clsMap) {
         if (writer == null) {
             return;
         }
-        
+
         Map<String, String> map = new HashMap<String, String>();
         for (QName qname : clsMap.values()) {
             map.put(qname.getPrefix(), qname.getNamespaceURI());
@@ -217,23 +217,23 @@ public class WadlGenerator implements Re
             sbApp.append(" xmlns:").append(entry.getKey()).append("=\"")
                  .append(entry.getValue()).append("\"");
         }
-        
+
         writer.write(sbGrammars);
     }
-    
-    
-    private void handleResource(StringBuilder sb, Set<Class<?>> jaxbTypes, 
+
+
+    private void handleResource(StringBuilder sb, Set<Class<?>> jaxbTypes,
                                 ElementQNameResolver qnameResolver,
-                                Map<Class<?>, QName> clsMap, ClassResourceInfo cri, 
+                                Map<Class<?>, QName> clsMap, ClassResourceInfo cri,
                                 Set<ClassResourceInfo> visitedResources) {
         visitedResources.add(cri);
         List<OperationResourceInfo> sortedOps = sortOperationsByPath(
             cri.getMethodDispatcher().getOperationResourceInfos());
-        
+
         boolean resourceTagOpened = false;
         for (int i = 0; i < sortedOps.size(); i++) {
-            OperationResourceInfo ori = sortedOps.get(i); 
-            
+            OperationResourceInfo ori = sortedOps.get(i);
+
             if (ori.getHttpMethod() == null) {
                 Class<?> cls = ori.getMethodToInvoke().getReturnType();
                 ClassResourceInfo subcri = cri.findResource(cls, cls);
@@ -241,7 +241,7 @@ public class WadlGenerator implements Re
                     startResourceTag(sb, subcri.getServiceClass(), ori.getURITemplate().getValue());
                     handleDocs(subcri.getServiceClass().getAnnotations(), sb);
                     handlePathAndMatrixParams(sb, ori);
-                    handleResource(sb, jaxbTypes, qnameResolver, clsMap, subcri, 
+                    handleResource(sb, jaxbTypes, qnameResolver, clsMap, subcri,
                                    visitedResources);
                     sb.append("</resource>");
                 } else {
@@ -250,11 +250,11 @@ public class WadlGenerator implements Re
                 continue;
             }
             OperationResourceInfo nextOp = i + 1 < sortedOps.size() ? sortedOps.get(i + 1) : null;
-            resourceTagOpened = handleOperation(sb, jaxbTypes, qnameResolver, clsMap, ori, nextOp, 
+            resourceTagOpened = handleOperation(sb, jaxbTypes, qnameResolver, clsMap, ori, nextOp,
                                                 resourceTagOpened, i);
         }
     }
-    
+
     private void startResourceTag(StringBuilder sb, Class<?> serviceClass, String path) {
         sb.append("<resource path=\"").append(path).append("\"");
         if (addResourceAndMethodIds) {
@@ -262,15 +262,15 @@ public class WadlGenerator implements Re
             if (useJaxbContextForQnames) {
                 jaxbQname = getJaxbQName(null, serviceClass, new HashMap<Class<?>, QName>(0));
             }
-            String pName = jaxbQname == null ? PackageUtils.getPackageName(serviceClass) 
+            String pName = jaxbQname == null ? PackageUtils.getPackageName(serviceClass)
                 : jaxbQname.getNamespaceURI();
-            String localName = jaxbQname == null ? serviceClass.getSimpleName() 
+            String localName = jaxbQname == null ? serviceClass.getSimpleName()
                 : jaxbQname.getLocalPart();
             sb.append(" id=\"").append("{" + pName + "}" + localName).append("\"");
         }
         sb.append(">");
     }
-    
+
     private void startMethodTag(StringBuilder sb, OperationResourceInfo ori) {
         sb.append("<method name=\"").append(ori.getHttpMethod()).append("\"");
         if (addResourceAndMethodIds) {
@@ -278,18 +278,18 @@ public class WadlGenerator implements Re
         }
         sb.append(">");
     }
-    
+
     //CHECKSTYLE:OFF
-    private boolean handleOperation(StringBuilder sb, Set<Class<?>> jaxbTypes, 
-                                 ElementQNameResolver qnameResolver, 
-                                 Map<Class<?>, QName> clsMap, 
+    private boolean handleOperation(StringBuilder sb, Set<Class<?>> jaxbTypes,
+                                 ElementQNameResolver qnameResolver,
+                                 Map<Class<?>, QName> clsMap,
                                  OperationResourceInfo ori,
                                  OperationResourceInfo nextOp,
                                  boolean resourceTagOpened,
                                  int index) {
-    //CHECKSTYLE:ON    
+    //CHECKSTYLE:ON
         boolean samePathOperationFollows = singleResourceMultipleMethods && compareOperations(ori, nextOp);
-        
+
         String path = ori.getURITemplate().getValue();
         if (!resourceTagOpened && openResource(path)) {
             resourceTagOpened = true;
@@ -297,7 +297,7 @@ public class WadlGenerator implements Re
             if (template != null) {
                 String parentPath = template.getValue();
                 if (parentPath.endsWith("/") && path.startsWith("/") && path.length() > 1) {
-                    path = path.substring(1); 
+                    path = path.substring(1);
                 }
             }
             sb.append("<resource path=\"").append(path).append("\">");
@@ -305,7 +305,7 @@ public class WadlGenerator implements Re
         } else if (index == 0) {
             handlePathAndMatrixParams(sb, ori);
         }
-        
+
         startMethodTag(sb, ori);
         handleDocs(ori.getAnnotatedMethod().getAnnotations(), sb);
         if (ori.getMethodToInvoke().getParameterTypes().length != 0) {
@@ -313,8 +313,8 @@ public class WadlGenerator implements Re
             if (isFormRequest(ori)) {
                 handleRepresentation(sb, jaxbTypes, qnameResolver, clsMap, ori, null, false);
             } else {
-                for (Parameter p : ori.getParameters()) {        
-                    handleParameter(sb, jaxbTypes, qnameResolver, clsMap, ori, p);             
+                for (Parameter p : ori.getParameters()) {
+                    handleParameter(sb, jaxbTypes, qnameResolver, clsMap, ori, p);
                 }
             }
             sb.append("</request>");
@@ -331,16 +331,16 @@ public class WadlGenerator implements Re
                                  ori.getMethodToInvoke().getReturnType(), false);
         }
         sb.append("</response>");
-        
+
         sb.append("</method>");
-        
+
         if (resourceTagOpened && !samePathOperationFollows) {
             sb.append("</resource>");
             resourceTagOpened = false;
         }
         return resourceTagOpened;
     }
-    
+
     protected boolean compareOperations(OperationResourceInfo ori1, OperationResourceInfo ori2) {
         if (ori1 == null || ori2 == null
             || !ori1.getURITemplate().getValue().equals(ori2.getURITemplate().getValue())) {
@@ -355,7 +355,7 @@ public class WadlGenerator implements Re
                 ori1MatrixParams++;
             }
         }
-        
+
         int ori2PathParams = 0;
         int ori2MatrixParams = 0;
         for (Parameter p : ori2.getParameters()) {
@@ -365,40 +365,40 @@ public class WadlGenerator implements Re
                 ori2MatrixParams++;
             }
         }
-        
+
         return ori1PathParams == ori2PathParams && ori1MatrixParams == ori2MatrixParams;
     }
-    
+
     private boolean openResource(String path) {
         if ("/".equals(path)) {
             return useSingleSlashResource;
         }
         return true;
     }
-    
-    protected void handleDynamicSubresource(StringBuilder sb, Set<Class<?>> jaxbTypes, 
+
+    protected void handleDynamicSubresource(StringBuilder sb, Set<Class<?>> jaxbTypes,
                  ElementQNameResolver qnameResolver, Map<Class<?>, QName> clsMap, OperationResourceInfo ori,
                  ClassResourceInfo subcri) {
-        
+
         if (subcri != null) {
             sb.append("<!-- Recursive subresource -->");
         } else {
-            sb.append("<!-- Dynamic subresource -->");    
+            sb.append("<!-- Dynamic subresource -->");
         }
-        startResourceTag(sb, subcri != null ? subcri.getServiceClass() : Object.class, 
+        startResourceTag(sb, subcri != null ? subcri.getServiceClass() : Object.class,
             ori.getURITemplate().getValue());
         handlePathAndMatrixParams(sb, ori);
         sb.append("</resource>");
     }
-    
+
     private void handlePathAndMatrixParams(StringBuilder sb, OperationResourceInfo ori) {
         handleParams(sb, ori, ParameterType.PATH);
         handleParams(sb, ori, ParameterType.MATRIX);
     }
-    
-    
-    private void handleParameter(StringBuilder sb, Set<Class<?>> jaxbTypes, 
-                                 ElementQNameResolver qnameResolver, 
+
+
+    private void handleParameter(StringBuilder sb, Set<Class<?>> jaxbTypes,
+                                 ElementQNameResolver qnameResolver,
                                  Map<Class<?>, QName> clsMap, OperationResourceInfo ori, Parameter pm) {
         Class<?> cls = ori.getMethodToInvoke().getParameterTypes()[pm.getIndex()];
         if (pm.getType() == ParameterType.REQUEST_BODY) {
@@ -411,9 +411,9 @@ public class WadlGenerator implements Re
         if (pm.getType() == ParameterType.HEADER || pm.getType() == ParameterType.QUERY) {
             writeParam(sb, pm, ori);
         }
-        
+
     }
-    
+
     private void handleParams(StringBuilder sb, OperationResourceInfo ori, ParameterType type) {
         for (Parameter pm : ori.getParameters()) {
             if (pm.getType() == type) {
@@ -421,7 +421,7 @@ public class WadlGenerator implements Re
             }
         }
     }
-    
+
     private Annotation[] getBodyAnnotations(OperationResourceInfo ori, boolean inbound) {
         if (inbound) {
             for (Parameter pm : ori.getParameters()) {
@@ -434,7 +434,7 @@ public class WadlGenerator implements Re
             return ori.getAnnotatedMethod().getDeclaredAnnotations();
         }
     }
-    
+
     private void writeParam(StringBuilder sb, Parameter pm, OperationResourceInfo ori) {
         Class<?> type = ori.getMethodToInvoke().getParameterTypes()[pm.getIndex()];
         if (!"".equals(pm.getName())) {
@@ -443,7 +443,7 @@ public class WadlGenerator implements Re
             doWriteBeanParam(sb, type, pm, null);
         }
     }
-    
+
     private void doWriteBeanParam(StringBuilder sb, Class<?> type, Parameter pm, String parentName) {
         Map<Parameter, Class<?>> pms = InjectionUtils.getParametersFromBeanClass(type, pm.getType(), true);
         for (Map.Entry<Parameter, Class<?>> entry : pms.entrySet()) {
@@ -458,13 +458,13 @@ public class WadlGenerator implements Re
             }
         }
     }
-    
+
     protected void doWriteParam(StringBuilder sb, Parameter pm, Class<?> type, String paramName) {
         if (ParameterType.REQUEST_BODY == pm.getType()) {
             return;
         }
         sb.append("<param name=\"").append(paramName).append("\" ");
-        String style = ParameterType.PATH == pm.getType() ? "template" 
+        String style = ParameterType.PATH == pm.getType() ? "template"
                        : ParameterType.FORM == pm.getType() ? "query"
                        : pm.getType().toString().toLowerCase();
         sb.append("style=\"").append(style).append("\"");
@@ -477,10 +477,10 @@ public class WadlGenerator implements Re
         }
         sb.append("/>");
     }
-    
-    private void handleRepresentation(StringBuilder sb, Set<Class<?>> jaxbTypes, 
+
+    private void handleRepresentation(StringBuilder sb, Set<Class<?>> jaxbTypes,
                                       ElementQNameResolver qnameResolver,
-                                      Map<Class<?>, QName> clsMap, OperationResourceInfo ori, 
+                                      Map<Class<?>, QName> clsMap, OperationResourceInfo ori,
                                       Class<?> type, boolean inbound) {
         List<MediaType> types = inbound ? ori.getConsumeTypes() : ori.getProduceTypes();
         if (types.size() == 1 && types.get(0).equals(MediaType.WILDCARD_TYPE)
@@ -496,7 +496,7 @@ public class WadlGenerator implements Re
                 }
                 sb.append("<representation");
                 sb.append(" mediaType=\"").append(mt.toString()).append("\"");
-                
+
                 type = getActualJaxbType(type, ori.getAnnotatedMethod(), inbound);
                 if (qnameResolver != null && mt.getSubtype().contains("xml") && jaxbTypes.contains(type)) {
                     generateQName(sb, qnameResolver, clsMap, type,
@@ -504,7 +504,7 @@ public class WadlGenerator implements Re
                 }
                 sb.append("/>");
             }
-        } else { 
+        } else {
             sb.append("<representation");
             sb.append(" mediaType=\"").append(types.get(0).toString()).append("\">");
             for (Parameter pm : ori.getParameters()) {
@@ -513,12 +513,12 @@ public class WadlGenerator implements Re
             sb.append("</representation>");
         }
     }
-    
+
     protected Class<?> getActualJaxbType(Class<?> type, Method resourceMethod, boolean inbound) {
         WadlElement element = resourceMethod.getAnnotation(WadlElement.class);
         return element == null ? type : inbound ? element.request() : element.response();
     }
-    
+
     protected List<OperationResourceInfo> sortOperationsByPath(Set<OperationResourceInfo> ops) {
         List<OperationResourceInfo> opsWithSamePath = new LinkedList<OperationResourceInfo>(ops);
         Collections.sort(opsWithSamePath, new Comparator<OperationResourceInfo>() {
@@ -539,43 +539,43 @@ public class WadlGenerator implements Re
                 }
                 return result;
             }
-            
-        });        
+
+        });
         return opsWithSamePath;
     }
-    
+
     public List<ClassResourceInfo> getResourcesList(Message m, ClassResourceInfo cri) {
         return cri != null ? Collections.singletonList(cri)
                : ((JAXRSServiceImpl)m.getExchange().get(Service.class)).getClassResourceInfos();
     }
-    
+
 
     private void generateQName(StringBuilder sb,
                                ElementQNameResolver qnameResolver,
-                               Map<Class<?>, QName> clsMap, 
+                               Map<Class<?>, QName> clsMap,
                                Class<?> type,
                                Annotation[] annotations) {
-        
+
         QName typeQName = clsMap.get(type);
         if (typeQName != null) {
             writeQName(sb, typeQName);
             return;
         }
-        
+
         QName qname = qnameResolver.resolve(type, annotations,
                                             Collections.unmodifiableMap(clsMap));
-        
+
         if (qname != null) {
             writeQName(sb, qname);
             clsMap.put(type, qname);
         }
-    }    
+    }
 
     private void writeQName(StringBuilder sb, QName qname) {
         sb.append(" element=\"").append(qname.getPrefix()).append(':')
             .append(qname.getLocalPart()).append("\"");
     }
-    
+
     private SchemaCollection getSchemaCollection(JAXBContext context) {
         if (context == null) {
             return null;
@@ -583,7 +583,7 @@ public class WadlGenerator implements Re
         SchemaCollection xmlSchemaCollection = new SchemaCollection();
         Collection<DOMSource> schemas = new HashSet<DOMSource>();
         try {
-            for (DOMResult r : JAXBUtils.generateJaxbSchemas(context, 
+            for (DOMResult r : JAXBUtils.generateJaxbSchemas(context,
                                     CastUtils.cast(Collections.emptyMap(), String.class, DOMResult.class))) {
                 schemas.add(new DOMSource(r.getNode(), r.getSystemId()));
             }
@@ -591,20 +591,20 @@ public class WadlGenerator implements Re
             LOG.fine("No schema can be generated");
             return null;
         }
-        
+
         boolean hackAroundEmptyNamespaceIssue = false;
         for (DOMSource r : schemas) {
-            hackAroundEmptyNamespaceIssue = 
-                              addSchemaDocument(xmlSchemaCollection, 
+            hackAroundEmptyNamespaceIssue =
+                              addSchemaDocument(xmlSchemaCollection,
                              (Document)r.getNode(),
                               r.getSystemId(),
                               hackAroundEmptyNamespaceIssue);
         }
         return xmlSchemaCollection;
     }
-    
+
     private QName getJaxbQName(JAXBContextProxy jaxbProxy, Class<?> type, Map<Class<?>, QName> clsMap) {
-        
+
         XmlRootElement root = type.getAnnotation(XmlRootElement.class);
         if (root != null) {
             QName qname = getQNameFromParts(root.name(), root.namespace(), clsMap);
@@ -618,22 +618,22 @@ public class WadlGenerator implements Re
                 return null;
             }
         }
-        
+
         try {
             JAXBBeanInfo jaxbInfo = jaxbProxy == null ? null : JAXBUtils.getBeanInfo(jaxbProxy, type);
             if (jaxbInfo == null) {
                 return null;
             }
             Object instance = type.newInstance();
-            return getQNameFromParts(jaxbInfo.getElementLocalName(instance), 
+            return getQNameFromParts(jaxbInfo.getElementLocalName(instance),
                                      jaxbInfo.getElementNamespaceURI(instance),
                                      clsMap);
         } catch (Exception ex) {
-            // ignore    
+            // ignore
         }
         return null;
     }
-    
+
     private String getPrefix(String ns, Map<Class<?>, QName> clsMap) {
         String prefix = null;
         for (QName name : clsMap.values()) {
@@ -641,14 +641,14 @@ public class WadlGenerator implements Re
                 prefix = name.getPrefix();
                 break;
             }
-        }    
+        }
         if (prefix == null) {
             int size = new HashSet<QName>(clsMap.values()).size();
             prefix = "prefix" + (size + 1);
         }
         return prefix;
     }
-    
+
     private JAXBContext createJaxbContext(Set<Class<?>> classes) {
         if (!useJaxbContextForQnames || classes.isEmpty()) {
             return null;
@@ -665,7 +665,7 @@ public class WadlGenerator implements Re
         }
         return null;
     }
-    
+
     private boolean isFormRequest(OperationResourceInfo ori) {
         for (Parameter p : ori.getParameters()) {
             if (p.getType() == ParameterType.FORM) {
@@ -674,32 +674,32 @@ public class WadlGenerator implements Re
         }
         return false;
     }
-    
+
     // TODO : can we reuse this block with JAXBBinding somehow ?
-    public boolean addSchemaDocument(SchemaCollection col, 
+    public boolean addSchemaDocument(SchemaCollection col,
                                      Document d,
                                      String systemId,
                                      boolean hackAroundEmptyNamespaceIssue) {
         String ns = d.getDocumentElement().getAttribute("targetNamespace");
-        
+
         if (StringUtils.isEmpty(ns)) {
             if (DOMUtils.getFirstElement(d.getDocumentElement()) == null) {
                 hackAroundEmptyNamespaceIssue = true;
                 return hackAroundEmptyNamespaceIssue;
             }
-            //create a copy of the dom so we 
+            //create a copy of the dom so we
             //can modify it.
             d = copy(d);
             ns = "";
             d.getDocumentElement().setAttribute("targetNamespace", ns);
         }
-        
+
         if (hackAroundEmptyNamespaceIssue) {
-            d = doEmptyNamespaceHack(d);            
+            d = doEmptyNamespaceHack(d);
         }
-        
+
         Node n = d.getDocumentElement().getFirstChild();
-        while (n != null) { 
+        while (n != null) {
             if (n instanceof Element) {
                 Element e = (Element)n;
                 if (e.getLocalName().equals("import")) {
@@ -708,13 +708,13 @@ public class WadlGenerator implements Re
             }
             n = n.getNextSibling();
         }
-         
+
         synchronized (d) {
-            col.read(d, systemId, null);
+            col.read(d, systemId);
         }
         return hackAroundEmptyNamespaceIssue;
     }
- 
+
     private Document doEmptyNamespaceHack(Document d) {
         boolean hasStuffToRemove = false;
         Element el = DOMUtils.getFirstElement(d.getDocumentElement());
@@ -727,7 +727,7 @@ public class WadlGenerator implements Re
             el = DOMUtils.getNextElement(el);
         }
         if (hasStuffToRemove) {
-            //create a copy of the dom so we 
+            //create a copy of the dom so we
             //can modify it.
             d = copy(d);
             el = DOMUtils.getFirstElement(d.getDocumentElement());
@@ -741,7 +741,7 @@ public class WadlGenerator implements Re
                 }
             }
         }
-            
+
         return d;
     }
 
@@ -755,16 +755,16 @@ public class WadlGenerator implements Re
         }
         return doc;
     }
-    
-    
+
+
     private QName getQNameFromParts(String name, String namespace, Map<Class<?>, QName> clsMap) {
         if (name == null || JAXB_DEFAULT_NAME.equals(name) || name.length() == 0) {
-            return null; 
+            return null;
         }
         if (namespace == null || JAXB_DEFAULT_NAMESPACE.equals(namespace) || namespace.length() == 0) {
             return null;
         }
-        
+
         String prefix = getPrefix(namespace, clsMap);
         return new QName(namespace, name, prefix);
     }
@@ -795,7 +795,7 @@ public class WadlGenerator implements Re
                         is = ResourceUtils.getClasspathResourceStream(path, SchemaHandler.class,
                             BusFactory.getDefaultBus());
                         if (is != null) {
-                            try { 
+                            try {
                                 sb.append(IOUtils.toString(is));
                             } catch (IOException ex) {
                                 // ignore
@@ -811,7 +811,7 @@ public class WadlGenerator implements Re
     private String getNamespace() {
         return wadlNamespace != null ? wadlNamespace : WADL_NS;
     }
-    
+
     public void setWadlNamespace(String namespace) {
         this.wadlNamespace = namespace;
     }
@@ -825,9 +825,9 @@ public class WadlGenerator implements Re
     }
 
     public void setSchemaLocations(List<String> locations) {
-        
+
         externalQnamesMap = new HashMap<String, List<String>>();
-        externalSchemasCache = new ArrayList<String>(locations.size()); 
+        externalSchemasCache = new ArrayList<String>(locations.size());
         for (int i = 0; i < locations.size(); i++) {
             String loc = locations.get(i);
             try {
@@ -839,8 +839,8 @@ public class WadlGenerator implements Re
                 XMLSource source = new XMLSource(bis);
                 source.setBuffering(true);
                 String targetNs = source.getValue("/*/@targetNamespace");
-                
-                Map<String, String> nsMap = 
+
+                Map<String, String> nsMap =
                     Collections.singletonMap("xs", XmlSchemaConstants.XSD_NAMESPACE_URI);
                 String[] elementNames = source.getValues("/*/xs:element/@name", nsMap);
                 externalQnamesMap.put(targetNs, Arrays.asList(elementNames));
@@ -853,20 +853,20 @@ public class WadlGenerator implements Re
                 return;
             }
         }
-         
+
     }
 
     public void setUseJaxbContextForQnames(boolean checkJaxbOnly) {
         this.useJaxbContextForQnames = checkJaxbOnly;
     }
-    
+
     protected ElementQNameResolver createElementQNameResolver(JAXBContext context) {
         if (resolver != null) {
             return resolver;
         }
         if (useJaxbContextForQnames) {
             if (context != null) {
-                JAXBContextProxy proxy = 
+                JAXBContextProxy proxy =
                     ReflectionInvokationHandler.createProxyWrapper(context, JAXBContextProxy.class);
                 return new JaxbContextQNameResolver(proxy);
             } else {
@@ -878,7 +878,7 @@ public class WadlGenerator implements Re
             return new XMLNameQNameResolver();
         }
     }
-    
+
     protected SchemaWriter createSchemaWriter(JAXBContext context, UriInfo ui) {
         // if neither externalSchemaLinks nor externalSchemasCache is set
         // then JAXBContext will be used to generate the schema
@@ -894,7 +894,7 @@ public class WadlGenerator implements Re
         }
         return null;
     }
-    
+
     public void setExternalLinks(List<String> externalLinks) {
         externalSchemaLinks = new LinkedList<URI>();
         for (String s : externalLinks) {
@@ -911,15 +911,15 @@ public class WadlGenerator implements Re
     private static interface SchemaWriter {
         void write(StringBuilder sb);
     }
-    
+
     private class StringSchemaWriter implements SchemaWriter {
-        
+
         private List<String> theSchemas;
-        
+
         public StringSchemaWriter(List<String> schemas, List<URI> links, UriInfo ui) {
-            
+
             this.theSchemas = new LinkedList<String>();
-            // we'll need to do the proper schema caching eventually 
+            // we'll need to do the proper schema caching eventually
             for (String s : schemas) {
                 XMLSource source = new XMLSource(new ByteArrayInputStream(s.getBytes()));
                 source.setBuffering(true);
@@ -931,13 +931,13 @@ public class WadlGenerator implements Re
 
         private Map<String, String> getLocationsMap(XMLSource source, String elementName,
                                                     List<URI> links, UriInfo ui) {
-            Map<String, String> nsMap = 
+            Map<String, String> nsMap =
                 Collections.singletonMap("xs", XmlSchemaConstants.XSD_NAMESPACE_URI);
             String[] locations = source.getValues("/*/xs:" + elementName + "/@schemaLocation", nsMap);
             if (locations == null) {
                 return Collections.emptyMap();
             }
-            
+
             Map<String, String> locs = new HashMap<String, String>();
             for (String loc : locations) {
                 try {
@@ -967,7 +967,7 @@ public class WadlGenerator implements Re
             }
             return locs;
         }
-        
+
         private String transformSchema(String schema, Map<String, String> locs) {
             ByteArrayOutputStream bos = new ByteArrayOutputStream();
             SchemaConverter sc = new SchemaConverter(StaxUtils.createXMLStreamWriter(bos), locs);
@@ -979,27 +979,27 @@ public class WadlGenerator implements Re
             } catch (Exception ex) {
                 return schema;
             }
-            
+
         }
-        
+
         public void write(StringBuilder sb) {
-            for (String s : theSchemas) { 
+            for (String s : theSchemas) {
                 sb.append(s);
             }
         }
     }
-    
+
     private class SchemaCollectionWriter implements SchemaWriter {
-        
+
         private SchemaCollection coll;
-        
+
         public SchemaCollectionWriter(SchemaCollection coll) {
             this.coll = coll;
         }
-        
+
         public void write(StringBuilder sb) {
             for (XmlSchema xs : coll.getXmlSchemas()) {
-                if (xs.getItems().getCount() == 0) {
+                if (xs.getItems().isEmpty()) {
                     continue;
                 }
                 StringWriter writer = new StringWriter();
@@ -1008,22 +1008,22 @@ public class WadlGenerator implements Re
             }
         }
     }
-    
+
     private class ExternalSchemaWriter implements SchemaWriter {
-        
+
         private List<URI> links;
-        private UriInfo uriInfo; 
-        
+        private UriInfo uriInfo;
+
         public ExternalSchemaWriter(List<URI> links, UriInfo ui) {
             this.links = links;
             this.uriInfo = ui;
         }
-        
+
         public void write(StringBuilder sb) {
             for (URI link : links) {
                 try {
-                    URI value = link.isAbsolute() ? link 
-                        : uriInfo.getBaseUriBuilder().path(link.toString()).build(); 
+                    URI value = link.isAbsolute() ? link
+                        : uriInfo.getBaseUriBuilder().path(link.toString()).build();
                     sb.append("<include href=\"").append(value.toString()).append("\"/>");
                 } catch (Exception ex) {
                     LOG.warning("WADL grammar section will be incomplete, this link is not a valid URI : "
@@ -1032,21 +1032,21 @@ public class WadlGenerator implements Re
             }
         }
     }
-    
+
     private class JaxbContextQNameResolver implements ElementQNameResolver {
 
         private JAXBContextProxy proxy;
-        
+
         public JaxbContextQNameResolver(JAXBContextProxy proxy) {
             this.proxy = proxy;
         }
-        
+
         public QName resolve(Class<?> type, Annotation[] annotations, Map<Class<?>, QName> clsMap) {
             return getJaxbQName(proxy, type, clsMap);
         }
-        
+
     }
-    
+
     private class XMLNameQNameResolver implements ElementQNameResolver {
 
         public QName resolve(Class<?> type, Annotation[] annotations, Map<Class<?>, QName> clsMap) {
@@ -1060,74 +1060,74 @@ public class WadlGenerator implements Re
                     return qname;
                 } else {
                     return getQNameFromParts(qname.getLocalPart(),
-                                             qname.getNamespaceURI(), clsMap);                    
+                                             qname.getNamespaceURI(), clsMap);
                 }
             }
             return null;
         }
-        
+
     }
-    
+
     private class SchemaQNameResolver implements ElementQNameResolver {
 
         private Map<String, List<String>> map;
-        
+
         public SchemaQNameResolver(Map<String, List<String>> map) {
             this.map = map;
         }
-        
+
         public QName resolve(Class<?> type, Annotation[] annotations, Map<Class<?>, QName> clsMap) {
             String name = type.getSimpleName();
             for (Map.Entry<String, List<String>> entry : map.entrySet()) {
-                String elementName = null;  
-                if (entry.getValue().contains(name)) { 
-                    elementName = name;                    
-                } else if (entry.getValue().contains(name.toLowerCase())) { 
-                    elementName = name.toLowerCase();                    
-                }  
+                String elementName = null;
+                if (entry.getValue().contains(name)) {
+                    elementName = name;
+                } else if (entry.getValue().contains(name.toLowerCase())) {
+                    elementName = name.toLowerCase();
+                }
                 if (elementName != null) {
                     return getQNameFromParts(elementName, entry.getKey(), clsMap);
                 }
             }
             return null;
         }
-        
+
     }
-    
+
     public void setResolver(ElementQNameResolver resolver) {
         this.resolver = resolver;
     }
-    
+
     public void setPrivateAddresses(List<String> privateAddresses) {
         this.privateAddresses = privateAddresses;
     }
-    
+
     public List<String> getPrivateAddresses() {
         return privateAddresses;
     }
 
     private boolean isPrivate(Message m) {
-        return MessageUtils.isTrue(m.getContextualProperty("org.apache.cxf.endpoint.private")); 
+        return MessageUtils.isTrue(m.getContextualProperty("org.apache.cxf.endpoint.private"));
     }
-    
+
     public void setAddResourceAndMethodIds(boolean addResourceAndMethodIds) {
         this.addResourceAndMethodIds = addResourceAndMethodIds;
     }
 
     private static class SchemaConverter extends DelegatingXMLStreamWriter {
         private static final String SCHEMA_LOCATION = "schemaLocation";
-        private Map<String, String> locsMap;    
+        private Map<String, String> locsMap;
         public SchemaConverter(XMLStreamWriter writer, Map<String, String> locsMap) {
             super(writer);
             this.locsMap = locsMap;
         }
-    
+
         public void writeAttribute(String local, String value) throws XMLStreamException {
             if (SCHEMA_LOCATION.equals(local) && locsMap.containsKey(value)) {
                 value = locsMap.get(value);
             }
             super.writeAttribute(local, value);
         }
-    }        
-        
+    }
+
 }

Modified: cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java?rev=1023402&r1=1023401&r2=1023402&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java (original)
+++ cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java Sun Oct 17 02:26:06 2010
@@ -110,10 +110,9 @@ import org.apache.cxf.wsdl11.WSDLService
 import org.apache.ws.commons.schema.XmlSchema;
 import org.apache.ws.commons.schema.XmlSchemaComplexType;
 import org.apache.ws.commons.schema.XmlSchemaElement;
+import org.apache.ws.commons.schema.XmlSchemaExternal;
 import org.apache.ws.commons.schema.XmlSchemaForm;
 import org.apache.ws.commons.schema.XmlSchemaImport;
-import org.apache.ws.commons.schema.XmlSchemaObject;
-import org.apache.ws.commons.schema.XmlSchemaObjectTable;
 import org.apache.ws.commons.schema.XmlSchemaSequence;
 import org.apache.ws.commons.schema.XmlSchemaType;
 import org.apache.ws.commons.schema.constants.Constants;
@@ -152,10 +151,10 @@ public class ReflectionServiceFactoryBea
     protected Class<?> serviceClass;
     protected ParameterizedType serviceType;
     protected Map<Type, Map<String, Class<?>>> parameterizedTypes;
-    
+
     protected final Map<String, String> schemaLocationMapping = new HashMap<String, String>();
 
-    private List<AbstractServiceConfiguration> serviceConfigurations = 
+    private List<AbstractServiceConfiguration> serviceConfigurations =
         new ArrayList<AbstractServiceConfiguration>();
     private QName serviceName;
     private Invoker invoker;
@@ -172,12 +171,12 @@ public class ReflectionServiceFactoryBea
     private boolean validate;
 
     private List<AbstractFeature> features;
-    
+
     private Map<Method, Boolean> wrappedCache = new HashMap<Method, Boolean>();
     private Map<Method, Boolean> isRpcCache = new HashMap<Method, Boolean>();
     private String styleCache;
     private Boolean defWrappedCache;
-    
+
     public ReflectionServiceFactoryBean() {
         getServiceConfigurations().add(0, new DefaultServiceConfiguration());
 
@@ -189,14 +188,14 @@ public class ReflectionServiceFactoryBea
         ignoredClasses.add("javax.rmi.CORBA.Stub");
     }
 
-    
-     
+
+
     protected DataBinding createDefaultDataBinding() {
-        
+
         DataBinding retVal = null;
-        
+
         if (getServiceClass() != null) {
-            org.apache.cxf.annotations.DataBinding db 
+            org.apache.cxf.annotations.DataBinding db
                 = getServiceClass().getAnnotation(org.apache.cxf.annotations.DataBinding.class);
             if (db != null) {
                 try {
@@ -206,7 +205,7 @@ public class ReflectionServiceFactoryBea
                     }
                     retVal = db.value().newInstance();
                 } catch (Exception e) {
-                    LOG.log(Level.WARNING, "Could not create databinding " 
+                    LOG.log(Level.WARNING, "Could not create databinding "
                             + db.value().getName(), e);
                 }
             }
@@ -218,7 +217,7 @@ public class ReflectionServiceFactoryBea
                 Object o = this.getProperties().get("jaxb.additionalContextClasses");
                 if (o instanceof Class) {
                     o = new Class[] {(Class)o};
-                } 
+                }
                 Class[] extraClass = (Class[])o;
                 db.setExtraClass(extraClass);
             }
@@ -287,11 +286,8 @@ public class ReflectionServiceFactoryBea
             // First pass, fill in any types for which we have a name but no
             // type.
             for (SchemaInfo schemaInfo : serviceInfo.getSchemas()) {
-                XmlSchemaObjectTable elementsTable = schemaInfo.getSchema().getElements();
-                Iterator elementsIterator = elementsTable.getNames();
-                while (elementsIterator.hasNext()) {
-                    QName elementName = (QName)elementsIterator.next();
-                    XmlSchemaElement element = schemaInfo.getSchema().getElementByName(elementName);
+                Map<QName, XmlSchemaElement> elementsTable = schemaInfo.getSchema().getElements();
+                for (XmlSchemaElement element : elementsTable.values()) {
                     if (element.getSchemaType() == null) {
                         QName typeName = element.getSchemaTypeName();
                         if (typeName != null) {
@@ -338,7 +334,7 @@ public class ReflectionServiceFactoryBea
             }
         }
     }
-    
+
     public void updateBindingOperation(BindingOperationInfo boi) {
         //nothing
     }
@@ -360,12 +356,12 @@ public class ReflectionServiceFactoryBea
         if (properties != null) {
             getService().putAll(properties);
         }
-        
+
     }
-    
+
     protected void buildServiceFromWSDL(String url) {
-        sendEvent(Event.CREATE_FROM_WSDL, url);        
-        
+        sendEvent(Event.CREATE_FROM_WSDL, url);
+
         if (LOG.isLoggable(Level.INFO)) {
             LOG.info("Creating Service " + getServiceQName() + " from WSDL: " + url);
         }
@@ -385,9 +381,9 @@ public class ReflectionServiceFactoryBea
         sendEvent(Event.WSDL_LOADED, factory.getDefinition());
         setService(factory.create());
         setServiceProperties();
-        
+
         sendEvent(Event.SERVICE_SET, getService());
-        
+
         EndpointInfo epInfo = getEndpointInfo();
         if (epInfo != null) {
             serviceConfigurations.add(new WSDLBasedServiceConfiguration(getEndpointInfo().getBinding()));
@@ -395,7 +391,7 @@ public class ReflectionServiceFactoryBea
 
         initializeWSDLOperations();
 
-        Set<Class<?>> cls = getExtraClass(); 
+        Set<Class<?>> cls = getExtraClass();
         for (ServiceInfo si : getService().getServiceInfos()) {
             if (cls != null && !cls.isEmpty()) {
                 si.setProperty(EXTRA_CLASS, cls);
@@ -413,7 +409,7 @@ public class ReflectionServiceFactoryBea
         if (Proxy.isProxyClass(this.getServiceClass())) {
             LOG.log(Level.WARNING, "USING_PROXY_FOR_SERVICE", getServiceClass());
         }
-        
+
         sendEvent(Event.CREATE_FROM_CLASS, getServiceClass());
 
         ServiceInfo serviceInfo = new ServiceInfo();
@@ -504,21 +500,21 @@ public class ReflectionServiceFactoryBea
         } else {
             buildServiceFromClass();
         }
-        
+
         if (isValidate()) {
             validateServiceModel();
         }
     }
 
     public void validateServiceModel() {
-        
+
         XmlSchemaValidationManager xsdValidator = getBus().getExtension(XmlSchemaValidationManager.class);
-        
+
         for (ServiceInfo si : getService().getServiceInfos()) {
             if (xsdValidator != null) {
                 validateSchemas(xsdValidator, si.getXmlSchemaCollection());
             }
-            
+
             for (OperationInfo opInfo : si.getInterface().getOperations()) {
                 for (MessagePartInfo mpi : opInfo.getInput().getMessageParts()) {
                     assert mpi.getXmlSchema() != null;
@@ -574,7 +570,7 @@ public class ReflectionServiceFactoryBea
         }
     }
 
-    private void validateSchemas(XmlSchemaValidationManager xsdValidator, 
+    private void validateSchemas(XmlSchemaValidationManager xsdValidator,
                                  SchemaCollection xmlSchemaCollection) {
         final boolean[] anyErrors = new boolean[1];
         final StringBuilder errorBuilder = new StringBuilder();
@@ -686,7 +682,7 @@ public class ReflectionServiceFactoryBea
             LOG.log(Level.WARNING, "NO_METHOD_FOR_OP", o.getName());
         }
     }
-    
+
     /**
      * set the holder generic type info into message part info
      *
@@ -754,14 +750,14 @@ public class ReflectionServiceFactoryBea
         if (o.hasOutput()
             && !initializeParameter(o, method, -1, paramType, genericType)) {
             return false;
-        }        
+        }
         if (origOp.hasOutput()) {
             sendEvent(Event.OPERATIONINFO_OUT_MESSAGE_SET, origOp, method, origOp.getOutput());
         }
 
         setFaultClassInfo(o, method);
         return true;
-    }   
+    }
     private boolean initializeParameter(OperationInfo o, Method method, int i,
                                      Class paramType, Type genericType) {
         boolean isIn = isInParam(method, i);
@@ -800,7 +796,7 @@ public class ReflectionServiceFactoryBea
                 return false;
             }
             initializeParameter(part, paramType, genericType);
-            
+
             part.setIndex(i);
         } else if (!isIn && isOut) {
             QName name = getOutPartName(o, method, i);
@@ -841,9 +837,9 @@ public class ReflectionServiceFactoryBea
         if (paraAnnos != null && part != null) {
             part.setProperty(PARAM_ANNOTATION, paraAnnos);
         }
-        
+
         return true;
-    }    
+    }
     private void setFaultClassInfo(OperationInfo o, Method selected) {
         Class[] types = selected.getExceptionTypes();
         for (int i = 0; i < types.length; i++) {
@@ -962,7 +958,7 @@ public class ReflectionServiceFactoryBea
         sendEvent(Event.INTERFACE_OPERATION_BOUND, op, m);
         return op;
     }
-    
+
     protected void bindOperation(OperationInfo op, Method m) {
         getMethodDispatcher().bind(op, m);
     }
@@ -1043,12 +1039,8 @@ public class ReflectionServiceFactoryBea
         XmlSchema schema = si.getSchema();
         si.setElement(null); //cached element is now invalid
 
-        XmlSchemaElement el = new XmlSchemaElement();
+        XmlSchemaElement el = new XmlSchemaElement(schema, true);
         XmlSchemaUtils.setElementQName(el, mpi.getElementQName());
-        if (!isExistSchemaElement(schema, mpi.getElementQName())) {
-            SchemaCollection.addGlobalElementToSchema(schema, el);
-        }
-
         el.setNillable(true);
 
         XmlSchemaType tp = (XmlSchemaType)mpi.getXmlSchema();
@@ -1151,16 +1143,10 @@ public class ReflectionServiceFactoryBea
             }
 
             schemaInfo.setElement(null); //cached element is now invalid
-            XmlSchemaElement el = new XmlSchemaElement();
+            XmlSchemaElement el = new XmlSchemaElement(schema, true);
             XmlSchemaUtils.setElementQName(el, qname);
             el.setNillable(true);
 
-            if (!isExistSchemaElement(schema, qname)) {
-                SchemaCollection.addGlobalElementToSchema(schema, el);
-            } else {
-                el = getExistingSchemaElement(schema, qname);
-            }
-
             if (mpi.isElement()) {
                 XmlSchemaElement oldEl = (XmlSchemaElement)mpi.getXmlSchema();
                 if (null != oldEl && !oldEl.getQName().equals(qname)) {
@@ -1201,10 +1187,10 @@ public class ReflectionServiceFactoryBea
     }
 
     private void addImport(XmlSchema schema, String ns) {
-        if (!ns.equals(schema.getTargetNamespace()) 
+        if (!ns.equals(schema.getTargetNamespace())
             && !ns.equals(WSDLConstants.NS_SCHEMA_XSD)
             && !isExistImport(schema, ns)) {
-            XmlSchemaImport is = new XmlSchemaImport();
+            XmlSchemaImport is = new XmlSchemaImport(schema);
             is.setNamespace(ns);
             if (this.schemaLocationMapping.get(ns) != null) {
                 is.setSchemaLocation(this.schemaLocationMapping.get(ns));
@@ -1216,10 +1202,9 @@ public class ReflectionServiceFactoryBea
     private boolean isExistImport(XmlSchema schema, String ns) {
         boolean isExist = false;
 
-        for (Iterator ite = schema.getItems().getIterator(); ite.hasNext();) {
-            XmlSchemaObject obj = (XmlSchemaObject)ite.next();
-            if (obj instanceof XmlSchemaImport) {
-                XmlSchemaImport xsImport = (XmlSchemaImport)obj;
+        for (XmlSchemaExternal ext : schema.getExternals()) {
+            if (ext instanceof XmlSchemaImport) {
+                XmlSchemaImport xsImport = (XmlSchemaImport)ext;
                 if (xsImport.getNamespace().equals(ns)) {
                     isExist = true;
                     break;
@@ -1231,16 +1216,7 @@ public class ReflectionServiceFactoryBea
     }
 
     private XmlSchemaElement getExistingSchemaElement(XmlSchema schema, QName qn) {
-        for (Iterator ite = schema.getItems().getIterator(); ite.hasNext();) {
-            XmlSchemaObject obj = (XmlSchemaObject)ite.next();
-            if (obj instanceof XmlSchemaElement) {
-                XmlSchemaElement xsEle = (XmlSchemaElement)obj;
-                if (xsEle.getQName().equals(qn)) {
-                    return xsEle;
-                }
-            }
-        }
-        return null;
+        return schema.getElements().get(qn);
     }
 
     private boolean isExistSchemaElement(XmlSchema schema, QName qn) {
@@ -1253,18 +1229,16 @@ public class ReflectionServiceFactoryBea
 
         XmlSchema schema = info.getSchema();
         info.setElement(null); // the cached schema will be no good
-        XmlSchemaElement el = new XmlSchemaElement();
+        XmlSchemaElement el = new XmlSchemaElement(schema, true);
         XmlSchemaUtils.setElementQName(el, wrapperName);
-        SchemaCollection.addGlobalElementToSchema(schema, el);
 
         wrappedMessage.getMessageParts().get(0).setXmlSchema(el);
 
-        XmlSchemaComplexType ct = new XmlSchemaComplexType(schema);
+        XmlSchemaComplexType ct = new XmlSchemaComplexType(schema, true);
 
         if (!isAnonymousWrapperTypes()) {
             ct.setName(wrapperName.getLocalPart());
             el.setSchemaTypeName(wrapperName);
-            SchemaCollection.addGlobalTypeToSchema(schema, ct);
         }
         el.setSchemaType(ct);
 
@@ -1272,7 +1246,7 @@ public class ReflectionServiceFactoryBea
         ct.setParticle(seq);
 
         for (MessagePartInfo mpi : unwrappedMessage.getMessageParts()) {
-            el = new XmlSchemaElement();
+            el = new XmlSchemaElement(schema, false);
             XmlSchemaUtils.setElementQName(el, mpi.getName());
             Map<Class, Boolean> jaxbAnnoMap = getJaxbAnnoMap(mpi);
             if (mpi.isElement()) {
@@ -1287,7 +1261,7 @@ public class ReflectionServiceFactoryBea
 
                 el.setSchemaType((XmlSchemaType)mpi.getXmlSchema());
 
-                if (schema.getElementFormDefault().getValue().equals(XmlSchemaForm.UNQUALIFIED)) {
+                if (schema.getElementFormDefault().equals(XmlSchemaForm.UNQUALIFIED)) {
                     mpi.setConcreteName(new QName(null, mpi.getName().getLocalPart()));
                 } else {
                     mpi.setConcreteName(mpi.getName());
@@ -1315,17 +1289,17 @@ public class ReflectionServiceFactoryBea
                 if (qualified == null) {
                     qualified = this.isQualifyWrapperSchema();
                 }
-                if (qualified 
+                if (qualified
                     && StringUtils.isEmpty(mpi.getConcreteName().getNamespaceURI())) {
                     QName newName = new QName(wrapperName.getNamespaceURI(),
                                               mpi.getConcreteName().getLocalPart());
                     mpi.setElement(true);
                     mpi.setElementQName(newName);
-                    mpi.setConcreteName(newName); 
+                    mpi.setConcreteName(newName);
                     XmlSchemaUtils.setElementQName(el, newName);
-                    el.setForm(new XmlSchemaForm(XmlSchemaForm.QUALIFIED));
+                    el.setForm(XmlSchemaForm.QUALIFIED);
                 }
-                
+
                 if (Collection.class.isAssignableFrom(mpi.getTypeClass())
                            && mpi.getTypeClass().isInterface()) {
                     Type type = (Type)mpi.getProperty(GENERIC_TYPE);
@@ -1387,7 +1361,7 @@ public class ReflectionServiceFactoryBea
     private Map<Class, Boolean> getJaxbAnnoMap(MessagePartInfo mpi) {
         Map<Class, Boolean> map = new ConcurrentHashMap<Class, Boolean>();
         Annotation[] anns = getMethodParameterAnnotations(mpi);
-       
+
         if (anns != null) {
             for (Annotation anno : anns) {
                 if (anno instanceof XmlList) {
@@ -1426,7 +1400,7 @@ public class ReflectionServiceFactoryBea
 
         schema = col.newXmlSchemaInCollection(namespaceURI);
         if (qualified) {
-            schema.setElementFormDefault(new XmlSchemaForm(XmlSchemaForm.QUALIFIED));
+            schema.setElementFormDefault(XmlSchemaForm.QUALIFIED);
         }
         schemaInfo.setSchema(schema);
 
@@ -1463,9 +1437,9 @@ public class ReflectionServiceFactoryBea
             if (isInParam(method, j)) {
                 final QName q = getInParameterName(op, method, j);
                 MessagePartInfo part = inMsg.addMessagePart(getInPartName(op, method, j));
-                
-                
-                
+
+
+
                 initializeParameter(part, paramClasses[j], method.getGenericParameterTypes()[j]);
                 //TODO:remove method param annotations
                 part.setProperty(METHOD_PARAM_ANNOTATIONS, method.getParameterAnnotations());
@@ -1489,7 +1463,7 @@ public class ReflectionServiceFactoryBea
             }
         }
         sendEvent(Event.OPERATIONINFO_IN_MESSAGE_SET, op, method, inMsg);
-        
+
         boolean hasOut = hasOutMessage(method);
         if (hasOut) {
             // Setup the output message
@@ -1564,7 +1538,7 @@ public class ReflectionServiceFactoryBea
             }
             sendEvent(Event.OPERATIONINFO_OUT_MESSAGE_SET, op, method, outMsg);
         }
-        
+
         //setting the parameterOrder that
         //allows preservation of method signatures
         //when doing java->wsdl->java
@@ -1575,7 +1549,7 @@ public class ReflectionServiceFactoryBea
             initializeFaults(intf, op, method);
         }
     }
-    
+
     private void setParameterOrder(Method method, Class[] paramClasses, OperationInfo op) {
         if (isRPC(method) || !isWrapped(method)) {
             List<String> paramOrdering = new LinkedList<String>();
@@ -1599,7 +1573,7 @@ public class ReflectionServiceFactoryBea
             }
         }
     }
-    
+
 
     protected void createInputWrappedMessageParts(OperationInfo op, Method method, MessageInfo inMsg) {
         String partName = null;
@@ -1640,9 +1614,9 @@ public class ReflectionServiceFactoryBea
                 int idx = mpart.getIndex();
                 inMsg.addMessagePart(mpart);
                 mpart.setIndex(idx);
-                
-                //make sure the header part and the wrapper part don't share the 
-                //same index.   We can move the wrapper part around a bit 
+
+                //make sure the header part and the wrapper part don't share the
+                //same index.   We can move the wrapper part around a bit
                 //if need be
                 if (maxIdx < idx) {
                     maxIdx = idx;
@@ -1672,7 +1646,7 @@ public class ReflectionServiceFactoryBea
                 break;
             }
         }
-        
+
         if (partName == null) {
             partName = "parameters";
         }
@@ -1719,14 +1693,14 @@ public class ReflectionServiceFactoryBea
             rawClass = createArrayClass((GenericArrayType)tp);
         } else if (tp instanceof ParameterizedType) {
             rawClass = (Class)((ParameterizedType)tp).getRawType();
-            if (List.class.isAssignableFrom(rawClass)) { 
+            if (List.class.isAssignableFrom(rawClass)) {
                 rawClass = getClass((ParameterizedType)tp);
                 rawClass = Array.newInstance(rawClass, 0).getClass();
             }
         }
         return Array.newInstance(rawClass, 0).getClass();
     }
-    
+
     private static Class getClass(Type paramType) {
         Class rawClass = null;
         if (paramType instanceof Class) {
@@ -1735,11 +1709,11 @@ public class ReflectionServiceFactoryBea
             rawClass = createArrayClass((GenericArrayType)paramType);
         } else if (paramType instanceof ParameterizedType) {
             rawClass = (Class)((ParameterizedType)paramType).getRawType();
-        } 
+        }
         return rawClass;
     }
-    
-    
+
+
     protected void initializeParameter(MessagePartInfo part, Class rawClass, Type type) {
         if (isHolder(rawClass, type)) {
             Type c = getHolderType(rawClass, type);
@@ -1770,14 +1744,14 @@ public class ReflectionServiceFactoryBea
             part.setProperty(RAW_CLASS, rawClass);
         }
         part.setTypeClass(rawClass);
-        
+
         if (part.getMessageInfo().getOperation().isUnwrapped()
             && Boolean.TRUE.equals(part.getProperty(HEADER))) {
-            //header from the unwrapped operation, make sure the type is set for the 
+            //header from the unwrapped operation, make sure the type is set for the
             //approriate header in the wrapped operation
             OperationInfo o = ((UnwrappedOperationInfo)part.getMessageInfo().getOperation())
                 .getWrappedOperation();
-            
+
             if (Boolean.TRUE.equals(part.getProperty(ReflectionServiceFactoryBean.MODE_OUT))
                 || Boolean.TRUE.equals(part.getProperty(ReflectionServiceFactoryBean.MODE_INOUT))) {
                 MessagePartInfo mpi = o.getOutput().getMessagePart(part.getName());
@@ -1799,7 +1773,7 @@ public class ReflectionServiceFactoryBea
                     }
                 }
             }
-        }      
+        }
     }
 
 
@@ -1849,7 +1823,7 @@ public class ReflectionServiceFactoryBea
         }
         throw new IllegalStateException("ServiceConfiguration must provide a value!");
     }
-    
+
     protected String getServiceNamespace() {
         if (serviceName != null) {
             return serviceName.getNamespaceURI();
@@ -1883,7 +1857,7 @@ public class ReflectionServiceFactoryBea
         }
         return true;
     }
-    
+
     public boolean isHolder(Class<?> cls, Type type) {
         for (AbstractServiceConfiguration c : serviceConfigurations) {
             Boolean b = c.isHolder(cls, type);
@@ -1893,7 +1867,7 @@ public class ReflectionServiceFactoryBea
         }
         return false;
     }
-    
+
     public Type getHolderType(Class<?> cls, Type type) {
         for (AbstractServiceConfiguration c : serviceConfigurations) {
             Type b = c.getHolderType(cls, type);
@@ -1903,7 +1877,7 @@ public class ReflectionServiceFactoryBea
         }
         return null;
     }
-    
+
     protected boolean isWrapped(final Method method) {
         Boolean b = wrappedCache.get(method);
         if (b == null) {
@@ -1911,7 +1885,7 @@ public class ReflectionServiceFactoryBea
                 wrappedCache.put(method, Boolean.FALSE);
                 return false;
             }
-            
+
             for (AbstractServiceConfiguration c : serviceConfigurations) {
                 b = c.isWrapped(method);
                 if (b != null) {
@@ -1919,11 +1893,11 @@ public class ReflectionServiceFactoryBea
                     return b.booleanValue();
                 }
             }
-            
+
             wrappedCache.put(method, Boolean.TRUE);
-            return true;            
+            return true;
         }
-        return b; 
+        return b;
     }
 
     protected boolean isMatchOperation(String methodNameInClass, String methodNameInWsdl) {
@@ -1995,7 +1969,7 @@ public class ReflectionServiceFactoryBea
         return true;
     }
 
-    protected void initializeFaults(final InterfaceInfo service, 
+    protected void initializeFaults(final InterfaceInfo service,
                                     final OperationInfo op, final Method method) {
         // Set up the fault messages
         final Class[] exceptionClasses = method.getExceptionTypes();
@@ -2044,7 +2018,7 @@ public class ReflectionServiceFactoryBea
                                    new QName(op.getName().getNamespaceURI(), faultMsgName));
         fi.setProperty(Class.class.getName(), exClass);
         fi.setProperty("elementName", faultName);
-        MessagePartInfo mpi = fi.addMessagePart(new QName(faultName.getNamespaceURI(), 
+        MessagePartInfo mpi = fi.addMessagePart(new QName(faultName.getNamespaceURI(),
                                                           exClass.getSimpleName()));
         mpi.setElementQName(faultName);
         mpi.setTypeClass(beanClass);
@@ -2122,7 +2096,7 @@ public class ReflectionServiceFactoryBea
      * to the end. I.e. if there is already two methods named
      * <code>doSomething</code>, the first one will have an operation name of
      * "doSomething" and the second "doSomething1".
-     * 
+     *
      * @param service
      * @param method
      */
@@ -2247,7 +2221,7 @@ public class ReflectionServiceFactoryBea
         }
         return null;
     }
-    
+
     public boolean isWrapperPartQualified(MessagePartInfo mpi) {
         for (AbstractServiceConfiguration c : serviceConfigurations) {
             Boolean b = c.isWrapperPartQualified(mpi);
@@ -2311,11 +2285,11 @@ public class ReflectionServiceFactoryBea
             for (int x = 0; x < serviceClass.getInterfaces().length; x++) {
                 processTypes(serviceClass.getInterfaces()[x], serviceClass.getGenericInterfaces()[x]);
             }
-            processTypes(serviceClass.getSuperclass(), serviceClass.getGenericSuperclass());            
+            processTypes(serviceClass.getSuperclass(), serviceClass.getGenericSuperclass());
         }
     }
     protected void processTypes(Class sc, Type tp) {
-        if (tp instanceof ParameterizedType) { 
+        if (tp instanceof ParameterizedType) {
             ParameterizedType ptp = (ParameterizedType)tp;
             Type c = (Class)ptp.getRawType();
             Map<String, Class<?>> m = new HashMap<String, Class<?>>();
@@ -2340,10 +2314,10 @@ public class ReflectionServiceFactoryBea
         Annotation anns[] = serviceClass.getAnnotations();
         if (anns != null) {
             for (Annotation ann : anns) {
-                String pkg = ann.annotationType().getPackage().getName(); 
+                String pkg = ann.annotationType().getPackage().getName();
                 if ("javax.xml.ws".equals(pkg)
                     || "javax.jws".equals(pkg)) {
-                    
+
                     LOG.log(Level.WARNING, "JAXWS_ANNOTATION_FOUND", serviceClass.getName());
                     return;
                 }
@@ -2353,10 +2327,10 @@ public class ReflectionServiceFactoryBea
             anns = m.getAnnotations();
             if (anns != null) {
                 for (Annotation ann : anns) {
-                    String pkg = ann.annotationType().getPackage().getName(); 
+                    String pkg = ann.annotationType().getPackage().getName();
                     if ("javax.xml.ws".equals(pkg)
                         || "javax.jws".equals(pkg)) {
-                        
+
                         LOG.log(Level.WARNING, "JAXWS_ANNOTATION_FOUND", serviceClass.getName());
                         return;
                     }
@@ -2487,7 +2461,7 @@ public class ReflectionServiceFactoryBea
                 }
             }
             b = "rpc".equals(getStyle());
-            isRpcCache.put(method, b);            
+            isRpcCache.put(method, b);
         }
         return b;
     }



Mime
View raw message