You are viewing a plain text version of this content. The canonical link for it is here.
Posted to wsrf-commits@ws.apache.org by sc...@apache.org on 2005/08/02 18:30:44 UTC

svn commit: r227033 [19/27] - in /webservices/wsrf/trunk: ./ src/java/org/apache/ws/ src/java/org/apache/ws/addressing/ src/java/org/apache/ws/addressing/v2003_03/ src/java/org/apache/ws/addressing/v2004_08_10/ src/java/org/apache/ws/resource/ src/java...

Modified: webservices/wsrf/trunk/src/java/org/apache/ws/util/XmlBeanUtils.java
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/java/org/apache/ws/util/XmlBeanUtils.java?rev=227033&r1=227032&r2=227033&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/java/org/apache/ws/util/XmlBeanUtils.java (original)
+++ webservices/wsrf/trunk/src/java/org/apache/ws/util/XmlBeanUtils.java Tue Aug  2 09:28:49 2005
@@ -28,7 +28,6 @@
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
-
 import javax.xml.namespace.QName;
 import javax.xml.soap.SOAPElement;
 import java.io.File;
@@ -48,604 +47,622 @@
  */
 public abstract class XmlBeanUtils
 {
-    
-    private static final Messages MSG = MessagesImpl.getInstance();
+   private static final Messages MSG = MessagesImpl.getInstance(  );
 
-    /**
-     * Returns an array containing all child elements, with the specified name, of the specified XMLBean.
-     *
-     * @param xBean an XMLBean that represents an XML element
-     * @param name the name to look for, or null to return all child elements
-     *
-     * @return an array containing all child elements, with the specified name, of the specified XMLBean
-     */
-    public static XmlObject[] getChildElements( XmlObject xBean,
-                                                QName name )
-    {
-        List foundElems = new ArrayList();
-        xBean = getRootElement( xBean );
-        XmlCursor xCursor = xBean.newCursor();
-        for ( boolean hasNext = xCursor.toFirstChild(); hasNext; hasNext = xCursor.toNextSibling() )
-        {
-            if ( ( name == null ) || getName( xCursor ).equals( name ) )
-            {
-                foundElems.add( xCursor.getObject() );
-            }
-        }
-        xCursor.dispose();
-        return (XmlObject[]) foundElems.toArray( new XmlObject[0] );
-    }
-
-    /**
-     * Returns an array containing all child elements of the specified XMLBean.
-     *
-     * @param xBean an XMLBean that represents an XML element
-     *
-     * @return an array containing all child elements of the specified XMLBean
-     */
-    public static XmlObject[] getChildElements( XmlObject xBean )
-    {
-        return getChildElements( xBean, null );
-    }
-
-    /**
-     * Returns true if the specified XMLBean represents an XML document, or false if it does not.
-     *
-     * @param xBean an XMLBean
-     *
-     * @return true if the specified XMLBean represents an XML document, or false if it does not
-     */
-    public static boolean isDocument( XmlObject xBean )
-    {
-        return xBean.schemaType().isDocumentType();
-    }
-
-    /**
-     * Returns the document XmlBean that is associated with the specified XmlBean.
-     *
-     * @param xBean an XmlBean
-     *
-     * @return the document XmlBean that is associated with the specified XmlBean
-     */
-    public static XmlObject getDocument( XmlObject xBean )
-    {
-        XmlCursor xCursor = xBean.newCursor();
-        xCursor.toStartDoc();
-        XmlObject docXBean = xCursor.getObject();
-        xCursor.dispose();
-        return docXBean;
-    }
-
-    /**
-     * @param xBean
-     *
-     * @return
-     */
-    public static QName getName( XmlObject xBean )
-    {
-        if ( xBean == null )
-        {
-            throw new IllegalArgumentException( MSG.getMessage( Keys.NULL_PARAM_NOT_ALLOWED ) );
-        }
-        SchemaType docSchemaType;
-        if ( isDocument( xBean ) )
-        {
-            docSchemaType = xBean.schemaType();
-        }
-        else
-        {
-            docSchemaType = xBean.schemaType().getOuterType();
-        }
-
-        QName name;
-        if ( docSchemaType != null )
-        {
-            name = docSchemaType.getDocumentElementName();
-        }
-        else
-        {
-            XmlCursor xCursor = xBean.newCursor();
-            name = getName( xCursor );
-            xCursor.dispose();
-        }
-        return name;
-    }
-
-    /**
-     * Note. this method does not dispose of the cursor
-     *
-     * @param xCursor
-     *
-     * @return
-     */
-    public static QName getName( XmlCursor xCursor )
-    {
-        QName name;
-        if ( xCursor.currentTokenType().equals( XmlCursor.TokenType.STARTDOC ) )
-        {
-            xCursor.toFirstChild();
-            name = xCursor.getName();
-            xCursor.toParent();
-        }
-        else
-        {
-            name = xCursor.getName();
-        }
-        return name;
-    }
-
-    /**
-     * Returns the root element of the specified document XMLBean. If the specified XMLBean is not a document, the
-     * XMLBean itself is returned.
-     *
-     * @param docXBean a document XMLBean
-     *
-     * @return the root element of the specified document XMLBean, or, if the specified XMLBean is not a document, the
-     *         XMLBean itself
-     */
-    public static XmlObject getRootElement( XmlObject docXBean )
-    {
-        XmlObject rootElemXBean;
-        if ( isDocument( docXBean ) )
-        {
-            XmlCursor xCursor = docXBean.newCursor();
-            if ( xCursor.toFirstChild() )
-            {
-                rootElemXBean = xCursor.getObject();
-            }
-            else
+   /**
+    *
+    * @param xBean
+    * @param attribName
+    * @return
+    */
+   public static String getAttributeValue( XmlObject xBean,
+                                           QName     attribName )
+   {
+      XmlCursor xCursor = xBean.newCursor(  );
+      String    value = xCursor.getAttributeText( attribName );
+      xCursor.dispose(  );
+      return value;
+   }
+
+   /**
+    * @param xBean
+    *
+    * @return
+    */
+   public static QName getAttributeValueAsQName( XmlObject xBean,
+                                                 QName     attribName )
+   {
+      String value = getAttributeValue( xBean, attribName );
+      return toQName( value, xBean );
+   }
+
+   /**
+    * Returns an array containing all child elements, with the specified name, of the specified XMLBean.
+    *
+    * @param xBean an XMLBean that represents an XML element
+    * @param name the name to look for, or null to return all child elements
+    *
+    * @return an array containing all child elements, with the specified name, of the specified XMLBean
+    */
+   public static XmlObject[] getChildElements( XmlObject xBean,
+                                               QName     name )
+   {
+      List foundElems = new ArrayList(  );
+      xBean = getRootElement( xBean );
+      XmlCursor xCursor = xBean.newCursor(  );
+      for ( boolean hasNext = xCursor.toFirstChild(  ); hasNext; hasNext = xCursor.toNextSibling(  ) )
+      {
+         if ( ( name == null ) || getName( xCursor ).equals( name ) )
+         {
+            foundElems.add( xCursor.getObject(  ) );
+         }
+      }
+
+      xCursor.dispose(  );
+      return (XmlObject[]) foundElems.toArray( new XmlObject[0] );
+   }
+
+   /**
+    * Returns an array containing all child elements of the specified XMLBean.
+    *
+    * @param xBean an XMLBean that represents an XML element
+    *
+    * @return an array containing all child elements of the specified XMLBean
+    */
+   public static XmlObject[] getChildElements( XmlObject xBean )
+   {
+      return getChildElements( xBean, null );
+   }
+
+   /**
+    * Returns the document XmlBean that is associated with the specified XmlBean.
+    *
+    * @param xBean an XmlBean
+    *
+    * @return the document XmlBean that is associated with the specified XmlBean
+    */
+   public static XmlObject getDocument( XmlObject xBean )
+   {
+      XmlCursor xCursor = xBean.newCursor(  );
+      xCursor.toStartDoc(  );
+      XmlObject docXBean = xCursor.getObject(  );
+      xCursor.dispose(  );
+      return docXBean;
+   }
+
+   /**
+    * Returns true if the specified XMLBean represents an XML document, or false if it does not.
+    *
+    * @param xBean an XMLBean
+    *
+    * @return true if the specified XMLBean represents an XML document, or false if it does not
+    */
+   public static boolean isDocument( XmlObject xBean )
+   {
+      return xBean.schemaType(  ).isDocumentType(  );
+   }
+
+   /**
+    * @param xBean
+    *
+    * @return
+    */
+   public static QName getName( XmlObject xBean )
+   {
+      if ( xBean == null )
+      {
+         throw new IllegalArgumentException( MSG.getMessage( Keys.NULL_PARAM_NOT_ALLOWED ) );
+      }
+
+      SchemaType docSchemaType;
+      if ( isDocument( xBean ) )
+      {
+         docSchemaType = xBean.schemaType(  );
+      }
+      else
+      {
+         docSchemaType = xBean.schemaType(  ).getOuterType(  );
+      }
+
+      QName name;
+      if ( docSchemaType != null )
+      {
+         name = docSchemaType.getDocumentElementName(  );
+      }
+      else
+      {
+         XmlCursor xCursor = xBean.newCursor(  );
+         name = getName( xCursor );
+         xCursor.dispose(  );
+      }
+
+      return name;
+   }
+
+   /**
+    * Note. this method does not dispose of the cursor
+    *
+    * @param xCursor
+    *
+    * @return
+    */
+   public static QName getName( XmlCursor xCursor )
+   {
+      QName name;
+      if ( xCursor.currentTokenType(  ).equals( XmlCursor.TokenType.STARTDOC ) )
+      {
+         xCursor.toFirstChild(  );
+         name = xCursor.getName(  );
+         xCursor.toParent(  );
+      }
+      else
+      {
+         name = xCursor.getName(  );
+      }
+
+      return name;
+   }
+
+   /**
+    * Returns the root element of the specified document XMLBean. If the specified XMLBean is not a document, the
+    * XMLBean itself is returned.
+    *
+    * @param docXBean a document XMLBean
+    *
+    * @return the root element of the specified document XMLBean, or, if the specified XMLBean is not a document, the
+    *         XMLBean itself
+    */
+   public static XmlObject getRootElement( XmlObject docXBean )
+   {
+      XmlObject rootElemXBean;
+      if ( isDocument( docXBean ) )
+      {
+         XmlCursor xCursor = docXBean.newCursor(  );
+         if ( xCursor.toFirstChild(  ) )
+         {
+            rootElemXBean = xCursor.getObject(  );
+         }
+         else
+         {
+            rootElemXBean = null;
+         }
+
+         xCursor.dispose(  );
+      }
+      else
+      {
+         rootElemXBean = docXBean;
+      }
+
+      return rootElemXBean;
+   }
+
+   /**
+    * @param xBean
+    * @param value
+    */
+   public static void setValue( XmlObject xBean,
+                                String    value )
+   {
+      XmlCursor xCursor = xBean.newCursor(  );
+      if ( xCursor.isStartdoc(  ) )
+      {
+         xCursor.toFirstChild(  );
+      }
+
+      xCursor.setTextValue( value );
+      xCursor.dispose(  );
+   }
+
+   /**
+    * @param xBean
+    *
+    * @return
+    */
+   public static String getValue( XmlObject xBean )
+   {
+      XmlCursor xCursor = xBean.newCursor(  );
+      String    value = xCursor.getTextValue(  );
+      xCursor.dispose(  );
+      return value;
+   }
+
+   /**
+    * @param xBean
+    * @param qName
+    *
+    */
+   public static void setValueAsQName( XmlObject xBean,
+                                       QName     qName )
+   {
+      XmlCursor xCursor = xBean.newCursor(  );
+      String    prefix = xCursor.prefixForNamespace( qName.getNamespaceURI(  ) );
+      String    value  = prefix + ":" + qName.getLocalPart(  );
+      xCursor.setTextValue( value );
+      xCursor.dispose(  );
+   }
+
+   /**
+    * @param xBean
+    *
+    * @return
+    */
+   public static QName getValueAsQName( XmlObject xBean )
+   {
+      String value = getValue( xBean );
+      return toQName( value, xBean );
+   }
+
+   /**
+    * Returns a Map keyed on Element QName to a List containing the "Any" XmlObjects types.
+    * <p/>
+    * The way we determine that an element is an Any is by asking for the element property of the schemaType for the
+    * element by the element's QName.
+    *
+    * @param xmlObjectToSearch The XmlObject to find the Any elements in.
+    *
+    * @return Map keyed on Element QName to a List containing the "Any" XmlObjects
+    */
+   public static Map getXmlBeanAnyMap( XmlObject xmlObjectToSearch )
+   {
+      Map       qnameToListMap = new HashMap(  );
+      XmlCursor xCursor = xmlObjectToSearch.newCursor(  );
+      for ( boolean hasNext = xCursor.toFirstChild(  ); hasNext; hasNext = xCursor.toNextSibling(  ) )
+      {
+         XmlObject siblingXmlObject      = xCursor.getObject(  );
+         QName     siblingXmlObjectQname = getName( siblingXmlObject );
+
+         // TODO (low priority): should this be tested against the original bean?
+         //if it contains the ElementProperty, then it is not an Any
+         if ( siblingXmlObject.schemaType(  ).getElementProperty( siblingXmlObjectQname ) != null )
+         {
+            continue;
+         }
+
+         //check to see if we have a xmlObjectList to add to for this QName
+         List xmlObjectList = (List) qnameToListMap.get( siblingXmlObjectQname );
+
+         if ( xmlObjectList == null )
+         {
+            xmlObjectList = new ArrayList(  );
+         }
+
+         xmlObjectList.add( siblingXmlObject );
+         qnameToListMap.put( siblingXmlObjectQname, xmlObjectList );
+      }
+
+      xCursor.dispose(  );
+
+      return qnameToListMap;
+   }
+
+   /**
+    * Adds a copy of the XmlBean <code>newChild</code> as the last child
+    * of the XmlBean <code>parent</code>.
+    *
+    * @param parent the XmlBean to be added to; must represent an element or a document
+    * @param newChild the XmlBean to be added; must represent an element or a document
+    */
+   public static XmlObject addChildElement( XmlObject parent,
+                                            XmlObject newChild )
+   {
+      parent = getRootElement( parent );
+      Node parentNode   = parent.getDomNode(  );
+      Node newChildNode = newChild.newDomNode(  ); // no need to use newDomNode() because importNode() will make a copy
+      if ( newChildNode.getNodeType(  ) == Node.DOCUMENT_NODE )
+      {
+         newChildNode = ( (Document) newChildNode ).getDocumentElement(  );
+      }
+
+      newChildNode = parentNode.getOwnerDocument(  ).importNode( newChildNode, true ); //
+      parentNode.appendChild( newChildNode );
+
+      // get a ref to the XmlObject corresponding to the child we've just added...
+      XmlCursor cursor = parent.newCursor(  );
+      cursor.toLastChild(  );
+      newChild = cursor.getObject(  );
+      cursor.dispose(  );
+      return newChild;
+   }
+
+   /**
+    * Creates a new XmlBean named <code>name</code> and adds it as the
+    * last child of the XmlBean <code>parent</code>.
+    *
+    * @param parent the XmlBean to be added to; must represent an element or a document
+    * @param name the name of the new XmlBean to be added
+    */
+   public static XmlObject addChildElement( XmlObject parent,
+                                            QName     name )
+   {
+      parent = getRootElement( parent );
+      XmlCursor parentCursor = parent.newCursor(  );
+      if ( parentCursor.toLastChild(  ) ) // has children
+      {
+         parentCursor.toEndToken(  );
+         parentCursor.toNextToken(  );
+      }
+      else // childless
+      {
+         parentCursor.toEndToken(  );
+      }
+
+      parentCursor.insertElement( name );
+      parentCursor.toPrevSibling(  );
+      XmlObject newChild = parentCursor.getObject(  );
+      parentCursor.dispose(  );
+      return newChild;
+   }
+
+   /**
+    * Makes and returns a copy of the specified XMLBean.
+    *
+    * @param srcXBean the XMLBean to be copied
+    *
+    * @return a copy of the specified XMLBean
+    */
+   public static XmlObject copyXmlBean( XmlObject srcXBean )
+   {
+      try
+      {
+         return XmlObject.Factory.parse( srcXBean.xmlText( new XmlOptions(  ).setSaveOuter(  ) ) );
+      }
+      catch ( XmlException xe )
+      {
+         throw new RuntimeException( xe );
+      }
+
+      /*XmlCursor srcCursor = srcXBean.newCursor(  );
+      
+                // create an object of the appropriate type to copy to
+                XmlObject destXBean = XmlObject.Factory.newInstance( new XmlOptions( ).setDocumentType( srcXBean.schemaType() ) );
+                XmlCursor destCursor = destXBean.newCursor(  );
+      
+                // move into the document
+                destCursor.toNextToken(  );
+      
+                // copy the xml into the new document
+                srcCursor.copyXml( destCursor );
+      
+                // clean up our cursors
+                destCursor.dispose(  );
+                srcCursor.dispose(  );
+      
+                return destXBean;*/
+   }
+
+   /**
+    * Makes and returns a copy of the specified XMLBean array.
+    *
+    * @param srcXBeans the array of XMLBeans to be copied
+    *
+    * @return a copy of the specified XMLBean array
+    */
+   public static XmlObject[] copyXmlBeans( XmlObject[] srcXBeans )
+   {
+      if ( srcXBeans == null )
+      {
+         return null;
+      }
+
+      XmlObject[] destXBeans = new XmlObject[srcXBeans.length];
+
+      for ( int i = 0; i < srcXBeans.length; i++ )
+      {
+         destXBeans[i] = copyXmlBean( srcXBeans[i] );
+      }
+
+      return destXBeans;
+   }
+
+   /**
+    * Removes the specifed XMLBean from its parent element.
+    *
+    * @param xBean an XMLBean
+    */
+   public static void remove( XmlObject xBean )
+   {
+      XmlCursor xCursor = xBean.newCursor(  );
+      xCursor.removeXml(  );
+
+      xCursor.dispose(  );
+   }
+
+   /**
+    * Removes all child elements, with the specified name, from the specified XMLBean.
+    *
+    * @param xBean an XMLBean
+    *
+    * @return true if all child elements, with the specified name, were successfully removed
+    */
+   public static boolean removeChildElements( XmlObject xBean,
+                                              QName     name )
+   {
+      boolean succeeded = true;
+      xBean = getRootElement( xBean );
+      XmlCursor xCursor = xBean.newCursor(  );
+      for ( boolean hasNext = xCursor.toFirstChild(  ); hasNext; hasNext = xCursor.toNextSibling(  ) )
+      {
+         if ( ( name == null ) || getName( xCursor ).equals( name ) )
+         {
+            succeeded = succeeded && xCursor.removeXml(  );
+         }
+      }
+
+      xCursor.dispose(  );
+      return succeeded;
+   }
+
+   /**
+    * Removes all child elements of the specified XMLBean.
+    *
+    * @param xBean an XMLBean
+    *
+    * @return true if all child elements were successfully removed
+    */
+   public static boolean removeChildElements( XmlObject xBean )
+   {
+      return removeChildElements( xBean, null );
+   }
+
+   /**
+    * @param xBean
+    *
+    * @return
+    *
+    * @throws Exception
+    */
+   public static SOAPElement toSOAPElement( XmlObject xBean )
+   throws Exception
+   {
+      XmlOptions xSaveOpts =
+         new XmlOptions(  ).setSaveOuter(  ).setSavePrettyPrint(  ).setSavePrettyPrintIndent( 2 );
+      Node       domNode = xBean.newDomNode( xSaveOpts );
+      Element    domElem = null;
+      if ( domNode instanceof Document )
+      {
+         domElem = ( (Document) domNode ).getDocumentElement(  );
+      }
+      else if ( domNode instanceof DocumentFragment )
+      {
+         NodeList childNodes = domNode.getChildNodes(  );
+         for ( int i = 0; i < childNodes.getLength(  ); i++ )
+         {
+            if ( childNodes.item( i ).getNodeType(  ) == Node.ELEMENT_NODE )
             {
-                rootElemXBean = null;
+               domElem = (Element) childNodes.item( i );
+               break;
             }
-            xCursor.dispose();
-        }
-        else
-        {
-            rootElemXBean = docXBean;
-        }
-        return rootElemXBean;
-    }
-
-    /**
-     * @param xBean
-     *
-     * @return
-     */
-    public static String getValue( XmlObject xBean )
-    {
-        XmlCursor xCursor = xBean.newCursor();
-        String value = xCursor.getTextValue();
-        xCursor.dispose();
-        return value;
-    }
-
-    /**
-     * @param xBean
-     *
-     * @return
-     */
-    public static QName getValueAsQName( XmlObject xBean )
-    {
-        String value = getValue( xBean );
-        return toQName( value, xBean );
-    }
-
-    /**
-     * @param xBean
-     * @param value
-     */
-    public static void setValue( XmlObject xBean,
-                                 String value )
-    {
-        XmlCursor xCursor = xBean.newCursor();
-        if ( xCursor.isStartdoc() )
-        {
-            xCursor.toFirstChild();
-        }
-        xCursor.setTextValue( value );
-        xCursor.dispose();
-    }
-
-    /**
-     * @param xBean
-     * @param qName
-     *
-     */
-    public static void setValueAsQName( XmlObject xBean, QName qName )
-    {
-        XmlCursor xCursor = xBean.newCursor();
-        String prefix = xCursor.prefixForNamespace( qName.getNamespaceURI() );
-        String value = prefix + ":" + qName.getLocalPart();
-        xCursor.setTextValue( value );
-        xCursor.dispose();
-    }
-
-    /**
-     *
-     * @param xBean
-     * @param attribName
-     * @return
-     */
-    public static String getAttributeValue( XmlObject xBean, QName attribName )
-    {
-        XmlCursor xCursor = xBean.newCursor();
-        String value = xCursor.getAttributeText( attribName );
-        xCursor.dispose();
-        return value;
-    }
-
-    /**
-     * @param xBean
-     *
-     * @return
-     */
-    public static QName getAttributeValueAsQName( XmlObject xBean, QName attribName )
-    {
-        String value = getAttributeValue( xBean, attribName );
-        return toQName( value, xBean );
-    }
-
-    /**
-     * Adds a copy of the XmlBean <code>newChild</code> as the last child
-     * of the XmlBean <code>parent</code>.
-     *
-     * @param parent the XmlBean to be added to; must represent an element or a document
-     * @param newChild the XmlBean to be added; must represent an element or a document
-     */
-    public static XmlObject addChildElement( XmlObject parent,
-                                             XmlObject newChild )
-    {
-        parent = getRootElement( parent );
-        Node parentNode = parent.getDomNode();
-        Node newChildNode = newChild.newDomNode(); // no need to use newDomNode() because importNode() will make a copy
-        if ( newChildNode.getNodeType() == Node.DOCUMENT_NODE )
-        {
-            newChildNode = ((Document)newChildNode).getDocumentElement();
-        }
-        newChildNode = parentNode.getOwnerDocument().importNode( newChildNode, true ); //
-        parentNode.appendChild( newChildNode );
-        // get a ref to the XmlObject corresponding to the child we've just added...
-        XmlCursor cursor = parent.newCursor();
-        cursor.toLastChild();
-        newChild = cursor.getObject();
-        cursor.dispose();
-        return newChild;
-    }
-
-    /**
-     * Creates a new XmlBean named <code>name</code> and adds it as the
-     * last child of the XmlBean <code>parent</code>.
-     *
-     * @param parent the XmlBean to be added to; must represent an element or a document
-     * @param name the name of the new XmlBean to be added
-     */
-    public static XmlObject addChildElement( XmlObject parent,
-                                             QName name )
-    {
-        parent = getRootElement( parent );
-        XmlCursor parentCursor = parent.newCursor();
-        if ( parentCursor.toLastChild() )  // has children
-        {
-            parentCursor.toEndToken();
-            parentCursor.toNextToken();
-        }
-        else                               // childless
-        {
-            parentCursor.toEndToken();
-        }
-        parentCursor.insertElement( name );
-        parentCursor.toPrevSibling();
-        XmlObject newChild = parentCursor.getObject();
-        parentCursor.dispose();
-        return newChild;
-    }
-
-    /**
-     * Removes the specifed XMLBean from its parent element.
-     *
-     * @param xBean an XMLBean
-     */
-    public static void remove( XmlObject xBean )
-    {
-        XmlCursor xCursor = xBean.newCursor();
-        xCursor.removeXml();
-
-        xCursor.dispose();
-    }
-
-    /**
-     * Removes all child elements, with the specified name, from the specified XMLBean.
-     *
-     * @param xBean an XMLBean
-     *
-     * @return true if all child elements, with the specified name, were successfully removed
-     */
-    public static boolean removeChildElements( XmlObject xBean,
-                                               QName name )
-    {
-        boolean succeeded = true;
-        xBean = getRootElement( xBean );
-        XmlCursor xCursor = xBean.newCursor();
-        for ( boolean hasNext = xCursor.toFirstChild(); hasNext; hasNext = xCursor.toNextSibling() )
-        {
-            if ( name == null || getName( xCursor ).equals( name ) )
-            {
-                succeeded = succeeded && xCursor.removeXml();
-            }
-        }
-        xCursor.dispose();
-        return succeeded;
-    }
-
-    /**
-     * Removes all child elements of the specified XMLBean.
-     *
-     * @param xBean an XMLBean
-     *
-     * @return true if all child elements were successfully removed
-     */
-    public static boolean removeChildElements( XmlObject xBean )
-    {
-        return removeChildElements( xBean, null );
-    }
-
-    /**
-     * @param xBean
-     *
-     * @return
-     *
-     * @throws Exception
-     */
-    public static SOAPElement toSOAPElement( XmlObject xBean )
-            throws Exception
-    {
-        XmlOptions xSaveOpts = new XmlOptions().setSaveOuter().setSavePrettyPrint().setSavePrettyPrintIndent( 2 );
-        Node domNode = xBean.newDomNode( xSaveOpts );
-        Element domElem = null;
-        if ( domNode instanceof Document )
-        {
-            domElem = ( (Document) domNode ).getDocumentElement();
-        }
-        else if ( domNode instanceof DocumentFragment )
-        {
-            NodeList childNodes = domNode.getChildNodes();
-            for ( int i = 0; i < childNodes.getLength(); i++ )
-            {
-                if ( childNodes.item( i ).getNodeType() == Node.ELEMENT_NODE )
-                {
-                    domElem = (Element) childNodes.item( i );
-                    break;
-                }
-            }
-        }
-        return SaajUtils.toSOAPElement( domElem );
-    }
-
-    /**
-     * DOCUMENT_ME
-     *
-     * @param elems DOCUMENT_ME
-     *
-     * @return DOCUMENT_ME
-     *
-     * @throws Exception DOCUMENT_ME
-     */
-    public static SOAPElement[] toSOAPElementArray( final XmlObject[] elems )
-            throws Exception
-    {
-        SOAPElement[] soapElems = new SOAPElement[elems.length];
-
-        for ( int i = 0; i < elems.length; i++ )
-        {
-            soapElems[i] = toSOAPElement( elems[i] );
-        }
-
-        return soapElems;
-    }
-
-    /**
-     * If possible, converts the specified object to an XMLBean.
-     *
-     * @param obj an object
-     *
-     * @return an XMLBean, or null if the parameter is null
-     *
-     * @throws Exception if the object cannot be converted to an XMLBean
-     */
-    public static XmlObject toXmlObject( Object obj )
-            throws Exception
-    {
-        XmlObject xBean;
-
-        if ( obj == null)
-        {
-            return null;
-        }
-
-        if ( obj instanceof XmlObject )
-        {
-            xBean = (XmlObject) obj;
-        }
-        else if ( obj instanceof SOAPElement )
-        {
-            // !!!NOTE!!! It is critical to do parse( obj.toString() ) here, instead of parse( (Node)obj ),
-            //            because Axis 1.2's DOM impl (MessageElement) strips off all attributes, including
-            //            namespace decls! (TODO: file an Axis bug for the aforementioned issue)
-            xBean = XmlObject.Factory.parse( obj.toString() );
-        }
-        else if ( obj instanceof Node )
-        {
-            xBean = XmlObject.Factory.parse( (Node) obj );
-        }
-        else if ( obj instanceof String )
-        {
-            xBean = XmlObject.Factory.parse( (String) obj );
-        }
-        else if ( obj instanceof InputStream )
-        {
-            xBean = XmlObject.Factory.parse( (InputStream) obj );
-        }
-        else if ( obj instanceof Reader )
-        {
-            xBean = XmlObject.Factory.parse( (Reader) obj );
-        }
-        else if ( obj instanceof File )
-        {
-            xBean = XmlObject.Factory.parse( (File) obj );
-        }
-        else if ( obj instanceof URL )
-        {
-            xBean = XmlObject.Factory.parse( (URL) obj );
-        }
-        else
-        {
-            throw new IllegalArgumentException( MSG.getMessage( Keys.PARAM_MUST_BE_TYPE )  + " " + obj.getClass().getName());
-        }
-
-        return xBean;
-    }
-
-    /**
-     * Creates a new XMLBean element with the specified name.
-     *
-     * @param elemName the element name
-     *
-     * @return a new XMLBean element with the specified name
-     */
-    public XmlObject newInstance( QName elemName )
-    {
-        XmlObject xBean = XmlObject.Factory.newInstance();
-        XmlCursor xCursor = xBean.newCursor();
-        xCursor.setName( elemName );
-        xCursor.dispose();
-        return xBean;
-    }
-
-    private static QName toQName( String value, XmlObject xBean )
-    {
-        int colonIndex = value.indexOf( ':' );
-        String nsURI;
-        if ( colonIndex != -1 )
-        {
-            String prefix = value.substring( 0, colonIndex );
-            XmlCursor xCursor = xBean.newCursor();
-            nsURI = xCursor.namespaceForPrefix( prefix );
-            if ( nsURI == null )
-            {
-                throw new RuntimeException( "No namespace is associated with prefix '" + prefix + "'" );
-            }
-            xCursor.dispose();
-        }
-        else
-        {
-            nsURI = "";
-        }
-        String localName = value.substring( colonIndex + 1 );
-        return new QName( nsURI, localName );
-    }
-
-    /**
-     * Makes and returns a copy of the specified XMLBean.
-     *
-     * @param srcXBean the XMLBean to be copied
-     *
-     * @return a copy of the specified XMLBean
-     */
-    public static XmlObject copyXmlBean( XmlObject srcXBean )
-    {
-        try
-        {
-            return XmlObject.Factory.parse( srcXBean.xmlText( new XmlOptions().setSaveOuter() ) );
-        }
-        catch ( XmlException xe )
-        {
-            throw new RuntimeException( xe );
-        }
-
-        /*XmlCursor srcCursor = srcXBean.newCursor(  );
-
-       // create an object of the appropriate type to copy to
-       XmlObject destXBean = XmlObject.Factory.newInstance( new XmlOptions( ).setDocumentType( srcXBean.schemaType() ) );
-       XmlCursor destCursor = destXBean.newCursor(  );
-
-       // move into the document
-       destCursor.toNextToken(  );
-
-       // copy the xml into the new document
-       srcCursor.copyXml( destCursor );
-
-       // clean up our cursors
-       destCursor.dispose(  );
-       srcCursor.dispose(  );
-
-       return destXBean;*/
-    }
-
-    /**
-     * Makes and returns a copy of the specified XMLBean array.
-     *
-     * @param srcXBeans the array of XMLBeans to be copied
-     *
-     * @return a copy of the specified XMLBean array
-     */
-    public static XmlObject[] copyXmlBeans( XmlObject[] srcXBeans )
-    {
-       if ( srcXBeans == null )
-       {
-          return null;
-       }
-
-       XmlObject[] destXBeans = new XmlObject[srcXBeans.length];
-
-       for ( int i = 0; i < srcXBeans.length; i++ )
-       {
-          destXBeans[i] = copyXmlBean( srcXBeans[i] );
-       }
-
-       return destXBeans;
-    }
-
-    /**
-     * Returns a Map keyed on Element QName to a List containing the "Any" XmlObjects types.
-     * <p/>
-     * The way we determine that an element is an Any is by asking for the element property of the schemaType for the
-     * element by the element's QName.
-     *
-     * @param xmlObjectToSearch The XmlObject to find the Any elements in.
-     *
-     * @return Map keyed on Element QName to a List containing the "Any" XmlObjects
-     */
-    public static Map getXmlBeanAnyMap( XmlObject xmlObjectToSearch )
-    {
-        Map qnameToListMap = new HashMap();
-        XmlCursor xCursor = xmlObjectToSearch.newCursor();
-        for ( boolean hasNext = xCursor.toFirstChild(); hasNext; hasNext = xCursor.toNextSibling() )
-        {
-            XmlObject siblingXmlObject = xCursor.getObject();
-            QName siblingXmlObjectQname = getName(siblingXmlObject);
-
-            // TODO (low priority): should this be tested against the original bean?
-            //if it contains the ElementProperty, then it is not an Any
-            if ( siblingXmlObject.schemaType().getElementProperty( siblingXmlObjectQname ) != null )
-            {
-                continue;
-            }
-
-            //check to see if we have a xmlObjectList to add to for this QName
-            List xmlObjectList = (List) qnameToListMap.get( siblingXmlObjectQname );
-
-            if ( xmlObjectList == null )
-            {
-                xmlObjectList = new ArrayList();
-            }
-
-            xmlObjectList.add( siblingXmlObject );
-            qnameToListMap.put( siblingXmlObjectQname, xmlObjectList );
-        }
-
-        xCursor.dispose();
+         }
+      }
 
-        return qnameToListMap;
-    }
+      return SaajUtils.toSOAPElement( domElem );
+   }
 
-}
+   /**
+    * DOCUMENT_ME
+    *
+    * @param elems DOCUMENT_ME
+    *
+    * @return DOCUMENT_ME
+    *
+    * @throws Exception DOCUMENT_ME
+    */
+   public static SOAPElement[] toSOAPElementArray( final XmlObject[] elems )
+   throws Exception
+   {
+      SOAPElement[] soapElems = new SOAPElement[elems.length];
+
+      for ( int i = 0; i < elems.length; i++ )
+      {
+         soapElems[i] = toSOAPElement( elems[i] );
+      }
+
+      return soapElems;
+   }
+
+   /**
+    * If possible, converts the specified object to an XMLBean.
+    *
+    * @param obj an object
+    *
+    * @return an XMLBean, or null if the parameter is null
+    *
+    * @throws Exception if the object cannot be converted to an XMLBean
+    */
+   public static XmlObject toXmlObject( Object obj )
+   throws Exception
+   {
+      XmlObject xBean;
+
+      if ( obj == null )
+      {
+         return null;
+      }
+
+      if ( obj instanceof XmlObject )
+      {
+         xBean = (XmlObject) obj;
+      }
+      else if ( obj instanceof SOAPElement )
+      {
+         // !!!NOTE!!! It is critical to do parse( obj.toString() ) here, instead of parse( (Node)obj ),
+         //            because Axis 1.2's DOM impl (MessageElement) strips off all attributes, including
+         //            namespace decls! (TODO: file an Axis bug for the aforementioned issue)
+         xBean = XmlObject.Factory.parse( obj.toString(  ) );
+      }
+      else if ( obj instanceof Node )
+      {
+         xBean = XmlObject.Factory.parse( (Node) obj );
+      }
+      else if ( obj instanceof String )
+      {
+         xBean = XmlObject.Factory.parse( (String) obj );
+      }
+      else if ( obj instanceof InputStream )
+      {
+         xBean = XmlObject.Factory.parse( (InputStream) obj );
+      }
+      else if ( obj instanceof Reader )
+      {
+         xBean = XmlObject.Factory.parse( (Reader) obj );
+      }
+      else if ( obj instanceof File )
+      {
+         xBean = XmlObject.Factory.parse( (File) obj );
+      }
+      else if ( obj instanceof URL )
+      {
+         xBean = XmlObject.Factory.parse( (URL) obj );
+      }
+      else
+      {
+         throw new IllegalArgumentException( MSG.getMessage( Keys.PARAM_MUST_BE_TYPE ) + " "
+                                             + obj.getClass(  ).getName(  ) );
+      }
+
+      return xBean;
+   }
+
+   /**
+    * Creates a new XMLBean element with the specified name.
+    *
+    * @param elemName the element name
+    *
+    * @return a new XMLBean element with the specified name
+    */
+   public XmlObject newInstance( QName elemName )
+   {
+      XmlObject xBean   = XmlObject.Factory.newInstance(  );
+      XmlCursor xCursor = xBean.newCursor(  );
+      xCursor.setName( elemName );
+      xCursor.dispose(  );
+      return xBean;
+   }
+
+   private static QName toQName( String    value,
+                                 XmlObject xBean )
+   {
+      int    colonIndex = value.indexOf( ':' );
+      String nsURI;
+      if ( colonIndex != -1 )
+      {
+         String    prefix  = value.substring( 0, colonIndex );
+         XmlCursor xCursor = xBean.newCursor(  );
+         nsURI = xCursor.namespaceForPrefix( prefix );
+         if ( nsURI == null )
+         {
+            throw new RuntimeException( "No namespace is associated with prefix '" + prefix + "'" );
+         }
+
+         xCursor.dispose(  );
+      }
+      else
+      {
+         nsURI = "";
+      }
+
+      String localName = value.substring( colonIndex + 1 );
+      return new QName( nsURI, localName );
+   }
+}
\ No newline at end of file

