You are viewing a plain text version of this content. The canonical link for it is here.
Posted to taglibs-dev@jakarta.apache.org by ra...@apache.org on 2005/08/10 23:11:40 UTC

svn commit: r231329 [3/13] - in /jakarta/taglibs/proper/rdc/trunk/src: META-INF/tags/rdc/ org/apache/taglibs/rdc/ org/apache/taglibs/rdc/core/ org/apache/taglibs/rdc/dm/ org/apache/taglibs/rdc/resources/ org/apache/taglibs/rdc/sampleapps/mortgage/ org/...

Modified: jakarta/taglibs/proper/rdc/trunk/src/org/apache/taglibs/rdc/Pause.java
URL: http://svn.apache.org/viewcvs/jakarta/taglibs/proper/rdc/trunk/src/org/apache/taglibs/rdc/Pause.java?rev=231329&r1=231328&r2=231329&view=diff
==============================================================================
--- jakarta/taglibs/proper/rdc/trunk/src/org/apache/taglibs/rdc/Pause.java (original)
+++ jakarta/taglibs/proper/rdc/trunk/src/org/apache/taglibs/rdc/Pause.java Wed Aug 10 14:10:59 2005
@@ -28,44 +28,44 @@
  */
 public class Pause extends BaseModel {
 
-	// The URI where the application will resume after being "unpaused"
-	private String resumeURI;
+    // The URI where the application will resume after being "unpaused"
+    private String resumeURI;
 
-	/**
-	  * Sets default values for all data members
-	  */
-	public Pause() {
-		super();
-		this.resumeURI = null;
-	}
-	
-	/**
-	 * Get the URI where the application will resume after being "unpaused"
-	 * 
-	 * @return String the resumeURI
-	 */
-	public String getResumeURI() {
-		return resumeURI;
-	}
+    /**
+      * Sets default values for all data members
+      */
+    public Pause() {
+        super();
+        this.resumeURI = null;
+    }
+    
+    /**
+     * Get the URI where the application will resume after being "unpaused"
+     * 
+     * @return String the resumeURI
+     */
+    public String getResumeURI() {
+        return resumeURI;
+    }
 
-	/**
-	 * Set the URI where the application will resume after being "unpaused"
-	 * 
-	 * @param String the resumeURI
-	 */
-	public void setResumeURI(String string) {
-		this.resumeURI = string;
-	}
-	
-	/**
-	 * Return the resumeURI when on the voice browser's "filled" event
-	 * 
-	 * @param input The grammar match from the "resume" grammar
-	 * @return The value of pause RDC (which will be the resumeURI as defined
-	 *         in the public contract)
-	 */
-	protected Object canonicalize(Object input, boolean isAttribute) {
-		return resumeURI;		
-	} // end canonicalize()
+    /**
+     * Set the URI where the application will resume after being "unpaused"
+     * 
+     * @param String the resumeURI
+     */
+    public void setResumeURI(String string) {
+        this.resumeURI = string;
+    }
+    
+    /**
+     * Return the resumeURI when on the voice browser's "filled" event
+     * 
+     * @param input The grammar match from the "resume" grammar
+     * @return The value of pause RDC (which will be the resumeURI as defined
+     *         in the public contract)
+     */
+    protected Object canonicalize(Object input, boolean isAttribute) {
+        return resumeURI;        
+    } // end canonicalize()
 
 }

Modified: jakarta/taglibs/proper/rdc/trunk/src/org/apache/taglibs/rdc/Percent.java
URL: http://svn.apache.org/viewcvs/jakarta/taglibs/proper/rdc/trunk/src/org/apache/taglibs/rdc/Percent.java?rev=231329&r1=231328&r2=231329&view=diff
==============================================================================
--- jakarta/taglibs/proper/rdc/trunk/src/org/apache/taglibs/rdc/Percent.java (original)
+++ jakarta/taglibs/proper/rdc/trunk/src/org/apache/taglibs/rdc/Percent.java Wed Aug 10 14:10:59 2005
@@ -34,146 +34,146 @@
  * @author Rahul Akolkar
  */
 public class Percent extends BaseModel {
-	// The percent RDC will be associated with the percent input,
-	// the maximum and minimum values within which the input must
-	// lie .
-
-	//this is the pattern for percent
-	private String pattern;
-	// Maximum allowed value for the percentage
-	private int maxPercent;
-	// Minimum allowed value for the percentage
-	private int minPercent;
-
-	// Error codes, defined in configuration file
-	/**A constant for Error Code stating Invalid percent */
-	public static final int ERR_INVALID_PERCENT = 1;
-
-	/**A constant for Error Code stating the percent entered is
-	 * larger than allowed */
-	public static final int ERR_NEED_LOWER_VALUE = 2;
-
-	/**A constant for Error Code stating the percent entered is
-	 * smaller than allowed */
-	public static final int ERR_NEED_HIGHER_VALUE = 3;
-
-	/**
-	 *
-	 * Sets default values for all data model members
-	 */
-	public Percent() {
-		super();
-		this.minPercent = 0;
-		this.maxPercent = 0;
-		this.pattern = "[0-9]{1,2}";
-	}
-
-	/**
-	 * Gets the maximum allowed value for the percentage.
-	 *
-	 * @return the maximum allowed value for the percentage
-	 */
-	public String getMaxPercent() {
-		return String.valueOf(maxPercent);
-	} // end getMaxPercent
-
-	/**
-	 * Sets the maximum allowed value for the percentage
-	 *
-	 * @param maxPercent The maximum allowed value for the percentage
-	 */
-	public void setMaxPercent(String maxPercent) {
-		if (maxPercent != null) {
-			try {
-				this.maxPercent = Integer.parseInt(maxPercent);
-			} catch (NumberFormatException e) {
-				throw new IllegalArgumentException("maxPercent attribute " +
-					"of \"" + getId() + "\" percent tag is not an integer.");
-			}
-		}
-	} // end setMaxPercent
-
-	/**
-	 * Gets the minimum allowed value for the percentage
-	 *
-	 * @return the minimum allowed value for the percentage
-	 */
-	public String getMinPercent() {
-		return String.valueOf(minPercent);
-	} // end getMinPercent
-
-	/**
-	 * Sets the minimum allowed value for the percentage
-	 *
-	 * @param minPercent The minimum allowed value.
-	 */
-	public void setMinPercent(String minPercent) {
-		if (minPercent != null) {
-			try {
-				this.minPercent = Integer.parseInt(minPercent);
-			} catch (NumberFormatException e) {
-				throw new IllegalArgumentException("minPercent attribute " +
-					"of \"" + getId() + "\" percent tag is not an integer.");
-			}
-		}
-	} // end setMinPercent
-
-	/**
-	 * Gets the pattern string
-	 *
-	 * @return the pattern string
-	 */
-	public String getPattern() {
-		return this.pattern;
-	}
-	
-	/**
-	* Sets the pattern string to which the input must conform
-	*
-	* @param pattern the pattern string to which the input must conform
-	*/
-	public void setPattern(String pattern) {
-		if (pattern != null) {
-			try {
-				Pattern.compile(pattern);
-				this.pattern = pattern;
-			} catch (PatternSyntaxException e) {
-				throw new IllegalArgumentException("pattern attribute of \"" +
-					getId()	+ "\" percent tag not in proper format.");
-			}
-		}
-	}
-	
-	/**
-	 * Validates the percent value against the given constraints
-	 *
-	 * @return TRUE if valid, FALSE otherwise
-	 */
-	protected Boolean validate(Object newValue, boolean setErrorCode) {
-
-		int val = Integer.parseInt((String) newValue);
-		if (pattern != null && !(Pattern.matches(pattern, (String)newValue))) {
-			if (setErrorCode) setErrorCode(ERR_INVALID_PERCENT);
-			return Boolean.FALSE;
-		}
-		if (maxPercent > 0 && val > maxPercent) {
-			if (setErrorCode) setErrorCode(ERR_NEED_LOWER_VALUE);
-			return Boolean.FALSE;
-		}
-		if (minPercent > 0 && val < minPercent) {
-			if (setErrorCode) setErrorCode(ERR_NEED_HIGHER_VALUE);
-			return Boolean.FALSE;
-		}
-		return Boolean.TRUE;
-
-	} // end customValidate()
-		
-	/**
-	 * Custom canonicalized value calculation
-	 */
-	protected String calculateCanonicalizedValue(Object newValue) {
-		return ((String) newValue) + "%";
-	}
+    // The percent RDC will be associated with the percent input,
+    // the maximum and minimum values within which the input must
+    // lie .
+
+    //this is the pattern for percent
+    private String pattern;
+    // Maximum allowed value for the percentage
+    private int maxPercent;
+    // Minimum allowed value for the percentage
+    private int minPercent;
+
+    // Error codes, defined in configuration file
+    /**A constant for Error Code stating Invalid percent */
+    public static final int ERR_INVALID_PERCENT = 1;
+
+    /**A constant for Error Code stating the percent entered is
+     * larger than allowed */
+    public static final int ERR_NEED_LOWER_VALUE = 2;
+
+    /**A constant for Error Code stating the percent entered is
+     * smaller than allowed */
+    public static final int ERR_NEED_HIGHER_VALUE = 3;
+
+    /**
+     *
+     * Sets default values for all data model members
+     */
+    public Percent() {
+        super();
+        this.minPercent = 0;
+        this.maxPercent = 0;
+        this.pattern = "[0-9]{1,2}";
+    }
+
+    /**
+     * Gets the maximum allowed value for the percentage.
+     *
+     * @return the maximum allowed value for the percentage
+     */
+    public String getMaxPercent() {
+        return String.valueOf(maxPercent);
+    } // end getMaxPercent
+
+    /**
+     * Sets the maximum allowed value for the percentage
+     *
+     * @param maxPercent The maximum allowed value for the percentage
+     */
+    public void setMaxPercent(String maxPercent) {
+        if (maxPercent != null) {
+            try {
+                this.maxPercent = Integer.parseInt(maxPercent);
+            } catch (NumberFormatException e) {
+                throw new IllegalArgumentException("maxPercent attribute " +
+                    "of \"" + getId() + "\" percent tag is not an integer.");
+            }
+        }
+    } // end setMaxPercent
+
+    /**
+     * Gets the minimum allowed value for the percentage
+     *
+     * @return the minimum allowed value for the percentage
+     */
+    public String getMinPercent() {
+        return String.valueOf(minPercent);
+    } // end getMinPercent
+
+    /**
+     * Sets the minimum allowed value for the percentage
+     *
+     * @param minPercent The minimum allowed value.
+     */
+    public void setMinPercent(String minPercent) {
+        if (minPercent != null) {
+            try {
+                this.minPercent = Integer.parseInt(minPercent);
+            } catch (NumberFormatException e) {
+                throw new IllegalArgumentException("minPercent attribute " +
+                    "of \"" + getId() + "\" percent tag is not an integer.");
+            }
+        }
+    } // end setMinPercent
+
+    /**
+     * Gets the pattern string
+     *
+     * @return the pattern string
+     */
+    public String getPattern() {
+        return this.pattern;
+    }
+    
+    /**
+    * Sets the pattern string to which the input must conform
+    *
+    * @param pattern the pattern string to which the input must conform
+    */
+    public void setPattern(String pattern) {
+        if (pattern != null) {
+            try {
+                Pattern.compile(pattern);
+                this.pattern = pattern;
+            } catch (PatternSyntaxException e) {
+                throw new IllegalArgumentException("pattern attribute of \"" +
+                    getId()    + "\" percent tag not in proper format.");
+            }
+        }
+    }
+    
+    /**
+     * Validates the percent value against the given constraints
+     *
+     * @return TRUE if valid, FALSE otherwise
+     */
+    protected Boolean validate(Object newValue, boolean setErrorCode) {
+
+        int val = Integer.parseInt((String) newValue);
+        if (pattern != null && !(Pattern.matches(pattern, (String)newValue))) {
+            if (setErrorCode) setErrorCode(ERR_INVALID_PERCENT);
+            return Boolean.FALSE;
+        }
+        if (maxPercent > 0 && val > maxPercent) {
+            if (setErrorCode) setErrorCode(ERR_NEED_LOWER_VALUE);
+            return Boolean.FALSE;
+        }
+        if (minPercent > 0 && val < minPercent) {
+            if (setErrorCode) setErrorCode(ERR_NEED_HIGHER_VALUE);
+            return Boolean.FALSE;
+        }
+        return Boolean.TRUE;
+
+    } // end customValidate()
+        
+    /**
+     * Custom canonicalized value calculation
+     */
+    protected String calculateCanonicalizedValue(Object newValue) {
+        return ((String) newValue) + "%";
+    }
 
 } // end class Percent{}
 

