cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r733884 - in /cxf/branches/2.1.x-fixes: ./ tools/common/src/main/java/org/apache/cxf/tools/common/toolspec/parser/
Date Mon, 12 Jan 2009 20:02:47 GMT
Author: dkulp
Date: Mon Jan 12 12:02:43 2009
New Revision: 733884

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

........
  r732411 | seanoc | 2009-01-07 13:01:31 -0500 (Wed, 07 Jan 2009) | 1 line
  
  More NodeList refactoring
........

Modified:
    cxf/branches/2.1.x-fixes/   (props changed)
    cxf/branches/2.1.x-fixes/tools/common/src/main/java/org/apache/cxf/tools/common/toolspec/parser/Form.java
    cxf/branches/2.1.x-fixes/tools/common/src/main/java/org/apache/cxf/tools/common/toolspec/parser/Option.java
    cxf/branches/2.1.x-fixes/tools/common/src/main/java/org/apache/cxf/tools/common/toolspec/parser/OptionGroup.java

Propchange: cxf/branches/2.1.x-fixes/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Jan 12 12:02:43 2009
@@ -1 +1 @@
-/cxf/trunk:686333-686363,686764,686820,687096,687194,687363,687387,687463,687543,687722,687798,687814,687817,687891,687910,687914,688086,688102,688133,688596,688735,688870,689572,689596,689855,689924,690067,690289,691246,691271,691295,691338,691355,691488,691602,691646,691706,691728,692116,692157,692310,692466,692499,693653,693819,694179,694263,694417,694716,694744,694747,694795,694869,694981,694987,694993,695041,695096,695396,695484,695537,695552,695561,695619,695684,695835,695840,695868,695935,695977,696016,696094,696433,696720,697085,697868,698128,699289,700261,700507,700602,700981,701316,701783,701830,701862,702187,702205-702248,702267,702547,702561,702580,702602,702609,702616,702653,702656,702957,703191,703239,703309,703501,703513,703548,704584,704937,704997,705150,705235,705274,705340,705446,705548,705614,705692,705708,706482,706631,706675,706900,706909,707034,707089,707100,707902,708035,708044,708074,708410,708417,708550,708554,709353-709354,709425,710076,710150,71015
 4,711193,711388,711410,711490,711635,711949,711975,712194,712198,712238,712272,712299,712312,712670,712893,713082,713095-713096,713099,713584,713597,713737,713804,713899,714167-714168,714245,714255,717937-717961,718281-718448,718565,718620,718640,718665,718970,719017,719210,719215-719218,719222-719273,719305,719327-719680,720053,720119-720218,720238,720293-720316,720497,721221,721241,721501,722117,722129,722412,722988,723024,723338,723378,723716-723791,724333-724372,724433-724438,724449,724481,724485,724668,724780,724782,724785,724793,724795,724940,725071,725316,725332,725335,725348,725364,725418,725425-725426,725455,725506,725554,725562,725651,725671,725688,725754,725773,725799,725839,726342,726524,726631,726634,726637,726639,726692,726724,726769,726992,727096,727445,727521,727568,727692,727754,727781,727792,728070,728087,728696,728897,729430,729449,729460,729863,730082,730139,730889,730891,731598,731604,731615,731631,731635,732036,732050,732320,732363,733582
+/cxf/trunk:686333-686363,686764,686820,687096,687194,687363,687387,687463,687543,687722,687798,687814,687817,687891,687910,687914,688086,688102,688133,688596,688735,688870,689572,689596,689855,689924,690067,690289,691246,691271,691295,691338,691355,691488,691602,691646,691706,691728,692116,692157,692310,692466,692499,693653,693819,694179,694263,694417,694716,694744,694747,694795,694869,694981,694987,694993,695041,695096,695396,695484,695537,695552,695561,695619,695684,695835,695840,695868,695935,695977,696016,696094,696433,696720,697085,697868,698128,699289,700261,700507,700602,700981,701316,701783,701830,701862,702187,702205-702248,702267,702547,702561,702580,702602,702609,702616,702653,702656,702957,703191,703239,703309,703501,703513,703548,704584,704937,704997,705150,705235,705274,705340,705446,705548,705614,705692,705708,706482,706631,706675,706900,706909,707034,707089,707100,707902,708035,708044,708074,708410,708417,708550,708554,709353-709354,709425,710076,710150,71015
 4,711193,711388,711410,711490,711635,711949,711975,712194,712198,712238,712272,712299,712312,712670,712893,713082,713095-713096,713099,713584,713597,713737,713804,713899,714167-714168,714245,714255,717937-717961,718281-718448,718565,718620,718640,718665,718970,719017,719210,719215-719218,719222-719273,719305,719327-719680,720053,720119-720218,720238,720293-720316,720497,721221,721241,721501,722117,722129,722412,722988,723024,723338,723378,723716-723791,724333-724372,724433-724438,724449,724481,724485,724668,724780,724782,724785,724793,724795,724940,725071,725316,725332,725335,725348,725364,725418,725425-725426,725455,725506,725554,725562,725651,725671,725688,725754,725773,725799,725839,726342,726524,726631,726634,726637,726639,726692,726724,726769,726992,727096,727445,727521,727568,727692,727754,727781,727792,728070,728087,728696,728897,729430,729449,729460,729863,730082,730139,730889,730891,731598,731604,731615,731631,731635,732036,732050,732320,732363,732411,733582

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