Modified: webservices/wsrf/trunk/src/java/org/apache/ws/util/XmlUtils.java
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/java/org/apache/ws/util/XmlUtils.java?rev=227033&r1=227032&r2=227033&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/java/org/apache/ws/util/XmlUtils.java (original)
+++ webservices/wsrf/trunk/src/java/org/apache/ws/util/XmlUtils.java Tue Aug  2 09:28:49 2005
@@ -25,7 +25,6 @@
 import org.w3c.dom.Element;
 import org.xml.sax.InputSource;
 import org.xml.sax.SAXException;
-
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.parsers.ParserConfigurationException;
@@ -45,8 +44,10 @@
  */
 public class XmlUtils
 {
-   private static Log                    LOG = LogFactory.getLog( XmlUtils.class.getName(  ) );
-   public static final Messages MSG = MessagesImpl.getInstance();
+   private static Log                    LOG   = LogFactory.getLog( XmlUtils.class.getName(  ) );
+
+   /** DOCUMENT_ME */
+   public static final Messages          MSG   = MessagesImpl.getInstance(  );
    private static DocumentBuilderFactory s_dbf = getDOMFactory(  );
 
    /**
@@ -225,7 +226,7 @@
    throws IOException
    {
       URL wsdlurl = null;
-      LOG.debug(MSG.getMessage( Keys.INPUT_SRC_FRM_URI,uri,username,password));
+      LOG.debug( MSG.getMessage( Keys.INPUT_SRC_FRM_URI, uri, username, password ) );
       try
       {
          wsdlurl = new URL( uri );

Modified: webservices/wsrf/trunk/src/java/org/apache/ws/util/ant/FileTask.java
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/java/org/apache/ws/util/ant/FileTask.java?rev=227033&r1=227032&r2=227033&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/java/org/apache/ws/util/ant/FileTask.java (original)
+++ webservices/wsrf/trunk/src/java/org/apache/ws/util/ant/FileTask.java Tue Aug  2 09:28:49 2005
@@ -20,7 +20,6 @@
 import org.apache.ws.util.i18n.Keys;
 import org.apache.ws.util.i18n.Messages;
 import org.apache.ws.util.i18n.MessagesImpl;
-
 import java.io.File;
 
 /**
@@ -30,21 +29,27 @@
  *
  * @author Ian P. Springer (Hewlett-Packard Company)
  */
-public class FileTask extends Task
+public class FileTask
+   extends Task
 {
-   public static final Messages MSG = MessagesImpl.getInstance();
-   private String m_property;
-   private File m_location;
-   private File m_baseDir;
+   /** DOCUMENT_ME */
+   public static final Messages MSG        = MessagesImpl.getInstance(  );
+   private String               m_property;
+   private File                 m_location;
+   private File                 m_baseDir;
 
    /**
-    * Sets the name of the property to set.
+    * If the specified location is relative, this directory will be used as
+    * the base directory when expanding the location to an absolute path.
+    * If the baseDir attribute is not specified, the project's basedir
+    * (i.e. ${basedir}) will be used.
     *
-    * @param property the name of the property to set
+    * @param baseDir used as the base directory when expanding the location
+    *                to an absolute path
     */
-   public void setProperty( String property )
+   public void setBaseDir( File baseDir )
    {
-      m_property = property;
+      m_baseDir = baseDir;
    }
 
    /**
@@ -60,42 +65,44 @@
    }
 
    /**
-    * If the specified location is relative, this directory will be used as
-    * the base directory when expanding the location to an absolute path.
-    * If the baseDir attribute is not specified, the project's basedir
-    * (i.e. ${basedir}) will be used.
-    * 
-    * @param baseDir used as the base directory when expanding the location
-    *                to an absolute path
+    * Sets the name of the property to set.
+    *
+    * @param property the name of the property to set
     */
-   public void setBaseDir( File baseDir )
+   public void setProperty( String property )
    {
-      m_baseDir = baseDir;
+      m_property = property;
    }
 
    /**
     * @see {@link org.apache.tools.ant.Task#execute()}
     */
-   public void execute() throws BuildException
+   public void execute(  )
+   throws BuildException
    {
-      if ( getProject() == null )
+      if ( getProject(  ) == null )
       {
-         throw new IllegalStateException( MSG.getMessage( Keys.PRJ_NOT_SET) );
+         throw new IllegalStateException( MSG.getMessage( Keys.PRJ_NOT_SET ) );
       }
+
       if ( m_property == null )
       {
-         throw new BuildException( MSG.getMessage( Keys.MST_SPECIFY_PROP_NAME) );
+         throw new BuildException( MSG.getMessage( Keys.MST_SPECIFY_PROP_NAME ) );
       }
+
       if ( m_location == null )
       {
-         throw new BuildException( MSG.getMessage( Keys.MST_SPECIFY_LOCATION) );
+         throw new BuildException( MSG.getMessage( Keys.MST_SPECIFY_LOCATION ) );
       }
-      if ( !m_location.isAbsolute() )
+
+      if ( !m_location.isAbsolute(  ) )
       {
-         m_baseDir = m_baseDir != null ? m_baseDir : getProject().getBaseDir();
-         m_location = new File( m_baseDir, m_location.getPath() );
+         m_baseDir     = ( m_baseDir != null ) ? m_baseDir : getProject(  ).getBaseDir(  );
+         m_location    = new File( m_baseDir,
+                                   m_location.getPath(  ) );
       }
-      getProject().setNewProperty( m_property, m_location.getAbsolutePath() );
-   }
 
-}
+      getProject(  ).setNewProperty( m_property,
+                                     m_location.getAbsolutePath(  ) );
+   }
+}
\ No newline at end of file