Modified: jakarta/taglibs/proper/rdc/trunk/src/org/apache/taglibs/rdc/RDCFilter.java
URL: http://svn.apache.org/viewcvs/jakarta/taglibs/proper/rdc/trunk/src/org/apache/taglibs/rdc/RDCFilter.java?rev=231329&r1=231328&r2=231329&view=diff
==============================================================================
--- jakarta/taglibs/proper/rdc/trunk/src/org/apache/taglibs/rdc/RDCFilter.java (original)
+++ jakarta/taglibs/proper/rdc/trunk/src/org/apache/taglibs/rdc/RDCFilter.java Wed Aug 10 14:10:59 2005
@@ -37,7 +37,7 @@
 /**
  * Servlet filter to tweak RDC output. Filter does the following:
  * 1) Improves aesthetics of VoiceXML output (filter out empty lines
- * 		and empty comments)
+ *         and empty comments)
  * 2) Performs platform adaptations
  * 
  * @author Rahul Akolkar
@@ -45,234 +45,234 @@
  */
 public class RDCFilter implements Filter {
 
-	//// Filter Init Params
-	// The init param name for the platform
-	private static final String INIT_PARAM_PLATFORM = "platform";
-	// The init param name for the platform
-	private static final String INIT_PARAM_VERSION = "version";
-	// The init param name for the debug
-	private static final String INIT_PARAM_DEBUG = "debug";
-	// The init param name for the language (i18n)
-	private static final String INIT_PARAM_LANGUAGE = "language";
-	// The init param name for the country (i18n)
-	private static final String INIT_PARAM_COUNTRY = "country";
-	// The init param name for the variant (i18n)
-	private static final String INIT_PARAM_VARIANT = "variant";
-	
-	//// Patterns
-	private static final String PATTERN_XML_COMMENT = "<!--(\\s|.)*?-->";
-	private static final String PATTERN_BLANK_LINES = "((\\s)*\\n){2,}";
-
-	//// String constants
-	private static final String STR_EMPTY = "";
-	private static final String STR_NEWLINE = "\n";
-	private static final String STR_CONTENT_TYPE_HTML = "text/html";
-
-	// Save the config so we can extract the platform information
-	// from the init parameter
-	private FilterConfig filterConfig;
-
-	// The init param value for the platform
-	private String platform;
-
-	// The init param value for the version
-	private String version;
-
-	// The init param value for the debug
-	private boolean bDebug;
-	
-	// The String representation of the Locale based on init param values
-	private String locale;
-	
-	// The Locale based on init param values
-	private Locale rdcLocale;
-	
-	// Whether locale information needs to be pushed to 
-	// org.apache.taglibs.rdc.core.Constants
-	private boolean pushLocale = true;
-
-	/**
-	 * Save FilterConfig so we can extract the init parameters later
-	 * 
-	 * @see javax.servlet.Filter#init(javax.servlet.FilterConfig)
-	 */
-	public void init(FilterConfig filterConfig) throws ServletException {
-		this.platform = filterConfig.getInitParameter(INIT_PARAM_PLATFORM);
-		this.version = filterConfig.getInitParameter(INIT_PARAM_VERSION);
-		String debug = filterConfig.getInitParameter(INIT_PARAM_DEBUG);
-
-		if (debug != null) {
-			this.bDebug = debug.equalsIgnoreCase("true");
-		} else {
-			this.bDebug = false;
-		}
-		
-		String language = filterConfig.getInitParameter(INIT_PARAM_LANGUAGE);
-		String country = filterConfig.getInitParameter(INIT_PARAM_COUNTRY);
-		String variant = filterConfig.getInitParameter(INIT_PARAM_VARIANT);
-		initLocale(language, country, variant);
-
-
-		// save a handle for later, standard practice
-		this.filterConfig = filterConfig;
-	}
-
-	/**
-	 * Filter out empty lines and empty comments, perform platform adaptations
-	 * 
-	 * @see javax.servlet.Filter#doFilter(javax.servlet.ServletRequest,
-	 *  javax.servlet.ServletResponse, javax.servlet.FilterChain)
-	 */
-	public void doFilter(ServletRequest request, ServletResponse response,
-			FilterChain chain) throws IOException, ServletException {
-		
-		if (!(request instanceof HttpServletRequest)) {
-			chain.doFilter(request, response);
-			return;
-		}
-		checkLocale();
-
-		HttpServletRequest httpReq = (HttpServletRequest) request;
-		HttpServletResponse httpRes = (HttpServletResponse) response;
-
-		PrintWriter out = httpRes.getWriter();
-		CharResponseWrapper wrapper = new CharResponseWrapper(httpRes);
-		chain.doFilter(httpReq, wrapper);
-
-		if (bDebug) {
-			String reqUrl = httpReq.getRequestURL().toString();
-			String queryString = httpReq.getQueryString();
-
-			if (queryString != null) {
-				reqUrl += "?" + queryString;
-			}
-			filterConfig.getServletContext().log("URL: " + reqUrl);
-		}
-
-		// Its possible this is a RDC based JSP if:
-		// 1) The content type is not set, or
-		// 2) The content type is non-HTML
-		if ( wrapper.getContentType() == null || 
-		    !wrapper.getContentType().equals(STR_CONTENT_TYPE_HTML) ) {
-			// 1) Improve aesthetics of VoiceXML output
-			String trimmedResponse = trimResponse(wrapper.toString());
-			// 2) Perform platform adaptations
-			String adaptedResponse = performPlatformAdaptations(trimmedResponse);
-
-			// Now that looks just fine
-			httpRes.setContentLength(adaptedResponse.length());
-			out.write(adaptedResponse);
-		} else {
-			// What a waste ;-)
-			out.write(wrapper.toString());
-		}
-
-		// We're done
-		out.close();
-	}
-
-	/**
-	 * Cleanup
-	 * 
-	 * @see javax.servlet.Filter#destroy()
-	 */
-	public void destroy() {
-		this.filterConfig = null;
-	}
-
-	/**
-	 * Trim the response.
-	 * 
-	 * @param String responseString - The response to trim
-	 */
-	private String trimResponse(String responseString) {
-		// Filter out the empty comments
-		String trimmedResponse = 
-			responseString.replaceAll(PATTERN_XML_COMMENT, STR_EMPTY);
-
-		// Trim any empty lines
-		trimmedResponse = 
-			trimmedResponse.replaceAll(PATTERN_BLANK_LINES, STR_NEWLINE);
-
-		return trimmedResponse;
-	}
-
-	/**
-	 * Perform platform adaptations.
-	 * 
-	 * @param String line - The line in the response
-	 */
-	private String performPlatformAdaptations(String vxmlMarkup) {
-		if (platform == null) {
-			return vxmlMarkup;
-		}
-		// Platform adaptations go here	
-		return vxmlMarkup;
-	}
-	
-	/**
-	 * Get Locale for given language, country and variant.
-	 * 
-	 * @param String language - The language of the Locale
-	 * @param String country - The country of the Locale
-	 * @param String variant - The variant of the Locale
-	 */
-	private void initLocale(String language, String country, String variant) {
-		boolean gotLanguage = !RDCUtils.isStringEmpty(language);
-		boolean gotCountry = !RDCUtils.isStringEmpty(country);
-		boolean gotVariant = !RDCUtils.isStringEmpty(variant);
-		if (!gotLanguage) {
-			return;
-		} else {
-			if (gotCountry) {
-				if (gotVariant) {
-					rdcLocale = new Locale(language, country, variant);
-				} else {
-					rdcLocale = new Locale(language, country);
-				}
-			} else {
-				rdcLocale = new Locale(language);
-			}
-		}
-		if (rdcLocale != null) {
-			StringBuffer buf = new StringBuffer(language);
-			if (!RDCUtils.isStringEmpty(country)) {
-				buf.append('-').append(country);
-				if (!RDCUtils.isStringEmpty(variant)) {
-					buf.append('-').append(variant);
-				}
-			}
-			locale = buf.toString();
-		}
-	}
-	
-	private void checkLocale() {
-		if (pushLocale) {
-			if (rdcLocale != null) {
-				Constants.initI18NResources(locale, rdcLocale);
-			}
-			pushLocale = false;
-		}
-	}
-
-	/**
-	 * Response wrapper so we can examine the RDC output
-	 */
-	private static class CharResponseWrapper extends HttpServletResponseWrapper {
-
-		private Writer output;
-
-		public String toString() {
-			return output.toString();
-		}
-
-		public CharResponseWrapper(HttpServletResponse response) {
-			super(response);
-			output = new CharArrayWriter();
-		}
-
-		public PrintWriter getWriter() {
-			return new PrintWriter(output);
-		}
-	}
+    //// Filter Init Params
+    // The init param name for the platform
+    private static final String INIT_PARAM_PLATFORM = "platform";
+    // The init param name for the platform
+    private static final String INIT_PARAM_VERSION = "version";
+    // The init param name for the debug
+    private static final String INIT_PARAM_DEBUG = "debug";
+    // The init param name for the language (i18n)
+    private static final String INIT_PARAM_LANGUAGE = "language";
+    // The init param name for the country (i18n)
+    private static final String INIT_PARAM_COUNTRY = "country";
+    // The init param name for the variant (i18n)
+    private static final String INIT_PARAM_VARIANT = "variant";
+    
+    //// Patterns
+    private static final String PATTERN_XML_COMMENT = "<!--(\\s|.)*?-->";
+    private static final String PATTERN_BLANK_LINES = "((\\s)*\\n){2,}";
+
+    //// String constants
+    private static final String STR_EMPTY = "";
+    private static final String STR_NEWLINE = "\n";
+    private static final String STR_CONTENT_TYPE_HTML = "text/html";
+
+    // Save the config so we can extract the platform information
+    // from the init parameter
+    private FilterConfig filterConfig;
+
+    // The init param value for the platform
+    private String platform;
+
+    // The init param value for the version
+    private String version;
+
+    // The init param value for the debug
+    private boolean bDebug;
+    
+    // The String representation of the Locale based on init param values
+    private String locale;
+    
+    // The Locale based on init param values
+    private Locale rdcLocale;
+    
+    // Whether locale information needs to be pushed to 
+    // org.apache.taglibs.rdc.core.Constants
+    private boolean pushLocale = true;
+
+    /**
+     * Save FilterConfig so we can extract the init parameters later
+     * 
+     * @see javax.servlet.Filter#init(javax.servlet.FilterConfig)
+     */
+    public void init(FilterConfig filterConfig) throws ServletException {
+        this.platform = filterConfig.getInitParameter(INIT_PARAM_PLATFORM);
+        this.version = filterConfig.getInitParameter(INIT_PARAM_VERSION);
+        String debug = filterConfig.getInitParameter(INIT_PARAM_DEBUG);
+
+        if (debug != null) {
+            this.bDebug = debug.equalsIgnoreCase("true");
+        } else {
+            this.bDebug = false;
+        }
+        
+        String language = filterConfig.getInitParameter(INIT_PARAM_LANGUAGE);
+        String country = filterConfig.getInitParameter(INIT_PARAM_COUNTRY);
+        String variant = filterConfig.getInitParameter(INIT_PARAM_VARIANT);
+        initLocale(language, country, variant);
+
+
+        // save a handle for later, standard practice
+        this.filterConfig = filterConfig;
+    }
+
+    /**
+     * Filter out empty lines and empty comments, perform platform adaptations
+     * 
+     * @see javax.servlet.Filter#doFilter(javax.servlet.ServletRequest,
+     *  javax.servlet.ServletResponse, javax.servlet.FilterChain)
+     */
+    public void doFilter(ServletRequest request, ServletResponse response,
+            FilterChain chain) throws IOException, ServletException {
+        
+        if (!(request instanceof HttpServletRequest)) {
+            chain.doFilter(request, response);
+            return;
+        }
+        checkLocale();
+
+        HttpServletRequest httpReq = (HttpServletRequest) request;
+        HttpServletResponse httpRes = (HttpServletResponse) response;
+
+        PrintWriter out = httpRes.getWriter();
+        CharResponseWrapper wrapper = new CharResponseWrapper(httpRes);
+        chain.doFilter(httpReq, wrapper);
+
+        if (bDebug) {
+            String reqUrl = httpReq.getRequestURL().toString();
+            String queryString = httpReq.getQueryString();
+
+            if (queryString != null) {
+                reqUrl += "?" + queryString;
+            }
+            filterConfig.getServletContext().log("URL: " + reqUrl);
+        }
+
+        // Its possible this is a RDC based JSP if:
+        // 1) The content type is not set, or
+        // 2) The content type is non-HTML
+        if ( wrapper.getContentType() == null || 
+            !wrapper.getContentType().equals(STR_CONTENT_TYPE_HTML) ) {
+            // 1) Improve aesthetics of VoiceXML output
+            String trimmedResponse = trimResponse(wrapper.toString());
+            // 2) Perform platform adaptations
+            String adaptedResponse = performPlatformAdaptations(trimmedResponse);
+
+            // Now that looks just fine
+            httpRes.setContentLength(adaptedResponse.length());
+            out.write(adaptedResponse);
+        } else {
+            // What a waste ;-)
+            out.write(wrapper.toString());
+        }
+
+        // We're done
+        out.close();
+    }
+
+    /**
+     * Cleanup
+     * 
+     * @see javax.servlet.Filter#destroy()
+     */
+    public void destroy() {
+        this.filterConfig = null;
+    }
+
+    /**
+     * Trim the response.
+     * 
+     * @param String responseString - The response to trim
+     */
+    private String trimResponse(String responseString) {
+        // Filter out the empty comments
+        String trimmedResponse = 
+            responseString.replaceAll(PATTERN_XML_COMMENT, STR_EMPTY);
+
+        // Trim any empty lines
+        trimmedResponse = 
+            trimmedResponse.replaceAll(PATTERN_BLANK_LINES, STR_NEWLINE);
+
+        return trimmedResponse;
+    }
+
+    /**
+     * Perform platform adaptations.
+     * 
+     * @param String line - The line in the response
+     */
+    private String performPlatformAdaptations(String vxmlMarkup) {
+        if (platform == null) {
+            return vxmlMarkup;
+        }
+        // Platform adaptations go here    
+        return vxmlMarkup;
+    }
+    
+    /**
+     * Get Locale for given language, country and variant.
+     * 
+     * @param String language - The language of the Locale
+     * @param String country - The country of the Locale
+     * @param String variant - The variant of the Locale
+     */
+    private void initLocale(String language, String country, String variant) {
+        boolean gotLanguage = !RDCUtils.isStringEmpty(language);
+        boolean gotCountry = !RDCUtils.isStringEmpty(country);
+        boolean gotVariant = !RDCUtils.isStringEmpty(variant);
+        if (!gotLanguage) {
+            return;
+        } else {
+            if (gotCountry) {
+                if (gotVariant) {
+                    rdcLocale = new Locale(language, country, variant);
+                } else {
+                    rdcLocale = new Locale(language, country);
+                }
+            } else {
+                rdcLocale = new Locale(language);
+            }
+        }
+        if (rdcLocale != null) {
+            StringBuffer buf = new StringBuffer(language);
+            if (!RDCUtils.isStringEmpty(country)) {
+                buf.append('-').append(country);
+                if (!RDCUtils.isStringEmpty(variant)) {
+                    buf.append('-').append(variant);
+                }
+            }
+            locale = buf.toString();
+        }
+    }
+    
+    private void checkLocale() {
+        if (pushLocale) {
+            if (rdcLocale != null) {
+                Constants.initI18NResources(locale, rdcLocale);
+            }
+            pushLocale = false;
+        }
+    }
+
+    /**
+     * Response wrapper so we can examine the RDC output
+     */
+    private static class CharResponseWrapper extends HttpServletResponseWrapper {
+
+        private Writer output;
+
+        public String toString() {
+            return output.toString();
+        }
+
+        public CharResponseWrapper(HttpServletResponse response) {
+            super(response);
+            output = new CharArrayWriter();
+        }
+
+        public PrintWriter getWriter() {
+            return new PrintWriter(output);
+        }
+    }
 }

