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 2005/06/29 14:07:56 UTC

svn commit: r202355 - in /incubator/woden/java/src/org/apache/woden: WSDLReader.java internal/BaseWSDLReader.java internal/DOMWSDLReader.java internal/ErrorReporter.java

Author: jkaputin
Date: Wed Jun 29 05:07:55 2005
New Revision: 202355

URL: http://svn.apache.org/viewcvs?rev=202355&view=rev
Log:
API additions and refactoring for error handler,
locale and factory

Modified:
    incubator/woden/java/src/org/apache/woden/WSDLReader.java
    incubator/woden/java/src/org/apache/woden/internal/BaseWSDLReader.java
    incubator/woden/java/src/org/apache/woden/internal/DOMWSDLReader.java
    incubator/woden/java/src/org/apache/woden/internal/ErrorReporter.java

Modified: incubator/woden/java/src/org/apache/woden/WSDLReader.java
URL: http://svn.apache.org/viewcvs/incubator/woden/java/src/org/apache/woden/WSDLReader.java?rev=202355&r1=202354&r2=202355&view=diff
==============================================================================
--- incubator/woden/java/src/org/apache/woden/WSDLReader.java (original)
+++ incubator/woden/java/src/org/apache/woden/WSDLReader.java Wed Jun 29 05:07:55 2005
@@ -37,18 +37,41 @@
     //TODO - a readWSDL method that returns a Description (eg a component)
     
     /**
-     * Set a custom error handler to report WSDL parsing errors.
-     * This replaces the default error handler.
+     * Set an error handler to be used to report WSDL parsing errors.
      * 
      * @param errorHandler the custom error handler
      */
     public void setErrorHandler(ErrorHandler errorHandler);
 
     /**
-     * Set the locale for localization of error messages.
+     * @return the ErrorHandler used to report WSDL parsing errors
+     */
+    public ErrorHandler getErrorHandler();
+
+    /**
+     * Store the name of the WSDLFactory implementation class to be used for  
+     * any subsequent WSDLFactory requests (i.e. this will replace any  
+     * existing factory object in use).
+     * 
+     * @param factoryImplName the WSDLFactory implementation classname
+     */
+    public void setFactoryImplName(String factoryImplName);
+    
+    /**
+     * @return the WSDLFactory implementation classname
+     */
+    public String getFactoryImplName();
+    
+    /**
+     * Set the Locale to use for localization of error messages.
      * 
-     * @param locale the locale 
+     * @param locale the Locale object
      */
     public void setLocale(Locale locale);
+    
+    /**
+     * @return the Locale used for localization of error messages
+     */
+    public Locale getLocale();
 
 }

Modified: incubator/woden/java/src/org/apache/woden/internal/BaseWSDLReader.java
URL: http://svn.apache.org/viewcvs/incubator/woden/java/src/org/apache/woden/internal/BaseWSDLReader.java?rev=202355&r1=202354&r2=202355&view=diff
==============================================================================
--- incubator/woden/java/src/org/apache/woden/internal/BaseWSDLReader.java (original)
+++ incubator/woden/java/src/org/apache/woden/internal/BaseWSDLReader.java Wed Jun 29 05:07:55 2005
@@ -29,6 +29,13 @@
     }
     
     /**
+     * @return Returns the fErrorReporter.
+     */
+    protected ErrorReporter getErrorReporter() {
+        return fErrorReporter;
+    }
+    
+    /**
      * Get the cached WSDLFactory if there is one, otherwise
      * create and cache a new one.
      * 
@@ -51,17 +58,33 @@
     }
 
     /**
-     * @return Returns the factoryImplName.
+     * Sets an error handler to be used to report WSDL parsing errors.
+     * Does this by delegating to the ErrorReporter object in 
+     * <code>fErrorReporter</code>
+     * 
+     * @param errorHandler the ErrorHandler for reporting parsing errors
      */