Modified: webservices/wsrf/trunk/src/java/org/apache/ws/util/helper/Dom2SaajConverter.java
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/java/org/apache/ws/util/helper/Dom2SaajConverter.java?rev=227033&r1=227032&r2=227033&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/java/org/apache/ws/util/helper/Dom2SaajConverter.java (original)
+++ webservices/wsrf/trunk/src/java/org/apache/ws/util/helper/Dom2SaajConverter.java Tue Aug  2 09:28:49 2005
@@ -20,7 +20,6 @@
 import org.w3c.dom.Element;
 import org.w3c.dom.NamedNodeMap;
 import org.w3c.dom.NodeList;
-
 import javax.xml.soap.Detail;
 import javax.xml.soap.DetailEntry;
 import javax.xml.soap.Name;
@@ -35,234 +34,237 @@
  */
 public class Dom2SaajConverter
 {
-    private SOAPFactory m_soap_factory;
-
-    /**
-     * Creates a new {@link Dom2SaajConverter} object.
-     *
-     * @throws SOAPException DOCUMENT_ME
-     */
-    public Dom2SaajConverter()
-            throws SOAPException
-    {
-        m_soap_factory = SOAPFactory.newInstance();
-    }
-
-    /**
-     * Converts a DOM {@link org.w3c.dom.Element} to a SAAJ {@link javax.xml.soap.SOAPElement}.
-     *
-     * @param domElem a DOM {@link org.w3c.dom.Element}
-     *
-     * @return a {@link javax.xml.soap.SOAPElement}
-     *
-     * @throws javax.xml.soap.SOAPException
-     */
-    public SOAPElement toSOAPElement( Element domElem )
-            throws SOAPException
-    {
-        if ( domElem == null )
-        {
-            return null;
-        }
-
-        SOAPElement soapElem;
-        if ( domElem instanceof SOAPElement )
-        {
-            soapElem = (SOAPElement) domElem;
-        }
-        else
-        {
-            soapElem =
-                    m_soap_factory.createElement( domElem.getLocalName(),
-                            getPrefix( domElem ),
-                            getNamespaceURI( domElem ) );
-
-            buildSOAPElement( domElem, soapElem );
-        }
-
-        return ( soapElem );
-    }
-
-    /**
-     * Adds a DOM {@link org.w3c.dom.Element} as an entry to a SAAJ {@link Detail}.
-     *
-     * @param detail  a SAAJ detail
-     * @param domElem a DOM element to be added as an entry in the specified detail
-     *
-     * @return a SAAJ detail entry
-     *
-     * @throws javax.xml.soap.SOAPException
-     */
-    public DetailEntry addDetailEntry( Detail detail, Element domElem )
-            throws SOAPException
-    {
-        if ( domElem == null )
-        {
-            return null;
-        }
-        DetailEntry detailEntry;
-        if ( domElem instanceof DetailEntry )
-        {
-            detailEntry = (DetailEntry) domElem;
-        }
-        else
-        {
-            detailEntry =
-                    detail.addDetailEntry( m_soap_factory.createName( domElem.getLocalName(),
-                            getPrefix( domElem ),
-                            getNamespaceURI( domElem ) ) );
-            buildSOAPElement( domElem, detailEntry );
-        }
-        return detailEntry;
-    }
-
-    /**
-     * @param attrib
-     *
-     * @return
-     */
-    private static boolean isNamespaceDeclarationAttrib( org.w3c.dom.Node attrib )
-    {
-        String prefix = attrib.getPrefix();
-        String ns_uri = attrib.getNamespaceURI();
-
-        return ( ( ( prefix != null ) && prefix.equals( XmlConstants.NSPREFIX_XMLNS ) )
-                || ( ( ns_uri != null ) && ns_uri.equals( XmlConstants.NSURI_XMLNS ) ) )
-                && !attrib.getLocalName().equals( XmlConstants.NSPREFIX_XMLNS );
-    }
-
-    /**
-     * @param node
-     *
-     * @return
-     */
-    private static String getNamespaceURI( org.w3c.dom.Node node )
-    {
-        String ns_uri = node.getNamespaceURI();
-
-        return ( ns_uri != null ? ns_uri : "" );
-    }
-
-    /**
-     * @param node
-     *
-     * @return
-     */
-    private static String getPrefix( org.w3c.dom.Node node )
-    {
-        String prefix = node.getPrefix();
-
-        return ( prefix != null ? prefix : NameUtils.getNamespacePrefix( node.getNamespaceURI() ) );
-    }
-
-    /**
-     * DOCUMENT_ME
-     *
-     * @param soap_elem DOCUMENT_ME
-     * @param elem      DOCUMENT_ME
-     *
-     * @throws SOAPException DOCUMENT_ME
-     */
-    private SOAPElement addAttributes( SOAPElement soap_elem,
-                                       Element elem )
-            throws SOAPException
-    {
-        NamedNodeMap attribs = elem.getAttributes();
-
-        for ( int i = 0; i < attribs.getLength(); i++ )
-        {
-            org.w3c.dom.Node attrib = attribs.item( i );
-
-            if ( isNamespaceDeclarationAttrib( attrib ) )
-            {
-                soap_elem.addNamespaceDeclaration( attrib.getLocalName(),
-                        attrib.getNodeValue() );
-            }
-            else
-            {
-                if ( hasPrefix( soap_elem ) && attrib.getLocalName().equals( XmlConstants.NSPREFIX_XMLNS ) )
-                {
-                    // don't add an xmlns="..." attribute if the element has a prefix
-                    continue;
-                }
-
-                Name attrib_pqname =
-                        m_soap_factory.createName( attrib.getLocalName(),
-                                attrib.getPrefix(),
-                                attrib.getNamespaceURI() );
-
-                soap_elem.addAttribute( attrib_pqname,
-                        attrib.getNodeValue() );
-            }
-        }
-
-        return ( soap_elem );
-    }
+   private SOAPFactory m_soap_factory;
 
-    /**
-     * DOCUMENT_ME
-     *
-     * @param soap_elem DOCUMENT_ME
-     * @param elem      DOCUMENT_ME
-     *
-     * @throws SOAPException DOCUMENT_ME
-     */
-    private SOAPElement addChildren( SOAPElement soap_elem,
-                                     Element elem )
-            throws SOAPException
-    {
-        NodeList children = elem.getChildNodes();
-
-        for ( int i = 0; i < children.getLength(); i++ )
-        {
-            org.w3c.dom.Node node = children.item( i );
-            short node_type = node.getNodeType();
-
-            if ( node_type == org.w3c.dom.Node.ELEMENT_NODE )
+   /**
+    * Creates a new {@link Dom2SaajConverter} object.
+    *
+    * @throws SOAPException DOCUMENT_ME
+    */
+   public Dom2SaajConverter(  )
+   throws SOAPException
+   {
+      m_soap_factory = SOAPFactory.newInstance(  );
+   }
+
+   /**
+    * Adds a DOM {@link org.w3c.dom.Element} as an entry to a SAAJ {@link Detail}.
+    *
+    * @param detail  a SAAJ detail
+    * @param domElem a DOM element to be added as an entry in the specified detail
+    *
+    * @return a SAAJ detail entry
+    *
+    * @throws javax.xml.soap.SOAPException
+    */
+   public DetailEntry addDetailEntry( Detail  detail,
+                                      Element domElem )
+   throws SOAPException
+   {
+      if ( domElem == null )
+      {
+         return null;
+      }
+
+      DetailEntry detailEntry;
+      if ( domElem instanceof DetailEntry )
+      {
+         detailEntry = (DetailEntry) domElem;
+      }
+      else
+      {
+         detailEntry =
+            detail.addDetailEntry( m_soap_factory.createName( domElem.getLocalName(  ),
+                                                              getPrefix( domElem ),
+                                                              getNamespaceURI( domElem ) ) );
+         buildSOAPElement( domElem, detailEntry );
+      }
+
+      return detailEntry;
+   }
+
+   /**
+    * Converts a DOM {@link org.w3c.dom.Element} to a SAAJ {@link javax.xml.soap.SOAPElement}.
+    *
+    * @param domElem a DOM {@link org.w3c.dom.Element}
+    *
+    * @return a {@link javax.xml.soap.SOAPElement}
+    *
+    * @throws javax.xml.soap.SOAPException
+    */
+   public SOAPElement toSOAPElement( Element domElem )
+   throws SOAPException
+   {
+      if ( domElem == null )
+      {
+         return null;
+      }
+
+      SOAPElement soapElem;
+      if ( domElem instanceof SOAPElement )
+      {
+         soapElem = (SOAPElement) domElem;
+      }
+      else
+      {
+         soapElem =
+            m_soap_factory.createElement( domElem.getLocalName(  ),
+                                          getPrefix( domElem ),
+                                          getNamespaceURI( domElem ) );
+
+         buildSOAPElement( domElem, soapElem );
+      }
+
+      return ( soapElem );
+   }
+
+   /**
+    * @param attrib
+    *
+    * @return
+    */
+   private static boolean isNamespaceDeclarationAttrib( org.w3c.dom.Node attrib )
+   {
+      String prefix = attrib.getPrefix(  );
+      String ns_uri = attrib.getNamespaceURI(  );
+
+      return ( ( ( prefix != null ) && prefix.equals( XmlConstants.NSPREFIX_XMLNS ) )
+             || ( ( ns_uri != null ) && ns_uri.equals( XmlConstants.NSURI_XMLNS ) ) )
+             && !attrib.getLocalName(  ).equals( XmlConstants.NSPREFIX_XMLNS );
+   }
+
+   /**
+    * @param node
+    *
+    * @return
+    */
+   private static String getNamespaceURI( org.w3c.dom.Node node )
+   {
+      String ns_uri = node.getNamespaceURI(  );
+
+      return ( ( ns_uri != null ) ? ns_uri : "" );
+   }
+
+   /**
+    * @param node
+    *
+    * @return
+    */
+   private static String getPrefix( org.w3c.dom.Node node )
+   {
+      String prefix = node.getPrefix(  );
+
+      return ( ( prefix != null ) ? prefix : NameUtils.getNamespacePrefix( node.getNamespaceURI(  ) ) );
+   }
+
+   /**
+    * DOCUMENT_ME
+    *
+    * @param soap_elem DOCUMENT_ME
+    * @param elem      DOCUMENT_ME
+    *
+    * @throws SOAPException DOCUMENT_ME
+    */
+   private SOAPElement addAttributes( SOAPElement soap_elem,
+                                      Element     elem )
+   throws SOAPException
+   {
+      NamedNodeMap attribs = elem.getAttributes(  );
+
+      for ( int i = 0; i < attribs.getLength(  ); i++ )
+      {
+         org.w3c.dom.Node attrib = attribs.item( i );
+
+         if ( isNamespaceDeclarationAttrib( attrib ) )
+         {
+            soap_elem.addNamespaceDeclaration( attrib.getLocalName(  ),
+                                               attrib.getNodeValue(  ) );
+         }
+         else
+         {
+            if ( hasPrefix( soap_elem ) && attrib.getLocalName(  ).equals( XmlConstants.NSPREFIX_XMLNS ) )
             {
-                SOAPElement new_elem =
-                        soap_elem.addChildElement( node.getLocalName(),
-                                getPrefix( node ),
-                                getNamespaceURI( node ) );
-
-                buildSOAPElement( (Element) node, new_elem );
+               // don't add an xmlns="..." attribute if the element has a prefix
+               continue;
             }
-            else if ( node_type == org.w3c.dom.Node.TEXT_NODE )
-            {
-                soap_elem.addTextNode( node.getNodeValue() );
-            }
-        }
-
-        return ( soap_elem );
-    }
 
-    /**
-     * Workhorse method for {@link Dom2SaajConverter#toSOAPElement} - calls itself recursively.
-     *
-     * @param elem      the DOM element to be converted
-     * @param soap_elem the SAAJ SOAP element being built
-     *
-     * @throws SOAPException
-     */
-    private SOAPElement buildSOAPElement( Element elem,
-                                          SOAPElement soap_elem )
-            throws SOAPException
-    {
-        return ( addChildren( addAttributes( soap_elem, elem ),
-                elem ) );
-    }
-
-    /**
-     * DOCUMENT_ME
-     *
-     * @param soap_elem DOCUMENT_ME
-     *
-     * @return DOCUMENT_ME
-     */
-    private static boolean hasPrefix( SOAPElement soap_elem )
-    {
-        String prefix = soap_elem.getElementName().getPrefix();
+            Name attrib_pqname =
+               m_soap_factory.createName( attrib.getLocalName(  ),
+                                          attrib.getPrefix(  ),
+                                          attrib.getNamespaceURI(  ) );
+
+            soap_elem.addAttribute( attrib_pqname,
+                                    attrib.getNodeValue(  ) );
+         }
+      }
+
+      return ( soap_elem );
+   }
+
+   /**
+    * DOCUMENT_ME
+    *
+    * @param soap_elem DOCUMENT_ME
+    * @param elem      DOCUMENT_ME
+    *
+    * @throws SOAPException DOCUMENT_ME
+    */
+   private SOAPElement addChildren( SOAPElement soap_elem,
+                                    Element     elem )
+   throws SOAPException
+   {
+      NodeList children = elem.getChildNodes(  );
+
+      for ( int i = 0; i < children.getLength(  ); i++ )
+      {
+         org.w3c.dom.Node node      = children.item( i );
+         short            node_type = node.getNodeType(  );
+
+         if ( node_type == org.w3c.dom.Node.ELEMENT_NODE )
+         {
+            SOAPElement new_elem =
+               soap_elem.addChildElement( node.getLocalName(  ),
+                                          getPrefix( node ),
+                                          getNamespaceURI( node ) );
+
+            buildSOAPElement( (Element) node, new_elem );
+         }
+         else if ( node_type == org.w3c.dom.Node.TEXT_NODE )
+         {
+            soap_elem.addTextNode( node.getNodeValue(  ) );
+         }
+      }
+
+      return ( soap_elem );
+   }
+
+   /**
+    * Workhorse method for {@link Dom2SaajConverter#toSOAPElement} - calls itself recursively.
+    *
+    * @param elem      the DOM element to be converted
+    * @param soap_elem the SAAJ SOAP element being built
+    *
+    * @throws SOAPException
+    */
+   private SOAPElement buildSOAPElement( Element     elem,
+                                         SOAPElement soap_elem )
+   throws SOAPException
+   {
+      return ( addChildren( addAttributes( soap_elem, elem ),
+                            elem ) );
+   }
+
+   /**
+    * DOCUMENT_ME
+    *
+    * @param soap_elem DOCUMENT_ME
+    *
+    * @return DOCUMENT_ME
+    */
+   private static boolean hasPrefix( SOAPElement soap_elem )
+   {
+      String prefix = soap_elem.getElementName(  ).getPrefix(  );
 
-        return ( ( prefix != null ) && !prefix.equals( XmlConstants.NSPREFIX_DEFAULT ) );
-    }
+      return ( ( prefix != null ) && !prefix.equals( XmlConstants.NSPREFIX_DEFAULT ) );
+   }
 }

