You are viewing a plain text version of this content. The canonical link for it is here.
Posted to woden-dev@ws.apache.org by jk...@apache.org on 2007/08/23 13:01:35 UTC

svn commit: r568932 [8/36] - in /incubator/woden/trunk/java/src/org/apache/woden: ./ ant/ internal/ internal/resolver/ internal/schema/ internal/util/ internal/util/dom/ internal/util/om/ internal/wsdl20/ internal/wsdl20/extensions/ internal/wsdl20/ext...

Modified: incubator/woden/trunk/java/src/org/apache/woden/internal/DOMXMLElement.java
URL: http://svn.apache.org/viewvc/incubator/woden/trunk/java/src/org/apache/woden/internal/DOMXMLElement.java?rev=568932&r1=568931&r2=568932&view=diff
==============================================================================
--- incubator/woden/trunk/java/src/org/apache/woden/internal/DOMXMLElement.java (original)
+++ incubator/woden/trunk/java/src/org/apache/woden/internal/DOMXMLElement.java Thu Aug 23 04:01:23 2007
@@ -1,261 +1,261 @@
-/**
+/**
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */                       
-
-package org.apache.woden.internal;
-
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.List;
-import java.util.Vector;
-
-import javax.xml.namespace.QName;
-
-import org.apache.woden.ErrorReporter;
-import org.apache.woden.WSDLException;
-import org.apache.woden.XMLElement;
-import org.apache.woden.internal.util.dom.DOMQNameUtils;
-import org.apache.woden.internal.util.dom.XPathUtils;
-import org.apache.woden.internal.wsdl20.Constants;
-import org.w3c.dom.Attr;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-
-public class DOMXMLElement extends BaseXMLElement{
-
-    public DOMXMLElement(ErrorReporter errorReporter) {
-        super(errorReporter);
-    }
-
-    /*
-     * @see org.apache.woden.XMLElement#setSource(java.lang.Object)
-     */
-    public void setSource(Object elem) {
-
-        if(elem instanceof Element) {
-            fSource = elem;
-        }
-        else {
-            String elemClass = (elem != null 
-                                    ? elem.getClass().getName()
-                                    : null);
-            String xmlElementClass = this.getClass().getName();
-            String msg = fErrorReporter.getFormattedMessage(
-                    "WSDL019", new Object[] {elemClass, xmlElementClass});
-            throw new IllegalArgumentException(msg);
-        }
-
-    }
-
-    /*TODO complete this method if it's added to XMLElement.
-     * 
-    public XMLAttribute[] getAttributes() {
-
-        String nodename, prefix;
-        Element el = (Element)fSource;
-        List attrs = new Vector();
-        NamedNodeMap attrMap = el.getAttributes();
-        for(int i = 0; i < attrMap.getLength(); i++){
-            nodename = attrMap.item(i).getNodeName();
-            prefix = attrMap.item(i).getPrefix();
-            if ( !(Constants.ATTR_XMLNS.equals(nodename) || 
-                    Constants.ATTR_XMLNS.equals(prefix)) ) {
-                //TODO create an XMLAttribute from attrMap.item(i)
-                //attrs.add(xmlAttribute);
-            }
-        }
-
-        XMLElement[] array = new XMLElement[attrs.size()];
-        attrs.toArray(array);
-        return array;
-    }
-    */
-
-
-    protected String doGetAttributeValue(String attrName) {
-    	
-    	Element el = (Element)fSource;
-    	return getAttribute(el, attrName);
-    }
-
-    protected URI doGetNamespaceURI() throws WSDLException {
-
-    	Element el = (Element)fSource;
-    	String nsStr =  el.getNamespaceURI();
-    	URI uri = null;
-    	
-    	try {
-    		uri = new URI(nsStr);
-    	} catch (URISyntaxException e) {
-    		String msg = fErrorReporter.getFormattedMessage(
-    				                        "WSDL506", 
-    				                        new Object[] {nsStr});
-    		throw new WSDLException(WSDLException.INVALID_WSDL, msg, e);
-    	}
-    	
-    	return uri;
-    }
-
-    protected String doGetLocalName() {
-
-    	Element el = (Element)fSource;
-    	return el.getLocalName();
-    }
-    
-    protected QName doGetQName() {
-    	
-    	Element el = (Element)fSource;
-    	return new QName(el.getNamespaceURI(), el.getLocalName());
-    }
-
-    protected QName doGetQName(String prefixedValue) throws WSDLException {
-
-    	Element el = (Element)fSource;
-    	int    index        = prefixedValue.indexOf(':');
-    	String prefix       = (index != -1) 
-    	                      ? prefixedValue.substring(0, index)
-    			              : null;
-    	String localPart    = prefixedValue.substring(index + 1);
-    	String namespaceURI = getNamespaceFromPrefix(el, prefix);
-
-        if(prefix != null && namespaceURI == null) {
-            String faultCode = WSDLException.UNBOUND_PREFIX;
-            String msg = fErrorReporter.getFormattedMessage(
-                    "WSDL513", 
-                    new Object[] {prefixedValue, DOMQNameUtils.newQName(el)});
-            WSDLException wsdlExc = new WSDLException(
-                    faultCode,
-                    msg);
-            wsdlExc.setLocation(XPathUtils.getXPathExprFromNode(el));
-            throw wsdlExc;
-        }
-        
-        return new QName(namespaceURI, localPart, (prefix != null ? prefix : ""));
-    }
-
-    protected XMLElement doGetFirstChildElement() {
-    	
-        XMLElement xmlElement = new DOMXMLElement(fErrorReporter);
-        Element el = (Element)fSource;
-        for (Node node = el.getFirstChild(); node!=null; node=node.getNextSibling()){
-        	if (node.getNodeType() == Node.ELEMENT_NODE){
-        		xmlElement.setSource(node);
-        		return xmlElement;
-        	}
-        }
-        return null;  //no child element found
-    }
-
-    protected XMLElement doGetNextSiblingElement() {
-    	
-        XMLElement xmlElement = new DOMXMLElement(fErrorReporter);
-        Element el = (Element)fSource;
-        for (Node node = el.getNextSibling (); node != null; node = node.getNextSibling ()) {
-        	if (node.getNodeType() == Node.ELEMENT_NODE){
-        		xmlElement.setSource(node);
-        		return xmlElement;
-        	}
-        }
-        return null;  //no sibling element found
-    }
-    
-    protected XMLElement[] doGetChildElements() {
-        
-        List children = new Vector();
-        XMLElement temp = doGetFirstChildElement();
-        while(temp != null)
-        {
-            children.add(temp);
-            temp = temp.getNextSiblingElement();
-        }
-        XMLElement[] array = new XMLElement[children.size()];
-        children.toArray(array);
-        return array;
-    }
-    
-    /* ************************************************************************
-     * Private helper methods
-     * ************************************************************************/
-    
-    private String getAttribute(Element el, String attrName) {
-    	
-    	String sRet = null;
-    	Attr   attr = el.getAttributeNode(attrName);
-    	
-    	if (attr != null) {
-    		sRet = attr.getValue();
-    	}
-    	return sRet;
-    }
-
-    private String getAttributeNS (Element el,
-    		                       String namespaceURI,
-    		                       String localPart) {
-    	String sRet = null;
-    	Attr   attr = el.getAttributeNodeNS (namespaceURI, localPart);
-
-    	if (attr != null) {
-    		sRet = attr.getValue ();
-    	}
-
-    	return sRet;
-    }
-    
-    private String getNamespaceFromPrefix(Node context, String prefix) {
-
-    	short nodeType = context.getNodeType ();
-    	Node tempNode = null;
-
-    	switch (nodeType)
-    	{
-	    	case Node.ATTRIBUTE_NODE :
-	    	{
-	    		tempNode = ((Attr) context).getOwnerElement ();
-	    		break;
-	    	}
-	    	case Node.ELEMENT_NODE :
-	    	{
-	    		tempNode = context;
-	    		break;
-	    	}
-	    	default :
-	    	{
-	    		tempNode = context.getParentNode ();
-	    		break;
-	    	}
-    	}
-
-    	while (tempNode != null && tempNode.getNodeType () == Node.ELEMENT_NODE)
-    	{
-    		Element tempEl = (Element) tempNode;
-
-    		String namespaceURI = (prefix == null)
-    		        ? getAttribute (tempEl, Constants.ATTR_XMLNS)
-    				: getAttributeNS (tempEl, Constants.NS_URI_XMLNS, prefix);
-
-    		if (namespaceURI != null)
-    		{
-    			return namespaceURI;
-    		} 
-    		else 
-    		{
-    			tempNode = tempEl.getParentNode ();
-    		}
-    	}
-
-    	return null; //no namespace found for specified prefix
-    }
-}
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */                       
+
+package org.apache.woden.internal;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.List;
+import java.util.Vector;
+
+import javax.xml.namespace.QName;
+
+import org.apache.woden.ErrorReporter;
+import org.apache.woden.WSDLException;
+import org.apache.woden.XMLElement;
+import org.apache.woden.internal.util.dom.DOMQNameUtils;
+import org.apache.woden.internal.util.dom.XPathUtils;
+import org.apache.woden.internal.wsdl20.Constants;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+public class DOMXMLElement extends BaseXMLElement{
+
+    public DOMXMLElement(ErrorReporter errorReporter) {
+        super(errorReporter);
+    }
+
+    /*
+     * @see org.apache.woden.XMLElement#setSource(java.lang.Object)
+     */
+    public void setSource(Object elem) {
+
+        if(elem instanceof Element) {
+            fSource = elem;
+        }
+        else {
+            String elemClass = (elem != null 
+                                    ? elem.getClass().getName()
+                                    : null);
+            String xmlElementClass = this.getClass().getName();
+            String msg = fErrorReporter.getFormattedMessage(
+                    "WSDL019", new Object[] {elemClass, xmlElementClass});
+            throw new IllegalArgumentException(msg);
+        }
+
+    }
+
+    /*TODO complete this method if it's added to XMLElement.
+     * 
+    public XMLAttribute[] getAttributes() {
+
+        String nodename, prefix;
+        Element el = (Element)fSource;
+        List attrs = new Vector();
+        NamedNodeMap attrMap = el.getAttributes();
+        for(int i = 0; i < attrMap.getLength(); i++){
+            nodename = attrMap.item(i).getNodeName();
+            prefix = attrMap.item(i).getPrefix();
+            if ( !(Constants.ATTR_XMLNS.equals(nodename) || 
+                    Constants.ATTR_XMLNS.equals(prefix)) ) {
+                //TODO create an XMLAttribute from attrMap.item(i)
+                //attrs.add(xmlAttribute);
+            }
+        }
+
+        XMLElement[] array = new XMLElement[attrs.size()];
+        attrs.toArray(array);
+        return array;
+    }
+    */
+
+
+    protected String doGetAttributeValue(String attrName) {
+    	
+    	Element el = (Element)fSource;
+    	return getAttribute(el, attrName);
+    }
+
+    protected URI doGetNamespaceURI() throws WSDLException {
+
+    	Element el = (Element)fSource;
+    	String nsStr =  el.getNamespaceURI();
+    	URI uri = null;
+    	
+    	try {
+    		uri = new URI(nsStr);
+    	} catch (URISyntaxException e) {
+    		String msg = fErrorReporter.getFormattedMessage(
+    				                        "WSDL506", 
+    				                        new Object[] {nsStr});
+    		throw new WSDLException(WSDLException.INVALID_WSDL, msg, e);
+    	}
+    	
+    	return uri;
+    }
+
+    protected String doGetLocalName() {
+
+    	Element el = (Element)fSource;
+    	return el.getLocalName();
+    }
+    
+    protected QName doGetQName() {
+    	
+    	Element el = (Element)fSource;
+    	return new QName(el.getNamespaceURI(), el.getLocalName());
+    }
+
+    protected QName doGetQName(String prefixedValue) throws WSDLException {
+
+    	Element el = (Element)fSource;
+    	int    index        = prefixedValue.indexOf(':');
+    	String prefix       = (index != -1) 
+    	                      ? prefixedValue.substring(0, index)
+    			              : null;
+    	String localPart    = prefixedValue.substring(index + 1);
+    	String namespaceURI = getNamespaceFromPrefix(el, prefix);
+
+        if(prefix != null && namespaceURI == null) {
+            String faultCode = WSDLException.UNBOUND_PREFIX;
+            String msg = fErrorReporter.getFormattedMessage(
+                    "WSDL513", 
+                    new Object[] {prefixedValue, DOMQNameUtils.newQName(el)});
+            WSDLException wsdlExc = new WSDLException(
+                    faultCode,
+                    msg);
+            wsdlExc.setLocation(XPathUtils.getXPathExprFromNode(el));
+            throw wsdlExc;
+        }
+        
+        return new QName(namespaceURI, localPart, (prefix != null ? prefix : ""));
+    }
+
+    protected XMLElement doGetFirstChildElement() {
+    	
+        XMLElement xmlElement = new DOMXMLElement(fErrorReporter);
+        Element el = (Element)fSource;
+        for (Node node = el.getFirstChild(); node!=null; node=node.getNextSibling()){
+        	if (node.getNodeType() == Node.ELEMENT_NODE){
+        		xmlElement.setSource(node);
+        		return xmlElement;
+        	}
+        }
+        return null;  //no child element found
+    }
+
+    protected XMLElement doGetNextSiblingElement() {
+    	
+        XMLElement xmlElement = new DOMXMLElement(fErrorReporter);
+        Element el = (Element)fSource;
+        for (Node node = el.getNextSibling (); node != null; node = node.getNextSibling ()) {
+        	if (node.getNodeType() == Node.ELEMENT_NODE){
+        		xmlElement.setSource(node);
+        		return xmlElement;
+        	}
+        }
+        return null;  //no sibling element found
+    }
+    
+    protected XMLElement[] doGetChildElements() {
+        
+        List children = new Vector();
+        XMLElement temp = doGetFirstChildElement();
+        while(temp != null)
+        {
+            children.add(temp);
+            temp = temp.getNextSiblingElement();
+        }
+        XMLElement[] array = new XMLElement[children.size()];
+        children.toArray(array);
+        return array;
+    }
+    
+    /* ************************************************************************
+     * Private helper methods
+     * ************************************************************************/
+    
+    private String getAttribute(Element el, String attrName) {
+    	
+    	String sRet = null;
+    	Attr   attr = el.getAttributeNode(attrName);
+    	
+    	if (attr != null) {
+    		sRet = attr.getValue();
+    	}
+    	return sRet;
+    }
+
+    private String getAttributeNS (Element el,
+    		                       String namespaceURI,
+    		                       String localPart) {
+    	String sRet = null;
+    	Attr   attr = el.getAttributeNodeNS (namespaceURI, localPart);
+
+    	if (attr != null) {
+    		sRet = attr.getValue ();
+    	}
+
+    	return sRet;
+    }
+    
+    private String getNamespaceFromPrefix(Node context, String prefix) {
+
+    	short nodeType = context.getNodeType ();
+    	Node tempNode = null;
+
+    	switch (nodeType)
+    	{
+	    	case Node.ATTRIBUTE_NODE :
+	    	{
+	    		tempNode = ((Attr) context).getOwnerElement ();
+	    		break;
+	    	}
+	    	case Node.ELEMENT_NODE :
+	    	{
+	    		tempNode = context;
+	    		break;
+	    	}
+	    	default :
+	    	{
+	    		tempNode = context.getParentNode ();
+	    		break;
+	    	}
+    	}
+
+    	while (tempNode != null && tempNode.getNodeType () == Node.ELEMENT_NODE)
+    	{
+    		Element tempEl = (Element) tempNode;
+
+    		String namespaceURI = (prefix == null)
+    		        ? getAttribute (tempEl, Constants.ATTR_XMLNS)
+    				: getAttributeNS (tempEl, Constants.NS_URI_XMLNS, prefix);
+
+    		if (namespaceURI != null)
+    		{
+    			return namespaceURI;
+    		} 
+    		else 
+    		{
+    			tempNode = tempEl.getParentNode ();
+    		}
+    	}
+
+    	return null; //no namespace found for specified prefix
+    }
+}