Modified: jakarta/taglibs/proper/rdc/trunk/src/org/apache/taglibs/rdc/RDCUtils.java
URL: http://svn.apache.org/viewcvs/jakarta/taglibs/proper/rdc/trunk/src/org/apache/taglibs/rdc/RDCUtils.java?rev=231329&r1=231328&r2=231329&view=diff
==============================================================================
--- jakarta/taglibs/proper/rdc/trunk/src/org/apache/taglibs/rdc/RDCUtils.java (original)
+++ jakarta/taglibs/proper/rdc/trunk/src/org/apache/taglibs/rdc/RDCUtils.java Wed Aug 10 14:10:59 2005
@@ -57,291 +57,291 @@
  */
 public class RDCUtils {
 
-	// ******************
-	// PRIVATE CONSTANTS
-	// ******************
-	private static final String RDC_PREFIX = "__rdc";
-	private static int varCounter = 71463;
-	
-	// Error messages (to be i18n'zed)
-	private static final String ERR_NO_SUCH_CLASS = "No class found with " +
-		"name \"{0}\"";
-	private static final String ERR_BAD_URI_SYNTAX = "Bad URI syntax in " +
-		"\"{0}\"";
-	private static final String ERR_COMP_CONFIGS = "Error while trying to " +
-		"obtain child component configuration files";
-	private static final String ERR_TRANS_EXP = "Transformer Exception " +
-		"while trying to evaluate attributes 'id' and 'config' of " +
-		"<component>";
-	private static final String ERR_NO_SUCH_ENTRY = "Could not locate jar " +
-		"entry: \"{0}\" in jar: \"{1}\"";
-	
-	// Logging
-	private static Log log = LogFactory.getLog(RDCUtils.class);
+    // ******************
+    // PRIVATE CONSTANTS
+    // ******************
+    private static final String RDC_PREFIX = "__rdc";
+    private static int varCounter = 71463;
+    
+    // Error messages (to be i18n'zed)
+    private static final String ERR_NO_SUCH_CLASS = "No class found with " +
+        "name \"{0}\"";
+    private static final String ERR_BAD_URI_SYNTAX = "Bad URI syntax in " +
+        "\"{0}\"";
+    private static final String ERR_COMP_CONFIGS = "Error while trying to " +
+        "obtain child component configuration files";
+    private static final String ERR_TRANS_EXP = "Transformer Exception " +
+        "while trying to evaluate attributes 'id' and 'config' of " +
+        "<component>";
+    private static final String ERR_NO_SUCH_ENTRY = "Could not locate jar " +
+        "entry: \"{0}\" in jar: \"{1}\"";
+    
+    // Logging
+    private static Log log = LogFactory.getLog(RDCUtils.class);
 
-	// ******************
-	// PUBLIC METHODS
-	// ******************			
-	/** 
-	 * Return true if the given class implements the given interface.
-	 *
-	 * @param Class clas
-	 * @param Class interfayce
-	 */
-	public static boolean implementsInterface(Class clas, Class interfayce) {
-		while (clas != null && clas != Object.class) {
-			Class[] implementedInterfaces = clas.getInterfaces();
-			for (int j = 0; j < implementedInterfaces.length; j++) {
-				if (implementedInterfaces[j] == interfayce) {
-					// nemo !
-					return true;
-				}
-			}
-			clas = clas.getSuperclass();
-		}
-		return false;
-	}
-	
-	/** 
-	 * Return true if the given class defines or inherits the given field.
-	 *
-	 * @param Class clas
-	 * @param String field
-	 */
-	public static boolean hasField(Class clas, String field) {
-		while (clas != null && clas != Object.class) {
-			Field[] fields = clas.getDeclaredFields();
-			for (int j = 0; j < fields.length; j++) {
-				if (((Field)fields[j]).getName() == field) {
-					return true;
-				}
-			}
-			clas = clas.getSuperclass();
-		}
-		return false;
-	}
-	
-	
-	/** 
-	 * Return true if the given class defines or inherits the given method.
-	 *
-	 * @param Class clas
-	 * @param String method
-	 */
-	public static boolean hasMethod(Class clas, String methodName,
-		Class[] paramTypes) {
-		while (clas != null && clas != Object.class) {
-			Method method = null;
-			try {
-				method = clas.getDeclaredMethod(methodName, paramTypes);
-			} catch (NoSuchMethodException nsme) {
-				clas = clas.getSuperclass();
-				continue;
-			}
-			return true;
-		}
-		return false;
-	}
-	
-	/** 
-	 * Return the Class for this class name, if such a class exists, 
-	 * else return null.
-	 *
-	 * @param String className
-	 */
-	public static Class getClass(String className) {
-		try {
-			Class clas = Class.forName(className);
-			return clas;
-		} catch (Exception e) {
-			MessageFormat msgFormat = new MessageFormat(ERR_NO_SUCH_CLASS);
-        	log.warn(msgFormat.format(new Object[] {className}));
-			return null;
-		}
-	}
+    // ******************
+    // PUBLIC METHODS
+    // ******************            
+    /** 
+     * Return true if the given class implements the given interface.
+     *
+     * @param Class clas
+     * @param Class interfayce
+     */
+    public static boolean implementsInterface(Class clas, Class interfayce) {
+        while (clas != null && clas != Object.class) {
+            Class[] implementedInterfaces = clas.getInterfaces();
+            for (int j = 0; j < implementedInterfaces.length; j++) {
+                if (implementedInterfaces[j] == interfayce) {
+                    // nemo !
+                    return true;
+                }
+            }
+            clas = clas.getSuperclass();
+        }
+        return false;
+    }
+    
+    /** 
+     * Return true if the given class defines or inherits the given field.
+     *
+     * @param Class clas
+     * @param String field
+     */
+    public static boolean hasField(Class clas, String field) {
+        while (clas != null && clas != Object.class) {
+            Field[] fields = clas.getDeclaredFields();
+            for (int j = 0; j < fields.length; j++) {
+                if (((Field)fields[j]).getName() == field) {
+                    return true;
+                }
+            }
+            clas = clas.getSuperclass();
+        }
+        return false;
+    }
+    
+    
+    /** 
+     * Return true if the given class defines or inherits the given method.
+     *
+     * @param Class clas
+     * @param String method
+     */
+    public static boolean hasMethod(Class clas, String methodName,
+        Class[] paramTypes) {
+        while (clas != null && clas != Object.class) {
+            Method method = null;
+            try {
+                method = clas.getDeclaredMethod(methodName, paramTypes);
+            } catch (NoSuchMethodException nsme) {
+                clas = clas.getSuperclass();
+                continue;
+            }
+            return true;
+        }
+        return false;
+    }
+    
+    /** 
+     * Return the Class for this class name, if such a class exists, 
+     * else return null.
+     *
+     * @param String className
+     */
+    public static Class getClass(String className) {
+        try {
+            Class clas = Class.forName(className);
+            return clas;
+        } catch (Exception e) {
+            MessageFormat msgFormat = new MessageFormat(ERR_NO_SUCH_CLASS);
+            log.warn(msgFormat.format(new Object[] {className}));
+            return null;
+        }
+    }
 
-	/** 
-	 * Log error if the supplied string is null or empty.
-	 *
-	 * @param String str
-	 * @param String err_msg
-	 */
-	public static void mustExist(String str, String err_msg) {
-		if (str == null || str.trim().length() == 0) {
-			log.error(err_msg);
-		}
-	}
-	
-	/** 
-	 * Log error if the supplied condition is not satisfied.
-	 *
-	 * @param boolean cond
-	 * @param String err_msg
-	 */
-	public static void mustSatisfy(boolean cond, String err_msg) {
-		if (!cond) {
-			log.error(err_msg);
-		}
-	}
-	
-	/** 
-	 * Print warning via if the supplied error condition holds, but move on.
-	 *
-	 * @param boolean cond
-	 * @param String err_msg
-	 */
-	public static void warnIf(boolean cond, String err_msg) {
-		if (cond) {
-			log.warn(err_msg);
-		}
-	}
-		
-	/** 
-	 * Return true if this string contains non-white space characters.
-	 *
-	 * @param String str
-	 */
-	public static boolean isStringEmpty(String str) {
-		if (str == null || str.trim().length() == 0) {
-			return true;
-		}
-		return false;
-	}
+    /** 
+     * Log error if the supplied string is null or empty.
+     *
+     * @param String str
+     * @param String err_msg
+     */
+    public static void mustExist(String str, String err_msg) {
+        if (str == null || str.trim().length() == 0) {
+            log.error(err_msg);
+        }
+    }
+    
+    /** 
+     * Log error if the supplied condition is not satisfied.
+     *
+     * @param boolean cond
+     * @param String err_msg
+     */
+    public static void mustSatisfy(boolean cond, String err_msg) {
+        if (!cond) {
+            log.error(err_msg);
+        }
+    }
+    
+    /** 
+     * Print warning via if the supplied error condition holds, but move on.
+     *
+     * @param boolean cond
+     * @param String err_msg
+     */
+    public static void warnIf(boolean cond, String err_msg) {
+        if (cond) {
+            log.warn(err_msg);
+        }
+    }
+        
+    /** 
+     * Return true if this string contains non-white space characters.
+     *
+     * @param String str
+     */
+    public static boolean isStringEmpty(String str) {
+        if (str == null || str.trim().length() == 0) {
+            return true;
+        }
+        return false;
+    }
 
-	/** 
-	 * Create a temporary variable name for this groupTag's page context 
-	 *
-	 */
-	public static String getNextRDCVarName() {
-		if (varCounter == Integer.MAX_VALUE) {
-			varCounter = 0;
-		}
-		varCounter++;
-		return RDC_PREFIX + varCounter; 
-	}
+    /** 
+     * Create a temporary variable name for this groupTag's page context 
+     *
+     */
+    public static String getNextRDCVarName() {
+        if (varCounter == Integer.MAX_VALUE) {
+            varCounter = 0;
+        }
+        varCounter++;
+        return RDC_PREFIX + varCounter; 
+    }
 
-	/** 
-	 * Return a nested data model 
-	 *
-	 */
-	public static BaseModel getChildDataModel(BaseModel parent,
-			String childId) {
-		Map localMap = null;
-		if (parent instanceof GroupModel) {
-			localMap = ((GroupModel) parent).getLocalMap();
-		} else if (parent instanceof ComponentModel) {
-			localMap = ((ComponentModel) parent).getLocalMap();
-		} else {
-			return null;
-		}
-		return (BaseModel) localMap.get(childId);
-	}
-	
-	/** 
-	 * Clear a nested data model 
-	 *
-	 */
-	public static boolean clearChildDataModel(BaseModel parent, 
-			String childId) {
-		Map localMap = null;
-		if (parent instanceof GroupModel) {
-			localMap = ((GroupModel) parent).getLocalMap();
-		} else if (parent instanceof ComponentModel) {
-			localMap = ((ComponentModel) parent).getLocalMap();
-		} else {
-			return false;
-		}
-		if (localMap.containsKey(childId)) {
-			localMap.remove(childId);
-			return true;
-		}
-		return false;
-	}
-	
-	/**
-	 * A config handler commonly used by composites for passing prompts
-	 * down to their constituent components
-	 * (such as mortgage and creditcardInfo).
-	 * 
-	 * Stores the id and file attributes from the config xml to a Map.
-	 * Composite config file should look like:<br>
-	 * <br>
-	 * &lt;config&gt;<br>
-	 * &lt;componentConfigList&gt;<br>
-	 * &lt;component id="foo" config="dir/configfile.xml" /&gt;<br>
-	 * &lt;!-- More component elements here --&gt;<br>
-	 * &lt;/componentConfigList&gt;<br>
-	 * &lt;/config&gt;<br>
-	 */
-	public static Map configHandler(String config, PageContext context) {
-		if (isStringEmpty(config)) {
-			return null;
-		}
-		Map configMap = new HashMap();
-		String uriPath = config;
-		DocumentBuilder builder = null;
-		Document doc = null;
-		XObject xPathResult = null;
-		NodeList nodelist = null;
-		Node node = null;
-		URI absTest = null;
-		
-		try {
-			absTest = new URI(uriPath);
-		} catch (URISyntaxException uriexp) {
-        	MessageFormat msgFormat = new MessageFormat(ERR_BAD_URI_SYNTAX);
-        	log.warn(msgFormat.format(new Object[] {uriPath}));
-		}
-		if (!absTest.isAbsolute()) {
-			uriPath = context.getServletContext().getRealPath(uriPath);
-		}
+    /** 
+     * Return a nested data model 
+     *
+     */
+    public static BaseModel getChildDataModel(BaseModel parent,
+            String childId) {
+        Map localMap = null;
+        if (parent instanceof GroupModel) {
+            localMap = ((GroupModel) parent).getLocalMap();
+        } else if (parent instanceof ComponentModel) {
+            localMap = ((ComponentModel) parent).getLocalMap();
+        } else {
+            return null;
+        }
+        return (BaseModel) localMap.get(childId);
+    }
+    
+    /** 
+     * Clear a nested data model 
+     *
+     */
+    public static boolean clearChildDataModel(BaseModel parent, 
+            String childId) {
+        Map localMap = null;
+        if (parent instanceof GroupModel) {
+            localMap = ((GroupModel) parent).getLocalMap();
+        } else if (parent instanceof ComponentModel) {
+            localMap = ((ComponentModel) parent).getLocalMap();
+        } else {
+            return false;
+        }
+        if (localMap.containsKey(childId)) {
+            localMap.remove(childId);
+            return true;
+        }
+        return false;
+    }
+    
+    /**
+     * A config handler commonly used by composites for passing prompts
+     * down to their constituent components
+     * (such as mortgage and creditcardInfo).
+     * 
+     * Stores the id and file attributes from the config xml to a Map.
+     * Composite config file should look like:<br>
+     * <br>
+     * &lt;config&gt;<br>
+     * &lt;componentConfigList&gt;<br>
+     * &lt;component id="foo" config="dir/configfile.xml" /&gt;<br>
+     * &lt;!-- More component elements here --&gt;<br>
+     * &lt;/componentConfigList&gt;<br>
+     * &lt;/config&gt;<br>
+     */
+    public static Map configHandler(String config, PageContext context) {
+        if (isStringEmpty(config)) {
+            return null;
+        }
+        Map configMap = new HashMap();
+        String uriPath = config;
+        DocumentBuilder builder = null;
+        Document doc = null;
+        XObject xPathResult = null;
+        NodeList nodelist = null;
+        Node node = null;
+        URI absTest = null;
+        
+        try {
+            absTest = new URI(uriPath);
+        } catch (URISyntaxException uriexp) {
+            MessageFormat msgFormat = new MessageFormat(ERR_BAD_URI_SYNTAX);
+            log.warn(msgFormat.format(new Object[] {uriPath}));
+        }
+        if (!absTest.isAbsolute()) {
+            uriPath = context.getServletContext().getRealPath(uriPath);
+        }
 
-		try {
-			builder = DocumentBuilderFactory.newInstance().
-				newDocumentBuilder();
-			doc = builder.parse(uriPath);
-			xPathResult =
-				XPathAPI.eval(doc.getDocumentElement(), 
-					Constants.XPATH_COMPONENT_CONFIG);
-			nodelist = xPathResult.nodelist();
-		} catch (Exception e) {
-        	log.warn(ERR_COMP_CONFIGS);
-		}
+        try {
+            builder = DocumentBuilderFactory.newInstance().
+                newDocumentBuilder();
+            doc = builder.parse(uriPath);
+            xPathResult =
+                XPathAPI.eval(doc.getDocumentElement(), 
+                    Constants.XPATH_COMPONENT_CONFIG);
+            nodelist = xPathResult.nodelist();
+        } catch (Exception e) {
+            log.warn(ERR_COMP_CONFIGS);
+        }
 
-		XObject attrId = null, attrFile = null;
-		for (int i = 0; i < nodelist.getLength(); i++) {
-			node = nodelist.item(i);
-			if (node == null) {
-				continue;
-			}
-			try {
-				attrId = XPathAPI.eval(node, Constants.XPATH_ATTR_ID);
-				attrFile = XPathAPI.eval(node, Constants.XPATH_ATTR_FILE);
-			} catch (TransformerException te) {
-				log.warn(ERR_TRANS_EXP);
-			}
-			configMap.put(attrId.toString(), attrFile.toString());
-		}	
-		return configMap;
-	}
-	
-	/**
-	 * Given a jar and a file location within the jar, extract the
-	 * file as an InputSource
-	 * 
-	 */
-	public static InputSource extract(final String jar, final String file) 
-	throws IOException {
-		JarFile j = new JarFile(jar);
-		ZipEntry e = j.getJarEntry(file);
-		if (e == null) {
-        	MessageFormat msgFormat = new MessageFormat(ERR_NO_SUCH_ENTRY);
-        	String errMsg = msgFormat.format(new Object[] {file, jar});
-        	// Log error and throw IOException
-			log.error(errMsg);
-			throw new IOException(errMsg);
-		}
-		return new InputSource(j.getInputStream(e));
-	}
-	
+        XObject attrId = null, attrFile = null;
+        for (int i = 0; i < nodelist.getLength(); i++) {
+            node = nodelist.item(i);
+            if (node == null) {
+                continue;
+            }
+            try {
+                attrId = XPathAPI.eval(node, Constants.XPATH_ATTR_ID);
+                attrFile = XPathAPI.eval(node, Constants.XPATH_ATTR_FILE);
+            } catch (TransformerException te) {
+                log.warn(ERR_TRANS_EXP);
+            }
+            configMap.put(attrId.toString(), attrFile.toString());
+        }    
+        return configMap;
+    }
+    
+    /**
+     * Given a jar and a file location within the jar, extract the
+     * file as an InputSource
+     * 
+     */
+    public static InputSource extract(final String jar, final String file) 
+    throws IOException {
+        JarFile j = new JarFile(jar);
+        ZipEntry e = j.getJarEntry(file);
+        if (e == null) {
+            MessageFormat msgFormat = new MessageFormat(ERR_NO_SUCH_ENTRY);
+            String errMsg = msgFormat.format(new Object[] {file, jar});
+            // Log error and throw IOException
+            log.error(errMsg);
+            throw new IOException(errMsg);
+        }
+        return new InputSource(j.getInputStream(e));
+    }
+    
 }