Modified: webservices/wsrf/trunk/src/java/org/apache/ws/util/helper/Saaj2StringConverter.java
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/java/org/apache/ws/util/helper/Saaj2StringConverter.java?rev=227033&r1=227032&r2=227033&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/java/org/apache/ws/util/helper/Saaj2StringConverter.java (original)
+++ webservices/wsrf/trunk/src/java/org/apache/ws/util/helper/Saaj2StringConverter.java Tue Aug  2 09:28:49 2005
@@ -19,7 +19,6 @@
 import org.apache.ws.util.i18n.Keys;
 import org.apache.ws.util.i18n.Messages;
 import org.apache.ws.util.i18n.MessagesImpl;
-
 import javax.xml.soap.Name;
 import javax.xml.soap.Node;
 import javax.xml.soap.SOAPBody;
@@ -40,7 +39,9 @@
  */
 public class Saaj2StringConverter
 {
-   public static final Messages MSG = MessagesImpl.getInstance();
+   /** DOCUMENT_ME */
+   public static final Messages MSG = MessagesImpl.getInstance(  );
+
    /**
     * Whitespace string to use for indentation in {@link #toString( javax.xml.soap.Node )}.
     */
@@ -154,7 +155,7 @@
    {
       if ( soap_text == null )
       {
-         throw new IllegalArgumentException( MSG.getMessage( Keys.NULL_PARAM_NOT_ALLOWED) );
+         throw new IllegalArgumentException( MSG.getMessage( Keys.NULL_PARAM_NOT_ALLOWED ) );
       }
 
       String value = soap_text.getValue(  );
@@ -166,7 +167,7 @@
 
       if ( value == null )
       {
-         throw new SOAPException( MSG.getMessage( Keys.NULL_VALUE) );
+         throw new SOAPException( MSG.getMessage( Keys.NULL_VALUE ) );
       }
 
       return ( value );

Modified: webservices/wsrf/trunk/src/java/org/apache/ws/util/i18n/AbstractMessages.java
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/java/org/apache/ws/util/i18n/AbstractMessages.java?rev=227033&r1=227032&r2=227033&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/java/org/apache/ws/util/i18n/AbstractMessages.java (original)
+++ webservices/wsrf/trunk/src/java/org/apache/ws/util/i18n/AbstractMessages.java Tue Aug  2 09:28:49 2005
@@ -386,4 +386,4 @@
    {
       return m_messageBundle.getResourceBundle(  );
    }
-}
+}
\ No newline at end of file

