Author: jkaputin
Date: Tue Jul  5 05:34:17 2005
New Revision: 209267

URL: http://svn.apache.org/viewcvs?rev=209267&view=rev
Log:
added get/setFeature and get/setProperty methods to the

WSDLReader API and implementation

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/Messages.properties

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=209267&r1=209266&r2=209267&view=diff
==============================================================================
--- incubator/woden/java/src/org/apache/woden/WSDLReader.java (original)
+++ incubator/woden/java/src/org/apache/woden/WSDLReader.java Tue Jul  5 
05:34:17 2005
@@ -8,6 +8,19 @@
 import java.util.Locale;

 

 /**

+ * This interface declares the WSDL reader API for parsing WSDL documents.

+ * <p>

+ * TODO after WSDL 2.0 parsing is implemented, consider if/how to make this 
reader

+ * API independent of the WSDL version (definition/description) or whether to 
make it

+ * support both versions. Also, make it independent of the type of XML parser 
if

+ * possible (e.g. no DOM objects in signatures).

+ * <p>

+ * TODO add to the API methods to get/set features and properties of the

+ * Woden framework (i.e. as distinct from features/properties of the WSDL 2.0

+ * component model). Similar to WSDLReader.setFeature in WSDL4J, a named 

+ * feature will be turned on or off with a boolean. A named property will be

+ * set with some object representing the property value.

+ *   

  * @author [EMAIL PROTECTED]

  */

 public interface WSDLReader {

@@ -74,4 +87,59 @@
      */

     public Locale getLocale();

 

+    /**

+     * Set a named feature on or off with a boolean. Note, this relates to 

+     * features of the Woden framework, not to WSDL-specific features such

+     * as the WSDL 2.0 Feature component.

+     * <p>

+     * All feature names should be fully-qualified, Java package style to 

+     * avoid name clashes. All names starting with org.apache.woden. are 

+     * reserved for features defined by the Woden implementation. 

+     * Features specific to other implementations should be fully-qualified  

+     * to match the package name structure of that implementation. 

+     * For example: com.abc.featureName

+     * 

+     * @param name the name of the feature to be set

+     * @param value a boolean value where true sets the feature on, false sets 
it off

+     * @throws IllegalArgumentException if the feature name is not recognized.

+     */

+    public void setFeature(String name, boolean value) throws 
IllegalArgumentException;

+    

+    /**

+     * Returns the on/off setting of the named feature, represented as a 
boolean. 

+     * 

+     * @param name the name of the feature to get the value of

+     * @return a boolean representing the on/off state of the named feature

+     * @throws IllegalArgumentException if the feature name is not recognized.

+     */

+    public boolean getFeature(String name) throws IllegalArgumentException;

+    

+    

+    /**

+     * Set a named property to the specified object.  Note, this relates to 

+     * properties of the Woden implementation, not to WSDL-specific properties

+     * such as the WSDL 2.0 Property component.

+     * <p>

+     * All property names should be fully-qualified, Java package style to 

+     * avoid name clashes. All names starting with org.apache.woden. are 

+     * reserved for properties defined by the Woden implementation. 

+     * Properties specific to other implementations should be fully-qualified  

+     * to match the package name structure of that implementation. 

+     * For example: com.abc.propertyName

+     * 

+     * @param name the name of the property to be set

+     * @param value an Object representing the value to set the property to

+     * @throws IllegalArgumentException if the property name is not recognized.

+     */

+    public void setProperty(String name, Object value) throws 
IllegalArgumentException;

+    

+    /**

+     * Returns the value of the named property.

+     * 

+     * @param name the name of the property to get the value of

+     * @return an Object representing the property's value

+     * @throws IllegalArgumentException if the property name is not recognized.

+     */

+    public Object getProperty(String feature) throws IllegalArgumentException;

+    

 }


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=209267&r1=209266&r2=209267&view=diff
==============================================================================
--- incubator/woden/java/src/org/apache/woden/internal/BaseWSDLReader.java 
(original)
+++ incubator/woden/java/src/org/apache/woden/internal/BaseWSDLReader.java Tue 
Jul  5 05:34:17 2005
@@ -14,6 +14,12 @@
  * This abstract class contains properties and methods common 

  * to WSDLReader implementations.

  * 

+ * <p>

+ * TODO a Template Inheritance pattern that ensures WSDL validation gets 
invoked 

+ * (if turned on by some property) after the subclass has parsed the WSDL. 
Note, 

+ * this class is currently WSDL version-independent and XML parser-independent;

+ * should try to keep it that way. 

+ * 

  * @author [EMAIL PROTECTED]

  */

 public abstract class BaseWSDLReader implements WSDLReader {

@@ -122,4 +128,150 @@
         return fErrorReporter.getLocale();

     }

     

-}

+    /**

+     * Set a named feature on or off with a boolean. Note, this relates to 

+     * features of the Woden framework, not to WSDL-specific features such

+     * as the WSDL 2.0 Feature component.

+     * <p>

+     * All feature names should be fully-qualified, Java package style to 

+     * avoid name clashes. All names starting with org.apache.woden. are 

+     * reserved for features defined by the Woden implementation. 

+     * Features specific to other implementations should be fully-qualified  

+     * to match the package name structure of that implementation. 

+     * For example: com.abc.featureName

+     * 

+     * @param name the name of the feature to be set

+     * @param value a boolean value where true sets the feature on, false sets 
it off

+     * @throws IllegalArgumentException if the feature name is not recognized.

+     */