Modified: jakarta/taglibs/proper/rdc/trunk/src/org/apache/taglibs/rdc/SelectOne.java
URL: http://svn.apache.org/viewcvs/jakarta/taglibs/proper/rdc/trunk/src/org/apache/taglibs/rdc/SelectOne.java?rev=231329&r1=231328&r2=231329&view=diff
==============================================================================
--- jakarta/taglibs/proper/rdc/trunk/src/org/apache/taglibs/rdc/SelectOne.java (original)
+++ jakarta/taglibs/proper/rdc/trunk/src/org/apache/taglibs/rdc/SelectOne.java Wed Aug 10 14:10:59 2005
@@ -31,146 +31,146 @@
  * @author Rahul Akolkar
  */
 public class SelectOne extends BaseModel {
-	// The SelectOne RDC will be associated with the list input. From
-	// a list of options the user selects one option
+    // The SelectOne RDC will be associated with the list input. From
+    // a list of options the user selects one option
 
-	// The optionList attribute
-	private Object optionList;
-	// The list of available options for selection
-	private Object options;
-	// org.w3c.dom.Document for static list and Options for a dynamic one
-	private String optionsClass;
-
-	/**
-	 * Sets default values for all data members
-	 * 
-	 */
-	public SelectOne() {
-		super();
-		this.optionList = null;
-		this.options = null;
-		// assume static list to start off
-		this.optionsClass = org.w3c.dom.Document.class.getName();
-	} // end SelectOne Constructor
-
-	/**
-	 * Gets the options list. This list has all the options from which
-	 * the user selects a value.
-	 * 
-	 * @return options list.
-	 */
-	public Object getOptions() {
-		return this.options;
-	} // end getOptions()
-
-	/**
-	 * Sets the options list. This list has all the options from which
-	 * the user selects a value
-	 * 
-	 * @param options The options list.
-	 */
-	public void setOptions(Object options) {
-		this.options = options;
-	} // end setOptions()
-
-	/**
-	 * Gets the Options object. This contains all the options from which
-	 * the user selects a value.
-	 * 
-	 * @return Options
-	 */
-	public Object getOptionList() {
-		return optionList;
-	} // end getOptionList()
-
-	/**
-	 * Sets the Options object. This contains all the options from which
-	 * the user selects a value.
-	 * 
-	 * @param Options
-	 */
-	public void setOptionList(Object optionList) {
-		this.optionList = optionList;
-		if (optionList instanceof Options) {
-			options = ((Options) optionList).getVXMLOptionsMarkup();
-			optionsClass = Options.class.getName();
-			if (((String) options).length() == 0) {
-				throw new IllegalArgumentException("SelectOne " + id +
-					" cannot be used with a empty optionList.");
-			}
-		}
-	} // end setOptionList()
-	
-	/**
-	 * Get the class name of the options for this instance
-	 * 
-	 * @return String class name as a String
-	 */
-	public String getOptionsClass() {
-		return optionsClass;
-	}
-
-	/**
-	 * Set the class name of the options for this instance
-	 * 
-	 * @param String class name as a String
-	 */
-	public void setOptionsClass(String string) {
-		optionsClass = string;
-	}
-	
-	/**
-	 * Encapsulates a set of options.
-	 * Each option should include an utterance, and an optional value.
-	 *
-	 */	
-	public static class Options implements Serializable {
-		
-		private List values;
-		private List utterances;
-		
-		/**
-		 * Constructor
-		 *
-		 */	
-		public Options() {
-			values = new ArrayList();
-			utterances = new ArrayList();
-		}
-
-		/**
-		 * Add this option to the list. Option contains an utterance
-		 * and an optional value.
-		 *
-		 */		
-		public void add(String option_value, String option_utterance) {
-			values.add(option_value);
-			utterances.add(option_utterance);
-		}
-
-		/**
-		 * Generate the markup of the vxml &lt;option&gt; elements as a String
-		 *
-		 * @return String the VXML markup
-		 */		
-		public String getVXMLOptionsMarkup() {
-			String options = "";
-			for (int i=0; i < utterances.size(); i++) {
-				String val = (String) values.get(i);
-				String utt = (String) utterances.get(i);
-				if (utt != null && utt.trim().length() > 0) {
-					if (val == null || val.trim().length() == 0) {
-						options += "<option>" + utt + "</option>";
-					} else {
-						options += "<option value=\"" + val.trim() + "\">" + 
-							utt + "</option>";
-					}
-				}
-			}
-			return options;
-		}
+    // The optionList attribute
+    private Object optionList;
+    // The list of available options for selection
+    private Object options;
+    // org.w3c.dom.Document for static list and Options for a dynamic one
+    private String optionsClass;
+
+    /**
+     * Sets default values for all data members
+     * 
+     */
+    public SelectOne() {
+        super();
+        this.optionList = null;
+        this.options = null;
+        // assume static list to start off
+        this.optionsClass = org.w3c.dom.Document.class.getName();
+    } // end SelectOne Constructor
+
+    /**
+     * Gets the options list. This list has all the options from which
+     * the user selects a value.
+     * 
+     * @return options list.
+     */
+    public Object getOptions() {
+        return this.options;
+    } // end getOptions()
+
+    /**
+     * Sets the options list. This list has all the options from which
+     * the user selects a value
+     * 
+     * @param options The options list.
+     */
+    public void setOptions(Object options) {
+        this.options = options;
+    } // end setOptions()
+
+    /**
+     * Gets the Options object. This contains all the options from which
+     * the user selects a value.
+     * 
+     * @return Options
+     */
+    public Object getOptionList() {
+        return optionList;
+    } // end getOptionList()
+
+    /**
+     * Sets the Options object. This contains all the options from which
+     * the user selects a value.
+     * 
+     * @param Options
+     */
+    public void setOptionList(Object optionList) {
+        this.optionList = optionList;
+        if (optionList instanceof Options) {
+            options = ((Options) optionList).getVXMLOptionsMarkup();
+            optionsClass = Options.class.getName();
+            if (((String) options).length() == 0) {
+                throw new IllegalArgumentException("SelectOne " + id +
+                    " cannot be used with a empty optionList.");
+            }
+        }
+    } // end setOptionList()
+    
+    /**
+     * Get the class name of the options for this instance
+     * 
+     * @return String class name as a String
+     */
+    public String getOptionsClass() {
+        return optionsClass;
+    }
+
+    /**
+     * Set the class name of the options for this instance
+     * 
+     * @param String class name as a String
+     */
+    public void setOptionsClass(String string) {
+        optionsClass = string;
+    }
+    
+    /**
+     * Encapsulates a set of options.
+     * Each option should include an utterance, and an optional value.
+     *
+     */    
+    public static class Options implements Serializable {
+        
+        private List values;
+        private List utterances;
+        
+        /**
+         * Constructor
+         *
+         */    
+        public Options() {
+            values = new ArrayList();
+            utterances = new ArrayList();
+        }
+
+        /**
+         * Add this option to the list. Option contains an utterance
+         * and an optional value.
+         *
+         */        
+        public void add(String option_value, String option_utterance) {
+            values.add(option_value);
+            utterances.add(option_utterance);
+        }
+
+        /**
+         * Generate the markup of the vxml &lt;option&gt; elements as a String
+         *
+         * @return String the VXML markup
+         */        
+        public String getVXMLOptionsMarkup() {
+            String options = "";
+            for (int i=0; i < utterances.size(); i++) {
+                String val = (String) values.get(i);
+                String utt = (String) utterances.get(i);
+                if (utt != null && utt.trim().length() > 0) {
+                    if (val == null || val.trim().length() == 0) {
+                        options += "<option>" + utt + "</option>";
+                    } else {
+                        options += "<option value=\"" + val.trim() + "\">" + 
+                            utt + "</option>";
+                    }
+                }
+            }
+            return options;
+        }
 
-	} // end class Options{}
+    } // end class Options{}
 
 } // end class SelectOne{}
 