Modified: webservices/wsrf/trunk/src/java/org/apache/ws/util/i18n/Keys.java
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/java/org/apache/ws/util/i18n/Keys.java?rev=227033&r1=227032&r2=227033&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/java/org/apache/ws/util/i18n/Keys.java (original)
+++ webservices/wsrf/trunk/src/java/org/apache/ws/util/i18n/Keys.java Tue Aug  2 09:28:49 2005
@@ -15,6 +15,7 @@
  *=============================================================================*/
 package org.apache.ws.util.i18n;
 
+
 /**
  * i18n message keys and messages for the {@link org.apache.ws.util} package
  * and all its subpackages.
@@ -23,169 +24,208 @@
  */
 public interface Keys
 {
-    /**
-     * @msg Getting an InputSource from the URI: {0} using username: {1} and password: {2}
-     */
-    String INPUT_SRC_FRM_URI = "INPUT_SRC_FRM_URI";
-    /**
-     * @msg Null parameter not allowed.
-     */
-    String NULL_PARAM_NOT_ALLOWED = "NULL_PARAM_NOT_ALLOWED";
-    /**
-     * @msg Parameter must be an instance of one of the following types: XmlObject, Node, String, InputStream, Reader, File, or URL
-     */
-    String PARAM_MUST_BE_TYPE = "PARAM_MUST_BE_TYPE";
-    /**
-     * @msg  parameter may not be null
-     */
-    String PARAM_MAY_NOT_BE_NULL = "PARAM_MAY_NOT_BE_NULL";
-    /**
-     * @msg text node has null value
-     */
-    String TEXT_NODE_IS_NULL = "TEXT_NODE_IS_NULL";
-    /**
-     * @msg Building a prefix for the namespace: {0}
-     */
-    String BLD_PREFIX_FOR_NAMESPC = "BLD_PREFIX_FOR_NAMESPC";
-    /**
-     * @msg Creating a Name from localpart: {0} prefix: {1} uri: {2}
-     */
-    String CREATING_NAME = "CREATING_NAME";
-    /**
-     * @msg Converting QName to Name.  QName: {0}
-     */
-    String CONVRT_QNAME_TO_NAME = "CONVRT_QNAME_TO_NAME";
-    /**
-     * @msg Converting Name to QName.  Name: {0}
-     */
-    String CONVRT_NAME_TO_QNAME = "CONVRT_NAME_TO_QNAME";
-    /**
-     * @msg Attempting to load xml string: {0} into a DOM.
-     */
-    String LOAD_XML_STRING = "LOAD_XML_STRING";
-    /**
-     * @msg InputStream parameter must not be null.
-     */
-    String INPUTSTRM_MST_NOT_B_NULL = "INPUTSTRM_MST_NOT_B_NULL";
-    /**
-     * @msg OutputStream parameter must not be null.
-     */
-    String OUTSTRM_MST_NOT_B_NULL = "OUTSTRM_MST_NOT_B_NULL";
-    /**
-     * @msg Attempting to copy an InputStream to the file: {0}
-     */
-    String COPY_OUTPUTSTRM_TO_FILE = "COPY_OUTPUTSTRM_TO_FILE";
-    /**
-     * @msg copy
-     */
-    String COPY = "COPY";
-    /**
-     * @msg Failed to copy input stream to {0}.  Rename of temporary file {1} failed.
-     */
-    String FAILED_TO_COPY_INPUTSTRM = "FAILED_TO_COPY_INPUTSTRM";
-    /**
-     * @msg Attempting to copy the file: {0} to the file: {1}
-     */
-    String ATTMPT_COPY_FILE_TO_FILE = "ATTMPT_COPY_FILE_TO_FILE";
-    /**
-     * @msg Failed to copy {0} to {1} Cause: {2}
-     */
-    String FAILED_TO_CPY_FILE_TO_FILE="FAILED_TO_CPY_FILE_TO_FILE";
-    /**
-     * @msg Attempting to delete directory: {0}
-     */
-    String ATTMPT_DEL_DIR = "ATTMPT_DEL_DIR";
-    /**
-     * @msg Attempting to convert a String to an InputStream. String: {0}
-     */
-    String ATTMPT_CNVRT_STRING_TO_INPTSTRM = "ATTMPT_CNVRT_STRING_TO_INPTSTRM";
-    /**
-     * @msg Work object cannot be null.
-     */
-    String NULL_WORK = "NULL_WORK";
-    /**
-     * @msg Setting WorkManager maxPoolSize to: {0}
-     */
-    String WRK_MGR_POOL_SIZE = "WRK_MGR_POOL_SIZE";
-    /**
-     * @msg Creating WorkManager with maxPoolSize: {0}
-     */
-    String CREATE_WRK_MGR_POOL_SZE = "CREATE_WRK_MGR_POOL_SZE";
-    /**
-     * @msg Cancelling.
-     */
-    String CANCELLING = "CANCELLING";
-    /**
-     * @msg Setting pool size to: {0}
-     */
-    String SET_POOL_SIZE = "SET_POOL_SIZE";
-    /**
-     * @msg Resuming.
-     */
-    String RESUMING = "RESUMING";
-    /**
-     * @msg Stopping.
-     */
-    String STOPPING = "STOPPING";
-    /**
-     * @msg Suspending.
-     */
-    String SUSPENDING = "SUSPENDING";
-    /**
-     * @msg Removing task: {0}
-     */
-    String REMOVING_TASK = "REMOVING_TASK";
-    /**
-     * @msg The serviceURL attribute is required.
-     */
-    String SRVC_URL_REQ = "SRVC_URL_REQ";
-    /**
-     * @msg The requestFile attribute is required.
-     */
-    String RQST_FILE_REQ = "RQST_FILE_REQ";
-    /**
-     * @msg SOAP request failed with HTTP status: {0} {1}
-     */
-    String SOAP_REQ_FAILED_HTTP_STATUS = "SOAP_REQ_FAILED_HTTP_STATUS";
-    /**
-     * @msg  Usage:  java {0} http://serviceURL soapEnvelope.xml [SOAPAction]
-     */
-    String SOAPCLIENT_USAGE = "SOAPCLIENT_USAGE";
-    /**
-     * @msg  SOAPAction is optional.
-     */
-    String SOAPACITON_OPTIONAL = "SOAPACITON_OPTIONAL";
-    /**
-     * @msg Getting Lock for key: {0}
-     */
-    String GET_LOCK_FOR_KEY = "GET_LOCK_FOR_KEY";
-    /**
-     * @msg Removing Lock for key: {0}
-     */
-    String REMOVING_LCK_FOR_KEY = "REMOVING_LCK_FOR_KEY";
-    /**
-     * @msg Acquiring lock.
-     */
-    String ACQUIRE_LCK = "ACQUIRE_LCK";
-    /**
-     * @msg Releasing lock.
-     */
-    String RELEASE_LCK = "RELEASE_LCK";
-    /**
-     * @msg project has not been set
-     */
-    String PRJ_NOT_SET = "PRJ_NOT_SET";
-    /**
-     * @msg You must specify a property name.
-     */
-    String MST_SPECIFY_PROP_NAME = "MST_SPECIFY_PROP_NAME";
-    /**
-     * @msg You must specify a location.
-     */
-    String MST_SPECIFY_LOCATION = "MST_SPECIFY_LOCATION";
-    /**
-     * @msg value is null
-     */
-    String NULL_VALUE = "NULL_VALUE";
-    
-}
+   /**
+    * @msg Getting an InputSource from the URI: {0} using username: {1} and password: {2}
+    */
+   String INPUT_SRC_FRM_URI = "INPUT_SRC_FRM_URI";
+
+   /**
+    * @msg Null parameter not allowed.
+    */
+   String NULL_PARAM_NOT_ALLOWED = "NULL_PARAM_NOT_ALLOWED";
+
+   /**
+    * @msg Parameter must be an instance of one of the following types: XmlObject, Node, String, InputStream, Reader, File, or URL
+    */
+   String PARAM_MUST_BE_TYPE = "PARAM_MUST_BE_TYPE";
+
+   /**
+    * @msg  parameter may not be null
+    */
+   String PARAM_MAY_NOT_BE_NULL = "PARAM_MAY_NOT_BE_NULL";
+
+   /**
+    * @msg text node has null value
+    */
+   String TEXT_NODE_IS_NULL = "TEXT_NODE_IS_NULL";
+
+   /**
+    * @msg Building a prefix for the namespace: {0}
+    */
+   String BLD_PREFIX_FOR_NAMESPC = "BLD_PREFIX_FOR_NAMESPC";
+
+   /**
+    * @msg Creating a Name from localpart: {0} prefix: {1} uri: {2}
+    */
+   String CREATING_NAME = "CREATING_NAME";
+
+   /**
+    * @msg Converting QName to Name.  QName: {0}
+    */
+   String CONVRT_QNAME_TO_NAME = "CONVRT_QNAME_TO_NAME";
+
+   /**
+    * @msg Converting Name to QName.  Name: {0}
+    */
+   String CONVRT_NAME_TO_QNAME = "CONVRT_NAME_TO_QNAME";
+
+   /**
+    * @msg Attempting to load xml string: {0} into a DOM.
+    */
+   String LOAD_XML_STRING = "LOAD_XML_STRING";
+
+   /**
+    * @msg InputStream parameter must not be null.
+    */
+   String INPUTSTRM_MST_NOT_B_NULL = "INPUTSTRM_MST_NOT_B_NULL";
+
+   /**
+    * @msg OutputStream parameter must not be null.
+    */
+   String OUTSTRM_MST_NOT_B_NULL = "OUTSTRM_MST_NOT_B_NULL";
+
+   /**
+    * @msg Attempting to copy an InputStream to the file: {0}
+    */
+   String COPY_OUTPUTSTRM_TO_FILE = "COPY_OUTPUTSTRM_TO_FILE";
+
+   /**
+    * @msg copy
+    */
+   String COPY = "COPY";
+
+   /**
+    * @msg Failed to copy input stream to {0}.  Rename of temporary file {1} failed.
+    */
+   String FAILED_TO_COPY_INPUTSTRM = "FAILED_TO_COPY_INPUTSTRM";
+
+   /**
+    * @msg Attempting to copy the file: {0} to the file: {1}
+    */
+   String ATTMPT_COPY_FILE_TO_FILE = "ATTMPT_COPY_FILE_TO_FILE";
+
+   /**
+    * @msg Failed to copy {0} to {1} Cause: {2}
+    */
+   String FAILED_TO_CPY_FILE_TO_FILE = "FAILED_TO_CPY_FILE_TO_FILE";
+
+   /**
+    * @msg Attempting to delete directory: {0}
+    */
+   String ATTMPT_DEL_DIR = "ATTMPT_DEL_DIR";
+
+   /**
+    * @msg Attempting to convert a String to an InputStream. String: {0}
+    */
+   String ATTMPT_CNVRT_STRING_TO_INPTSTRM = "ATTMPT_CNVRT_STRING_TO_INPTSTRM";
+
+   /**
+    * @msg Work object cannot be null.
+    */
+   String NULL_WORK = "NULL_WORK";
+
+   /**
+    * @msg Setting WorkManager maxPoolSize to: {0}
+    */
+   String WRK_MGR_POOL_SIZE = "WRK_MGR_POOL_SIZE";
+
+   /**
+    * @msg Creating WorkManager with maxPoolSize: {0}
+    */
+   String CREATE_WRK_MGR_POOL_SZE = "CREATE_WRK_MGR_POOL_SZE";
+
+   /**
+    * @msg Cancelling.
+    */
+   String CANCELLING = "CANCELLING";
+
+   /**
+    * @msg Setting pool size to: {0}
+    */
+   String SET_POOL_SIZE = "SET_POOL_SIZE";
+
+   /**
+    * @msg Resuming.
+    */
+   String RESUMING = "RESUMING";
+
+   /**
+    * @msg Stopping.
+    */
+   String STOPPING = "STOPPING";
+
+   /**
+    * @msg Suspending.
+    */
+   String SUSPENDING = "SUSPENDING";
+
+   /**
+    * @msg Removing task: {0}
+    */
+   String REMOVING_TASK = "REMOVING_TASK";
+
+   /**
+    * @msg The serviceURL attribute is required.
+    */
+   String SRVC_URL_REQ = "SRVC_URL_REQ";
+
+   /**
+    * @msg The requestFile attribute is required.
+    */
+   String RQST_FILE_REQ = "RQST_FILE_REQ";
+
+   /**
+    * @msg SOAP request failed with HTTP status: {0} {1}
+    */
+   String SOAP_REQ_FAILED_HTTP_STATUS = "SOAP_REQ_FAILED_HTTP_STATUS";
+
+   /**
+    * @msg  Usage:  java {0} http://serviceURL soapEnvelope.xml [SOAPAction]
+    */
+   String SOAPCLIENT_USAGE = "SOAPCLIENT_USAGE";
+
+   /**
+    * @msg  SOAPAction is optional.
+    */
+   String SOAPACITON_OPTIONAL = "SOAPACITON_OPTIONAL";
+
+   /**
+    * @msg Getting Lock for key: {0}
+    */
+   String GET_LOCK_FOR_KEY = "GET_LOCK_FOR_KEY";
+
+   /**
+    * @msg Removing Lock for key: {0}
+    */
+   String REMOVING_LCK_FOR_KEY = "REMOVING_LCK_FOR_KEY";
+
+   /**
+    * @msg Acquiring lock.
+    */
+   String ACQUIRE_LCK = "ACQUIRE_LCK";
+
+   /**
+    * @msg Releasing lock.
+    */
+   String RELEASE_LCK = "RELEASE_LCK";
+
+   /**
+    * @msg project has not been set
+    */
+   String PRJ_NOT_SET = "PRJ_NOT_SET";
+
+   /**
+    * @msg You must specify a property name.
+    */
+   String MST_SPECIFY_PROP_NAME = "MST_SPECIFY_PROP_NAME";
+
+   /**
+    * @msg You must specify a location.
+    */
+   String MST_SPECIFY_LOCATION = "MST_SPECIFY_LOCATION";
+
+   /**
+    * @msg value is null
+    */
+   String NULL_VALUE = "NULL_VALUE";
+}
\ No newline at end of file