Modified: cxf/branches/2.1.x-fixes/tools/common/src/main/java/org/apache/cxf/tools/common/toolspec/parser/Form.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/tools/common/src/main/java/org/apache/cxf/tools/common/toolspec/parser/Form.java?rev=733884&r1=733883&r2=733884&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/tools/common/src/main/java/org/apache/cxf/tools/common/toolspec/parser/Form.java
(original)
+++ cxf/branches/2.1.x-fixes/tools/common/src/main/java/org/apache/cxf/tools/common/toolspec/parser/Form.java
Mon Jan 12 12:02:43 2009
@@ -26,9 +26,9 @@
 
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
-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;
 
 
@@ -43,15 +43,24 @@
 
     public Form(Element el) {
         this.element = el;
-        NodeList list = element.getElementsByTagNameNS(Tool.TOOL_SPEC_PUBLIC_ID, "optionGroup");
-
-        for (int i = 0; i < list.getLength(); i++) {
-            optionGroups.add(new OptionGroup((Element)list.item(i)));
-        }
-        list = element.getElementsByTagNameNS(Tool.TOOL_SPEC_PUBLIC_ID, "argument");
-        for (int i = 0; i < list.getLength(); i++) {
-            arguments.add(new Argument((Element)list.item(i)));
+        
+        List<Element> elemList = 
+            DOMUtils.findAllElementsByTagNameNS(element, 
+                                                Tool.TOOL_SPEC_PUBLIC_ID, 
+                                                "optionGroup");
+        
+        for (Element elem : elemList) {
+            optionGroups.add(new OptionGroup(elem));
         }
+        
+        elemList = 
+            DOMUtils.findAllElementsByTagNameNS(element, 
+                                                Tool.TOOL_SPEC_PUBLIC_ID, 
+                                                "argument");
+        for (Element elem : elemList) {
+            arguments.add(new Argument(elem));
+        }     
+        
         getOptions(element);
     }
 

Modified: cxf/branches/2.1.x-fixes/tools/common/src/main/java/org/apache/cxf/tools/common/toolspec/parser/Option.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/tools/common/src/main/java/org/apache/cxf/tools/common/toolspec/parser/Option.java?rev=733884&r1=733883&r2=733884&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/tools/common/src/main/java/org/apache/cxf/tools/common/toolspec/parser/Option.java
(original)
+++ cxf/branches/2.1.x-fixes/tools/common/src/main/java/org/apache/cxf/tools/common/toolspec/parser/Option.java
Mon Jan 12 12:02:43 2009
@@ -19,14 +19,15 @@
 
 package org.apache.cxf.tools.common.toolspec.parser;
 
+import java.util.List;
 import java.util.StringTokenizer;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
 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;
 
 public class Option implements TokenConsumer {
@@ -42,22 +43,27 @@
 
     public Option(Element el) {
         this.element = el;
-
-        NodeList list = element.getElementsByTagNameNS(Tool.TOOL_SPEC_PUBLIC_ID, "associatedArgument");
-
-        if (list != null && list.getLength() > 0) {
-            argument = (Element)list.item(0);
-        }
-
-        list = element.getElementsByTagNameNS(Tool.TOOL_SPEC_PUBLIC_ID, "annotation");
-        if (list != null && list.getLength() > 0) {
-            annotation = (Element)list.item(0);
+        
+        
+        List<Element> elemList = DOMUtils.findAllElementsByTagNameNS(element, 
+                                                                     Tool.TOOL_SPEC_PUBLIC_ID,

+                                                                     "associatedArgument");
+        if (elemList != null && elemList.size() > 0) {            
+            argument = (Element)elemList.get(0);
+        }
+        
+        elemList = DOMUtils.findAllElementsByTagNameNS(element, 
+                                                       Tool.TOOL_SPEC_PUBLIC_ID, 
+                                                       "annotation");
+        if (elemList != null && elemList.size() > 0) {            
+            annotation = (Element)elemList.get(0);
         }
 
         if (annotation == null && argument != null) {
-            list = argument.getElementsByTagNameNS(Tool.TOOL_SPEC_PUBLIC_ID, "annotation");
-            if (list != null && list.getLength() > 0) {
-                annotation = (Element)list.item(0);
+            elemList =  DOMUtils.findAllElementsByTagNameNS(argument, Tool.TOOL_SPEC_PUBLIC_ID,
"annotation");
+
+            if (elemList != null && elemList.size() > 0) {
+                annotation = (Element)elemList.get(0);
             }
         }
     }
@@ -85,13 +91,14 @@
         }
 
         // go through each switch to see if we can match one to the arg.
-        NodeList switches = element.getElementsByTagNameNS(Tool.TOOL_SPEC_PUBLIC_ID, "switch");
+        List<Element> switches = 
+            DOMUtils.findAllElementsByTagNameNS(element, Tool.TOOL_SPEC_PUBLIC_ID, "switch");
 
         boolean accepted = false;
 
-        for (int i = 0; i < switches.getLength(); i++) {
+        for (Element switchElem : switches) {
 
-            String switchArg = "-" + switches.item(i).getFirstChild().getNodeValue();
+            String switchArg = "-" + switchElem.getFirstChild().getNodeValue();
             if (LOG.isLoggable(Level.FINE)) {
                 LOG.fine("switchArg is " + switchArg);
             }
@@ -152,11 +159,14 @@
     }
 
     private boolean hasInvalidCharacter(String argValue) {
-        NodeList list = argument.getElementsByTagNameNS(Tool.TOOL_SPEC_PUBLIC_ID, "valuetype");
+        
+        List<Element> list = 
+            DOMUtils.findAllElementsByTagNameNS(argument, Tool.TOOL_SPEC_PUBLIC_ID, "valuetype");
+        //NodeList list = argument.getElementsByTagNameNS(Tool.TOOL_SPEC_PUBLIC_ID, "valuetype");
         String valuetypeStr = null;
 
-        if (list != null && list.getLength() > 0) {
-            valueType = (Element)list.item(0);
+        if (list != null && list.size() > 0) {
+            valueType = (Element)list.get(0);
             valuetypeStr = valueType.getFirstChild().getNodeValue();
 
             if ("IdentifyString".equals(valuetypeStr)) {
@@ -176,10 +186,14 @@
     
     private boolean isInEnumArgumentValue(String argValue) {
         boolean result = true;
-        NodeList list = argument.getElementsByTagNameNS(Tool.TOOL_SPEC_PUBLIC_ID, "valueenum");
-        if (list != null && list.getLength() == 1) {
+        List<Element> list = 
+            DOMUtils.findAllElementsByTagNameNS(argument, Tool.TOOL_SPEC_PUBLIC_ID, "valueenum");
+        
+        
+        //NodeList list = argument.getElementsByTagNameNS(Tool.TOOL_SPEC_PUBLIC_ID, "valueenum");
+        if (list != null && list.size() == 1) {
             result = false;
-            String enumValue = list.item(0).getTextContent();
+            String enumValue = list.get(0).getTextContent();
             StringTokenizer stk = new StringTokenizer(enumValue, VALUE_ENUM_SEPARATOR);
             if (stk.countTokens() <= 0) {
                 return result;
@@ -274,11 +288,14 @@
     }
 
     public String getPrimarySwitch() {
-        NodeList switches = element.getElementsByTagNameNS(Tool.TOOL_SPEC_PUBLIC_ID, "switch");
+        //NodeList switches = element.getElementsByTagNameNS(Tool.TOOL_SPEC_PUBLIC_ID, "switch");
+        
+        List<Element> switches = 
+            DOMUtils.findAllElementsByTagNameNS(element, Tool.TOOL_SPEC_PUBLIC_ID, "switch");
 
         // options must have atleast one switch, as enforced by schema, so no
         // need for defensive coding.
-        return switches.item(0).getFirstChild().getNodeValue();
+        return switches.get(0).getFirstChild().getNodeValue();
     }
 
     public String toString() {

Modified: cxf/branches/2.1.x-fixes/tools/common/src/main/java/org/apache/cxf/tools/common/toolspec/parser/OptionGroup.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/tools/common/src/main/java/org/apache/cxf/tools/common/toolspec/parser/OptionGroup.java?rev=733884&r1=733883&r2=733884&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/tools/common/src/main/java/org/apache/cxf/tools/common/toolspec/parser/OptionGroup.java
(original)
+++ cxf/branches/2.1.x-fixes/tools/common/src/main/java/org/apache/cxf/tools/common/toolspec/parser/OptionGroup.java
Mon Jan 12 12:02:43 2009
@@ -26,9 +26,9 @@
 import java.util.logging.Logger;
 
 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;
 
 public class OptionGroup implements TokenConsumer {
@@ -40,10 +40,13 @@
 
     public OptionGroup(Element el) {
         this.element = el;
-        NodeList optionEls = element.getElementsByTagNameNS(Tool.TOOL_SPEC_PUBLIC_ID, "option");
-
-        for (int i = 0; i < optionEls.getLength(); i++) {
-            options.add(new Option((Element)optionEls.item(i)));
+        
+        List<Element> optionEls = 
+            DOMUtils.findAllElementsByTagNameNS(element, 
+                                                Tool.TOOL_SPEC_PUBLIC_ID, 
+                                                "option");        
+        for (Element elem : optionEls) {
+            options.add(new Option(elem));
         }
     }
 



Mime
View raw message