-    public String getFactoryImplName() {
-        return fFactoryImplName;
+    public void setErrorHandler(ErrorHandler errorHandler) {
+        fErrorReporter.setErrorHandler(errorHandler);
+    }
+    
+    /**
+     * Returns the ErrorHandler used to report WSDL parsing errors.
+     * Does this by delegating to the ErrorReporter object in 
+     * <code>fErrorReporter</code>.
+     * 
+     * @return the ErrorHandler for reporting parsing errors
+     */
+    public ErrorHandler getErrorHandler() {
+        return fErrorReporter.getErrorHandler();
     }
     
     /**
-     * Store the name of the concrete WSDLFactory class, 
-     * discarding any cached factory object.
+     * Stores the name of the WSDLFactory implementation class to be used for
+     * any subsequent WSDLFactory requests, first discarding any cached factory 
+     * object.
      * 
-     * @param factoryImplName The factoryImplName to set.
+     * @param factoryImplName the WSDLFactory implementation classname
      */
     public void setFactoryImplName(String factoryImplName) {
         
@@ -71,32 +94,32 @@
     }
     
     /**
-     * @return Returns the fErrorReporter.
+     * @return the WSDLFactory implementation classname
      */
-    public ErrorReporter getErrorReporter() {
-        return fErrorReporter;
+    public String getFactoryImplName() {
+        return fFactoryImplName;
     }
     
     /**
-     * Sets a custom error handler in <code>fErrorReporter</code> which
-     * overrides the default error handler.
+     * Sets the Locale to use for the localization of error messages. 
+     * Does this by delegating to the ErrorReporter object in 
+     * <code>fErrorReporter</code>.
      * 
-     * @param errorHandler the custom error handler
+     * @param locale the Locale object
      */
-    public void setErrorHandler(ErrorHandler errorHandler) {
-        
-        fErrorReporter.setErrorHandler(errorHandler);
+    public void setLocale(Locale locale) {
+        fErrorReporter.setLocale(locale);
     }
     
     /**
-     * Sets a locale in <code>fErrorReporter</code> which will determine the
-     * message resource bundle to be used for reporting errors.
+     * Returns the Locale used for the localization of error messages.
+     * Does this by delegating to the ErrorReporter object in 
+     * <code>fErrorReporter</code>.
      * 
-     * @param locale the locale
+     * @return the Locale object
      */
-    public void setLocale(Locale locale) {
-        
-        fErrorReporter.setLocale(locale);
+    public Locale getLocale() {
+        return fErrorReporter.getLocale();
     }
     
 }

Modified: incubator/woden/java/src/org/apache/woden/internal/DOMWSDLReader.java
URL: http://svn.apache.org/viewcvs/incubator/woden/java/src/org/apache/woden/internal/DOMWSDLReader.java?rev=202355&r1=202354&r2=202355&view=diff
==============================================================================
--- incubator/woden/java/src/org/apache/woden/internal/DOMWSDLReader.java (original)
+++ incubator/woden/java/src/org/apache/woden/internal/DOMWSDLReader.java Wed Jun 29 05:07:55 2005
@@ -80,8 +80,10 @@
         DescriptionElement desc = 
             ((DOMWSDLFactory)getFactory()).newDescription();
 
-        String targetNamespace = DOMUtils.getAttribute(docEl,
-                Constants.ATTR_TARGET_NAMESPACE);
+        //TODO set extension registry
+        
+        String targetNamespace = 
+            DOMUtils.getAttribute(docEl, Constants.ATTR_TARGET_NAMESPACE);
         
         desc.setTargetNamespace(targetNamespace);
         
@@ -91,6 +93,13 @@
     }
 
 
+    /**
+     * Check the actual element encountered against the expected qname
+     * 
+     * @param el actual element encountered
+     * @param qname expected element's qname
+     * @throws WSDLException
+     */
     private void checkElementName(Element el, QName qname)
     throws WSDLException
     {

Modified: incubator/woden/java/src/org/apache/woden/internal/ErrorReporter.java
URL: http://svn.apache.org/viewcvs/incubator/woden/java/src/org/apache/woden/internal/ErrorReporter.java?rev=202355&r1=202354&r2=202355&view=diff
==============================================================================
--- incubator/woden/java/src/org/apache/woden/internal/ErrorReporter.java (original)
+++ incubator/woden/java/src/org/apache/woden/internal/ErrorReporter.java Wed Jun 29 05:07:55 2005
@@ -57,7 +57,7 @@
         "org.apache.woden.continue-after-fatal-error";
     
 
-    //Used for localization of formatted messages.
+    //Used for localization of error messages.
     private Locale fLocale;
     
     //Combines parameterized message text with message parameters 
@@ -287,9 +287,19 @@
     public void setErrorHandler(ErrorHandler errorHandler) {
         fErrorHandler = errorHandler;
     }
+    
+    /**
+     * Return the custom error handler if one has been set,  
+     * otherwise return the default error handler.
+     * 
+     * @return the ErrorHandler used by this error reporter
+     */
+    public ErrorHandler getErrorHandler() {
+        return (fErrorHandler != null) ? fErrorHandler : fDefaultErrorHandler;
+    }
 
     /**
-     * Set the locale to determine the localized message resource bundle to use.
+     * Set the Locale used for localization of error messages.
      * 
      * TODO: identify all use cases for setting the locale and determine how best to
      * expose this on the API. Currently, just via WSDLReader.setLocale which supports 
@@ -303,5 +313,11 @@
         fLocale = locale;
     }
 
+    /**
+     * @return the Locale used for localization of error messages.
+     */
+    public Locale getLocale() {
+        return fLocale;
+    }
 
 }



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