Modified: webservices/wsrf/trunk/src/java/org/apache/ws/util/i18n/MessageBundle.java
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/java/org/apache/ws/util/i18n/MessageBundle.java?rev=227033&r1=227032&r2=227033&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/java/org/apache/ws/util/i18n/MessageBundle.java (original)
+++ webservices/wsrf/trunk/src/java/org/apache/ws/util/i18n/MessageBundle.java Tue Aug  2 09:28:49 2005
@@ -31,15 +31,14 @@
  */
 public class MessageBundle
 {
-
-   private final ClassLoader m_classLoader;
+   private final ClassLoader     m_classLoader;
    private final Locale          m_locale;
    private ProjectResourceBundle m_resourceBundle = null;
-   private final ResourceBundle m_parent;
-   private final String m_packageName;
-   private final String m_projectName;
-   private final String m_resourceName;
-   private boolean      m_loaded;
+   private final ResourceBundle  m_parent;
+   private final String          m_packageName;
+   private final String          m_projectName;
+   private final String          m_resourceName;
+   private boolean               m_loaded;
 
    /**
     * Construct a new ExtendMessages
@@ -70,7 +69,8 @@
       if ( !m_loaded )
       {
          m_resourceBundle =
-            ProjectResourceBundle.getBundle( m_projectName, m_packageName, m_resourceName, m_locale, m_classLoader, m_parent );
+            ProjectResourceBundle.getBundle( m_projectName, m_packageName, m_resourceName, m_locale,
+                                             m_classLoader, m_parent );
          m_loaded = true;
       }
 

Modified: webservices/wsrf/trunk/src/java/org/apache/ws/util/i18n/Messages.java
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/java/org/apache/ws/util/i18n/Messages.java?rev=227033&r1=227032&r2=227033&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/java/org/apache/ws/util/i18n/Messages.java (original)
+++ webservices/wsrf/trunk/src/java/org/apache/ws/util/i18n/Messages.java Tue Aug  2 09:28:49 2005
@@ -19,12 +19,11 @@
 
 /**
  * Provides methods for retrieving i18n messages.
- * 
+ *
  * @author Ian P. Springer <ia...@hp.com>
  */
 public interface Messages
 {
-
    /**
     * Get a message from resource.properties from the package of the given object.
     *
@@ -230,5 +229,4 @@
    String getMessage( String   key,
                       String[] args )
    throws MissingResourceException;
-
 }

Modified: webservices/wsrf/trunk/src/java/org/apache/ws/util/i18n/MessagesImpl.java
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/java/org/apache/ws/util/i18n/MessagesImpl.java?rev=227033&r1=227032&r2=227033&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/java/org/apache/ws/util/i18n/MessagesImpl.java (original)
+++ webservices/wsrf/trunk/src/java/org/apache/ws/util/i18n/MessagesImpl.java Tue Aug  2 09:28:49 2005
@@ -15,6 +15,7 @@
  *=============================================================================*/
 package org.apache.ws.util.i18n;
 
+
 /**
  * Singleton used by all classes below the {@link org.apache.ws.util} package
  * for retrieving i18n messages.
@@ -24,8 +25,10 @@
 public class MessagesImpl
    extends AbstractMessages
 {
+   /** DOCUMENT_ME */
+   public static final String PROJECT_PACKAGE_NAME  = "org.apache.ws.util";
 
-   public static final String PROJECT_PACKAGE_NAME = "org.apache.ws.util";
+   /** DOCUMENT_ME */
    public static final String RESOURCE_PACKAGE_NAME = "org.apache.ws.util.i18n";
    private static Messages    s_ourInstance = new MessagesImpl(  );
 
@@ -58,5 +61,4 @@
    {
       return RESOURCE_PACKAGE_NAME;
    }
-   
 }

Modified: webservices/wsrf/trunk/src/java/org/apache/ws/util/i18n/ProjectResourceBundle.java
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/java/org/apache/ws/util/i18n/ProjectResourceBundle.java?rev=227033&r1=227032&r2=227033&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/java/org/apache/ws/util/i18n/ProjectResourceBundle.java (original)
+++ webservices/wsrf/trunk/src/java/org/apache/ws/util/i18n/ProjectResourceBundle.java Tue Aug  2 09:28:49 2005
@@ -17,7 +17,6 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-
 import java.util.Enumeration;
 import java.util.HashSet;
 import java.util.Hashtable;

Modified: webservices/wsrf/trunk/src/java/org/apache/ws/util/i18n/doclet/ResourcePropertiesGeneratorDoclet.java
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/java/org/apache/ws/util/i18n/doclet/ResourcePropertiesGeneratorDoclet.java?rev=227033&r1=227032&r2=227033&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/java/org/apache/ws/util/i18n/doclet/ResourcePropertiesGeneratorDoclet.java (original)
+++ webservices/wsrf/trunk/src/java/org/apache/ws/util/i18n/doclet/ResourcePropertiesGeneratorDoclet.java Tue Aug  2 09:28:49 2005
@@ -20,7 +20,6 @@
 import com.sun.javadoc.FieldDoc;
 import com.sun.javadoc.RootDoc;
 import com.sun.javadoc.Tag;
-
 import java.io.BufferedWriter;
 import java.io.File;
 import java.io.FileWriter;
@@ -34,7 +33,8 @@
  *
  * @author Ian P. Springer (Hewlett-Packard Company)
  */
-public class ResourcePropertiesGeneratorDoclet extends Doclet
+public class ResourcePropertiesGeneratorDoclet
+   extends Doclet
 {
    /**
     * The writer that is used to write the properties files.
@@ -59,6 +59,39 @@
    protected static String s_fields_with_no_msg_tag = "";
 
    /**
+    * It is necessary to over-ride the super class's
+    * method here because we use custom options.
+    * <p>
+    * -d determines the output directory.  -d was
+    * chosen because it coincides with the output directory
+    * for the standard doclet, which allows developers
+    * to leverage certain advantages when using 3rd
+    * party tools like Ant.
+    * <p>
+    * -p sets the flag that will store each resource bundle in its own package directory [--mazz]
+    * <p>
+    * If the option is unrecognized, 0 should be returned
+    * to express that the option is in error.
+    *
+    * @param option
+    *
+    * @return number of params this option contains
+    */
+   public static int optionLength( String option )
+   {
+      int result = 0;
+      if ( option != null )
+      {
+         if ( option.equals( "-d" ) )
+         {
+            result = 2;
+         }
+      }
+
+      return result;
+   }
+
+   /**
     * The method that gets invoked to process
     * the javadocs.
     *
@@ -74,8 +107,8 @@
        * condition.  This is not true.  That is why this code
        * in this class throws exceptions instead of returning false.
        */
-      boolean    result  = false;
-      String     tagName = "msg";
+      boolean result  = false;
+      String  tagName = "msg";
       processOptions( root.options(  ) );
       result = processSourceFiles( root.classes(  ),
                                    tagName );
@@ -83,6 +116,89 @@
    }
 
    /**
+    * This method closes the output stream to the .properties file if it is
+    * open.
+    */
+   protected static void closeOutputStream(  )
+   {
+      try
+      {
+         if ( s_file_out != null )
+         {
+            s_file_out.flush(  );
+            s_file_out.close(  );
+            s_file_out = null;
+         }
+      }
+      catch ( IOException e )
+      {
+         e.printStackTrace(  );
+      }
+   }
+
+   /**
+    * Opens a properties file for writing.
+    *
+    * @param sourceFile the javadoc representation of a source file.
+    * Used for determining the name of the properties file.
+    */
+   protected static void openOutputFile( ClassDoc sourceFile )
+   {
+      String fileName    = "resource.properties";
+      String packagePath = sourceFile.containingPackage(  ).name(  ).replace( '.', File.separatorChar );
+      String filePath    = s_output_path + File.separator + packagePath + File.separator + fileName;
+      System.out.println( "Writing " + filePath + " ..." );
+      try
+      {
+         s_file_out = new BufferedWriter( new FileWriter( filePath ) );
+      }
+      catch ( IOException e )
+      {
+         e.printStackTrace(  );
+      }
+   }
+
+   /**
+    * This method prints a standard header into the properties files.
+    *
+    * @param sourceFile
+    */
+   protected static void printStandardFileHeader( ClassDoc sourceFile )
+   {
+      String keysFilePath = sourceFile.qualifiedName(  ).replace( '.', File.separatorChar ) + ".java";
+      try
+      {
+         s_file_out.write( "# Resource bundle for package " + sourceFile.containingPackage(  ).name(  )
+                           + " and its subpackages" );
+         s_file_out.newLine(  );
+         s_file_out.write( "# Auto-generated " + new Date(  ) + " from: " + keysFilePath );
+         s_file_out.newLine(  );
+         s_file_out.newLine(  );
+      }
+      catch ( IOException ioe )
+      {
+         ioe.printStackTrace(  );
+      }
+   }
+
+   /**
+    * From the command line options to javadoc, this method extracts
+    * the output path for the properties files.
+    *
+    * @param options from the command line.
+    */
+   protected static void processOptions( String[][] options )
+   {
+      for ( int i = 0; i < options.length; i++ )
+      {
+         if ( ( options[i][0] != null ) && options[i][0].equals( "-d" ) )
+         {
+            s_output_path = options[i][1];
+         }
+      }
+   }
+
+   /**
     * This method looks at each
     * of the <code>java.lang.String</code> fields for each class to see if a @msg tag exists.
     * If more than one @msg tag exists per field, it's an error.  If even one
@@ -123,6 +239,7 @@
                s_is_resource_keys_file = true;
                validate( classes[i], fields[j] );
                writeToPropertiesFile( fields[j].name(  ) + "=" + tags[0].text(  ), classes[i] );
+
                // print a warning since ' causes problems with parameter replacement --mazz
                if ( tags[0].text(  ).indexOf( '\'' ) != -1 )
                {
@@ -176,6 +293,37 @@
    }
 
    /**
+    * Strips any newlines and accompanying white space from a string.
+    *
+    * @param message
+    *
+    * @return
+    */
+   protected static String stripNewLines( String message )
+   {
+      if ( message.indexOf( '\n' ) != -1 )
+      {
+         final StringTokenizer tokenizer = new StringTokenizer( message, "\n" );
+         final StringBuffer    buf = new StringBuffer(  );
+
+         while ( tokenizer.hasMoreTokens(  ) )
+         {
+            final String token = tokenizer.nextToken(  ).trim(  );
+
+            if ( !token.equals( "" ) )
+            {
+               buf.append( token );
+               buf.append( ' ' );
+            }
+         }
+
+         message = buf.toString(  );
+      }
+
+      return ( message.trim(  ) );
+   }
+
+   /**
     * This method makes sure that the field name and its corresponding
     * String value are identical.  If they are not identical, an
     * exception is thrown.  If the field is not of type String, an exception is thrown.
@@ -247,27 +395,6 @@
    }
 
    /**
-    * This method closes the output stream to the .properties file if it is
-    * open.
-    */
-   protected static void closeOutputStream(  )
-   {
-      try
-      {
-         if ( s_file_out != null )
-         {
-            s_file_out.flush(  );
-            s_file_out.close(  );
-            s_file_out = null;
-         }
-      }
-      catch ( IOException e )
-      {
-         e.printStackTrace(  );
-      }
-   }
-
-   /**
     * This method writes to the properties file.  If the file
     * is not open for writing, it opens it and prints a standard
     * header.  If the message containes new lines,
@@ -296,130 +423,4 @@
          e.printStackTrace(  );
       }
    }
-
-   /**
-    * Opens a properties file for writing.
-    *
-    * @param sourceFile the javadoc representation of a source file.
-    * Used for determining the name of the properties file.
-    */
-   protected static void openOutputFile( ClassDoc sourceFile )
-   {
-      String fileName    = "resource.properties";
-      String packagePath = sourceFile.containingPackage(  ).name(  ).replace( '.', File.separatorChar );
-      String filePath    = s_output_path + File.separator + packagePath + File.separator + fileName;
-      System.out.println( "Writing " + filePath + " ..." );
-      try
-      {
-         s_file_out = new BufferedWriter( new FileWriter( filePath ) );
-      }
-      catch ( IOException e )
-      {
-         e.printStackTrace(  );
-      }
-   }
-
-   /**
-    * This method prints a standard header into the properties files.
-    *
-    * @param sourceFile
-    */
-   protected static void printStandardFileHeader( ClassDoc sourceFile )
-   {
-      String keysFilePath = sourceFile.qualifiedName(  ).replace( '.', File.separatorChar ) + ".java";
-      try
-      {
-         s_file_out.write( "# Resource bundle for package " + sourceFile.containingPackage(  ).name(  ) + " and its subpackages" );
-         s_file_out.newLine(  );
-         s_file_out.write( "# Auto-generated " + new Date() + " from: " + keysFilePath );
-         s_file_out.newLine(  );
-         s_file_out.newLine(  );         
-      }
-      catch ( IOException ioe )
-      {
-         ioe.printStackTrace(  );
-      }
-   }
-
-   /**
-    * Strips any newlines and accompanying white space from a string.
-    *
-    * @param message
-    *
-    * @return
-    */
-   protected static String stripNewLines( String message )
-   {
-      if ( message.indexOf( '\n' ) != -1 )
-      {
-         final StringTokenizer tokenizer = new StringTokenizer( message, "\n" );
-         final StringBuffer    buf = new StringBuffer(  );
-
-         while ( tokenizer.hasMoreTokens(  ) )
-         {
-            final String token = tokenizer.nextToken(  ).trim(  );
-
-            if ( !token.equals( "" ) )
-            {
-               buf.append( token );
-               buf.append( ' ' );
-            }
-         }
-
-         message = buf.toString(  );
-      }
-
-      return ( message.trim(  ) );
-   }
-
-   /**
-    * It is necessary to over-ride the super class's
-    * method here because we use custom options.
-    * <p>
-    * -d determines the output directory.  -d was
-    * chosen because it coincides with the output directory
-    * for the standard doclet, which allows developers
-    * to leverage certain advantages when using 3rd
-    * party tools like Ant.
-    * <p>
-    * -p sets the flag that will store each resource bundle in its own package directory [--mazz]
-    * <p>
-    * If the option is unrecognized, 0 should be returned
-    * to express that the option is in error.
-    *
-    * @param option
-    *
-    * @return number of params this option contains
-    */
-   public static int optionLength( String option )
-   {
-      int result = 0;
-      if ( option != null )
-      {
-         if ( option.equals( "-d" ) )
-         {
-            result = 2;
-         }
-      }
-      return result;
-   }
-
-   /**
-    * From the command line options to javadoc, this method extracts
-    * the output path for the properties files.
-    *
-    * @param options from the command line.
-    */
-   protected static void processOptions( String[][] options )
-   {
-      for ( int i = 0; i < options.length; i++ )
-      {
-         if ( ( options[i][0] != null ) && options[i][0].equals( "-d" ) )
-         {
-            s_output_path = options[i][1];
-         }
-      }
-   }
-
-
-}
+}
\ No newline at end of file