Modified: jakarta/taglibs/proper/rdc/trunk/src/org/apache/taglibs/rdc/SocialSecurityNumber.java
URL: http://svn.apache.org/viewcvs/jakarta/taglibs/proper/rdc/trunk/src/org/apache/taglibs/rdc/SocialSecurityNumber.java?rev=231329&r1=231328&r2=231329&view=diff
==============================================================================
--- jakarta/taglibs/proper/rdc/trunk/src/org/apache/taglibs/rdc/SocialSecurityNumber.java (original)
+++ jakarta/taglibs/proper/rdc/trunk/src/org/apache/taglibs/rdc/SocialSecurityNumber.java Wed Aug 10 14:10:59 2005
@@ -34,73 +34,73 @@
  */
 
 public class SocialSecurityNumber extends BaseModel {
-	// The ssn RDC is associated with the Social Security Number
-	// input and a pattern to which the input must conform. The ssn is a 9 digit
-	// number and should conform to this length.
-
-	// The social security number input must conform to this pattern
-	private String pattern;
-
-	// Error codes, defined in configuration file
-	/**A constant for Error Code stating Invalid SSN */
-	public static final int ERR_INVALID_SSN_CODE = 1;
-
-	/**A constant for Error Code stating the incorrect length of SSN */
-	public static final int ERR_NEED_CORRECT_LENGTH_SSN_CODE = 2;
-
-	// the length of the social security number is 9
-	public static final int SSN_LENGTH = 9;
-
-	/**
-	  * Sets default values for all data members
-	  */
-	public SocialSecurityNumber() {
-		super();
-		// Default pattern allows any combination of digits
-		this.pattern = "[0-9]+";
-	}
-
-	/**
-	 * Sets the pattern string to which the input must conform
-	 * 
-	 * @param pattern the pattern string to which the input must conform
-	 */
-	public void setPattern(String pattern) {
-		if (pattern != null) {
-			try {
-				Pattern.compile(pattern);
-				this.pattern = pattern;
-			} catch (PatternSyntaxException e) {
-				throw new IllegalArgumentException("pattern attribute of \"" +
-					getId()	+ "\" ssn tag not in proper format.");
-			}
-		}
-	}
-
-	/**
-	 * Gets the pattern string
-	 * 
-	 * @return the pattern string
-	 */
-	public String getPattern() {
-		return this.pattern;
-	}
-
-	/**
-	 * Validates the input against the given constraints
-	 * 
-	 * @return TRUE if valid, FALSE otherwise
-	 */
-	protected Boolean validate(Object newValue, boolean setErrorCode) {
-
-		if (pattern != null && !(Pattern.matches(pattern, (String)newValue))) {
-			if (setErrorCode) setErrorCode(ERR_INVALID_SSN_CODE);
-			return Boolean.FALSE;
-		}
-		if (((String) newValue).length() != SSN_LENGTH) {
-			if (setErrorCode) setErrorCode(ERR_NEED_CORRECT_LENGTH_SSN_CODE);
-			return Boolean.FALSE;
-		}
-		return Boolean.TRUE;
-	}
+    // The ssn RDC is associated with the Social Security Number
+    // input and a pattern to which the input must conform. The ssn is a 9 digit
+    // number and should conform to this length.
+
+    // The social security number input must conform to this pattern
+    private String pattern;
+
+    // Error codes, defined in configuration file
+    /**A constant for Error Code stating Invalid SSN */
+    public static final int ERR_INVALID_SSN_CODE = 1;
+
+    /**A constant for Error Code stating the incorrect length of SSN */
+    public static final int ERR_NEED_CORRECT_LENGTH_SSN_CODE = 2;
+
+    // the length of the social security number is 9
+    public static final int SSN_LENGTH = 9;
+
+    /**
+      * Sets default values for all data members
+      */
+    public SocialSecurityNumber() {
+        super();
+        // Default pattern allows any combination of digits
+        this.pattern = "[0-9]+";
+    }
+
+    /**
+     * Sets the pattern string to which the input must conform
+     * 
+     * @param pattern the pattern string to which the input must conform
+     */
+    public void setPattern(String pattern) {
+        if (pattern != null) {
+            try {
+                Pattern.compile(pattern);
+                this.pattern = pattern;
+            } catch (PatternSyntaxException e) {
+                throw new IllegalArgumentException("pattern attribute of \"" +
+                    getId()    + "\" ssn tag not in proper format.");
+            }
+        }
+    }
+
+    /**
+     * Gets the pattern string
+     * 
+     * @return the pattern string
+     */
+    public String getPattern() {
+        return this.pattern;
+    }
+
+    /**
+     * Validates the input against the given constraints
+     * 
+     * @return TRUE if valid, FALSE otherwise
+     */
+    protected Boolean validate(Object newValue, boolean setErrorCode) {
+
+        if (pattern != null && !(Pattern.matches(pattern, (String)newValue))) {
+            if (setErrorCode) setErrorCode(ERR_INVALID_SSN_CODE);
+            return Boolean.FALSE;
+        }
+        if (((String) newValue).length() != SSN_LENGTH) {
+            if (setErrorCode) setErrorCode(ERR_NEED_CORRECT_LENGTH_SSN_CODE);
+            return Boolean.FALSE;
+        }
+        return Boolean.TRUE;
+    }
 }