+    public void setFeature(String name, boolean value) 

+    throws IllegalArgumentException

+    {

+        if(name == null) 

+        {

+            //name must not be null

+            throw new IllegalArgumentException(

+                    fErrorReporter.getFormattedMessage("WSDL005", null));

+        }

+        else if(name.equals("xyz"))

+        {

+            //TODO determine the required features (e.g. 
org.apache.woden.verbose) and

+            //create an if block for each one to set the value.

+        }

+        else

+        {

+            //feature name is not recognized, so throw an exception

+            Object[] args = new Object[] {name};

+            throw new IllegalArgumentException(

+                    fErrorReporter.getFormattedMessage("WSDL006", args));

+        }

+    }

+

+    /**

+     * Returns the on/off setting of the named feature, represented as a 
boolean. 

+     * 

+     * @param name the name of the feature to get the value of

+     * @return a boolean representing the on/off state of the named feature

+     * @throws IllegalArgumentException if the feature name is not recognized.

+     */

+    public boolean getFeature(String name) throws IllegalArgumentException

+    {

+        if(name == null) 

+        {

+            //name must not be null

+            throw new IllegalArgumentException(

+                    fErrorReporter.getFormattedMessage("WSDL005", null));

+        }

+        

+        //Return the feature's value or throw an exception if the feature

+        //name is not recognized

+        

+        if(name.equals("xyz"))

+        {

+            //TODO determine the required features (e.g. 
org.apache.woden.verbose) and

+            //create an if block for each one to get the value.

+            return true;

+        }

+        else

+        {

+            //feature name is not recognized, so throw an exception

+            Object[] args = new Object[] {name};

+            throw new IllegalArgumentException(

+                    fErrorReporter.getFormattedMessage("WSDL006", args));

+        }

+    }

+    

+    /**

+     * Set a named property to the specified object.  Note, this relates to 

+     * properties of the Woden implementation, not to WSDL-specific properties

+     * such as the WSDL 2.0 Property component.

+     * <p>

+     * All property names should be fully-qualified, Java package style to 

+     * avoid name clashes. All names starting with org.apache.woden. are 

+     * reserved for properties defined by the Woden implementation. 

+     * Properties specific to other implementations should be fully-qualified  

+     * to match the package name structure of that implementation. 

+     * For example: com.abc.propertyName

+     * 

+     * @param name the name of the property to be set

+     * @param value an Object representing the value to set the property to

+     * @throws IllegalArgumentException if the property name is not recognized.

+     */

+    public void setProperty(String name, Object value) 

+    throws IllegalArgumentException

+    {

+        if(name == null) 

+        {

+            //name must not be null

+            throw new IllegalArgumentException(

+                    fErrorReporter.getFormattedMessage("WSDL007", null));

+        }

+        else if(name.equals("xyz"))

+        {

+            //TODO determine the required properties and

+            //create an if block for each one to set the value.

+        }

+        else

+        {

+            //property name is not recognized, so throw an exception

+            Object[] args = new Object[] {name};

+            throw new IllegalArgumentException(

+                    fErrorReporter.getFormattedMessage("WSDL008", args));

+        }

+    }

+

+    /**

+     * Returns the value of the named property.

+     * 

+     * @param name the name of the property to get the value of

+     * @return an Object representing the property's value

+     * @throws IllegalArgumentException if the property name is not recognized.

+     */

+    public Object getProperty(String name) throws IllegalArgumentException

+    {

+        if(name == null) 

+        {

+            //name must not be null

+            throw new IllegalArgumentException(

+                    fErrorReporter.getFormattedMessage("WSDL007", null));

+        }

+        

+        //Return the property's value or throw an exception if the property

+        //name is not recognized

+        

+        if(name.equals("xyz"))

+        {

+            //TODO determine the required properties and

+            //create an if block for each one to get the value.

+            return null;

+        }

+        else

+        {

+            //property name is not recognized, so throw an exception

+            Object[] args = new Object[] {name};

+            throw new IllegalArgumentException(

+                    fErrorReporter.getFormattedMessage("WSDL008", args));

+        }

+    }

+    

+}
\ No newline at end of file

Modified: incubator/woden/java/src/org/apache/woden/internal/Messages.properties
URL: 
http://svn.apache.org/viewcvs/incubator/woden/java/src/org/apache/woden/internal/Messages.properties?rev=209267&r1=209266&r2=209267&view=diff
==============================================================================
--- incubator/woden/java/src/org/apache/woden/internal/Messages.properties 
(original)
+++ incubator/woden/java/src/org/apache/woden/internal/Messages.properties Tue 
Jul  5 05:34:17 2005
@@ -14,7 +14,12 @@
 WSDL001=An error message.

 WSDL002=Another error message.

 WSDL003=Parameter test msg. The parms are {0} and {1}.

+

 WSDL004=Expected a "{0}" element, but found a "{1}" element instead.

+WSDL005=The feature name must not be null when attempting to get or set a 
named feature.

+WSDL006=The feature name "{0}" is not recognized.

+WSDL007=The property name must not be null when attempting to get or set a 
named property.

+WSDL008=The property name "{0}" is not recognized.

 

 

 ############### End of Messages ############################



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to