Modified: webservices/wsrf/trunk/src/java/org/apache/ws/util/jndi/BasicBeanFactory.java
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/java/org/apache/ws/util/jndi/BasicBeanFactory.java?rev=227033&r1=227032&r2=227033&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/java/org/apache/ws/util/jndi/BasicBeanFactory.java (original)
+++ webservices/wsrf/trunk/src/java/org/apache/ws/util/jndi/BasicBeanFactory.java Tue Aug  2 09:28:49 2005
@@ -17,7 +17,6 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-
 import javax.naming.Context;
 import javax.naming.Name;
 import javax.naming.NamingException;
@@ -31,32 +30,41 @@
  *
  * @author Globus
  */
-public class BasicBeanFactory extends org.apache.naming.factory.BeanFactory {
-    
+public class BasicBeanFactory
+   extends org.apache.naming.factory.BeanFactory
+{
    private static final Log LOG = LogFactory.getLog( BasicBeanFactory.class );
-    /**
-     * Create a new Bean instance. If the created bean implements
-     * <code>Initializable</code> interface, the <code>initialize()</code>
-     * function will be called after the bean is created and all properties
-     * are set.
-     */
-    public Object getObjectInstance(Object obj, Name name, Context nameCtx,
-                                    Hashtable environment)
-        throws NamingException {
-        LOG.debug( "Creating instance of " + obj.getClass().getName() + " bean " + " and adding to JNDI registry with name " + name + " ..." );
-        Object bean = super.getObjectInstance(obj, name, nameCtx, environment);
-        if (bean instanceof Initializable) {
-            try {
-                LOG.debug("Calling init() on the bean: " + bean.getClass().getName());
-                ((Initializable)bean).init();
-            } catch (Exception e) {
-                NamingException ex =
-                    new NamingException("beanInitFailed");
-                ex.setRootCause(e);
-                throw ex;
-            }
-        }
-        return bean;
-    }
-    
-}
+
+   /**
+    * Create a new Bean instance. If the created bean implements
+    * <code>Initializable</code> interface, the <code>initialize()</code>
+    * function will be called after the bean is created and all properties
+    * are set.
+    */
+   public Object getObjectInstance( Object    obj,
+                                    Name      name,
+                                    Context   nameCtx,
+                                    Hashtable environment )
+   throws NamingException
+   {
+      LOG.debug( "Creating instance of " + obj.getClass(  ).getName(  ) + " bean "
+                 + " and adding to JNDI registry with name " + name + " ..." );
+      Object bean = super.getObjectInstance( obj, name, nameCtx, environment );
+      if ( bean instanceof Initializable )
+      {
+         try
+         {
+            LOG.debug( "Calling init() on the bean: " + bean.getClass(  ).getName(  ) );
+            ( (Initializable) bean ).init(  );
+         }
+         catch ( Exception e )
+         {
+            NamingException ex = new NamingException( "beanInitFailed" );
+            ex.setRootCause( e );
+            throw ex;
+         }
+      }
+
+      return bean;
+   }
+}
\ No newline at end of file