Modified: jakarta/taglibs/proper/rdc/trunk/src/org/apache/taglibs/rdc/Time.java
URL: http://svn.apache.org/viewcvs/jakarta/taglibs/proper/rdc/trunk/src/org/apache/taglibs/rdc/Time.java?rev=231329&r1=231328&r2=231329&view=diff
==============================================================================
--- jakarta/taglibs/proper/rdc/trunk/src/org/apache/taglibs/rdc/Time.java (original)
+++ jakarta/taglibs/proper/rdc/trunk/src/org/apache/taglibs/rdc/Time.java Wed Aug 10 14:10:59 2005
@@ -36,211 +36,211 @@
  */
 
 public class Time extends BaseModel {
-	// The time RDC will be associated with the time input,
-	// and the maximum and minimum times within which the 
-	// time input must lie.
-
-	// Time returned cannot be before this time
-	private java.util.Date minTime;
-	// Time returned cannot be beyond this time
-	private java.util.Date maxTime;
-
-	// Error codes, defined in configuration file
-	/**A constant for Error Code stating Invalid time*/
-	public static final int ERR_INVALID_TIME = 1;
-
-	/**A constant for Error Code stating the time entered is later 
-	 * than allowed */
-	public static final int ERR_NEED_EARLIER_TIME = 2;
-
-	/**A constant for Error Code stating the time entered is earlier 
-	 * than allowed */
-	public static final int ERR_NEED_LATER_TIME = 3;
-
-	/**
-	 * Sets default values for all data members
-	 */
-	public Time() {
-		super();
-		this.minTime = null;
-		this.maxTime = null;
-	} // End Time constructor
-
-	/**
-	 * Gets the maximum allowed time
-	 * 
-	 * @return the maximum allowed time
-	 */
-	public String getMaxTime() {
-		return calculateCanonicalizedValue(maxTime);
-	}
-
-	/**
-	 * Sets maximum allowed time
-	 * 
-	 * @param maxTime the maximum allowed time
-	 */
-	public void setMaxTime(String maxTime) {
-		if (maxTime != null) {
-			this.maxTime = (java.util.Date)canonicalize(maxTime, true);
-		}
-	}
-
-	/**
-	 * Gets the minimum allowed time
-	 * 
-	 * @return the minimum allowed time
-	 */
-	public String getMinTime() {
-		return calculateCanonicalizedValue(minTime);
-	}
-
-	/**
-	 * Sets minimum allowed time
-	 * 
-	 * @param minTime the minimum allowed time
-	 */
-	public void setMinTime(String minTime) {
-		if (minTime != null) {
-			this.minTime = (java.util.Date)canonicalize(minTime, true);
-		}
-	}
-	
-	/**
-	 * Sets the value of time.
-	 * 
-	 * @param value the value of time returned by grammar (hhmma)
-	 * 5 P M will be 0500p
-	 * @see BaseModel#setValue(Object)
-	 */
-	public void setValue(Object value) {
-		if (value != null) {
-
-			// Check the time for ambiguity
-			setIsAmbiguous(isTimeAmbiguous(value));
-			// If the time is ambiguous, then no point validating it
-			// since it is not complete
-			if (getIsAmbiguous() == Boolean.TRUE) {
-				return;
-			}
-			this.value = baseCanonicalize(value);
-			
-			setIsValid(baseValidate(this.value, true));
-
-			if (getIsValid() == Boolean.TRUE) {
-				setCanonicalizedValue(calculateCanonicalizedValue(this.value));
-			}
-		}
-	} //end setValue
-	
-	/**
-	 * Converts the min and max time strings to java.util.Date objects
-	 * 
-	 * @param str the time string to be converted (hhmma)
-	 * 
-	 * @return The java.util.Date object for the time string
-	 */
-	protected Object canonicalize(Object input, boolean isAttribute) {
-		if (input == null) {
-			return null;
-		}
-		String inputStr = (String) input;
-		SimpleDateFormat formatter = new SimpleDateFormat("hhmma");
-		if (!isAttribute || (inputStr.toLowerCase().indexOf('x') == -1)) {
-			java.util.Date canonVal = formatter.parse(inputStr,
-				new ParsePosition(0));
-			if (canonVal == null) {
-				if (isAttribute) {
-					throw new IllegalArgumentException("Cannot canonicalize " +
-					"value " + inputStr + " for time tag with ID " + getId());
-				} else {
-					// will only be here if grammar allows invalid times
-					setErrorCode(ERR_INVALID_TIME);
-				}
-			}
-			return canonVal;
-		} else if (isAttribute && inputStr.toLowerCase().indexOf('x') != -1) {
-			// offset the time value
-			String hh = inputStr.substring(0, 2);
-			String mm = inputStr.substring(2, 4);
-
-			Calendar thisDay = new GregorianCalendar();
-			try {
-				if (!hh.equals("xx")) {
-					thisDay.add(GregorianCalendar.HOUR, Integer.parseInt(hh));
-				}
-				if (!mm.equals("xx")) {
-					thisDay.add(GregorianCalendar.MINUTE,Integer.parseInt(mm));
-				}
-				// am/pm will be ignored in offseting time
-			} catch (NumberFormatException e) {
-				throw new IllegalArgumentException("Cannot canonicalize " +
-				"value " + inputStr + " for time tag with ID " + getId());
-			}
-			// factor out the date - to do: add check for date wrap
-			return formatter.parse(formatter.format(thisDay.getTime()),
-				new ParsePosition(0));
-		} else {
-			// won't be here
-			return input;
-		}
-	}
-	
-	/**
-	 * Validates the received input against validation constraints
-	 * 
-	 * @return TRUE if valid, FALSE if invalid
-	 */
-	protected Boolean validate(Object newValue, boolean setErrorCode) {
-		
-		java.util.Date time = (java.util.Date) newValue;
-		if (minTime != null && time.before(minTime)) {
-			if (setErrorCode) setErrorCode(ERR_NEED_LATER_TIME);
-			return Boolean.FALSE;
-		}
-		if (maxTime != null && time.after(maxTime)) {
-			if (setErrorCode) setErrorCode(ERR_NEED_EARLIER_TIME);
-			return Boolean.FALSE;
-		}
-		return Boolean.TRUE;
-	}
-
-	/**
-	 * Builds a time string to be used for output into prompts etc.
-	 * For e.g., 0505am gets converted to 5 5 AM 
-	 *  
-	 * @return the time string for time
-	 */
-	protected String calculateCanonicalizedValue(Object time) {
-		if (time == null) {
-			return null;
-		}
-		SimpleDateFormat df = new SimpleDateFormat("MMMM dd yyyy h m a");
-		return df.format((java.util.Date) time);
-	}
-
-	/** 
-	 * Checks if the input received is ambiguous or not
-	 * 
-	 * @return TRUE if ambiguous input, FALSE otherwise
-	 */
-	private Boolean isTimeAmbiguous(Object newValue) {
-		if (((String) newValue).charAt(4) == '?') {
-			int hh = Integer.parseInt(((String) newValue).substring(0, 2));
-			int mm = Integer.parseInt(((String) newValue).substring(2, 4));
-			if (getAmbiguousValues() != null) {
-				getAmbiguousValues().clear();
-			} else {
-				setAmbiguousValues(new LinkedHashMap());
-			}
-			getAmbiguousValues().put(((String)newValue).substring(0, 4) + "am",
-				hh + (mm > 0 ? " " + mm : "") + " a.m.");
-			getAmbiguousValues().put(((String)newValue).substring(0, 4) + "pm",
-				hh + (mm > 0 ? " " + mm : "") + " p.m.");
-			return Boolean.TRUE;
-		} else {
-			return Boolean.FALSE;
-		}
-	}
+    // The time RDC will be associated with the time input,
+    // and the maximum and minimum times within which the 
+    // time input must lie.
+
+    // Time returned cannot be before this time
+    private java.util.Date minTime;
+    // Time returned cannot be beyond this time
+    private java.util.Date maxTime;
+
+    // Error codes, defined in configuration file
+    /**A constant for Error Code stating Invalid time*/
+    public static final int ERR_INVALID_TIME = 1;
+
+    /**A constant for Error Code stating the time entered is later 
+     * than allowed */
+    public static final int ERR_NEED_EARLIER_TIME = 2;
+
+    /**A constant for Error Code stating the time entered is earlier 
+     * than allowed */
+    public static final int ERR_NEED_LATER_TIME = 3;
+
+    /**
+     * Sets default values for all data members
+     */
+    public Time() {
+        super();
+        this.minTime = null;
+        this.maxTime = null;
+    } // End Time constructor
+
+    /**
+     * Gets the maximum allowed time
+     * 
+     * @return the maximum allowed time
+     */
+    public String getMaxTime() {
+        return calculateCanonicalizedValue(maxTime);
+    }
+
+    /**
+     * Sets maximum allowed time
+     * 
+     * @param maxTime the maximum allowed time
+     */
+    public void setMaxTime(String maxTime) {
+        if (maxTime != null) {
+            this.maxTime = (java.util.Date)canonicalize(maxTime, true);
+        }
+    }
+
+    /**
+     * Gets the minimum allowed time
+     * 
+     * @return the minimum allowed time
+     */
+    public String getMinTime() {
+        return calculateCanonicalizedValue(minTime);
+    }
+
+    /**
+     * Sets minimum allowed time
+     * 
+     * @param minTime the minimum allowed time
+     */
+    public void setMinTime(String minTime) {
+        if (minTime != null) {
+            this.minTime = (java.util.Date)canonicalize(minTime, true);
+        }
+    }
+    
+    /**
+     * Sets the value of time.
+     * 
+     * @param value the value of time returned by grammar (hhmma)
+     * 5 P M will be 0500p
+     * @see BaseModel#setValue(Object)
+     */
+    public void setValue(Object value) {
+        if (value != null) {
+
+            // Check the time for ambiguity
+            setIsAmbiguous(isTimeAmbiguous(value));
+            // If the time is ambiguous, then no point validating it
+            // since it is not complete
+            if (getIsAmbiguous() == Boolean.TRUE) {
+                return;
+            }
+            this.value = baseCanonicalize(value);
+            
+            setIsValid(baseValidate(this.value, true));
+
+            if (getIsValid() == Boolean.TRUE) {
+                setCanonicalizedValue(calculateCanonicalizedValue(this.value));
+            }
+        }
+    } //end setValue
+    
+    /**
+     * Converts the min and max time strings to java.util.Date objects
+     * 
+     * @param str the time string to be converted (hhmma)
+     * 
+     * @return The java.util.Date object for the time string
+     */
+    protected Object canonicalize(Object input, boolean isAttribute) {
+        if (input == null) {
+            return null;
+        }
+        String inputStr = (String) input;
+        SimpleDateFormat formatter = new SimpleDateFormat("hhmma");
+        if (!isAttribute || (inputStr.toLowerCase().indexOf('x') == -1)) {
+            java.util.Date canonVal = formatter.parse(inputStr,
+                new ParsePosition(0));
+            if (canonVal == null) {
+                if (isAttribute) {
+                    throw new IllegalArgumentException("Cannot canonicalize " +
+                    "value " + inputStr + " for time tag with ID " + getId());
+                } else {
+                    // will only be here if grammar allows invalid times
+                    setErrorCode(ERR_INVALID_TIME);
+                }
+            }
+            return canonVal;
+        } else if (isAttribute && inputStr.toLowerCase().indexOf('x') != -1) {
+            // offset the time value
+            String hh = inputStr.substring(0, 2);
+            String mm = inputStr.substring(2, 4);
+
+            Calendar thisDay = new GregorianCalendar();
+            try {
+                if (!hh.equals("xx")) {
+                    thisDay.add(GregorianCalendar.HOUR, Integer.parseInt(hh));
+                }
+                if (!mm.equals("xx")) {
+                    thisDay.add(GregorianCalendar.MINUTE,Integer.parseInt(mm));
+                }
+                // am/pm will be ignored in offseting time
+            } catch (NumberFormatException e) {
+                throw new IllegalArgumentException("Cannot canonicalize " +
+                "value " + inputStr + " for time tag with ID " + getId());
+            }
+            // factor out the date - to do: add check for date wrap
+            return formatter.parse(formatter.format(thisDay.getTime()),
+                new ParsePosition(0));
+        } else {
+            // won't be here
+            return input;
+        }
+    }
+    
+    /**
+     * Validates the received input against validation constraints
+     * 
+     * @return TRUE if valid, FALSE if invalid
+     */
+    protected Boolean validate(Object newValue, boolean setErrorCode) {
+        
+        java.util.Date time = (java.util.Date) newValue;
+        if (minTime != null && time.before(minTime)) {
+            if (setErrorCode) setErrorCode(ERR_NEED_LATER_TIME);
+            return Boolean.FALSE;
+        }
+        if (maxTime != null && time.after(maxTime)) {
+            if (setErrorCode) setErrorCode(ERR_NEED_EARLIER_TIME);
+            return Boolean.FALSE;
+        }
+        return Boolean.TRUE;
+    }
+
+    /**
+     * Builds a time string to be used for output into prompts etc.
+     * For e.g., 0505am gets converted to 5 5 AM 
+     *  
+     * @return the time string for time
+     */
+    protected String calculateCanonicalizedValue(Object time) {
+        if (time == null) {
+            return null;
+        }
+        SimpleDateFormat df = new SimpleDateFormat("MMMM dd yyyy h m a");
+        return df.format((java.util.Date) time);
+    }
+
+    /** 
+     * Checks if the input received is ambiguous or not
+     * 
+     * @return TRUE if ambiguous input, FALSE otherwise
+     */
+    private Boolean isTimeAmbiguous(Object newValue) {
+        if (((String) newValue).charAt(4) == '?') {
+            int hh = Integer.parseInt(((String) newValue).substring(0, 2));
+            int mm = Integer.parseInt(((String) newValue).substring(2, 4));
+            if (getAmbiguousValues() != null) {
+                getAmbiguousValues().clear();
+            } else {
+                setAmbiguousValues(new LinkedHashMap());
+            }
+            getAmbiguousValues().put(((String)newValue).substring(0, 4) + "am",
+                hh + (mm > 0 ? " " + mm : "") + " a.m.");
+            getAmbiguousValues().put(((String)newValue).substring(0, 4) + "pm",
+                hh + (mm > 0 ? " " + mm : "") + " p.m.");
+            return Boolean.TRUE;
+        } else {
+            return Boolean.FALSE;
+        }
+    }
 
 }