Propchange: incubator/woden/trunk/java/src/org/apache/woden/internal/DOMXMLElement.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/woden/trunk/java/src/org/apache/woden/internal/ErrorHandlerImpl.java
URL: http://svn.apache.org/viewvc/incubator/woden/trunk/java/src/org/apache/woden/internal/ErrorHandlerImpl.java?rev=568932&r1=568931&r2=568932&view=diff
==============================================================================
--- incubator/woden/trunk/java/src/org/apache/woden/internal/ErrorHandlerImpl.java (original)
+++ incubator/woden/trunk/java/src/org/apache/woden/internal/ErrorHandlerImpl.java Thu Aug 23 04:01:23 2007
@@ -1,61 +1,61 @@
-/**
+/**
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
- *     http://www.apache.org/licenses/LICENSE-2.0 
- * 
- * Unless required by applicable law or agreed to in writing, software 
- * distributed under the License is distributed on an "AS IS" BASIS, 
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
- * See the License for the specific language governing permissions and 
- * limitations under the License.
- */
-package org.apache.woden.internal;
-
-import org.apache.woden.ErrorHandler;
-import org.apache.woden.ErrorInfo;
-
-/**
- * This class implements the default error handling behaviour, which is simply
- * to report warnings, errors and fatal errors by printing the error info to 
- * the system output stream.
- * 
- * Implementations may replace this behaviour by providing their own implementation
- * of the ErrorHandler interface.
- *   
- * @author jkaputin@apache.org
- */
-public class ErrorHandlerImpl implements ErrorHandler {
-
-    /* (non-Javadoc)
-     * @see org.apache.woden.ErrorHandler#warning(org.apache.woden.ErrorInfo)
-     */
-    public void warning(ErrorInfo errorInfo) {
-        
-        System.out.println("Woden[Warning]," + errorInfo.toString());
-
-    }
-
-    /* (non-Javadoc)
-     * @see org.apache.woden.ErrorHandler#error(org.apache.woden.ErrorInfo)
-     */
-    public void error(ErrorInfo errorInfo) {
-
-        System.out.println("Woden[Error]," + errorInfo.toString());
-
-    }
-
-    /* (non-Javadoc)
-     * @see org.apache.woden.ErrorHandler#fatalError(org.apache.woden.ErrorInfo)
-     */
-    public void fatalError(ErrorInfo errorInfo) {
-
-        System.out.println("Woden[Fatal Error]," + errorInfo.toString());
-
-    }
-
-}
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0 
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+package org.apache.woden.internal;
+
+import org.apache.woden.ErrorHandler;
+import org.apache.woden.ErrorInfo;
+
+/**
+ * This class implements the default error handling behaviour, which is simply
+ * to report warnings, errors and fatal errors by printing the error info to 
+ * the system output stream.
+ * 
+ * Implementations may replace this behaviour by providing their own implementation
+ * of the ErrorHandler interface.
+ *   
+ * @author jkaputin@apache.org
+ */
+public class ErrorHandlerImpl implements ErrorHandler {
+
+    /* (non-Javadoc)
+     * @see org.apache.woden.ErrorHandler#warning(org.apache.woden.ErrorInfo)
+     */
+    public void warning(ErrorInfo errorInfo) {
+        
+        System.out.println("Woden[Warning]," + errorInfo.toString());
+
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.woden.ErrorHandler#error(org.apache.woden.ErrorInfo)
+     */
+    public void error(ErrorInfo errorInfo) {
+
+        System.out.println("Woden[Error]," + errorInfo.toString());
+
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.woden.ErrorHandler#fatalError(org.apache.woden.ErrorInfo)
+     */
+    public void fatalError(ErrorInfo errorInfo) {
+
+        System.out.println("Woden[Fatal Error]," + errorInfo.toString());
+
+    }
+
+}

Propchange: incubator/woden/trunk/java/src/org/apache/woden/internal/ErrorHandlerImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/woden/trunk/java/src/org/apache/woden/internal/ErrorInfoImpl.java
URL: http://svn.apache.org/viewvc/incubator/woden/trunk/java/src/org/apache/woden/internal/ErrorInfoImpl.java?rev=568932&r1=568931&r2=568932&view=diff
==============================================================================
--- incubator/woden/trunk/java/src/org/apache/woden/internal/ErrorInfoImpl.java (original)
+++ incubator/woden/trunk/java/src/org/apache/woden/internal/ErrorInfoImpl.java Thu Aug 23 04:01:23 2007
@@ -1,91 +1,91 @@
-/**
+/**
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
- *     http://www.apache.org/licenses/LICENSE-2.0 
- * 
- * Unless required by applicable law or agreed to in writing, software 
- * distributed under the License is distributed on an "AS IS" BASIS, 
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
- * See the License for the specific language governing permissions and 
- * limitations under the License.
- */
-package org.apache.woden.internal;
-
-import org.apache.woden.ErrorInfo;
-import org.apache.woden.ErrorLocator;
-
-/**
- * This class is a data object containing the information needed
- * for reporting warnings, errors and fatal errors. It overrides
- * the toString() method to concatenate this information into
- * a single string for reporting purposes.
- * 
- * @author jkaputin@apache.org
- */
-public class ErrorInfoImpl implements ErrorInfo {
-    
-    //TODO decide if a data container object like this is suitable,
-    //rather than an exception like XMLParserException used in Xerces.
-    
-    //TODO decide if properties captured here are sufficient for reporting needs.
-    
-    private ErrorLocator fErrLoc;
-    private String fKey;
-    private String fMessage;
-    private Exception fException;
-
-    public ErrorInfoImpl(ErrorLocator errorLocator,
-                         String key, 
-                         String message,
-                         Exception exception) 
-    {
-        fErrLoc = errorLocator;
-        fKey = key;
-        fMessage = message;
-        fException = exception;
-    }
-    
-    public ErrorLocator getErrorLocator() {
-        return fErrLoc;
-    }
-
-    public String getKey() {
-        return fKey;
-    }
-
-    public String getMessage() {
-        return fMessage;
-    }
-    
-    public Exception getException() {
-        return fException;
-    }
-    
-    public String toString() {
-        
-        StringBuffer sb = new StringBuffer();
-        
-        if(fErrLoc != null)
-        {
-            sb.append(fErrLoc.getLineNumber() + ":" + 
-                      fErrLoc.getColumnNumber() + ",");
-        }
-        
-        sb.append(fKey + ",");
-        sb.append(fMessage);
-        
-        if(fException != null) {
-            sb.append("," + fException.getClass().getName() + ":" +
-                      fException.getMessage());
-        }
-        
-        return sb.toString();
-        
-    }
-
-}
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0 
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+package org.apache.woden.internal;
+
+import org.apache.woden.ErrorInfo;
+import org.apache.woden.ErrorLocator;
+
+/**
+ * This class is a data object containing the information needed
+ * for reporting warnings, errors and fatal errors. It overrides
+ * the toString() method to concatenate this information into
+ * a single string for reporting purposes.
+ * 
+ * @author jkaputin@apache.org
+ */
+public class ErrorInfoImpl implements ErrorInfo {
+    
+    //TODO decide if a data container object like this is suitable,
+    //rather than an exception like XMLParserException used in Xerces.
+    
+    //TODO decide if properties captured here are sufficient for reporting needs.
+    
+    private ErrorLocator fErrLoc;
+    private String fKey;
+    private String fMessage;
+    private Exception fException;
+
+    public ErrorInfoImpl(ErrorLocator errorLocator,
+                         String key, 
+                         String message,
+                         Exception exception) 
+    {
+        fErrLoc = errorLocator;
+        fKey = key;
+        fMessage = message;
+        fException = exception;
+    }
+    
+    public ErrorLocator getErrorLocator() {
+        return fErrLoc;
+    }
+
+    public String getKey() {
+        return fKey;
+    }
+
+    public String getMessage() {
+        return fMessage;
+    }
+    
+    public Exception getException() {
+        return fException;
+    }
+    
+    public String toString() {
+        
+        StringBuffer sb = new StringBuffer();
+        
+        if(fErrLoc != null)
+        {
+            sb.append(fErrLoc.getLineNumber() + ":" + 
+                      fErrLoc.getColumnNumber() + ",");
+        }
+        
+        sb.append(fKey + ",");
+        sb.append(fMessage);
+        
+        if(fException != null) {
+            sb.append("," + fException.getClass().getName() + ":" +
+                      fException.getMessage());
+        }
+        
+        return sb.toString();
+        
+    }
+
+}

Propchange: incubator/woden/trunk/java/src/org/apache/woden/internal/ErrorInfoImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/woden/trunk/java/src/org/apache/woden/internal/ErrorLocatorImpl.java
URL: http://svn.apache.org/viewvc/incubator/woden/trunk/java/src/org/apache/woden/internal/ErrorLocatorImpl.java?rev=568932&r1=568931&r2=568932&view=diff
==============================================================================
--- incubator/woden/trunk/java/src/org/apache/woden/internal/ErrorLocatorImpl.java (original)
+++ incubator/woden/trunk/java/src/org/apache/woden/internal/ErrorLocatorImpl.java Thu Aug 23 04:01:23 2007
@@ -1,97 +1,97 @@
-/**
+/**
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
- *     http://www.apache.org/licenses/LICENSE-2.0 
- * 
- * Unless required by applicable law or agreed to in writing, software 
- * distributed under the License is distributed on an "AS IS" BASIS, 
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
- * See the License for the specific language governing permissions and 
- * limitations under the License.
- */
-package org.apache.woden.internal;
-
-import org.apache.woden.ErrorLocator;
-
-/**
- * Represents the location of parsing error within a XML document.
- *
- * @author kaputin
- */
-public class ErrorLocatorImpl implements ErrorLocator {
-    
-    private int fLineNumber;
-    private int fColumnNumber;
-
-    /* (non-Javadoc)
-     * @see org.apache.woden.ErrorLocator#getDocumentBaseURI()
-     */
-    public String getDocumentBaseURI() {
-        // TODO required?
-        return null;
-    }
-
-    /* (non-Javadoc)
-     * @see org.apache.woden.ErrorLocator#getLocationURI()
-     */
-    public String getLocationURI() {
-        // TODO required?
-        return null;
-    }
-
-    /* (non-Javadoc)
-     * @see org.apache.woden.ErrorLocator#getLineNumber()
-     */
-    public int getLineNumber() {
-        return fLineNumber;
-    }
-    
-    /* (non-Javadoc)
-     * @see org.apache.woden.ErrorLocator#getColumnNumber()
-     */
-    public int getColumnNumber() {
-        return fColumnNumber;
-    }
-
-    /**
-     * Set the base URI of this locator.
-     * 
-     * @param uri The URI of the base location to set.
-     */
-    public void setDocumentBaseURI(String uri) {
-        // TODO required?
-    }
-
-    /**
-     * Set the location URI of this locator.
-     * 
-     * @param uri The URI of the location to set.
-     */
-    public void setLocationURI(String uri) {
-        // TODO required?
-    }
-
-    /**
-     * Set the line number of this locator.
-     * 
-     * @param line The line number to set.
-     */
-    public void setLineNumber(int line) {
-        fLineNumber = line;
-    }
-
-    /**
-     * Set the column number of this locator.
-     * 
-     * @param col The column number to set.
-     */
-    public void setColumnNumber(int col) {
-        fColumnNumber = col;
-    }
-    
-}
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0 
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+package org.apache.woden.internal;
+
+import org.apache.woden.ErrorLocator;
+
+/**
+ * Represents the location of parsing error within a XML document.
+ *
+ * @author kaputin
+ */
+public class ErrorLocatorImpl implements ErrorLocator {
+    
+    private int fLineNumber;
+    private int fColumnNumber;
+
+    /* (non-Javadoc)
+     * @see org.apache.woden.ErrorLocator#getDocumentBaseURI()
+     */
+    public String getDocumentBaseURI() {
+        // TODO required?
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.woden.ErrorLocator#getLocationURI()
+     */
+    public String getLocationURI() {
+        // TODO required?
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.woden.ErrorLocator#getLineNumber()
+     */
+    public int getLineNumber() {
+        return fLineNumber;
+    }
+    
+    /* (non-Javadoc)
+     * @see org.apache.woden.ErrorLocator#getColumnNumber()
+     */
+    public int getColumnNumber() {
+        return fColumnNumber;
+    }
+
+    /**
+     * Set the base URI of this locator.
+     * 
+     * @param uri The URI of the base location to set.
+     */
+    public void setDocumentBaseURI(String uri) {
+        // TODO required?
+    }
+
+    /**
+     * Set the location URI of this locator.
+     * 
+     * @param uri The URI of the location to set.
+     */
+    public void setLocationURI(String uri) {
+        // TODO required?
+    }
+
+    /**
+     * Set the line number of this locator.
+     * 
+     * @param line The line number to set.
+     */
+    public void setLineNumber(int line) {
+        fLineNumber = line;
+    }
+
+    /**
+     * Set the column number of this locator.
+     * 
+     * @param col The column number to set.
+     */
+    public void setColumnNumber(int col) {
+        fColumnNumber = col;
+    }
+    
+}

Propchange: incubator/woden/trunk/java/src/org/apache/woden/internal/ErrorLocatorImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/woden/trunk/java/src/org/apache/woden/internal/ErrorReporterImpl.java
URL: http://svn.apache.org/viewvc/incubator/woden/trunk/java/src/org/apache/woden/internal/ErrorReporterImpl.java?rev=568932&r1=568931&r2=568932&view=diff
==============================================================================
--- incubator/woden/trunk/java/src/org/apache/woden/internal/ErrorReporterImpl.java (original)
+++ incubator/woden/trunk/java/src/org/apache/woden/internal/ErrorReporterImpl.java Thu Aug 23 04:01:23 2007
@@ -1,289 +1,289 @@
-/**
+/**
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
- *     http://www.apache.org/licenses/LICENSE-2.0 
- * 
- * Unless required by applicable law or agreed to in writing, software 
- * distributed under the License is distributed on an "AS IS" BASIS, 
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
- * See the License for the specific language governing permissions and 
- * limitations under the License.
- */
-package org.apache.woden.internal;
-
-import java.util.Locale;
-import org.apache.woden.ErrorHandler;
-import org.apache.woden.ErrorInfo;
-import org.apache.woden.ErrorLocator;
-import org.apache.woden.ErrorReporter;
-import org.apache.woden.WSDLException;
-import org.apache.woden.internal.ErrorInfoImpl;
-import org.apache.woden.internal.MessageFormatter;
-import org.apache.woden.internal.util.PropertyUtils;
-
-
-/**
- * This class reports errors that occur while parsing, validating or
- * manipulating WSDL descriptions, such as XML parser errors or violations
- * of the rules defined in the WSDL specification. That is, errors that
- * relate specifically to the WSDL. It does not report system runtime 
- * or configuration errors, which are instead treated as exceptions.
- * <p>
- * There are four ways to report an error:
- * <p>
- * An error id and an array of message arguments are used to produce 
- * a formatted error message from some parameterized message text.
- * The error may be reported with an target exception or without one.
- * <p>
- * An error id is specified with some ready-formatted message text.
- * The error may be reported with an target exception or without one.
- * <p>
- * The error is handled according to the severity level 
- * (warning, error or fatal error) reported with the error.
- * <p/>
- * The error reporter supports the 'en' (English) locale by default 
- * and has a default error handler (i.e. a default implementation of 
- * ErrorHandler). However, a different locale may be configured 
- * via <code>setLocale</code> and a custom error handler implementation 
- * may be configured as a system property.
- * 
- * @author jkaputin@apache.org
- */
-public class ErrorReporterImpl implements ErrorReporter {
-    
-    //TODO: add further behaviour as requirements emerge - e.g.
-    //using a xml locator object to report line/col numbers.
-
-    //the ISO-639 language code for the required locale
-    protected static final String LOCALE_LANGUAGE = 
-        "org.apache.woden.locale-language";
-
-    //the class name of a custom error handler
-    protected static final String ERROR_HANDLER_NAME = 
-        "org.apache.woden.error-handler-name";
-
-    //"true" or "false" to continue parsing after a fatal error
-    protected static final String CONTINUE_AFTER_FATAL_ERROR = 
-        "org.apache.woden.continue-after-fatal-error";
-
-    //Used for localization of error messages.
-    private Locale fLocale;
-    
-    //Combines parameterized message text with message parameters 
-    private MessageFormatter fMessageFormatter;
-    
-    //Used only if no custom error handler has been specified
-    private ErrorHandler fDefaultErrorHandler;
-    
-    //Custom error handler to use instead of the default error handler
-    private ErrorHandler fErrorHandler;  
-
-    /*
-     * The default constructor sets the instance variables. It uses default
-     * implementations for <code>fMessageFormatter</code> and 
-     * <code>fDefaultErrorHandler</code>. It checks for optional properties that
-     * specify the settings for the remaining variables.
-     * For <code>fLocale</code>, property org.apache.woden.locale can be used to
-     * specify the ISO-639 language code for the required locale. If it is omitted 
-     * it will default to "en" for English. There is also a setter method which will
-     * override any value set by this constructor.
-     * For <code>fErrorHandler</code>, property org.apache.woden.error-handler-name
-     * can be used to specify the class name of the custom error handler or if
-     * omitted, it is set to null.  There is also a setter method which will
-     * override any value set by this constructor.
-     * <p/> 
-     * Their are several alternatives for specifying these properties, so the property lookup 
-     * mechanism is encapsulated in a separate <code>PropertyUtils</code> class.
-     * <p/>
-     * TODO fContinueAfterFatalError and related code has been commented out for 
-     * the time being. If we cannot identify a use case for it, it will be removed.
-     * <p/>
-     * For <code>fContinueAfterFatalError</code>, 
-     * org.apache.woden.continue-after-fatal-error can be used to specify 
-     * "true" or "false". If this property is omitted or contains any other value,
-     * default to "true".
-
-     * @throws WSDLException wraps exceptions that may occur while creating 
-     * objects from Class names specified as properties (e.g. 
-     * ClassNotFoundException, InstantiationException and IllegalAccessException).
-     * 
-     */
-    public ErrorReporterImpl() throws WSDLException
-    {
-        fMessageFormatter = new MessageFormatter();
-        fDefaultErrorHandler = new ErrorHandlerImpl();
-        
-        //Set the locale using the language code property if specified.
-        String localeLanguage = PropertyUtils.findProperty(LOCALE_LANGUAGE);
-
-        if (localeLanguage != null) {
-            fLocale = new Locale(localeLanguage);;
-        }
-        
-        //TODO handle an unsupported locale lang code 
-        //(e.g. use system locale and log a warning message)
-        
-        //Set the custom error handler from the error handler property if specified.
-        String errorHandlerName = PropertyUtils.findProperty(ERROR_HANDLER_NAME);
-        
-        if (errorHandlerName != null)
-        {
-            try
-            {
-                Class cl = Class.forName(errorHandlerName);
-                fErrorHandler = (ErrorHandler)cl.newInstance();
-            }
-            catch (Exception e)
-            {
-                /*
-                 ClassNotFoundException
-                 InstantiationException
-                 IllegalAccessException
-                 */
-                throw new WSDLException(WSDLException.CONFIGURATION_ERROR,
-                        "Problem instantiating the customer error handler.",
-                        e);
-            }
-        } 
-        else 
-        {
-            fErrorHandler = null;
-        }
-    }
-
-    /*
-     *  (non-Javadoc)
-     * @see org.apache.woden.ErrorReporter#reportError(org.apache.woden.ErrorLocator, java.lang.String, java.lang.Object[], short)
-     */
-    public void reportError(ErrorLocator errLoc, 
-                            String errorId, 
-                            Object[] arguments, 
-                            short severity)
-    throws WSDLException
-    {
-        reportError(errLoc, errorId, arguments, severity, null);
-    }
-        
-    /*
-     *  (non-Javadoc)
-     * @see org.apache.woden.ErrorReporter#reportError(org.apache.woden.ErrorLocator, java.lang.String, java.lang.Object[], short, java.lang.Exception)
-     */
-    public void reportError(ErrorLocator errLoc, 
-                            String errorId, 
-                            Object[] arguments, 
-                            short severity,
-                            Exception exception)
-    throws WSDLException
-    {
-        String message = fMessageFormatter.formatMessage(fLocale, errorId, arguments);
-        reportError(errLoc, errorId, message, severity, exception);
-    }
-    
-    /*
-     *  (non-Javadoc)
-     * @see org.apache.woden.ErrorReporter#reportError(org.apache.woden.ErrorLocator, java.lang.String, java.lang.String, short)
-     */
-    public void reportError(ErrorLocator errLoc, 
-                            String errorId, 
-                            String message, 
-                            short severity)
-    throws WSDLException
-    {
-        reportError(errLoc, errorId, message, severity, null);
-    }
-    
-    /*
-     *  (non-Javadoc)
-     * @see org.apache.woden.ErrorReporter#reportError(org.apache.woden.ErrorLocator, java.lang.String, java.lang.String, short, java.lang.Exception)
-     */
-    public void reportError(ErrorLocator errLoc, 
-                            String errorId, 
-                            String message, 
-                            short severity,
-                            Exception exception)
-    throws WSDLException
-    {
-        ErrorInfo errorInfo = 
-            new ErrorInfoImpl(errLoc, errorId, message, exception);
-
-        ErrorHandler eh = 
-            (fErrorHandler != null) ? fErrorHandler : fDefaultErrorHandler;
-        
-        if(severity == SEVERITY_WARNING) {
-            eh.warning(errorInfo);
-        }
-        else if(severity == SEVERITY_ERROR) {
-            eh.error(errorInfo);
-        }
-        else if(severity == SEVERITY_FATAL_ERROR) {
-            eh.fatalError(errorInfo);
-            
-            // Fatal error strategy is to terminate with a WSDLException.
-            
-            if(exception == null) {
-                throw new WSDLException(WSDLException.INVALID_WSDL,
-                        "Fatal WSDL error:\n" + errorInfo.toString());
-            }
-            else if(exception instanceof WSDLException) {
-                throw (WSDLException)exception;
-            }
-            else {
-                throw new WSDLException(WSDLException.OTHER_ERROR,
-                                        "Fatal error.",
-                                        exception);
-            }
-        }
-        else 
-        {
-            //TODO externalize these messages for localization
-            throw new IllegalArgumentException("Invalid severity: " + severity);
-        }
-    }
-    
-    /*
-     *  (non-Javadoc)
-     * @see org.apache.woden.ErrorReporter#setErrorHandler(org.apache.woden.ErrorHandler)
-     */
-    public void setErrorHandler(ErrorHandler errorHandler) {
-        fErrorHandler = errorHandler;
-    }
-    
-    /*
-     *  (non-Javadoc)
-     * @see org.apache.woden.ErrorReporter#getErrorHandler()
-     */
-    public ErrorHandler getErrorHandler() {
-        return (fErrorHandler != null) ? fErrorHandler : fDefaultErrorHandler;
-    }
-
-    /*
-     *  (non-Javadoc)
-     * @see org.apache.woden.ErrorReporter#setLocale(java.util.Locale)
-     */
-    public void setLocale(Locale locale) {
-        fLocale = locale;
-    }
-
-    /*
-     *  (non-Javadoc)
-     * @see org.apache.woden.ErrorReporter#getLocale()
-     */
-    public Locale getLocale() {
-        return fLocale;
-    }
-
-    /*
-     *  (non-Javadoc)
-     * @see org.apache.woden.ErrorReporter#getFormattedMessage(java.lang.String, java.lang.Object[])
-     */
-    public String getFormattedMessage(String key, Object[] arguments)
-    {
-        String message = fMessageFormatter.formatMessage(fLocale, key, arguments);
-        return message;
-    }
-}
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0 
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+package org.apache.woden.internal;
+
+import java.util.Locale;
+import org.apache.woden.ErrorHandler;
+import org.apache.woden.ErrorInfo;
+import org.apache.woden.ErrorLocator;
+import org.apache.woden.ErrorReporter;
+import org.apache.woden.WSDLException;
+import org.apache.woden.internal.ErrorInfoImpl;
+import org.apache.woden.internal.MessageFormatter;
+import org.apache.woden.internal.util.PropertyUtils;
+
+
+/**
+ * This class reports errors that occur while parsing, validating or
+ * manipulating WSDL descriptions, such as XML parser errors or violations
+ * of the rules defined in the WSDL specification. That is, errors that
+ * relate specifically to the WSDL. It does not report system runtime 
+ * or configuration errors, which are instead treated as exceptions.
+ * <p>
+ * There are four ways to report an error:
+ * <p>
+ * An error id and an array of message arguments are used to produce 
+ * a formatted error message from some parameterized message text.
+ * The error may be reported with an target exception or without one.
+ * <p>
+ * An error id is specified with some ready-formatted message text.
+ * The error may be reported with an target exception or without one.
+ * <p>
+ * The error is handled according to the severity level 
+ * (warning, error or fatal error) reported with the error.
+ * <p/>
+ * The error reporter supports the 'en' (English) locale by default 
+ * and has a default error handler (i.e. a default implementation of 
+ * ErrorHandler). However, a different locale may be configured 
+ * via <code>setLocale</code> and a custom error handler implementation 
+ * may be configured as a system property.
+ * 
+ * @author jkaputin@apache.org
+ */
+public class ErrorReporterImpl implements ErrorReporter {
+    
+    //TODO: add further behaviour as requirements emerge - e.g.
+    //using a xml locator object to report line/col numbers.
+
+    //the ISO-639 language code for the required locale
+    protected static final String LOCALE_LANGUAGE = 
+        "org.apache.woden.locale-language";
+
+    //the class name of a custom error handler
+    protected static final String ERROR_HANDLER_NAME = 
+        "org.apache.woden.error-handler-name";
+
+    //"true" or "false" to continue parsing after a fatal error
+    protected static final String CONTINUE_AFTER_FATAL_ERROR = 
+        "org.apache.woden.continue-after-fatal-error";
+
+    //Used for localization of error messages.
+    private Locale fLocale;
+    
+    //Combines parameterized message text with message parameters 
+    private MessageFormatter fMessageFormatter;
+    
+    //Used only if no custom error handler has been specified
+    private ErrorHandler fDefaultErrorHandler;
+    
+    //Custom error handler to use instead of the default error handler
+    private ErrorHandler fErrorHandler;  
+
+    /*
+     * The default constructor sets the instance variables. It uses default
+     * implementations for <code>fMessageFormatter</code> and 
+     * <code>fDefaultErrorHandler</code>. It checks for optional properties that
+     * specify the settings for the remaining variables.
+     * For <code>fLocale</code>, property org.apache.woden.locale can be used to
+     * specify the ISO-639 language code for the required locale. If it is omitted 
+     * it will default to "en" for English. There is also a setter method which will
+     * override any value set by this constructor.
+     * For <code>fErrorHandler</code>, property org.apache.woden.error-handler-name
+     * can be used to specify the class name of the custom error handler or if
+     * omitted, it is set to null.  There is also a setter method which will
+     * override any value set by this constructor.
+     * <p/> 
+     * Their are several alternatives for specifying these properties, so the property lookup 
+     * mechanism is encapsulated in a separate <code>PropertyUtils</code> class.
+     * <p/>
+     * TODO fContinueAfterFatalError and related code has been commented out for 
+     * the time being. If we cannot identify a use case for it, it will be removed.
+     * <p/>
+     * For <code>fContinueAfterFatalError</code>, 
+     * org.apache.woden.continue-after-fatal-error can be used to specify 
+     * "true" or "false". If this property is omitted or contains any other value,
+     * default to "true".
+
+     * @throws WSDLException wraps exceptions that may occur while creating 
+     * objects from Class names specified as properties (e.g. 
+     * ClassNotFoundException, InstantiationException and IllegalAccessException).
+     * 
+     */
+    public ErrorReporterImpl() throws WSDLException
+    {
+        fMessageFormatter = new MessageFormatter();
+        fDefaultErrorHandler = new ErrorHandlerImpl();
+        
+        //Set the locale using the language code property if specified.
+        String localeLanguage = PropertyUtils.findProperty(LOCALE_LANGUAGE);
+
+        if (localeLanguage != null) {
+            fLocale = new Locale(localeLanguage);;
+        }
+        
+        //TODO handle an unsupported locale lang code 
+        //(e.g. use system locale and log a warning message)
+        
+        //Set the custom error handler from the error handler property if specified.
+        String errorHandlerName = PropertyUtils.findProperty(ERROR_HANDLER_NAME);
+        
+        if (errorHandlerName != null)
+        {
+            try
+            {
+                Class cl = Class.forName(errorHandlerName);
+                fErrorHandler = (ErrorHandler)cl.newInstance();
+            }
+            catch (Exception e)
+            {
+                /*
+                 ClassNotFoundException
+                 InstantiationException
+                 IllegalAccessException
+                 */
+                throw new WSDLException(WSDLException.CONFIGURATION_ERROR,
+                        "Problem instantiating the customer error handler.",
+                        e);
+            }
+        } 
+        else 
+        {
+            fErrorHandler = null;
+        }
+    }
+
+    /*
+     *  (non-Javadoc)
+     * @see org.apache.woden.ErrorReporter#reportError(org.apache.woden.ErrorLocator, java.lang.String, java.lang.Object[], short)
+     */
+    public void reportError(ErrorLocator errLoc, 
+                            String errorId, 
+                            Object[] arguments, 
+                            short severity)
+    throws WSDLException
+    {
+        reportError(errLoc, errorId, arguments, severity, null);
+    }
+        
+    /*
+     *  (non-Javadoc)
+     * @see org.apache.woden.ErrorReporter#reportError(org.apache.woden.ErrorLocator, java.lang.String, java.lang.Object[], short, java.lang.Exception)
+     */
+    public void reportError(ErrorLocator errLoc, 
+                            String errorId, 
+                            Object[] arguments, 
+                            short severity,
+                            Exception exception)
+    throws WSDLException
+    {
+        String message = fMessageFormatter.formatMessage(fLocale, errorId, arguments);
+        reportError(errLoc, errorId, message, severity, exception);
+    }
+    
+    /*
+     *  (non-Javadoc)
+     * @see org.apache.woden.ErrorReporter#reportError(org.apache.woden.ErrorLocator, java.lang.String, java.lang.String, short)
+     */
+    public void reportError(ErrorLocator errLoc, 
+                            String errorId, 
+                            String message, 
+                            short severity)
+    throws WSDLException
+    {
+        reportError(errLoc, errorId, message, severity, null);
+    }
+    
+    /*
+     *  (non-Javadoc)
+     * @see org.apache.woden.ErrorReporter#reportError(org.apache.woden.ErrorLocator, java.lang.String, java.lang.String, short, java.lang.Exception)
+     */
+    public void reportError(ErrorLocator errLoc, 
+                            String errorId, 
+                            String message, 
+                            short severity,
+                            Exception exception)
+    throws WSDLException
+    {
+        ErrorInfo errorInfo = 
+            new ErrorInfoImpl(errLoc, errorId, message, exception);
+
+        ErrorHandler eh = 
+            (fErrorHandler != null) ? fErrorHandler : fDefaultErrorHandler;
+        
+        if(severity == SEVERITY_WARNING) {
+            eh.warning(errorInfo);
+        }
+        else if(severity == SEVERITY_ERROR) {
+            eh.error(errorInfo);
+        }
+        else if(severity == SEVERITY_FATAL_ERROR) {
+            eh.fatalError(errorInfo);
+            
+            // Fatal error strategy is to terminate with a WSDLException.
+            
+            if(exception == null) {
+                throw new WSDLException(WSDLException.INVALID_WSDL,
+                        "Fatal WSDL error:\n" + errorInfo.toString());
+            }
+            else if(exception instanceof WSDLException) {
+                throw (WSDLException)exception;
+            }
+            else {
+                throw new WSDLException(WSDLException.OTHER_ERROR,
+                                        "Fatal error.",
+                                        exception);
+            }
+        }
+        else 
+        {
+            //TODO externalize these messages for localization
+            throw new IllegalArgumentException("Invalid severity: " + severity);
+        }
+    }
+    
+    /*
+     *  (non-Javadoc)
+     * @see org.apache.woden.ErrorReporter#setErrorHandler(org.apache.woden.ErrorHandler)
+     */
+    public void setErrorHandler(ErrorHandler errorHandler) {
+        fErrorHandler = errorHandler;
+    }
+    
+    /*
+     *  (non-Javadoc)
+     * @see org.apache.woden.ErrorReporter#getErrorHandler()
+     */
+    public ErrorHandler getErrorHandler() {
+        return (fErrorHandler != null) ? fErrorHandler : fDefaultErrorHandler;
+    }
+
+    /*
+     *  (non-Javadoc)
+     * @see org.apache.woden.ErrorReporter#setLocale(java.util.Locale)
+     */
+    public void setLocale(Locale locale) {
+        fLocale = locale;
+    }
+
+    /*
+     *  (non-Javadoc)
+     * @see org.apache.woden.ErrorReporter#getLocale()
+     */
+    public Locale getLocale() {
+        return fLocale;
+    }
+
+    /*
+     *  (non-Javadoc)
+     * @see org.apache.woden.ErrorReporter#getFormattedMessage(java.lang.String, java.lang.Object[])
+     */
+    public String getFormattedMessage(String key, Object[] arguments)
+    {
+        String message = fMessageFormatter.formatMessage(fLocale, key, arguments);
+        return message;
+    }
+}

Propchange: incubator/woden/trunk/java/src/org/apache/woden/internal/ErrorReporterImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/woden/trunk/java/src/org/apache/woden/internal/MessageFormatter.java
URL: http://svn.apache.org/viewvc/incubator/woden/trunk/java/src/org/apache/woden/internal/MessageFormatter.java?rev=568932&r1=568931&r2=568932&view=diff
==============================================================================
--- incubator/woden/trunk/java/src/org/apache/woden/internal/MessageFormatter.java (original)
+++ incubator/woden/trunk/java/src/org/apache/woden/internal/MessageFormatter.java Thu Aug 23 04:01:23 2007
@@ -1,67 +1,67 @@
-/**
+/**
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
- *     http://www.apache.org/licenses/LICENSE-2.0 
- * 
- * Unless required by applicable law or agreed to in writing, software 
- * distributed under the License is distributed on an "AS IS" BASIS, 
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
- * See the License for the specific language governing permissions and 
- * limitations under the License.
- */
-package org.apache.woden.internal;
-
-import java.text.MessageFormat;
-import java.util.Locale;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-/**
- * This class is used for formatting error messages. Unformatted error messages
- * are stored in a resource bundle. Formatting involves replacing any parameters
- * in the unformatted message text with values supplied at invocation. The error
- * messages may be translated into a localized resource bundle, so a locale may be
- * specified to determine the localization required.
- * 
- * @author jkaputin@apache.org
- */
-public class MessageFormatter {
-
-    /**
-     * The specified key is used to retrieve an unformatted message from a  
-     * resource bundle localized for the specified locale. This text is then
-     * formatted with the specified message args.
-     *
-     * @param locale the required locale
-     * @param key the message key
-     * @param args message parameter values
-     * @return the formatted message text
-     * 
-     * @throws NullPointerException if key is null 
-     * @throws MissingResourceException if no object for the given key can be found 
-     * @throws ClassCastException if the object found for the given key is not a string
-     * @throws IllegalArgumentException if the args don't match the message.
-     */
-    public String formatMessage(Locale locale, String key, Object[] args) {
-        
-        ResourceBundle bundle = null;
-        
-        if (locale == null) {
-            bundle = ResourceBundle.getBundle("org.apache.woden.internal.Messages");
-        } else {
-            bundle = ResourceBundle.getBundle("org.apache.woden.internal.Messages",
-                                              locale);
-        }
-        
-        String unformattedMsg = bundle.getString(key);
-        String formattedMsg = MessageFormat.format(unformattedMsg, args);
-        
-        return formattedMsg;
-    }
-
-}
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0 
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+package org.apache.woden.internal;
+
+import java.text.MessageFormat;
+import java.util.Locale;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+/**
+ * This class is used for formatting error messages. Unformatted error messages
+ * are stored in a resource bundle. Formatting involves replacing any parameters
+ * in the unformatted message text with values supplied at invocation. The error
+ * messages may be translated into a localized resource bundle, so a locale may be
+ * specified to determine the localization required.
+ * 
+ * @author jkaputin@apache.org
+ */
+public class MessageFormatter {
+
+    /**
+     * The specified key is used to retrieve an unformatted message from a  
+     * resource bundle localized for the specified locale. This text is then
+     * formatted with the specified message args.
+     *
+     * @param locale the required locale
+     * @param key the message key
+     * @param args message parameter values
+     * @return the formatted message text
+     * 
+     * @throws NullPointerException if key is null 
+     * @throws MissingResourceException if no object for the given key can be found 
+     * @throws ClassCastException if the object found for the given key is not a string
+     * @throws IllegalArgumentException if the args don't match the message.
+     */
+    public String formatMessage(Locale locale, String key, Object[] args) {
+        
+        ResourceBundle bundle = null;
+        
+        if (locale == null) {
+            bundle = ResourceBundle.getBundle("org.apache.woden.internal.Messages");
+        } else {
+            bundle = ResourceBundle.getBundle("org.apache.woden.internal.Messages",
+                                              locale);
+        }
+        
+        String unformattedMsg = bundle.getString(key);
+        String formattedMsg = MessageFormat.format(unformattedMsg, args);
+        
+        return formattedMsg;
+    }
+
+}

Propchange: incubator/woden/trunk/java/src/org/apache/woden/internal/MessageFormatter.java
------------------------------------------------------------------------------
    svn:eol-style = native



---------------------------------------------------------------------
To unsubscribe, e-mail: woden-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: woden-dev-help@ws.apache.org