servicemix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject svn commit: r564607 [2/12] - in /incubator/servicemix/trunk/core/servicemix-core/src: main/java/org/apache/servicemix/ main/java/org/apache/servicemix/jbi/ main/java/org/apache/servicemix/jbi/framework/ main/java/org/apache/servicemix/jbi/framework/sup...
Date Fri, 10 Aug 2007 14:38:14 GMT
Modified: incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/support/WSDL1Processor.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/support/WSDL1Processor.java?view=diff&rev=564607&r1=564606&r2=564607
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/support/WSDL1Processor.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/support/WSDL1Processor.java Fri Aug 10 07:37:46 2007
@@ -24,13 +24,14 @@
 import javax.wsdl.xml.WSDLReader;
 import javax.xml.namespace.QName;
 
+import org.w3c.dom.Document;
+
+import com.ibm.wsdl.Constants;
+
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.servicemix.jbi.framework.Registry;
 import org.apache.servicemix.jbi.servicedesc.InternalEndpoint;
-import org.w3c.dom.Document;
-
-import com.ibm.wsdl.Constants;
 
 /**
  * Retrieve interface implemented by the given endpoint using the WSDL 1 description.
@@ -41,12 +42,12 @@
 
     public static final String WSDL1_NAMESPACE = "http://schemas.xmlsoap.org/wsdl/";
     
-    private static final Log logger = LogFactory.getLog(WSDL1Processor.class);
+    private static final Log LOG = LogFactory.getLog(WSDL1Processor.class);
     
     private Registry registry;
     
-    public void init(Registry registry) {
-        this.registry = registry;
+    public void init(Registry reg) {
+        this.registry = reg;
     }
 
     /**
@@ -58,14 +59,14 @@
         try {
             Document document = registry.getEndpointDescriptor(serviceEndpoint);
             if (document == null || document.getDocumentElement() == null) {
-                if (logger.isDebugEnabled()) {
-                    logger.debug("Endpoint " + serviceEndpoint + " has no service description");
+                if (LOG.isDebugEnabled()) {
+                    LOG.debug("Endpoint " + serviceEndpoint + " has no service description");
                 }
                 return;
             }
             if (!WSDL1_NAMESPACE.equals(document.getDocumentElement().getNamespaceURI())) {
-                if (logger.isDebugEnabled()) {
-                    logger.debug("Endpoint " + serviceEndpoint + " has a non WSDL1 service description");
+                if (LOG.isDebugEnabled()) {
+                    LOG.debug("Endpoint " + serviceEndpoint + " has a non WSDL1 service description");
                 }
                 return;
             }
@@ -75,43 +76,45 @@
             // Check if the wsdl is only a port type
             // In these cases, only the port type is used, as the service name and endpoint name
             // are provided on the jbi endpoint
-            if (definition.getPortTypes().keySet().size() == 1 &&
-                definition.getServices().keySet().size() == 0) {
+            if (definition.getPortTypes().keySet().size() == 1
+                    && definition.getServices().keySet().size() == 0) {
                 PortType portType = (PortType) definition.getPortTypes().values().iterator().next();
                 QName interfaceName = portType.getQName();
-                if (logger.isDebugEnabled()) {
-                    logger.debug("Endpoint " + serviceEndpoint + " implements interface " + interfaceName);
+                if (LOG.isDebugEnabled()) {
+                    LOG.debug("Endpoint " + serviceEndpoint + " implements interface " + interfaceName);
                 }
                 serviceEndpoint.addInterface(interfaceName);
             } else {
                 Service service = definition.getService(serviceEndpoint.getServiceName());
                 if (service == null) {
-                    logger.info("Endpoint " + serviceEndpoint + " has a service description, but no matching service found in " + definition.getServices().keySet());
+                    LOG.info("Endpoint " + serviceEndpoint + " has a service description, but no matching service found in "
+                                    + definition.getServices().keySet());
                     return;
                 }
                 Port port = service.getPort(serviceEndpoint.getEndpointName());
                 if (port == null) {
-                    logger.info("Endpoint " + serviceEndpoint + " has a service description, but no matching endpoint found in " + service.getPorts().keySet());
+                    LOG.info("Endpoint " + serviceEndpoint + " has a service description, but no matching endpoint found in "
+                                    + service.getPorts().keySet());
                     return;
                 }
                 if (port.getBinding() == null) {
-                    logger.info("Endpoint " + serviceEndpoint + " has a service description, but no binding found");
+                    LOG.info("Endpoint " + serviceEndpoint + " has a service description, but no binding found");
                     return;
                 }
                 if (port.getBinding().getPortType() == null) {
-                    logger.info("Endpoint " + serviceEndpoint + " has a service description, but no port type found");
+                    LOG.info("Endpoint " + serviceEndpoint + " has a service description, but no port type found");
                     return;
                 }
                 QName interfaceName = port.getBinding().getPortType().getQName();
-                if (logger.isDebugEnabled()) {
-                    logger.debug("Endpoint " + serviceEndpoint + " implements interface " + interfaceName);
+                if (LOG.isDebugEnabled()) {
+                    LOG.debug("Endpoint " + serviceEndpoint + " implements interface " + interfaceName);
                 }
                 serviceEndpoint.addInterface(interfaceName);
             }
         } catch (Exception e) {
-            logger.warn("Error retrieving interfaces from service description: " + e.getMessage());
-            if (logger.isDebugEnabled()) {
-                logger.debug("Error retrieving interfaces from service description", e);
+            LOG.warn("Error retrieving interfaces from service description: " + e.getMessage());
+            if (LOG.isDebugEnabled()) {
+                LOG.debug("Error retrieving interfaces from service description", e);
             }
         }
     }

Modified: incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/support/WSDL2Processor.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/support/WSDL2Processor.java?view=diff&rev=564607&r1=564606&r2=564607
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/support/WSDL2Processor.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/support/WSDL2Processor.java Fri Aug 10 07:37:46 2007
@@ -18,6 +18,8 @@
 
 import javax.xml.namespace.QName;
 
+import org.w3c.dom.Document;
+
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.servicemix.jbi.framework.Registry;
@@ -31,7 +33,6 @@
 import org.apache.woden.wsdl20.Interface;
 import org.apache.woden.wsdl20.Service;
 import org.apache.woden.wsdl20.xml.DescriptionElement;
-import org.w3c.dom.Document;
 
 /**
  * Retrieve interface implemented by the given endpoint using the WSDL 2 description.
@@ -42,12 +43,12 @@
 
     public static final String WSDL2_NAMESPACE = "http://www.w3.org/2006/01/wsdl";
 
-    private static final Log logger = LogFactory.getLog(WSDL2Processor.class);
+    private static final Log LOG = LogFactory.getLog(WSDL2Processor.class);
     
     private Registry registry;
     
-    public void init(Registry registry) {
-        this.registry = registry;
+    public void init(Registry reg) {
+        this.registry = reg;
     }
 
     /**
@@ -59,14 +60,14 @@
         try {
             Document document = registry.getEndpointDescriptor(serviceEndpoint);
             if (document == null || document.getDocumentElement() == null) {
-                if (logger.isDebugEnabled()) {
-                    logger.debug("Endpoint " + serviceEndpoint + " has no service description");
+                if (LOG.isDebugEnabled()) {
+                    LOG.debug("Endpoint " + serviceEndpoint + " has no service description");
                 }
                 return;
             }
             if (!WSDL2_NAMESPACE.equals(document.getDocumentElement().getNamespaceURI())) {
-                if (logger.isDebugEnabled()) {
-                    logger.debug("Endpoint " + serviceEndpoint + " has a non WSDL2 service description");
+                if (LOG.isDebugEnabled()) {
+                    LOG.debug("Endpoint " + serviceEndpoint + " has a non WSDL2 service description");
                 }
                 return;
             }
@@ -81,39 +82,41 @@
             if (desc.getInterfaces().length == 1 && desc.getServices().length == 0) {
                 Interface itf = desc.getInterfaces()[0];
                 QName interfaceName = itf.getName();
-                if (logger.isDebugEnabled()) {
-                    logger.debug("Endpoint " + serviceEndpoint + " implements interface " + interfaceName);
+                if (LOG.isDebugEnabled()) {
+                    LOG.debug("Endpoint " + serviceEndpoint + " implements interface " + interfaceName);
                 }
                 serviceEndpoint.addInterface(interfaceName);
             } else {
                 Service service = desc.getService(serviceEndpoint.getServiceName());
                 if (service == null) {
-                    logger.info("Endpoint " + serviceEndpoint + " has a service description, but no matching service found in " + desc.getServices());
+                    LOG.info("Endpoint " + serviceEndpoint + " has a service description, but no matching service found in "
+                                    + desc.getServices());
                     return;
                 }
                 Endpoint endpoint = service.getEndpoint(new NCName(serviceEndpoint.getEndpointName()));
                 if (endpoint == null) {
-                    logger.info("Endpoint " + serviceEndpoint + " has a service description, but no matching endpoint found in " + service.getEndpoints());
+                    LOG.info("Endpoint " + serviceEndpoint + " has a service description, but no matching endpoint found in "
+                                    + service.getEndpoints());
                     return;
                 }
                 if (endpoint.getBinding() == null) {
-                    logger.info("Endpoint " + serviceEndpoint + " has a service description, but no binding found");
+                    LOG.info("Endpoint " + serviceEndpoint + " has a service description, but no binding found");
                     return;
                 }
                 if (endpoint.getBinding().getInterface() == null) {
-                    logger.info("Endpoint " + serviceEndpoint + " has a service description, but no port type found");
+                    LOG.info("Endpoint " + serviceEndpoint + " has a service description, but no port type found");
                     return;
                 }
                 QName interfaceName = endpoint.getBinding().getInterface().getName();
-                if (logger.isDebugEnabled()) {
-                    logger.debug("Endpoint " + serviceEndpoint + " implements interface " + interfaceName);
+                if (LOG.isDebugEnabled()) {
+                    LOG.debug("Endpoint " + serviceEndpoint + " implements interface " + interfaceName);
                 }
                 serviceEndpoint.addInterface(interfaceName);
             }
         } catch (Exception e) {
-            logger.warn("Error retrieving interfaces from service description: " + e.getMessage());
-            if (logger.isDebugEnabled()) {
-                logger.debug("Error retrieving interfaces from service description", e);
+            LOG.warn("Error retrieving interfaces from service description: " + e.getMessage());
+            if (LOG.isDebugEnabled()) {
+                LOG.debug("Error retrieving interfaces from service description", e);
             }
         }
     }

Modified: incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/jaxp/BytesSource.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/jaxp/BytesSource.java?view=diff&rev=564607&r1=564606&r2=564607
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/jaxp/BytesSource.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/jaxp/BytesSource.java Fri Aug 10 07:37:46 2007
@@ -21,7 +21,6 @@
 import java.io.InputStreamReader;
 import java.io.Reader;
 
-import javax.xml.transform.Source;
 import javax.xml.transform.stream.StreamSource;
 
 /**

Modified: incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/jaxp/DOMStreamReader.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/jaxp/DOMStreamReader.java?view=diff&rev=564607&r1=564606&r2=564607
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/jaxp/DOMStreamReader.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/jaxp/DOMStreamReader.java Fri Aug 10 07:37:46 2007
@@ -33,48 +33,43 @@
 import org.apache.servicemix.jbi.util.FastStack;
 
 /**
- * Abstract logic for creating XMLStreamReader from DOM documents.
- * Its works using adapters for Element, Node and Attribute ( @see ElementAdapter }
+ * Abstract logic for creating XMLStreamReader from DOM documents. Its works
+ * using adapters for Element, Node and Attribute (
+ * 
+ * @see ElementAdapter }
  * 
  * @author <a href="mailto:tsztelak@gmail.com">Tomasz Sztelak</a>
  */
 public abstract class DOMStreamReader implements XMLStreamReader {
-    public Map properties = new HashMap();
-
-    private FastStack<ElementFrame> frames = new FastStack<ElementFrame>();
 
-    private ElementFrame frame;
+    protected Map properties = new HashMap();
 
     protected int currentEvent = XMLStreamConstants.START_DOCUMENT;
 
+    protected FastStack<ElementFrame> frames = new FastStack<ElementFrame>();
+
+    protected ElementFrame frame;
+
     /**
-     *     
+     * 
      */
     public static class ElementFrame {
-        public ElementFrame(Object element, ElementFrame parent) {
-            this.element = element;
-            this.parent = parent;
-        }
 
         Object element;
-
-        boolean started = false;
-
-        boolean ended = false;
-
+        boolean started;
+        boolean ended;
         int currentChild = -1;
-
         int currentAttribute = -1;
-
         int currentElement = -1;
-
         List<String> uris;
-
         List<String> prefixes;
-
         List attributes;
-
         final ElementFrame parent;
+
+        public ElementFrame(Object element, ElementFrame parent) {
+            this.element = element;
+            this.parent = parent;
+        }
     }
 
     /**
@@ -90,14 +85,18 @@
         return frame;
     }
 
-    /* (non-Javadoc)
+    /*
+     * (non-Javadoc)
+     * 
      * @see javax.xml.stream.XMLStreamReader#getProperty(java.lang.String)
      */
     public Object getProperty(String key) throws IllegalArgumentException {
         return properties.get(key);
     }
 
-    /* (non-Javadoc)
+    /*
+     * (non-Javadoc)
+     * 
      * @see javax.xml.stream.XMLStreamReader#next()
      */
     public int next() throws XMLStreamException {
@@ -146,36 +145,46 @@
     }
 
     protected abstract int moveToChild(int currentChild);
-
+    
     protected abstract ElementFrame getChildFrame(int currentChild);
-
+    
     protected abstract int getChildCount();
 
-    /* (non-Javadoc)
-     * @see javax.xml.stream.XMLStreamReader#require(int, java.lang.String, java.lang.String)
+    /*
+     * (non-Javadoc)
+     * 
+     * @see javax.xml.stream.XMLStreamReader#require(int, java.lang.String,
+     *      java.lang.String)
      */
     public void require(int arg0, String arg1, String arg2) throws XMLStreamException {
         throw new UnsupportedOperationException();
     }
 
-    /* (non-Javadoc)
+    /*
+     * (non-Javadoc)
+     * 
      * @see javax.xml.stream.XMLStreamReader#getElementText()
      */
     public abstract String getElementText() throws XMLStreamException;
 
-    /* (non-Javadoc)
+    /*
+     * (non-Javadoc)
+     * 
      * @see javax.xml.stream.XMLStreamReader#nextTag()
      */
     public int nextTag() throws XMLStreamException {
         while (hasNext()) {
-            if (START_ELEMENT == next())
+            if (START_ELEMENT == next()) {
                 return START_ELEMENT;
+            }
         }
 
         return currentEvent;
     }
 
-    /* (non-Javadoc)
+    /*
+     * (non-Javadoc)
+     * 
      * @see javax.xml.stream.XMLStreamReader#hasNext()
      */
     public boolean hasNext() throws XMLStreamException {
@@ -183,43 +192,55 @@
 
     }
 
-    /* (non-Javadoc)
+    /*
+     * (non-Javadoc)
+     * 
      * @see javax.xml.stream.XMLStreamReader#close()
      */
     public void close() throws XMLStreamException {
     }
 
-    /* (non-Javadoc)
+    /*
+     * (non-Javadoc)
+     * 
      * @see javax.xml.stream.XMLStreamReader#getNamespaceURI(java.lang.String)
      */
     public abstract String getNamespaceURI(String prefix);
 
-    /* (non-Javadoc)
+    /*
+     * (non-Javadoc)
+     * 
      * @see javax.xml.stream.XMLStreamReader#isStartElement()
      */
     public boolean isStartElement() {
-        return (currentEvent == START_ELEMENT);
+        return currentEvent == START_ELEMENT;
     }
 
-    /* (non-Javadoc)
+    /*
+     * (non-Javadoc)
+     * 
      * @see javax.xml.stream.XMLStreamReader#isEndElement()
      */
     public boolean isEndElement() {
-        return (currentEvent == END_ELEMENT);
+        return currentEvent == END_ELEMENT;
     }
 
-    /* (non-Javadoc)
+    /*
+     * (non-Javadoc)
+     * 
      * @see javax.xml.stream.XMLStreamReader#isCharacters()
      */
     public boolean isCharacters() {
-        return (currentEvent == CHARACTERS);
+        return currentEvent == CHARACTERS;
     }
 
-    /* (non-Javadoc)
+    /*
+     * (non-Javadoc)
+     * 
      * @see javax.xml.stream.XMLStreamReader#isWhiteSpace()
      */
     public boolean isWhiteSpace() {
-        return (currentEvent == SPACE);
+        return currentEvent == SPACE;
     }
 
     public int getEventType() {
@@ -229,8 +250,9 @@
     public int getTextCharacters(int sourceStart, char[] target, int targetStart, int length) throws XMLStreamException {
         char[] src = getText().toCharArray();
 
-        if (sourceStart + length >= src.length)
+        if (sourceStart + length >= src.length) {
             length = src.length - sourceStart;
+        }
 
         for (int i = 0; i < length; i++) {
             target[targetStart + i] = src[i + sourceStart];
@@ -240,8 +262,9 @@
     }
 
     public boolean hasText() {
-        return (currentEvent == CHARACTERS || currentEvent == DTD || currentEvent == ENTITY_REFERENCE
-                        || currentEvent == COMMENT || currentEvent == SPACE);
+        return currentEvent == CHARACTERS || currentEvent == DTD
+            || currentEvent == ENTITY_REFERENCE || currentEvent == COMMENT
+            || currentEvent == SPACE;
     }
 
     public Location getLocation() {
@@ -271,7 +294,7 @@
     }
 
     public boolean hasName() {
-        return (currentEvent == START_ELEMENT || currentEvent == END_ELEMENT);
+        return currentEvent == START_ELEMENT || currentEvent == END_ELEMENT;
     }
 
     public String getVersion() {

Modified: incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/jaxp/DOMStreamWriter.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/jaxp/DOMStreamWriter.java?view=diff&rev=564607&r1=564606&r2=564607
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/jaxp/DOMStreamWriter.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/jaxp/DOMStreamWriter.java Fri Aug 10 07:37:46 2007
@@ -24,16 +24,11 @@
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamWriter;
 
-public abstract class DOMStreamWriter implements XMLStreamWriter
-{
+public abstract class DOMStreamWriter implements XMLStreamWriter {
 
-    public void close()
-        throws XMLStreamException
-    {
+    public void close() throws XMLStreamException {
     }
 
-    public void flush()
-        throws XMLStreamException
-    {
+    public void flush() throws XMLStreamException {
     }
 }

Modified: incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/jaxp/ExtendedNamespaceContext.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/jaxp/ExtendedNamespaceContext.java?view=diff&rev=564607&r1=564606&r2=564607
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/jaxp/ExtendedNamespaceContext.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/jaxp/ExtendedNamespaceContext.java Fri Aug 10 07:37:46 2007
@@ -22,11 +22,12 @@
 
 public interface ExtendedNamespaceContext extends NamespaceContext {
 
-	/**
-	 * Returns an {@link Iterator} of all namespace prefixes in scope within this
-	 * context, including those inherited from ancestor contexts.
-	 * 
-	 * @return An {@link Iterator} of prefix {@link String}s.
-	 */
-    public Iterator getPrefixes();
+    /**
+     * Returns an {@link Iterator} of all namespace prefixes in scope within
+     * this context, including those inherited from ancestor contexts.
+     * 
+     * @return An {@link Iterator} of prefix {@link String}s.
+     */
+    Iterator getPrefixes();
+
 }

Modified: incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/jaxp/ExtendedXMLStreamReader.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/jaxp/ExtendedXMLStreamReader.java?view=diff&rev=564607&r1=564606&r2=564607
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/jaxp/ExtendedXMLStreamReader.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/jaxp/ExtendedXMLStreamReader.java Fri Aug 10 07:37:46 2007
@@ -20,6 +20,7 @@
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.Map;
+import java.util.Set;
 
 import javax.xml.namespace.NamespaceContext;
 import javax.xml.stream.XMLStreamConstants;
@@ -29,111 +30,111 @@
 
 public class ExtendedXMLStreamReader extends StreamReaderDelegate {
 
-	private SimpleNamespaceContext context = new SimpleNamespaceContext();
-	
-	public ExtendedXMLStreamReader(XMLStreamReader delegate) {
-		super(delegate);
-	}
-
-	public NamespaceContext getNamespaceContext() {
-		return context;
-	}
-	
+    private SimpleNamespaceContext context = new SimpleNamespaceContext();
+
+    public ExtendedXMLStreamReader(XMLStreamReader delegate) {
+        super(delegate);
+    }
+
+    public NamespaceContext getNamespaceContext() {
+        return context;
+    }
+
     public int nextTag() throws XMLStreamException {
-    	int eventType = next();
-    	 while((eventType == XMLStreamConstants.CHARACTERS && isWhiteSpace()) // skip whitespace
-	    	 || (eventType == XMLStreamConstants.CDATA && isWhiteSpace()) 
-	    	 // skip whitespace
-	    	 || eventType == XMLStreamConstants.SPACE
-	    	 || eventType == XMLStreamConstants.PROCESSING_INSTRUCTION
-	    	 || eventType == XMLStreamConstants.COMMENT
-	    	 ) {
-	    	 eventType = next();
-    	 }
-    	 if (eventType != XMLStreamConstants.START_ELEMENT && eventType != XMLStreamConstants.END_ELEMENT) {
-    	 	throw new XMLStreamException("expected start or end tag", getLocation());
-    	 }
-    	 return eventType;
-    }
-
-	public int next() throws XMLStreamException {
-		int next = super.next();
-		if (next == START_ELEMENT) {
-			context = new SimpleNamespaceContext(context, getNamespaces());
-		} else if (next == END_ELEMENT) {
-			context = context.getParent();
-		}
-		return next;
-	}
-
-	private Map getNamespaces() {
-		Map ns = new HashMap();
-		for (int i = 0; i < getNamespaceCount(); i++) {
-			ns.put(getNamespacePrefix(i), getNamespaceURI(i));
-		}
-		return ns;
-	}
-	
-	public static class SimpleNamespaceContext implements ExtendedNamespaceContext {
-
-		private SimpleNamespaceContext parent;
-		private Map namespaces;
-		
-		public SimpleNamespaceContext() {
-			namespaces = new HashMap();
-		}
-
-		public SimpleNamespaceContext(SimpleNamespaceContext parent, Map namespaces) {
-			this.parent = parent;
-			this.namespaces = namespaces;
-		}
-
-		public SimpleNamespaceContext getParent() {
-			return parent;
-		}
-		
-		public Iterator getPrefixes() {
-			HashSet prefixes = new HashSet();
-			for (SimpleNamespaceContext context = this; context != null; context = context.parent) {
-				prefixes.addAll(context.namespaces.keySet());
-			}
-			return prefixes.iterator();
-		}
-
-		public String getNamespaceURI(String prefix) {
-			String uri = (String) namespaces.get(prefix);
-			if (uri == null && parent != null) {
-				uri = parent.getNamespaceURI(prefix);
-			}
-			return uri;
-		}
-
-		public String getPrefix(String namespaceURI) {
-			for (SimpleNamespaceContext context = this; context != null; context = context.parent) {
-				for (Iterator it = context.namespaces.keySet().iterator(); it.hasNext();) {
-					Map.Entry entry = (Map.Entry) it.next();
-					if (entry.getValue().equals(namespaceURI)) {
-						return (String) entry.getKey();
-					}
-				}
-			}
-			return null;
-		}
-
-		public Iterator getPrefixes(String namespaceURI) {
-			HashSet prefixes = new HashSet();
-			for (SimpleNamespaceContext context = this; context != null; context = context.parent) {
-				for (Iterator it = context.namespaces.keySet().iterator(); it.hasNext();) {
-					Map.Entry entry = (Map.Entry) it.next();
-					if (entry.getValue().equals(namespaceURI)) {
-						prefixes.add(entry.getKey());
-					}
-				}
-			}
-			return prefixes.iterator();
-		}
-		
-	}
+        int eventType = next();
+        while ((eventType == XMLStreamConstants.CHARACTERS && isWhiteSpace())
+                        // skip whitespace
+                        || (eventType == XMLStreamConstants.CDATA && isWhiteSpace())
+                        // skip whitespace
+                        || eventType == XMLStreamConstants.SPACE
+                        || eventType == XMLStreamConstants.PROCESSING_INSTRUCTION
+                        || eventType == XMLStreamConstants.COMMENT) {
+            eventType = next();
+        }
+        if (eventType != XMLStreamConstants.START_ELEMENT && eventType != XMLStreamConstants.END_ELEMENT) {
+            throw new XMLStreamException("expected start or end tag", getLocation());
+        }
+        return eventType;
+    }
+
+    public int next() throws XMLStreamException {
+        int next = super.next();
+        if (next == START_ELEMENT) {
+            context = new SimpleNamespaceContext(context, getNamespaces());
+        } else if (next == END_ELEMENT) {
+            context = context.getParent();
+        }
+        return next;
+    }
 
+    private Map getNamespaces() {
+        Map ns = new HashMap();
+        for (int i = 0; i < getNamespaceCount(); i++) {
+            ns.put(getNamespacePrefix(i), getNamespaceURI(i));
+        }
+        return ns;
+    }
+
+    public static class SimpleNamespaceContext implements ExtendedNamespaceContext {
+
+        private SimpleNamespaceContext parent;
+
+        private Map namespaces;
+
+        public SimpleNamespaceContext() {
+            namespaces = new HashMap();
+        }
+
+        public SimpleNamespaceContext(SimpleNamespaceContext parent, Map namespaces) {
+            this.parent = parent;
+            this.namespaces = namespaces;
+        }
+
+        public SimpleNamespaceContext getParent() {
+            return parent;
+        }
+
+        public Iterator getPrefixes() {
+            Set prefixes = new HashSet();
+            for (SimpleNamespaceContext context = this; context != null; context = context.parent) {
+                prefixes.addAll(context.namespaces.keySet());
+            }
+            return prefixes.iterator();
+        }
+
+        public String getNamespaceURI(String prefix) {
+            String uri = (String) namespaces.get(prefix);
+            if (uri == null && parent != null) {
+                uri = parent.getNamespaceURI(prefix);
+            }
+            return uri;
+        }
+
+        public String getPrefix(String namespaceURI) {
+            for (SimpleNamespaceContext context = this; context != null; context = context.parent) {
+                for (Iterator it = context.namespaces.keySet().iterator(); it.hasNext();) {
+                    Map.Entry entry = (Map.Entry) it.next();
+                    if (entry.getValue().equals(namespaceURI)) {
+                        return (String) entry.getKey();
+                    }
+                }
+            }
+            return null;
+        }
+
+        public Iterator getPrefixes(String namespaceURI) {
+            Set prefixes = new HashSet();
+            for (SimpleNamespaceContext context = this; context != null; context = context.parent) {
+                for (Iterator it = context.namespaces.keySet().iterator(); it.hasNext();) {
+                    Map.Entry entry = (Map.Entry) it.next();
+                    if (entry.getValue().equals(namespaceURI)) {
+                        prefixes.add(entry.getKey());
+                    }
+                }
+            }
+            return prefixes.iterator();
+        }
+
+    }
 
 }

Modified: incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/jaxp/FragmentStreamReader.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/jaxp/FragmentStreamReader.java?view=diff&rev=564607&r1=564606&r2=564607
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/jaxp/FragmentStreamReader.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/jaxp/FragmentStreamReader.java Fri Aug 10 07:37:46 2007
@@ -28,119 +28,120 @@
 
 public class FragmentStreamReader extends StreamReaderDelegate implements XMLStreamReader {
 
-	private static final int STATE_START_DOC = 0;
-	private static final int STATE_FIRST_ELEM = 1;
-	private static final int STATE_FIRST_RUN = 2;
-	private static final int STATE_RUN = 3;
-	private static final int STATE_END_DOC = 4;
-	
-	private int depth;
-	private int state = STATE_START_DOC;
-	private int event = START_DOCUMENT;
-	private List rootPrefixes;
-	
-	public FragmentStreamReader(XMLStreamReader parent) {
-		super(parent);
-		rootPrefixes = new ArrayList();
-		NamespaceContext ctx = getParent().getNamespaceContext();
-		if (ctx instanceof ExtendedNamespaceContext) {
-			Iterator it = ((ExtendedNamespaceContext) ctx).getPrefixes();
-			while (it.hasNext()) {
-				String prefix = (String) it.next();
-				rootPrefixes.add(prefix);
-			}
-		}
-	}
-	
-	public int getEventType() {
-		return event;
-	}
+    private static final int STATE_START_DOC = 0;
+    private static final int STATE_FIRST_ELEM = 1;
+    private static final int STATE_FIRST_RUN = 2;
+    private static final int STATE_RUN = 3;
+    private static final int STATE_END_DOC = 4;
+
+    private int depth;
+    private int state = STATE_START_DOC;
+    private int event = START_DOCUMENT;
+    private List rootPrefixes;
+
+    public FragmentStreamReader(XMLStreamReader parent) {
+        super(parent);
+        rootPrefixes = new ArrayList();
+        NamespaceContext ctx = getParent().getNamespaceContext();
+        if (ctx instanceof ExtendedNamespaceContext) {
+            Iterator it = ((ExtendedNamespaceContext) ctx).getPrefixes();
+            while (it.hasNext()) {
+                String prefix = (String) it.next();
+                rootPrefixes.add(prefix);
+            }
+        }
+    }
+
+    public int getEventType() {
+        return event;
+    }
 
     public boolean hasNext() throws XMLStreamException {
         return event != END_DOCUMENT;
     }
 
-	public int next() throws XMLStreamException {
-		switch (state) {
-		case STATE_START_DOC:
-			state = STATE_FIRST_ELEM;
-			event = START_DOCUMENT;
-			break;
-		case STATE_FIRST_ELEM:
-			state = STATE_FIRST_RUN;
-			depth++;
-			event = START_ELEMENT;
-			break;
-		case STATE_FIRST_RUN:
-			state = STATE_RUN;
-			// do not break
-		case STATE_RUN:
-			event = getParent().next();
-			if (event == START_ELEMENT) {
-				depth++;
-			} else if (event == END_ELEMENT) {
-				depth--;
-				if (depth == 0) {
-					state = STATE_END_DOC;
-				}
-			}
-			break;
-		case STATE_END_DOC:
-			event = END_DOCUMENT;
-			break;
-		default:
-			throw new IllegalStateException();
-		}
-		return event;
-	}
+    public int next() throws XMLStreamException {
+        switch (state) {
+        case STATE_START_DOC:
+            state = STATE_FIRST_ELEM;
+            event = START_DOCUMENT;
+            break;
+        case STATE_FIRST_ELEM:
+            state = STATE_FIRST_RUN;
+            depth++;
+            event = START_ELEMENT;
+            break;
+        case STATE_FIRST_RUN:
+        case STATE_RUN:
+            state = STATE_RUN;
+            event = getParent().next();
+            if (event == START_ELEMENT) {
+                depth++;
+            } else if (event == END_ELEMENT) {
+                depth--;
+                if (depth == 0) {
+                    state = STATE_END_DOC;
+                }
+            }
+            break;
+        case STATE_END_DOC:
+            event = END_DOCUMENT;
+            break;
+        default:
+            throw new IllegalStateException();
+        }
+        return event;
+    }
 
     public int nextTag() throws XMLStreamException {
         int eventType = next();
-        while((eventType == XMLStreamConstants.CHARACTERS && isWhiteSpace()) // skip whitespace
-            || (eventType == XMLStreamConstants.CDATA && isWhiteSpace()) // skip whitespace
-            || eventType == XMLStreamConstants.SPACE
-            || eventType == XMLStreamConstants.PROCESSING_INSTRUCTION
-            || eventType == XMLStreamConstants.COMMENT) {
+        while ((eventType == XMLStreamConstants.CHARACTERS && isWhiteSpace()) // skip
+                                                                                // whitespace
+                        || (eventType == XMLStreamConstants.CDATA && isWhiteSpace()) // skip
+                                                                                        // whitespace
+                        || eventType == XMLStreamConstants.SPACE
+                        || eventType == XMLStreamConstants.PROCESSING_INSTRUCTION
+                        || eventType == XMLStreamConstants.COMMENT) {
             eventType = next();
-         }
-         if (eventType != XMLStreamConstants.START_ELEMENT && eventType != XMLStreamConstants.END_ELEMENT) {
-             throw new XMLStreamException("expected start or end tag", getLocation());
-         }
-         return eventType;    
+        }
+        if (eventType != XMLStreamConstants.START_ELEMENT && eventType != XMLStreamConstants.END_ELEMENT) {
+            throw new XMLStreamException("expected start or end tag", getLocation());
+        }
+        return eventType;
     }
-    
+
     public int getNamespaceCount() {
-    	if (state == STATE_FIRST_RUN) {
-    		return rootPrefixes.size();
-    	} else {
-    		return getParent().getNamespaceCount();
-    	}
+        if (state == STATE_FIRST_RUN) {
+            return rootPrefixes.size();
+        } else {
+            return getParent().getNamespaceCount();
+        }
     }
-    
+
     public String getNamespacePrefix(int i) {
-    	if (state == STATE_FIRST_RUN) {
-	    	return (String) rootPrefixes.get(i);
-    	} else {
-    		return getParent().getNamespacePrefix(i);
-    	}
+        if (state == STATE_FIRST_RUN) {
+            return (String) rootPrefixes.get(i);
+        } else {
+            return getParent().getNamespacePrefix(i);
+        }
     }
-    
+
     public String getNamespaceURI(int i) {
-    	if (state == STATE_FIRST_RUN) {
-	    	return getParent().getNamespaceContext().getNamespaceURI((String) rootPrefixes.get(i));
-    	} else {
-    		return getParent().getNamespaceURI(i);
-    	}
+        if (state == STATE_FIRST_RUN) {
+            return getParent().getNamespaceContext().getNamespaceURI((String) rootPrefixes.get(i));
+        } else {
+            return getParent().getNamespaceURI(i);
+        }
     }
-    
+
     public String getNamespaceURI(String prefix) {
-    	if (state == STATE_FIRST_RUN) {
-	    	return getParent().getNamespaceContext().getNamespaceURI(prefix);
-    	} else {
-    		return getParent().getNamespaceURI(prefix);
-    	}
+        if (state == STATE_FIRST_RUN) {
+            return getParent().getNamespaceContext().getNamespaceURI(prefix);
+        } else {
+            return getParent().getNamespaceURI(prefix);
+        }
     }
-    
+
     @Override
     public boolean isStartElement() {
         return event == START_ELEMENT;

Modified: incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/jaxp/QNameHelper.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/jaxp/QNameHelper.java?view=diff&rev=564607&r1=564606&r2=564607
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/jaxp/QNameHelper.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/jaxp/QNameHelper.java Fri Aug 10 07:37:46 2007
@@ -22,8 +22,11 @@
 /**
  * @version $Revision: 1.1 $
  */
-public class QNameHelper {
-	
+public final class QNameHelper {
+
+    private QNameHelper() {
+    }
+
     public static String getQualifiedName(QName qname) {
         String prefix = qname.getPrefix();
         String localPart = qname.getLocalPart();
@@ -43,8 +46,7 @@
             String localPart = text.substring(idx + 1);
             String uri = context.getNamespaceURI(prefix);
             return new QName(uri, localPart, prefix);
-        }
-        else {
+        } else {
             return new QName(text);
         }
     }

Modified: incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/jaxp/ResourceSource.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/jaxp/ResourceSource.java?view=diff&rev=564607&r1=564606&r2=564607
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/jaxp/ResourceSource.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/jaxp/ResourceSource.java Fri Aug 10 07:37:46 2007
@@ -42,8 +42,7 @@
     public InputStream getInputStream() {
         try {
             return resource.getInputStream();
-        }
-        catch (IOException e) {
+        } catch (IOException e) {
             throw new RuntimeException("Failed to open resource: " + resource + ". Reason: " + e, e); 
         }
     }

Modified: incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/jaxp/SourceTransformer.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/jaxp/SourceTransformer.java?view=diff&rev=564607&r1=564606&r2=564607
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/jaxp/SourceTransformer.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/jaxp/SourceTransformer.java Fri Aug 10 07:37:46 2007
@@ -52,17 +52,35 @@
 
 /**
  * A helper class to transform from one type of {@link Source} to another
- *
+ * 
  * @version $Revision$
  */
 public class SourceTransformer {
+
     public static final String DEFAULT_CHARSET_PROPERTY = "org.apache.servicemix.default.charset";
 
+    /*
+     * When converting a DOM tree to a SAXSource, we try to use Xalan internal
+     * DOM parser if available. Else, transform the DOM tree to a String and
+     * build a SAXSource on top of it.
+     */
+    private static final Class DOM_2_SAX_CLASS;
+    static {
+        Class cl = null;
+        try {
+            cl = Class.forName("org.apache.xalan.xsltc.trax.DOM2SAX");
+        } catch (Throwable t) {
+            // Ignore
+        }
+        DOM_2_SAX_CLASS = cl;
+    }
+
+    private static String defaultCharset = System.getProperty(DEFAULT_CHARSET_PROPERTY, "UTF-8");
+
     private DocumentBuilderFactory documentBuilderFactory;
+
     private TransformerFactory transformerFactory;
 
-    public static String defaultCharset = System.getProperty(DEFAULT_CHARSET_PROPERTY, "UTF-8");
-        
     public SourceTransformer() {
     }
 
@@ -70,6 +88,13 @@
         this.documentBuilderFactory = documentBuilderFactory;
     }
 
+    public static String getDefaultCharset() {
+        return defaultCharset;
+    }
+
+    public static void setDefaultCharset(String defaultCharset) {
+        SourceTransformer.defaultCharset = defaultCharset;
+    }
 
     /**
      * Converts the given input Source into the required result
@@ -86,7 +111,6 @@
         transformer.transform(source, result);
     }
 
-
     /**
      * Converts the given input Source into text
      */
@@ -113,53 +137,52 @@
 
     /**
      * Converts the content of the given message to a String
-     * @throws SAXException 
-     * @throws IOException 
-     * @throws ParserConfigurationException 
+     * 
+     * @throws SAXException
+     * @throws IOException
+     * @throws ParserConfigurationException
      */
-    public String contentToString(NormalizedMessage message) throws MessagingException, TransformerException, ParserConfigurationException, IOException, SAXException {
+    public String contentToString(NormalizedMessage message) throws MessagingException, TransformerException, ParserConfigurationException,
+                    IOException, SAXException {
         return toString(message.getContent());
     }
 
     /**
-     * Converts the source instance to a {@link DOMSource} or returns null if the conversion is not
-     * supported (making it easy to derive from this class to add new kinds of conversion).
+     * Converts the source instance to a {@link DOMSource} or returns null if
+     * the conversion is not supported (making it easy to derive from this class
+     * to add new kinds of conversion).
      */
     public DOMSource toDOMSource(Source source) throws ParserConfigurationException, IOException, SAXException, TransformerException {
         if (source instanceof DOMSource) {
             return (DOMSource) source;
-        }
-        else if (source instanceof SAXSource) {
+        } else if (source instanceof SAXSource) {
             return toDOMSourceFromSAX((SAXSource) source);
-        }
-        else if (source instanceof StreamSource) {
+        } else if (source instanceof StreamSource) {
             return toDOMSourceFromStream((StreamSource) source);
-        }
-        else {
+        } else {
             return null;
         }
     }
 
-    public Source toDOMSource(NormalizedMessage message) throws MessagingException, TransformerException, ParserConfigurationException, IOException, SAXException {
+    public Source toDOMSource(NormalizedMessage message) throws MessagingException, TransformerException, ParserConfigurationException,
+                    IOException, SAXException {
         Node node = toDOMNode(message);
         return new DOMSource(node);
     }
 
     /**
-     * Converts the source instance to a {@link SAXSource} or returns null if the conversion is not
-     * supported (making it easy to derive from this class to add new kinds of conversion).
+     * Converts the source instance to a {@link SAXSource} or returns null if
+     * the conversion is not supported (making it easy to derive from this class
+     * to add new kinds of conversion).
      */
     public SAXSource toSAXSource(Source source) throws IOException, SAXException, TransformerException {
         if (source instanceof SAXSource) {
             return (SAXSource) source;
-        }
-        else if (source instanceof DOMSource) {
+        } else if (source instanceof DOMSource) {
             return toSAXSourceFromDOM((DOMSource) source);
-        }
-        else if (source instanceof StreamSource) {
+        } else if (source instanceof StreamSource) {
             return toSAXSourceFromStream((StreamSource) source);
-        }
-        else {
+        } else {
             return null;
         }
     }
@@ -229,36 +252,18 @@
                 InputSource inputsource = new InputSource(inputStream);
                 inputsource.setSystemId(systemId);
                 document = builder.parse(inputsource);
-            }
-            else {
+            } else {
                 throw new IOException("No input stream or reader available");
             }
         }
         return new DOMSource(document, systemId);
     }
 
-    /*
-     * When converting a DOM tree to a SAXSource,
-     * we try to use Xalan internal DOM parser if
-     * available.  Else, transform the DOM tree
-     * to a String and build a SAXSource on top of
-     * it.
-     */
-    private static final Class dom2SaxClass;
-    
-    static {
-        Class cl = null;
-        try {
-            cl = Class.forName("org.apache.xalan.xsltc.trax.DOM2SAX");
-        } catch (Throwable t) {}
-        dom2SaxClass = cl;
-    }
-    
     public SAXSource toSAXSourceFromDOM(DOMSource source) throws TransformerException {
-        if (dom2SaxClass != null) {
+        if (DOM_2_SAX_CLASS != null) {
             try {
-                Constructor cns = dom2SaxClass.getConstructor(new Class[] { Node.class });
-                XMLReader converter = (XMLReader) cns.newInstance(new Object[] { source.getNode() });
+                Constructor cns = DOM_2_SAX_CLASS.getConstructor(new Class[] {Node.class });
+                XMLReader converter = (XMLReader) cns.newInstance(new Object[] {source.getNode() });
                 return new SAXSource(converter, new InputSource());
             } catch (Exception e) {
                 throw new TransformerException(e);
@@ -270,7 +275,8 @@
         }
     }
 
-    public DOMSource toDOMSourceFromSAX(SAXSource source) throws IOException, SAXException, ParserConfigurationException, TransformerException {
+    public DOMSource toDOMSourceFromSAX(SAXSource source) throws IOException, SAXException, ParserConfigurationException,
+                    TransformerException {
         return new DOMSource(toDOMNodeFromSAX(source));
     }
 
@@ -282,32 +288,35 @@
 
     /**
      * Converts the given TRaX Source into a W3C DOM node
-     * @throws SAXException 
-     * @throws IOException 
-     * @throws ParserConfigurationException 
+     * 
+     * @throws SAXException
+     * @throws IOException
+     * @throws ParserConfigurationException
      */
     public Node toDOMNode(Source source) throws TransformerException, ParserConfigurationException, IOException, SAXException {
         DOMSource domSrc = toDOMSource(source);
-        return domSrc != null ? domSrc.getNode() :  null;
+        return domSrc != null ? domSrc.getNode() : null;
     }
 
     /**
-     * Avoids multple parsing to DOM by caching the DOM representation in the message
-     * as a property so future calls will avoid the reparse - and avoid issues with
-     * stream based Source instances.
-     *
-     * @param message the normalized message
+     * Avoids multple parsing to DOM by caching the DOM representation in the
+     * message as a property so future calls will avoid the reparse - and avoid
+     * issues with stream based Source instances.
+     * 
+     * @param message
+     *            the normalized message
      * @return the W3C DOM node for this message
-     * @throws SAXException 
-     * @throws IOException 
-     * @throws ParserConfigurationException 
+     * @throws SAXException
+     * @throws IOException
+     * @throws ParserConfigurationException
      */
-    public Node toDOMNode(NormalizedMessage message) throws MessagingException, TransformerException, ParserConfigurationException, IOException, SAXException {
+    public Node toDOMNode(NormalizedMessage message) throws MessagingException, TransformerException, ParserConfigurationException,
+                    IOException, SAXException {
         Source content = message.getContent();
         Node node = toDOMNode(content);
         return node;
     }
-    
+
     /**
      * Create a DOM element from the normalized message.
      * 
@@ -319,11 +328,12 @@
      * @throws IOException
      * @throws SAXException
      */
-    public Element toDOMElement(NormalizedMessage message) throws MessagingException, TransformerException, ParserConfigurationException, IOException, SAXException {
+    public Element toDOMElement(NormalizedMessage message) throws MessagingException, TransformerException, ParserConfigurationException,
+                    IOException, SAXException {
         Node node = toDOMNode(message);
         return toDOMElement(node);
     }
-    
+
     /**
      * Create a DOM element from the given source.
      * 
@@ -338,29 +348,28 @@
         Node node = toDOMNode(source);
         return toDOMElement(node);
     }
-    
+
     /**
-     * Create a DOM element from the DOM node.
-     * Simply cast if the node is an Element, or
-     * return the root element if it is a Document.
+     * Create a DOM element from the DOM node. Simply cast if the node is an
+     * Element, or return the root element if it is a Document.
      * 
      * @param node
      * @return
-     * @throws TransformerException 
+     * @throws TransformerException
      */
     public Element toDOMElement(Node node) throws TransformerException {
         // If the node is an document, return the root element
         if (node instanceof Document) {
             return ((Document) node).getDocumentElement();
-        // If the node is an element, just cast it
+            // If the node is an element, just cast it
         } else if (node instanceof Element) {
             return (Element) node;
-        // Other node types are not handled
+            // Other node types are not handled
         } else {
             throw new TransformerException("Unable to convert DOM node to an Element");
         }
     }
-    
+
     /**
      * Create a DOM document from the given normalized message
      * 
@@ -372,11 +381,12 @@
      * @throws IOException
      * @throws SAXException
      */
-    public Document toDOMDocument(NormalizedMessage message) throws MessagingException, TransformerException, ParserConfigurationException, IOException, SAXException {
+    public Document toDOMDocument(NormalizedMessage message) throws MessagingException, TransformerException, ParserConfigurationException,
+                    IOException, SAXException {
         Node node = toDOMNode(message);
         return toDOMDocument(node);
     }
-    
+
     /**
      * Create a DOM document from the given source.
      * 
@@ -391,43 +401,41 @@
         Node node = toDOMNode(source);
         return toDOMDocument(node);
     }
-    
+
     /**
-     * Create a DOM document from the given Node.
-     * If the node is an document, just cast it,
-     * if the node is an root element, retrieve its
-     * owner element or create a new document and import
-     * the node.
+     * Create a DOM document from the given Node. If the node is an document,
+     * just cast it, if the node is an root element, retrieve its owner element
+     * or create a new document and import the node.
      * 
      * @param node
      * @return
      * @throws ParserConfigurationException
-     * @throws TransformerException 
+     * @throws TransformerException
      */
     public Document toDOMDocument(Node node) throws ParserConfigurationException, TransformerException {
         // If the node is the document, just cast it
         if (node instanceof Document) {
             return (Document) node;
-        // If the node is an element
+            // If the node is an element
         } else if (node instanceof Element) {
             Element elem = (Element) node;
             // If this is the root element, return its owner document
             if (elem.getOwnerDocument().getDocumentElement() == elem) {
                 return elem.getOwnerDocument();
-            // else, create a new doc and copy the element inside it
+                // else, create a new doc and copy the element inside it
             } else {
                 Document doc = createDocument();
                 doc.appendChild(doc.importNode(node, true));
                 return doc;
             }
-        // other element types are not handled
+            // other element types are not handled
         } else {
             throw new TransformerException("Unable to convert DOM node to a Document");
         }
     }
 
     // Properties
-    //-------------------------------------------------------------------------
+    // -------------------------------------------------------------------------
     public DocumentBuilderFactory getDocumentBuilderFactory() {
         if (documentBuilderFactory == null) {
             documentBuilderFactory = createDocumentBuilderFactory();
@@ -439,9 +447,8 @@
         this.documentBuilderFactory = documentBuilderFactory;
     }
 
-
     // Helper methods
-    //-------------------------------------------------------------------------
+    // -------------------------------------------------------------------------
     public DocumentBuilderFactory createDocumentBuilderFactory() {
         DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
         factory.setNamespaceAware(true);
@@ -449,7 +456,6 @@
         factory.setIgnoringComments(true);
         return factory;
     }
-
 
     public DocumentBuilder createDocumentBuilder() throws ParserConfigurationException {
         DocumentBuilderFactory factory = getDocumentBuilderFactory();

Modified: incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/jaxp/StAXSourceTransformer.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/jaxp/StAXSourceTransformer.java?view=diff&rev=564607&r1=564606&r2=564607
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/jaxp/StAXSourceTransformer.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/jaxp/StAXSourceTransformer.java Fri Aug 10 07:37:46 2007
@@ -37,32 +37,35 @@
 import org.xml.sax.SAXException;
 
 /**
- * An enhanced {@link org.apache.servicemix.jbi.jaxp.SourceTransformer} which adds support for converting from and to
- * {@link StAXSource} instances. Since this class introduces a runtime dependency on StAX
- * which some users may not use/require, this class is separated out from the core JAXP transformer.
- *
+ * An enhanced {@link org.apache.servicemix.jbi.jaxp.SourceTransformer} which
+ * adds support for converting from and to {@link StAXSource} instances. Since
+ * this class introduces a runtime dependency on StAX which some users may not
+ * use/require, this class is separated out from the core JAXP transformer.
+ * 
  * @version $Revision$
  */
 public class StAXSourceTransformer extends SourceTransformer {
 
     private XMLInputFactory inputFactory;
+
     private XMLOutputFactory outputFactory;
 
     /**
-     * Converts the source instance to a {@link javax.xml.transform.dom.DOMSource} or returns null if the conversion is not
-     * supported (making it easy to derive from this class to add new kinds of conversion).
+     * Converts the source instance to a
+     * {@link javax.xml.transform.dom.DOMSource} or returns null if the
+     * conversion is not supported (making it easy to derive from this class to
+     * add new kinds of conversion).
      */
     public StaxSource toStaxSource(Source source) throws XMLStreamException {
         if (source instanceof StaxSource) {
             return (StaxSource) source;
-        }
-        else {
+        } else {
             XMLInputFactory factory = getInputFactory();
             XMLStreamReader reader = factory.createXMLStreamReader(source);
             return new StaxSource(reader);
         }
     }
-    
+
     public XMLStreamReader toXMLStreamReader(Source source) throws XMLStreamException, TransformerException {
         if (source instanceof StaxSource) {
             return ((StaxSource) source).getXMLStreamReader();
@@ -78,9 +81,9 @@
         }
         XMLInputFactory factory = getInputFactory();
         try {
-        	return factory.createXMLStreamReader(source);
+            return factory.createXMLStreamReader(source);
         } catch (XMLStreamException e) {
-        	return factory.createXMLStreamReader(toReaderFromSource(source));
+            return factory.createXMLStreamReader(toReaderFromSource(source));
         }
     }
 
@@ -112,7 +115,7 @@
     }
 
     // Properties
-    //-------------------------------------------------------------------------
+    // -------------------------------------------------------------------------
     public XMLInputFactory getInputFactory() {
         if (inputFactory == null) {
             inputFactory = createInputFactory();
@@ -123,20 +126,20 @@
     public void setInputFactory(XMLInputFactory inputFactory) {
         this.inputFactory = inputFactory;
     }
-    
+
     public XMLOutputFactory getOutputFactory() {
         if (outputFactory == null) {
             outputFactory = createOutputFactory();
         }
         return outputFactory;
     }
-    
+
     public void setOutputFactory(XMLOutputFactory outputFactory) {
         this.outputFactory = outputFactory;
     }
 
     // Implementation methods
-    //-------------------------------------------------------------------------
+    // -------------------------------------------------------------------------
     protected XMLInputFactory createInputFactory() {
         XMLInputFactory answer = XMLInputFactory.newInstance();
         return answer;

Modified: incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/jaxp/StaxSource.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/jaxp/StaxSource.java?view=diff&rev=564607&r1=564606&r2=564607
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/jaxp/StaxSource.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/jaxp/StaxSource.java Fri Aug 10 07:37:46 2007
@@ -113,9 +113,9 @@
                     String prefix = streamReader.getPrefix();
                     String qname = prefix != null && prefix.length() > 0 ? prefix + ":" + localName : localName;
                     contentHandler.endElement(uri, localName, qname);
-                    for (int i = 0; i < streamReader.getNamespaceCount(); i++) {
-                        //contentHandler.endPrefixMapping(streamReader.getNamespaceURI(i));
-                    }
+                    //for (int i = 0; i < streamReader.getNamespaceCount(); i++) {
+                    //    contentHandler.endPrefixMapping(streamReader.getNamespaceURI(i));
+                    //}
                     break;
                 }
                 case XMLStreamConstants.ENTITY_DECLARATION:
@@ -129,18 +129,19 @@
                     contentHandler.startDocument();
                     break;
                 case XMLStreamConstants.START_ELEMENT: {
-                    for (int i = 0; i < streamReader.getNamespaceCount(); i++) {
-                        //contentHandler.startPrefixMapping(streamReader.getNamespacePrefix(i),
-                        //                                  streamReader.getNamespaceURI(i));
-                    }
+                    //for (int i = 0; i < streamReader.getNamespaceCount(); i++) {
+                    //    contentHandler.startPrefixMapping(streamReader.getNamespacePrefix(i),
+                    //                                      streamReader.getNamespaceURI(i));
+                    //}
                     String uri = streamReader.getNamespaceURI();
                     String localName = streamReader.getLocalName();
                     String prefix = streamReader.getPrefix();
                     String qname = prefix != null && prefix.length() > 0 ? prefix + ":" + localName : localName;
-
                     contentHandler.startElement(uri == null ? "" : uri, localName, qname, getAttributes());
                     break;
                 }
+                default:
+                    break;
                 }
                 streamReader.next();
             }
@@ -225,7 +226,7 @@
     }
 
     public void setProperty(String name, Object value) throws SAXNotRecognizedException, SAXNotSupportedException {
-        if( "http://xml.org/sax/properties/lexical-handler".equals(name) ) {
+        if ("http://xml.org/sax/properties/lexical-handler".equals(name)) {
             lexicalHandler = (LexicalHandler) value;
         } else {
             throw new SAXNotRecognizedException(name);

Modified: incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/jaxp/StringSource.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/jaxp/StringSource.java?view=diff&rev=564607&r1=564606&r2=564607
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/jaxp/StringSource.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/jaxp/StringSource.java Fri Aug 10 07:37:46 2007
@@ -23,18 +23,18 @@
 import java.io.StringReader;
 import java.io.UnsupportedEncodingException;
 
-import javax.xml.transform.Source;
 import javax.xml.transform.stream.StreamSource;
 
 /**
- * A helper class which provides a JAXP {@link Source} from a String
- * which can be read as many times as required.
- *
+ * A helper class which provides a JAXP {@link Source} from a String which can
+ * be read as many times as required.
+ * 
  * @version $Revision$
  */
 public class StringSource extends StreamSource implements Serializable {
 
     private final String text;
+
     private String encoding = "UTF-8";
 
     public StringSource(String text) {
@@ -51,7 +51,7 @@
 
     public StringSource(String text, String systemId, String encoding) {
         this.text = text;
-        this.encoding=encoding;
+        this.encoding = encoding;
         setSystemId(systemId);
     }
 

Modified: incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/jaxp/W3CDOMStreamReader.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/jaxp/W3CDOMStreamReader.java?view=diff&rev=564607&r1=564606&r2=564607
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/jaxp/W3CDOMStreamReader.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/jaxp/W3CDOMStreamReader.java Fri Aug 10 07:37:46 2007
@@ -71,8 +71,9 @@
         frame.prefixes = new ArrayList<String>();
         frame.attributes = new ArrayList<Attr>();
 
-        if (context == null)
+        if (context == null) {
             context = new W3CNamespaceContext();
+        }
 
         context.setElement(element);
 
@@ -90,8 +91,9 @@
             String value = node.getNodeValue();
             String name = node.getNodeName();
 
-            if (prefix == null)
+            if (prefix == null) {
                 prefix = "";
+            }
 
             if (name != null && name.equals("xmlns")) {
                 frame.uris.add(value);
@@ -127,23 +129,22 @@
 
     protected int moveToChild(int currentChild) {
         this.content = getCurrentElement().getChildNodes().item(currentChild);
-
-        if (content instanceof Text)
+        if (content instanceof Text) {
             return CHARACTERS;
-        else if (content instanceof Element)
+        } else if (content instanceof Element) {
             return START_ELEMENT;
-        else if (content instanceof CDATASection)
+        } else if (content instanceof CDATASection) {
             return CDATA;
-        else if (content instanceof Comment)
+        } else if (content instanceof Comment) {
             return CHARACTERS;
-        else if (content instanceof EntityReference)
+        } else if (content instanceof EntityReference) {
             return ENTITY_REFERENCE;
-
+        }
         throw new IllegalStateException();
     }
 
     public String getElementText() throws XMLStreamException {
-        getCurrentFrame().ended = true;
+        frame.ended = true;
         currentEvent = END_ELEMENT;
         endElement();
         String result = getContent(getCurrentElement());
@@ -168,12 +169,14 @@
 
     public String getAttributeValue(String ns, String local) {
         Attr attr;
-        if (ns == null || ns.equals(""))
+        if (ns == null || ns.equals("")) {
             attr = getCurrentElement().getAttributeNode(local);
-        else
+        } else {
             attr = getCurrentElement().getAttributeNodeNS(ns, local);
-        if (attr != null)
+        }
+        if (attr != null) {
             return attr.getValue();
+        }
         return null;
     }
 
@@ -186,7 +189,6 @@
     }
 
     private String getLocalName(Attr attr) {
-
         String name = attr.getLocalName();
         if (name == null) {
             name = attr.getNodeName();
@@ -318,11 +320,13 @@
      * Get the trimed text content of a node or null if there is no text
      */
     public static String getContent(Node n) {
-        if (n == null)
+        if (n == null) {
             return null;
+        }
         Node n1 = getChild(n, Node.TEXT_NODE);
-        if (n1 == null)
+        if (n1 == null) {
             return null;
+        }
         String s1 = n1.getNodeValue();
         return s1.trim();
     }
@@ -335,8 +339,9 @@
         while (n != null && type != n.getNodeType()) {
             n = n.getNextSibling();
         }
-        if (n == null)
+        if (n == null) {
             return null;
+        }
         return n;
     }
 

Modified: incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/jaxp/W3CDOMStreamWriter.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/jaxp/W3CDOMStreamWriter.java?view=diff&rev=564607&r1=564606&r2=564607
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/jaxp/W3CDOMStreamWriter.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/jaxp/W3CDOMStreamWriter.java Fri Aug 10 07:37:46 2007
@@ -35,253 +35,184 @@
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 
-public class W3CDOMStreamWriter
-    extends DOMStreamWriter
-{
+public class W3CDOMStreamWriter extends DOMStreamWriter {
     static final String XML_NS = "http://www.w3.org/2000/xmlns/";
+
     private Stack stack = new Stack();
+
     private Document document;
+
     private Element currentNode;
+
     private NamespaceContext context;
+
     private Map properties = new HashMap();
 
-    public W3CDOMStreamWriter() throws ParserConfigurationException
-    {
+    public W3CDOMStreamWriter() throws ParserConfigurationException {
         this(DocumentBuilderFactory.newInstance().newDocumentBuilder());
     }
-    
-    public W3CDOMStreamWriter(DocumentBuilder builder)
-    {
+
+    public W3CDOMStreamWriter(DocumentBuilder builder) {
         document = builder.newDocument();
     }
-    
-    public W3CDOMStreamWriter(Document document)
-    {
+
+    public W3CDOMStreamWriter(Document document) {
         this.document = document;
     }
-    
-    public Document getDocument()
-    {
+
+    public Document getDocument() {
         return document;
     }
-    
-    public void writeStartElement(String local)
-        throws XMLStreamException
-    {
+
+    public void writeStartElement(String local) throws XMLStreamException {
         newChild(document.createElement(local));
     }
 
-    private void newChild(Element element)
-    {
-        if (currentNode != null)
-        {
+    private void newChild(Element element) {
+        if (currentNode != null) {
             stack.push(currentNode);
             currentNode.appendChild(element);
-        }
-        else
-        {
+        } else {
             document.appendChild(element);
         }
-        
-        W3CNamespaceContext context = new W3CNamespaceContext();
-        context.setElement(element);
-        this.context = context;
-        
+
+        W3CNamespaceContext ctx = new W3CNamespaceContext();
+        ctx.setElement(element);
+        this.context = ctx;
+
         currentNode = element;
     }
 
-    public void writeStartElement(String namespace, String local)
-        throws XMLStreamException
-    {
+    public void writeStartElement(String namespace, String local) throws XMLStreamException {
         newChild(document.createElementNS(namespace, local));
     }
 
-    public void writeStartElement(String prefix, String local, String namespace)
-        throws XMLStreamException
-    {
-        if (prefix == null || prefix.equals(""))
-        {
+    public void writeStartElement(String prefix, String local, String namespace) throws XMLStreamException {
+        if (prefix == null || prefix.equals("")) {
             writeStartElement(namespace, local);
-        }
-        else
-        {
+        } else {
             newChild(document.createElementNS(namespace, prefix + ":" + local));
         }
     }
 
-    public void writeEmptyElement(String namespace, String local)
-        throws XMLStreamException
-    {
+    public void writeEmptyElement(String namespace, String local) throws XMLStreamException {
         writeStartElement(namespace, local);
     }
 
-    public void writeEmptyElement(String prefix, String namespace, String local)
-        throws XMLStreamException
-    {
+    public void writeEmptyElement(String prefix, String namespace, String local) throws XMLStreamException {
         writeStartElement(prefix, namespace, local);
     }
 
-    public void writeEmptyElement(String local)
-        throws XMLStreamException
-    {
+    public void writeEmptyElement(String local) throws XMLStreamException {
         writeStartElement(local);
     }
 
-    public void writeEndElement()
-        throws XMLStreamException
-    {
-        if (stack.size() > 0)
+    public void writeEndElement() throws XMLStreamException {
+        if (stack.size() > 0) {
             currentNode = (Element) stack.pop();
-        else
+        } else {
             currentNode = null;
+        }
     }
 
-    public void writeEndDocument()
-        throws XMLStreamException
-    {
+    public void writeEndDocument() throws XMLStreamException {
     }
 
-    public void writeAttribute(String local, String value)
-        throws XMLStreamException
-    {
+    public void writeAttribute(String local, String value) throws XMLStreamException {
         Attr a = document.createAttribute(local);
         a.setValue(value);
         currentNode.setAttributeNode(a);
     }
 
-    public void writeAttribute(String prefix, String namespace, String local, String value)
-        throws XMLStreamException
-    {
-        if (prefix.length() > 0)
+    public void writeAttribute(String prefix, String namespace, String local, String value) throws XMLStreamException {
+        if (prefix.length() > 0) {
             local = prefix + ":" + local;
-        
+        }
         Attr a = document.createAttributeNS(namespace, local);
         a.setValue(value);
         currentNode.setAttributeNodeNS(a);
     }
 
-    public void writeAttribute(String namespace, String local, String value)
-        throws XMLStreamException
-    {
+    public void writeAttribute(String namespace, String local, String value) throws XMLStreamException {
         Attr a = document.createAttributeNS(namespace, local);
         a.setValue(value);
         currentNode.setAttributeNodeNS(a);
     }
 
-    public void writeNamespace(String prefix, String namespace)
-        throws XMLStreamException
-    {
-        if (prefix.length() == 0) 
-        {
+    public void writeNamespace(String prefix, String namespace) throws XMLStreamException {
+        if (prefix.length() == 0) {
             writeDefaultNamespace(namespace);
-        }
-        else
-        {
+        } else {
             currentNode.setAttributeNS(XML_NS, "xmlns:" + prefix, namespace);
         }
     }
 
-    public void writeDefaultNamespace(String namespace)
-        throws XMLStreamException
-    {
+    public void writeDefaultNamespace(String namespace) throws XMLStreamException {
         currentNode.setAttributeNS(XML_NS, "xmlns", namespace);
     }
 
-    public void writeComment(String value)
-        throws XMLStreamException
-    {
+    public void writeComment(String value) throws XMLStreamException {
         currentNode.appendChild(document.createComment(value));
     }
 
-    public void writeProcessingInstruction(String target)
-        throws XMLStreamException
-    {
+    public void writeProcessingInstruction(String target) throws XMLStreamException {
         currentNode.appendChild(document.createProcessingInstruction(target, null));
     }
 
-    public void writeProcessingInstruction(String target, String data)
-        throws XMLStreamException
-    {
+    public void writeProcessingInstruction(String target, String data) throws XMLStreamException {
         currentNode.appendChild(document.createProcessingInstruction(target, data));
     }
 
-    public void writeCData(String data)
-        throws XMLStreamException
-    {
+    public void writeCData(String data) throws XMLStreamException {
         currentNode.appendChild(document.createCDATASection(data));
     }
 
-    public void writeDTD(String arg0)
-        throws XMLStreamException
-    {
+    public void writeDTD(String arg0) throws XMLStreamException {
         throw new UnsupportedOperationException();
     }
 
-    public void writeEntityRef(String ref)
-        throws XMLStreamException
-    {
+    public void writeEntityRef(String ref) throws XMLStreamException {
         currentNode.appendChild(document.createEntityReference(ref));
     }
 
-    public void writeStartDocument()
-        throws XMLStreamException
-    {
+    public void writeStartDocument() throws XMLStreamException {
     }
 
-    public void writeStartDocument(String version)
-        throws XMLStreamException
-    {
+    public void writeStartDocument(String version) throws XMLStreamException {
         writeStartDocument();
     }
 
-    public void writeStartDocument(String encoding, String version)
-        throws XMLStreamException
-    {
+    public void writeStartDocument(String encoding, String version) throws XMLStreamException {
         writeStartDocument();
     }
 
-    public void writeCharacters(String text)
-        throws XMLStreamException
-    {
+    public void writeCharacters(String text) throws XMLStreamException {
         currentNode.appendChild(document.createTextNode(text));
     }
 
-    public void writeCharacters(char[] text, int start, int len)
-        throws XMLStreamException
-    {
+    public void writeCharacters(char[] text, int start, int len) throws XMLStreamException {
         writeCharacters(new String(text, start, len));
     }
 
-    public String getPrefix(String uri)
-        throws XMLStreamException
-    {
+    public String getPrefix(String uri) throws XMLStreamException {
         return context.getPrefix(uri);
     }
 
-    public void setPrefix(String arg0, String arg1)
-        throws XMLStreamException
-    {
+    public void setPrefix(String arg0, String arg1) throws XMLStreamException {
     }
 
-    public void setDefaultNamespace(String arg0)
-        throws XMLStreamException
-    {
+    public void setDefaultNamespace(String arg0) throws XMLStreamException {
     }
 
-    public void setNamespaceContext(NamespaceContext context)
-        throws XMLStreamException
-    {
-        this.context = context;
+    public void setNamespaceContext(NamespaceContext ctx) throws XMLStreamException {
+        this.context = ctx;
     }
 
-    public NamespaceContext getNamespaceContext()
-    {
+    public NamespaceContext getNamespaceContext() {
         return context;
     }
 
-    public Object getProperty(String prop)
-        throws IllegalArgumentException
-    {
+    public Object getProperty(String prop) throws IllegalArgumentException {
         return properties.get(prop);
     }
 }

Modified: incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/jaxp/W3CNamespaceContext.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/jaxp/W3CNamespaceContext.java?view=diff&rev=564607&r1=564606&r2=564607
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/jaxp/W3CNamespaceContext.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/jaxp/W3CNamespaceContext.java Fri Aug 10 07:37:46 2007
@@ -32,85 +32,75 @@
 import org.w3c.dom.NamedNodeMap;
 import org.w3c.dom.Node;
 
-public class W3CNamespaceContext implements NamespaceContext
-{
+public class W3CNamespaceContext implements NamespaceContext {
     private Element currentNode;
-    
-    public String getNamespaceURI(String prefix)
-    {
+
+    public String getNamespaceURI(String prefix) {
         String name = prefix;
-        if (name.length() == 0) name = "xmlns";
-        else name = "xmlns:" + prefix;
-        
+        if (name.length() == 0) {
+            name = "xmlns";
+        } else {
+            name = "xmlns:" + prefix;
+        }
         return getNamespaceURI(currentNode, name);
     }
 
-    private String getNamespaceURI(Element e, String name)
-    {
+    private String getNamespaceURI(Element e, String name) {
         Attr attr = e.getAttributeNode(name);
-        if (attr == null)
-        {
+        if (attr == null) {
             Node n = e.getParentNode();
-            if (n instanceof Element && n != e)
-            {
+            if (n instanceof Element && n != e) {
                 return getNamespaceURI((Element) n, name);
             }
-        }
-        else
-        {
+        } else {
             return attr.getValue();
         }
-        
+
         return null;
     }
-    
-    public String getPrefix(String uri)
-    {
+
+    public String getPrefix(String uri) {
         return getPrefix(currentNode, uri);
     }
 
-    private String getPrefix(Element e, String uri)
-    {
+    private String getPrefix(Element e, String uri) {
         NamedNodeMap attributes = e.getAttributes();
-        for (int i = 0; i < attributes.getLength(); i++)
-        {
+        for (int i = 0; i < attributes.getLength(); i++) {
             Attr a = (Attr) attributes.item(i);
-            
+
             String val = a.getValue();
-            if (val != null && val.equals(uri))
-            {
+            if (val != null && val.equals(uri)) {
                 String name = a.getNodeName();
-                if (name.equals("xmlns")) return "";
-                else return name.substring(6);
+                if (name.equals("xmlns")) {
+                    return "";
+                } else {
+                    return name.substring(6);
+                }
             }
         }
-        
+
         Node n = e.getParentNode();
-        if (n instanceof Element && n != e)
-        {
+        if (n instanceof Element && n != e) {
             return getPrefix((Element) n, uri);
         }
-        
+
         return null;
     }
 
-    public Iterator getPrefixes(String uri)
-    {
+    public Iterator getPrefixes(String uri) {
         List prefixes = new ArrayList();
-        
         String prefix = getPrefix(uri);
-        if (prefix != null) prefixes.add(prefix);
-        
+        if (prefix != null) {
+            prefixes.add(prefix);
+        }
         return prefixes.iterator();
     }
 
-    public Element getElement()
-    {
+    public Element getElement() {
         return currentNode;
     }
 
-    public void setElement(Element currentNode)
-    {
-        this.currentNode = currentNode;
+    public void setElement(Element node) {
+        this.currentNode = node;
     }
 }



Mime
View raw message