Modified: jakarta/taglibs/proper/rdc/trunk/src/org/apache/taglibs/rdc/USMajorCity.java
URL: http://svn.apache.org/viewcvs/jakarta/taglibs/proper/rdc/trunk/src/org/apache/taglibs/rdc/USMajorCity.java?rev=231329&r1=231328&r2=231329&view=diff
==============================================================================
--- jakarta/taglibs/proper/rdc/trunk/src/org/apache/taglibs/rdc/USMajorCity.java (original)
+++ jakarta/taglibs/proper/rdc/trunk/src/org/apache/taglibs/rdc/USMajorCity.java Wed Aug 10 14:10:59 2005
@@ -29,14 +29,14 @@
  */
 
 public class USMajorCity extends BaseModel {
-	// The usMajorCity RDC is associated with the  US major
-	// city input.     
+    // The usMajorCity RDC is associated with the  US major
+    // city input.     
 
-	/**
-	  * Sets default values for all data members
-	  */
-	public USMajorCity() {
-		super();
-	}
+    /**
+      * Sets default values for all data members
+      */
+    public USMajorCity() {
+        super();
+    }
 
 }

Modified: jakarta/taglibs/proper/rdc/trunk/src/org/apache/taglibs/rdc/USState.java
URL: http://svn.apache.org/viewcvs/jakarta/taglibs/proper/rdc/trunk/src/org/apache/taglibs/rdc/USState.java?rev=231329&r1=231328&r2=231329&view=diff
==============================================================================
--- jakarta/taglibs/proper/rdc/trunk/src/org/apache/taglibs/rdc/USState.java (original)
+++ jakarta/taglibs/proper/rdc/trunk/src/org/apache/taglibs/rdc/USState.java Wed Aug 10 14:10:59 2005
@@ -29,13 +29,13 @@
  */
 
 public class USState extends BaseModel {
-	// The usState RDC is associated with the  US state
-	// input.
+    // The usState RDC is associated with the  US state
+    // input.
 
-	/**
-	  * Sets default values for all data members
-	  */
-	public USState() {
-		super();
-	}
+    /**
+      * Sets default values for all data members
+      */
+    public USState() {
+        super();
+    }
 }

