cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sea...@apache.org
Subject svn commit: r732363 - in /cxf/trunk: rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/ tools/common/src/main/java/org/apache/cxf/tools/common/toolspec/ tools/common/src/main/java/org/apache/cxf/tools/common/toolspec/parser/
Date Wed, 07 Jan 2009 15:30:18 GMT
Author: seanoc
Date: Wed Jan  7 07:30:18 2009
New Revision: 732363

URL: http://svn.apache.org/viewvc?rev=732363&view=rev
Log:
More Nodelist changes and fix chcekstyle failures in Aegis ArrayType

Modified:
    cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/ArrayType.java
    cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/toolspec/ToolSpec.java
    cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/toolspec/parser/CommandLineParser.java

Modified: cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/ArrayType.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/ArrayType.java?rev=732363&r1=732362&r2=732363&view=diff
==============================================================================
--- cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/ArrayType.java
(original)
+++ cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/ArrayType.java
Wed Jan  7 07:30:18 2009
@@ -30,13 +30,11 @@
 import org.apache.commons.logging.LogFactory;
 import org.apache.cxf.aegis.Context;
 import org.apache.cxf.aegis.DatabindingException;
-import org.apache.cxf.aegis.type.AbstractTypeCreator;
 import org.apache.cxf.aegis.type.Type;
 import org.apache.cxf.aegis.type.TypeUtil;
 import org.apache.cxf.aegis.xml.MessageReader;
 import org.apache.cxf.aegis.xml.MessageWriter;
 import org.apache.cxf.common.xmlschema.XmlSchemaConstants;
-import org.apache.cxf.common.xmlschema.XmlSchemaUtils;
 import org.apache.ws.commons.schema.XmlSchema;
 import org.apache.ws.commons.schema.XmlSchemaComplexType;
 import org.apache.ws.commons.schema.XmlSchemaElement;

Modified: cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/toolspec/ToolSpec.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/toolspec/ToolSpec.java?rev=732363&r1=732362&r2=732363&view=diff
==============================================================================
--- cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/toolspec/ToolSpec.java
(original)
+++ cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/toolspec/ToolSpec.java
Wed Jan  7 07:30:18 2009
@@ -226,8 +226,8 @@
         }
     }
 
-    public NodeList getUsageForms() {
-        return getUsage().getElementsByTagNameNS(Tool.TOOL_SPEC_PUBLIC_ID, "form");
+    public List<Element> getUsageForms() {  
+        return DOMUtils.findAllElementsByTagNameNS(getUsage(), Tool.TOOL_SPEC_PUBLIC_ID,
"form");   
     }
 
     /**

Modified: cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/toolspec/parser/CommandLineParser.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/toolspec/parser/CommandLineParser.java?rev=732363&r1=732362&r2=732363&view=diff
==============================================================================
--- cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/toolspec/parser/CommandLineParser.java
(original)
+++ cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/toolspec/parser/CommandLineParser.java
Wed Jan  7 07:30:18 2009
@@ -38,9 +38,9 @@
 import org.w3c.dom.Attr;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
-import org.w3c.dom.NodeList;
 
 import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.helpers.DOMUtils;
 import org.apache.cxf.tools.common.toolspec.Tool;
 import org.apache.cxf.tools.common.toolspec.ToolSpec;
 
@@ -114,14 +114,37 @@
         // for all form elements...
         Element usage = toolspec.getUsage();
 
-        NodeList usageForms = toolspec.getUsageForms();
+        List<Element> usageForms = toolspec.getUsageForms();
         if (LOG.isLoggable(Level.FINE)) {
-            LOG.fine("Found " + usageForms.getLength()
+            LOG.fine("Found " + usageForms.size()
                       + " alternative forms of usage, will use default form");
         }
-        if (usageForms.getLength() > 0) {
+        if (usageForms.size() > 0) {
             ErrorVisitor errors = new ErrorVisitor();
+            
+            for (Element elem : usageForms) {
+                Form form = new Form(elem);
+
+                int pos = tokens.getPosition();
 
+                if (form.accept(tokens, commandEl, errors)) {
+                    commandEl.setAttribute("form", form.getName());
+                    break;
+                } else {
+                    // if no more left then return null;
+                    tokens.setPosition(pos);
+                    
+                    if (elem.getNextSibling() == null) {
+                        if (LOG.isLoggable(Level.INFO)) {
+                            LOG.info("No more forms left to try, returning null");
+                        }
+                        throwUsage(errors);
+                    }
+                }
+            
+                
+            }
+/*
             for (int i = 0; i < usageForms.getLength(); i++) {
                 Form form = new Form((Element)usageForms.item(i));
 
@@ -141,6 +164,7 @@
                     }
                 }
             }
+*/
         } else {
             ErrorVisitor errors = new ErrorVisitor();
             Form form = new Form(usage);
@@ -291,9 +315,14 @@
     public String getDetailedUsage(String id) {
         String result = null;
         Element element = toolspec.getElementById(id);
-        NodeList annotations = element.getElementsByTagNameNS(Tool.TOOL_SPEC_PUBLIC_ID, "annotation");
-        if ((annotations != null) && (annotations.getLength() > 0)) {
-            result = annotations.item(0).getFirstChild().getNodeValue();
+        
+        List<Element> annotations = DOMUtils.findAllElementsByTagNameNS(element,
+                                                                     Tool.TOOL_SPEC_PUBLIC_ID,

+                                                                     "annotation");
+        
+        
+        if ((annotations != null) && (annotations.size() > 0)) {
+            result = annotations.get(0).getFirstChild().getNodeValue();
         }
         return result;
     }



Mime
View raw message