Modified: jakarta/taglibs/proper/rdc/trunk/src/org/apache/taglibs/rdc/ZipCode.java
URL: http://svn.apache.org/viewcvs/jakarta/taglibs/proper/rdc/trunk/src/org/apache/taglibs/rdc/ZipCode.java?rev=231329&r1=231328&r2=231329&view=diff
==============================================================================
--- jakarta/taglibs/proper/rdc/trunk/src/org/apache/taglibs/rdc/ZipCode.java (original)
+++ jakarta/taglibs/proper/rdc/trunk/src/org/apache/taglibs/rdc/ZipCode.java Wed Aug 10 14:10:59 2005
@@ -33,100 +33,100 @@
  */
 
 public class ZipCode extends BaseModel {
-	// The zipCode RDC is associated with the zip code
-	// input, the length  which the 
-	// inputs should have, and a pattern to which the input
-	// must conform.
-
-	//  Length of the input; -1 indicates no constraint on length.
-	private int length;
-	// The zip code input must conform to this pattern
-	private String pattern;
-
-	// Error codes, defined in configuration file
-	/**A constant for Error Code stating Invalid Zip Code */
-	public static final int ERR_INVALID_ZIP_CODE = 1;
-
-	/**A constant for Error Code stating Invalid length of Zip Code */
-	public static final int ERR_INCORRECT_LENGTH_ZIP_CODE = 2;
-
-	/**
-	  * Sets default values for all data members
-	  */
-	public ZipCode() {
-		super();
-		this.length = -1;
-		// Default pattern allows any combination of digits
-		this.pattern = "[0-9]+";
-	}
-
-	/**
-	 * Sets the allowed length of input
-	 * 
-	 * @param length the allowed length of input
-	 */
-	public void setLength(String length) {
-		if (length != null) {
-			try {
-				this.length = Integer.parseInt(length);
-			} catch (NumberFormatException e) {
-				throw new IllegalArgumentException("length attribute of \"" +
-						getId() + "\" zipCode tag is not an integer.");
-			}
-		}
-	}
-	
-	/**
-	 * Gets the length as a string
-	 * 
-	 * @return the length string
-	 */
-	public String getLength() {
-		return String.valueOf(this.length);
-	}
-
-	/**
-	 * Sets the pattern string to which the input must conform
-	 * 
-	 * @param pattern the pattern string to which the input must conform
-	 */
-	public void setPattern(String pattern) {
-		if (pattern != null) {
-			try {
-				Pattern.compile(pattern);
-				this.pattern = pattern;
-			} catch (PatternSyntaxException e) {
-				throw new IllegalArgumentException("pattern attribute " +
-					"of \"" + getId() + "\" zipCode tag has invalid " +
-					"pattern syntax.");
-			}
-		}
-	}
-
-	/**
-	 * Gets the pattern string
-	 * 
-	 * @return the pattern string
-	 */
-	public String getPattern() {
-		return this.pattern;
-	}
-
-	/**
-	 * Validates the input against the given constraints
-	 * 
-	 * @return TRUE if valid, FALSE otherwise
-	 */
-	protected Boolean validate(Object newValue, boolean setErrorCode) {
-
-		if (pattern != null && !(Pattern.matches(pattern, (String)newValue))) {
-			if (setErrorCode) setErrorCode(ERR_INVALID_ZIP_CODE);
-			return Boolean.FALSE;
-		}
-		if (length > 0 && (((String) newValue).length() != length)) {
-			if (setErrorCode) setErrorCode(ERR_INCORRECT_LENGTH_ZIP_CODE);
-			return Boolean.FALSE;
-		}
-		return Boolean.TRUE;
-	}
+    // The zipCode RDC is associated with the zip code
+    // input, the length  which the 
+    // inputs should have, and a pattern to which the input
+    // must conform.
+
+    //  Length of the input; -1 indicates no constraint on length.
+    private int length;
+    // The zip code input must conform to this pattern
+    private String pattern;
+
+    // Error codes, defined in configuration file
+    /**A constant for Error Code stating Invalid Zip Code */
+    public static final int ERR_INVALID_ZIP_CODE = 1;
+
+    /**A constant for Error Code stating Invalid length of Zip Code */
+    public static final int ERR_INCORRECT_LENGTH_ZIP_CODE = 2;
+
+    /**
+      * Sets default values for all data members
+      */
+    public ZipCode() {
+        super();
+        this.length = -1;
+        // Default pattern allows any combination of digits
+        this.pattern = "[0-9]+";
+    }
+
+    /**
+     * Sets the allowed length of input
+     * 
+     * @param length the allowed length of input
+     */
+    public void setLength(String length) {
+        if (length != null) {
+            try {
+                this.length = Integer.parseInt(length);
+            } catch (NumberFormatException e) {
+                throw new IllegalArgumentException("length attribute of \"" +
+                        getId() + "\" zipCode tag is not an integer.");
+            }
+        }
+    }
+    
+    /**
+     * Gets the length as a string
+     * 
+     * @return the length string
+     */
+    public String getLength() {
+        return String.valueOf(this.length);
+    }
+
+    /**
+     * Sets the pattern string to which the input must conform
+     * 
+     * @param pattern the pattern string to which the input must conform
+     */
+    public void setPattern(String pattern) {
+        if (pattern != null) {
+            try {
+                Pattern.compile(pattern);
+                this.pattern = pattern;
+            } catch (PatternSyntaxException e) {
+                throw new IllegalArgumentException("pattern attribute " +
+                    "of \"" + getId() + "\" zipCode tag has invalid " +
+                    "pattern syntax.");
+            }
+        }
+    }
+
+    /**
+     * Gets the pattern string
+     * 
+     * @return the pattern string
+     */
+    public String getPattern() {
+        return this.pattern;
+    }
+
+    /**
+     * Validates the input against the given constraints
+     * 
+     * @return TRUE if valid, FALSE otherwise
+     */
+    protected Boolean validate(Object newValue, boolean setErrorCode) {
+
+        if (pattern != null && !(Pattern.matches(pattern, (String)newValue))) {
+            if (setErrorCode) setErrorCode(ERR_INVALID_ZIP_CODE);
+            return Boolean.FALSE;
+        }
+        if (length > 0 && (((String) newValue).length() != length)) {
+            if (setErrorCode) setErrorCode(ERR_INCORRECT_LENGTH_ZIP_CODE);
+            return Boolean.FALSE;
+        }
+        return Boolean.TRUE;
+    }
 }



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