Stranger error when I parse XML file

2003-11-25 Thread Mai,Nguyen Huu
Hi folks
I am a new with configuration
Right now, I have problem when loading XML file, 
Below this my code

String testProperties = new File("webapps/mvnforum/Web-inf/classes/" + 
OPTION_FILE_NAME).getAbsolutePath();
DOM4JConfiguration conf = new DOM4JConfiguration();
conf.setFileName(testProperties);
conf.load();

If I run this code in console, it works well (I must change the path to XML file, of 
course)
but if I run this code in Servlet Container like Resin or Tomcat, I will receive an 
error

"XML file has no top-element.  All well-formed XML files have a single top-level 
element. Nested exception: file:/C:/resin-2.1.9:1: XML file has no top-element.  All 
well-formed XML files have a single top-level element."

And I am sure I check the syntax of XML file carefully and the path to XML file is OK
Any body here get the same error like me.
Please help me.
Thanks iin advance

---
Nguyen Huu Mai
Software Developer
Email: [EMAIL PROTECTED]
web site: www.myvietnam.net

Re: [scaffold] component mavenized

2003-11-25 Thread Dirk Verbeeck
I see you found my JIRA requests.

Thanks for the update, scaffold now builds without manual downloads.
Dirk
[EMAIL PROTECTED] wrote:
Dirk,

must've missed the request to the repo.

What was it?
--
dIon Gillard, Multitask Consulting
Blog:  http://blogs.codehaus.org/people/dion/


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


Re: [collections][PROPOSAL] Remove Observable subpackage

2003-11-25 Thread Michael Heuer

As a consideration, I believe that neither Neil nor myself have commit
access to the commons sandbox.  That isn't a show stopper for me because I
haven't contributed all that much, but maybe Neil feels otherwise?

+0

   michael


On Tue, 25 Nov 2003, Stephen Colebourne wrote:

> We've had all positives so far. I'm going to take this as agreed and move
> the code to a new sandbox project. I reckon [observable] is probably the
> best name, although I'm open to offers. The move will probably happen late
> this week/weekend unless someone objects.
>
> Stephen
>
>
> - Original Message -
> From: "Neil O'Toole" <[EMAIL PROTECTED]>
> > --- Henri Yandell <[EMAIL PROTECTED]> wrote:
> > >
> > > I'm +1 on it moving out. Who is the community as far as that piece of
> > > code
> > > is concerned? Is it just a Stephen Colebourne work, ie) moving to
> > > joda
> > > makes good sense, or something by more people?
> >
> > Stephen, Michael Hauer, and myself are the three people who have had
> > most involvement in this area. Stephen wrote the observable
> > implementation. I'd developed another full implementation called
> > notifyingcollections with a different slant. I don't have strong
> > feelings on having separate source trees / projects (+0?) but the
> > observable stuff should certainly have its own distributable. There are
> > many equally valid ways of doing notification (in particular callback
> > vs. event-based, and light event vs. heavy event), and novel features
> > that can be added (such as the "ReplayableEvent" mechanism in
> > notifyingcollections that allows an event to be undone/replayed in an
> > arbitrary manner thus enable the easy recording of the entire state
> > history of a collection). In short, lots of code.
> >
> > I really think it does deserve its own distributable, and the more I
> > think about it, probably it's own subproject. I believe one of the
> > points that Steven was making is that this work is holding up the
> > release of the core [collections] stuff. And since there's so much that
> > can be done in [observable], I feel it would be fairer to decouple the
> > pair.
> >
> > >neil
> >
> > -
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


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



Re: File Upload does not work....

2003-11-25 Thread Craig R. McClanahan
Quoting "Shah, Mehul - Contractor" <[EMAIL PROTECTED]>:

> Hello,
> 
>  
> 
> I am using Tomcat 4.1 and Commons-FileUpload api. I cant get it working.
> I get the following error:
> 

One thing to ensure is that you're not trying to include servlet.jar inside your
webapp (since it's built in to Tomcat already).  Including servlet.jar is
pretty much guaranteed to cause you very wierd errors, and this could certainly
be one of them.

On the other hand, it is important to include commons-fileupload.jar and any
JARs it depends on (see the docs) in your webapp's WEB-INF/lib directory.

Craig


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



cvs commit: jakarta-commons/codec default.properties

2003-11-25 Thread ggregory
ggregory2003/11/25 19:18:28

  Modified:codec/src/java/org/apache/commons/codec overview.html
   codecdefault.properties
  Log:
  Replaced "1.2-rc1" with "1.2".
  
  Revision  ChangesPath
  1.3   +2 -2  
jakarta-commons/codec/src/java/org/apache/commons/codec/overview.html
  
  Index: overview.html
  ===
  RCS file: 
/home/cvs/jakarta-commons/codec/src/java/org/apache/commons/codec/overview.html,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- overview.html 13 Nov 2003 02:08:15 -  1.2
  +++ overview.html 26 Nov 2003 03:18:28 -  1.3
  @@ -2,7 +2,7 @@
   
   
   
  -This document is the API specification for the Apache Jakarta Commons Codec 
Library, version 1.2-rc1.
  +This document is the API specification for the Apache Jakarta Commons Codec 
Library, version 1.2.
   
   
   This library requires a JRE version of 1.2.2 or greater.
  
  
  
  1.8   +2 -2  jakarta-commons/codec/default.properties
  
  Index: default.properties
  ===
  RCS file: /home/cvs/jakarta-commons/codec/default.properties,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- default.properties14 Nov 2003 01:43:38 -  1.7
  +++ default.properties26 Nov 2003 03:18:28 -  1.8
  @@ -13,7 +13,7 @@
   component.title = Encode/Decode Utilities
   
   # The current version number of this component
  -component.version = 1.2-rc1
  +component.version = 1.2
   
   # The name that is used to create the jar file
   final.name = ${component.name}-${component.version}
  
  
  

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



DO NOT REPLY [Bug 24997] - [dbutils] Implement Pluggable Adaptors to Make BeanHandler Smarter

2003-11-25 Thread bugzilla
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=24997

[dbutils] Implement Pluggable Adaptors to Make BeanHandler Smarter

[EMAIL PROTECTED] changed:

   What|Removed |Added

   Keywords||PatchAvailable
Summary|[Patch]Implements Pluggable |[dbutils] Implement
   |Adaptors to Make BeanHandler|Pluggable Adaptors to Make
   |Smarter |BeanHandler Smarter



--- Additional Comments From [EMAIL PROTECTED]  2003-11-26 02:52 ---
Please submit patches in cvs diff -u format; they're much easier to read :-).

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



Re: Commons-collections on Gump

2003-11-25 Thread Stephen Colebourne
Fixed in CVS, although I have to admit that I wasn't aware that gump was
building javadocs.
Stephen

- Original Message -
From: "Adam R. B. Jack" <[EMAIL PROTECTED]>
> Could I trouble you guys to look this and tell me if this is a
> commons-collections problem, or a Gump problem, or some combination?
>
> This is from Python Gump:
>
> http://gump.dotnot.org/jakarta-commons/commons-collections.html
>
http://gump.dotnot.org/jakarta-commons/work/build_jakarta-commons_commons-co
llections.html
>
> This from traditional Gump:
>
> http://gump.covalent.com/log/commons-collections.html
>
>[delete] Deleting directory /var/tmp/buildtemp_200311242110
>
> doc-javadoc-testframework:
> [mkdir] Created dir: /var/tmp/buildtemp_200311242110
>
> BUILD FAILED
> /data/gump/jakarta-commons/collections/build.xml:251:
> /var/tmp/buildtemp_200311242110/java not found.
>
> Total time: 3 minutes 45 seconds
>
>
> P.S. Impressive set of dependees:
>
>
http://gump.dotnot.org/jakarta-commons/commons-collections.html#Project+Depe
ndees
>
>
> regards
>
> Adam
> --
> Experience Sybase Technology...
> http://www.try.sybase.com
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>


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



cvs commit: jakarta-commons/collections build.xml

2003-11-25 Thread scolebourne
scolebourne2003/11/25 18:26:42

  Modified:collections build.xml
  Log:
  Fix to testframework javadoc build for gump
  
  Revision  ChangesPath
  1.53  +4 -8  jakarta-commons/collections/build.xml
  
  Index: build.xml
  ===
  RCS file: /home/cvs/jakarta-commons/collections/build.xml,v
  retrieving revision 1.52
  retrieving revision 1.53
  diff -u -r1.52 -r1.53
  --- build.xml 22 Nov 2003 12:06:34 -  1.52
  +++ build.xml 26 Nov 2003 02:26:42 -  1.53
  @@ -35,8 +35,8 @@
   
  
  
  -  
  -  
  +  
  +  
  
   
  
  @@ -244,14 +244,10 @@
 
 
 
  -
  +
 
   
 
  -  
  -  
  -  
  -  
 
 

cvs commit: jakarta-commons-sandbox/functor/xdocs examples.xml

2003-11-25 Thread rwaldhoff
rwaldhoff2003/11/25 17:28:36

  Modified:functor/xdocs examples.xml
  Log:
  link to new examples
  
  Revision  ChangesPath
  1.5   +13 -0 jakarta-commons-sandbox/functor/xdocs/examples.xml
  
  Index: examples.xml
  ===
  RCS file: /home/cvs/jakarta-commons-sandbox/functor/xdocs/examples.xml,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- examples.xml  31 Mar 2003 19:04:53 -  1.4
  +++ examples.xml  26 Nov 2003 01:28:36 -  1.5
  @@ -50,6 +50,12 @@
In other words, with descriptive prose mixed right in with the source, as 
/* C++ style */ comments.
 
  +  
  +
  +  The lines
  +  package demonstrates a functional approach to IO using Generators and the 
Algorithms class.
  +
  +
 

   The Functor package, and more generally, a functional approach
  @@ -84,6 +90,13 @@
   applies this design to java.util.Map, demonstrating how 
   "pluggable" functors can be applied to a generic Map 
structure in order
   to introduce new behaviors.   
  + 
  + 
  +The 
  +http://jakarta.apache.org/commons/sandbox/functor/xref-test/org/apache/commons/functor/example/map/package-summary.html";>map
  +package is a more complete example of this, implementing a number of 
the Commons-Collections Maps
  +derived from a base 
  +http://jakarta.apache.org/commons/sandbox/functor/xref-test/org/apache/commons/functor/example/map/FunctoredMap.html";>FunctoredMap.

   
 
  
  
  

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



cvs commit: jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/example/map TestLazyMap.java FunctoredMap.java FixedSizeMap.java TestAll.java TestPredicatedMap.java PredicatedMap.java LazyMap.java TestFixedSizeMap.java

2003-11-25 Thread rwaldhoff
rwaldhoff2003/11/25 17:18:28

  Modified:functor/src/test/org/apache/commons/functor/example
TestAll.java
  Added:   functor/src/test/org/apache/commons/functor/example/map
TestLazyMap.java FunctoredMap.java
FixedSizeMap.java TestAll.java
TestPredicatedMap.java PredicatedMap.java
LazyMap.java TestFixedSizeMap.java
  Log:
  more examples
  
  Revision  ChangesPath
  1.6   +3 -2  
jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/example/TestAll.java
  
  Index: TestAll.java
  ===
  RCS file: 
/home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/example/TestAll.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- TestAll.java  25 Nov 2003 23:33:15 -  1.5
  +++ TestAll.java  26 Nov 2003 01:18:28 -  1.6
  @@ -75,6 +75,7 @@
   suite.addTest(FlexiMapExample.suite());
   suite.addTest(QuicksortExample.suite());
   suite.addTest(org.apache.commons.functor.example.lines.TestAll.suite());
  +suite.addTest(org.apache.commons.functor.example.map.TestAll.suite());
   
   return suite;
   }
  
  
  
  1.1  
jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/example/map/TestLazyMap.java
  
  Index: TestLazyMap.java
  ===
  /* 
   * $Header: 
/home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/example/map/TestLazyMap.java,v
 1.1 2003/11/26 01:18:28 rwaldhoff Exp $
   * 
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2003 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *notice, this list of conditions and the following disclaimer in
   *the documentation and/or other materials provided with the
   *distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *if any, must include the following acknowledgment:
   *   "This product includes software developed by the
   *Apache Software Foundation (http://www.apache.org/)."
   *Alternately, this acknowledgment may appear in the software itself,
   *if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *Foundation" must not be used to endorse or promote products derived 
   *from this software without prior written permission. For written
   *permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache",
   *nor may "Apache" appear in their name, without prior written
   *permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * 
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * .
   *
   */
  package org.apache.commons.functor.example.map;
  
  import java.util.HashMap;
  import java.util.Iterator;
  import java.util.Map;
  
  import junit.framework.Test;
  import junit.framework.TestCase;
  import junit.framework.TestSuite;
  
  import org.apache.commons.functor.core.collection.Size;
  
  
  /**
   * @version $Revision: 1.1 $ $Date: 2003/11/26 01:18:28 $
   * @author Rodney Waldhoff
   */
  public class TestLazyMap extends TestCase {
  
  public TestLazy

cvs commit: jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/example/map - New directory

2003-11-25 Thread rwaldhoff
rwaldhoff2003/11/25 17:18:27

  jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/example/map - 
New directory

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



Re: [VOTE][RESULT] Commons Karma for Jean-Francois Arcand

2003-11-25 Thread Jeanfrancois Arcand
Thanks!

Now I have to do some work :-)

-- Jeanfrancois

Daniel Rall wrote:

robert burrell donkin wrote:

by my count, Jean-Francois Arcand ([EMAIL PROTECTED]) has received 
7 binding +1's with no other votes cast (see 
http://marc.theaimsgroup.com/?t=10686645822&r=1&w=2). this is 
sufficient to secure his election as a committer for jakarta-commons.

Jean-Francois is an existing jakarta committer and requires only 
karma. (hopefully some kindly person with the required permissions 
can grant this without needing to bother infrastructure.)

welcome Jean-Francois! please read the jakarta-commons rules and 
remember to add your name to the Digester status file.


I've added Jean-Francois Arcand (jfarcand) to jakarta-commons and 
jakarta-commons-sandbox in avail CVS rev 1.1285.  Welcome 
Jean-Francois.  :)

- Dan

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



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


[DBUtils] Patch for Pluggable Adaptors

2003-11-25 Thread Corby Page
OK, be gentle if I have messed anything up here, I am new to Bugzilla.

I have submitted the patch as a source diff per David's request. The
enhancement is logged as Bug 24997.

Per Yoav's request, I have implemented an interface that enables pluggable
conversion strategies. The interface is ColumnAdaptor. The default
implementation is SimpleAdaptor, which works like DbUtils 1.0. I have also
shipped DriverAdaptor, which delegates to the JDBC driver to map to the
JavaBean properties, as I described in my initial e-mail.

I have included a TestCase that illustrates my original use case, where the
JavaBean property is a double, but the native return type from the database
is a BigDecimal.

I have created a new package, org.apache.commons.dbutils.adaptors, under
both the src and the test trees.

Let me know if this meets your needs.

Thanks,
Corby



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



DO NOT REPLY [Bug 24997] - [Patch]Implements Pluggable Adaptors to Make BeanHandler Smarter

2003-11-25 Thread bugzilla
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=24997

[Patch]Implements Pluggable Adaptors to Make BeanHandler Smarter





--- Additional Comments From [EMAIL PROTECTED]  2003-11-26 00:23 ---
Created an attachment (id=9286)
Source diff to apply patch

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



DO NOT REPLY [Bug 24997] New: - [Patch]Implements Pluggable Adaptors to Make BeanHandler Smarter

2003-11-25 Thread bugzilla
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=24997

[Patch]Implements Pluggable Adaptors to Make BeanHandler Smarter

   Summary: [Patch]Implements Pluggable Adaptors to Make BeanHandler
Smarter
   Product: Commons
   Version: unspecified
  Platform: All
OS/Version: All
Status: NEW
  Severity: Enhancement
  Priority: Other
 Component: DbUtils
AssignedTo: [EMAIL PROTECTED]
ReportedBy: [EMAIL PROTECTED]


diff -rN /cygdrive/c/Java/commons-dbutils-
1.0/src/java/org/apache/commons/dbutils/BasicRowProcessor.java 
src/java/org/apache/commons/dbutils/BasicRowProcessor.java
5c5
<  * 
---
>  *
82c82
<  * 
---
>  *
84c84
<  * 
---
>  *
88a89
>  * @author Corby Page
93,94c94,95
<  * Set a bean's primitive properties to these defaults when SQL NULL 
<  * is returned.  These are the same as the defaults that ResultSet get* 
---
>  * Set a bean's primitive properties to these defaults when SQL NULL
>  * is returned.  These are the same as the defaults that ResultSet get*
139c140
<  * This implementation copies column values into the array in the same 
---
>  * This implementation copies column values into the array in the same
158,160c159,161
<  * Convert a ResultSet row into a JavaBean.  This 
<  * implementation uses reflection and BeanInfo classes to 
<  * match column names to bean property names.  Properties are matched to 
---
>  * Convert a ResultSet row into a JavaBean.  This
>  * implementation uses reflection and BeanInfo classes to
>  * match column names to bean property names.  Properties are matched to
168c169
<  * 
---
>  *
170c171
<  * The property's set method parameter type matches the column 
---
>  * The property's set method parameter type matches the column
174c175
<  * 
---
>  *
178c179
<  * and booleans are set to false.  Object bean properties are set to 
---
>  * and booleans are set to false.  Object bean properties are set to
182,183c183,184
<  * 
<  * @see org.apache.commons.dbutils.RowProcessor#toBean
(java.sql.ResultSet, java.lang.Class)
---
>  *
>  * @see org.apache.commons.dbutils.RowProcessor#toBean
(java.sql.ResultSet, java.lang.Class, org.apache.commons.dbutils.ColumnAdaptor)
185c186
< public Object toBean(ResultSet rs, Class type) throws SQLException {
---
> public Object toBean(ResultSet rs, Class type, ColumnAdaptor adaptor) 
throws SQLException {
195c196
< return this.createBean(rs, type, props, columnToProperty, cols);
---
> return this.createBean(rs, type, props, columnToProperty, cols, 
adaptor);
199,201c200,202
<  * Convert a ResultSet into a List of 
JavaBeans.  
<  * This implementation uses reflection and BeanInfo classes 
to 
<  * match column names to bean property names. Properties are matched to 
---
>  * Convert a ResultSet into a List of JavaBeans.
>  * This implementation uses reflection and BeanInfo classes 
to
>  * match column names to bean property names. Properties are matched to
209c210
<  * 
---
>  *
211c212
<  * The property's set method parameter type matches the column 
---
>  * The property's set method parameter type matches the column
215c216
<  * 
---
>  *
219c220
<  * and booleans are set to false.  Object bean properties are set to 
---
>  * and booleans are set to false.  Object bean properties are set to
223,224c224,225
<  * 
<  * @see org.apache.commons.dbutils.RowProcessor#toBeanList
(java.sql.ResultSet, java.lang.Class)
---
>  *
>  * @see org.apache.commons.dbutils.RowProcessor#toBeanList
(java.sql.ResultSet, java.lang.Class, org.apache.commons.dbutils.ColumnAdaptor)
226c227
< public List toBeanList(ResultSet rs, Class type) throws SQLException {
---
> public List toBeanList(ResultSet rs, Class type, ColumnAdaptor adaptor) 
throws SQLException {
239c240
< results.add(this.createBean(rs, type, props, columnToProperty, 
cols));
---
> results.add(this.createBean(rs, type, props, columnToProperty, 
cols, adaptor));
262c263,264
< int cols)
---
> int cols,
> ColumnAdaptor adaptor )
272,273d273
< 
< Object value = rs.getObject(i);
277a278,279
> Object value = adaptor.getValue( rs, i, propType );
> 
290c292
<  * stored at each position represent the index in the PropertyDescriptor
[] 
---
>  * stored at each position represent the index in the PropertyDescriptor[]
293c295
<  * 
---
>  *
296c298
<  * @return An int[] with column index to property index mappings.  The 
0th 

Commons-collections on Gump

2003-11-25 Thread Adam R. B. Jack
Hi,

Could I trouble you guys to look this and tell me if this is a
commons-collections problem, or a Gump problem, or some combination?

This is from Python Gump:

http://gump.dotnot.org/jakarta-commons/commons-collections.html
http://gump.dotnot.org/jakarta-commons/work/build_jakarta-commons_commons-collections.html

This from traditional Gump:

http://gump.covalent.com/log/commons-collections.html

   [delete] Deleting directory /var/tmp/buildtemp_200311242110

doc-javadoc-testframework:
[mkdir] Created dir: /var/tmp/buildtemp_200311242110

BUILD FAILED
/data/gump/jakarta-commons/collections/build.xml:251:
/var/tmp/buildtemp_200311242110/java not found.

Total time: 3 minutes 45 seconds


P.S. Impressive set of dependees:

http://gump.dotnot.org/jakarta-commons/commons-collections.html#Project+Dependees


regards

Adam
--
Experience Sybase Technology...
http://www.try.sybase.com


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



DO NOT REPLY [Bug 24962] - [math] MathUtils.sign(NaN) returns -1 instead of NaN

2003-11-25 Thread bugzilla
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=24962

[math] MathUtils.sign(NaN) returns -1 instead of NaN





--- Additional Comments From [EMAIL PROTECTED]  2003-11-26 00:01 ---
I'm OK with sign( NaN ) == NaN, but the issue of sign( 0 ) == +1 or 0 is also in
dispute.  It's really this latter issue that makes me say we need a new method
to implement the return value being zero.

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



DO NOT REPLY [Bug 24995] - Cannot get FileUpload working with Tomcat 4.1

2003-11-25 Thread bugzilla
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=24995

Cannot get FileUpload working with Tomcat 4.1

[EMAIL PROTECTED] changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||INVALID



--- Additional Comments From [EMAIL PROTECTED]  2003-11-25 23:37 ---
This is not a bug in Commons FileUpload, but in your application. FileUpload is 
not even in the call stack when the exception is happening. The exception is 
happening in your servlet, and is because of a missing class that is not part 
of FileUpload.

Make sure that the Commons FileUpload jar is in your WEB-INF/lib, as it should 
be, and that your Tomcat installation is otherwise working. Most likely, the 
problem is with your application deployment.

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



cvs commit: jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/example TestAll.java

2003-11-25 Thread rwaldhoff
rwaldhoff2003/11/25 15:33:15

  Modified:functor/src/test/org/apache/commons/functor/example
TestAll.java
  Added:   functor/src/test/org/apache/commons/functor/example/lines
TestAll.java
  Log:
  add TestAll
  
  Revision  ChangesPath
  1.1  
jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/example/lines/TestAll.java
  
  Index: TestAll.java
  ===
  /* 
   * $Header: 
/home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/example/lines/TestAll.java,v
 1.1 2003/11/25 23:33:15 rwaldhoff Exp $
   * 
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2003 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *notice, this list of conditions and the following disclaimer in
   *the documentation and/or other materials provided with the
   *distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *if any, must include the following acknowledgment:
   *   "This product includes software developed by the
   *Apache Software Foundation (http://www.apache.org/)."
   *Alternately, this acknowledgment may appear in the software itself,
   *if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *Foundation" must not be used to endorse or promote products derived 
   *from this software without prior written permission. For written
   *permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache",
   *nor may "Apache" appear in their name, without prior written
   *permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * 
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * .
   *
   */
  package org.apache.commons.functor.example.lines;
  
  import junit.framework.Test;
  import junit.framework.TestCase;
  import junit.framework.TestSuite;
  
  /**
   * @version $Revision: 1.1 $ $Date: 2003/11/25 23:33:15 $
   * @author Rodney Waldhoff
   */
  public class TestAll extends TestCase {
  public TestAll(String testName) {
  super(testName);
  }
  
  public static Test suite() {
  TestSuite suite = new TestSuite();
  
  suite.addTest(TestLines.suite());
  
  return suite;
  }
  }
  
  
  
  1.5   +3 -3  
jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/example/TestAll.java
  
  Index: TestAll.java
  ===
  RCS file: 
/home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/example/TestAll.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- TestAll.java  25 Nov 2003 23:13:38 -  1.4
  +++ TestAll.java  25 Nov 2003 23:33:15 -  1.5
  @@ -74,7 +74,7 @@
   
   suite.addTest(FlexiMapExample.suite());
   suite.addTest(QuicksortExample.suite());
  -suite.addTest(org.apache.commons.functor.example.lines.TestLines.suite());
  +suite.addTest(org.apache.commons.functor.example.lines.TestAll.suite());
   
   return suite;
   }
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
Fo

cvs commit: jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/example TestAll.java

2003-11-25 Thread rwaldhoff
rwaldhoff2003/11/25 15:13:38

  Modified:functor/src/test/org/apache/commons/functor/generator/util
TestIntegerRange.java TestLongRange.java
   functor/src/test/org/apache/commons/functor/example
TestAll.java
  Added:   functor/src/test/org/apache/commons/functor/example/lines
WordCount.java Lines.java Count.java Contains.java
Sum.java StartsWith.java TestLines.java
  Log:
  add examples
  
  Revision  ChangesPath
  1.4   +23 -2 
jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/generator/util/TestIntegerRange.java
  
  Index: TestIntegerRange.java
  ===
  RCS file: 
/home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/generator/util/TestIntegerRange.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- TestIntegerRange.java 25 Nov 2003 00:01:15 -  1.3
  +++ TestIntegerRange.java 25 Nov 2003 23:13:38 -  1.4
  @@ -57,6 +57,9 @@
   
   package org.apache.commons.functor.generator.util;
   
  +import java.util.ArrayList;
  +import java.util.List;
  +
   import junit.framework.Test;
   import junit.framework.TestSuite;
   
  @@ -85,6 +88,24 @@
   
   // Tests
   // 
  +
  +public void testGenerateListExample() {
  +// generates a collection of Integers from 0 (inclusive) to 10 (exclusive)
  +{
  +List list = (List)(new IntegerRange(0,10).to(new ArrayList()));
  +for(int i=0;i<10;i++) {
  +assertEquals(new Integer(i),list.get(i));
  +}
  +}
  +
  +// generates a collection of Integers from 10 (inclusive) to 0 (exclusive)
  +{
  +List list = (List)(new IntegerRange(10,0).to(new ArrayList()));
  +for(int i=10;i>0;i--) {
  +assertEquals(new Integer(i),list.get(10-i));
  +}
  +}
  +}
   
   public void testStepChecking() {
   {
  
  
  
  1.3   +23 -2 
jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/generator/util/TestLongRange.java
  
  Index: TestLongRange.java
  ===
  RCS file: 
/home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/generator/util/TestLongRange.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TestLongRange.java25 Nov 2003 00:01:15 -  1.2
  +++ TestLongRange.java25 Nov 2003 23:13:38 -  1.3
  @@ -57,6 +57,9 @@
   
   package org.apache.commons.functor.generator.util;
   
  +import java.util.ArrayList;
  +import java.util.List;
  +
   import junit.framework.Test;
   import junit.framework.TestSuite;
   
  @@ -85,6 +88,24 @@
   
   // Tests
   // 
  +
  +public void testGenerateListExample() {
  +// generates a collection of Integers from 0 (inclusive) to 10 (exclusive)
  +{
  +List list = (List)(new LongRange(0,10).to(new ArrayList()));
  +for(int i=0;i<10;i++) {
  +assertEquals(new Long(i),list.get(i));
  +}
  +}
  +
  +// generates a collection of Integers from 10 (inclusive) to 0 (exclusive)
  +{
  +List list = (List)(new LongRange(10,0).to(new ArrayList()));
  +for(int i=10;i>0;i--) {
  +assertEquals(new Long(i),list.get(10-i));
  +}
  +}
  +}
   
   public void testStepChecking() {
   {
  
  
  
  1.1  
jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/example/lines/WordCount.java
  
  Index: WordCount.java
  ===
  /* 
   * $Header: 
/home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/example/lines/WordCount.java,v
 1.1 2003/11/25 23:13:38 rwaldhoff Exp $
   * 
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2003 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *notice, this list of conditions and the following disclaimer in
   *the documentation and/or other materials provided with the
   *distribution.
   *
   

cvs commit: jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/example/lines - New directory

2003-11-25 Thread rwaldhoff
rwaldhoff2003/11/25 15:13:36

  jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/example/lines - 
New directory

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



File Upload does not work....

2003-11-25 Thread Shah, Mehul - Contractor
Hello,

 

I am using Tomcat 4.1 and Commons-FileUpload api. I cant get it working.
I get the following error:

 


HTTP Status 500 - Internal Server Error

  _  


type Exception report

message Internal Server Error

description The server encountered an internal error (Internal Server
Error) that prevented it from fulfilling this request.

exception 

javax.servlet.ServletException: Servlet execution threw an exception
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica
tionFilterChain.java:269)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt
erChain.java:193)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValv
e.java:256)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i
nvokeNext(StandardPipeline.java:643)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4
80)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValv
e.java:191)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i
nvokeNext(StandardPipeline.java:643)
at
org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.ja
va:246)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i
nvokeNext(StandardPipeline.java:641)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4
80)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:241
7)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java
:180)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i
nvokeNext(StandardPipeline.java:643)
at
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherVa
lve.java:171)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i
nvokeNext(StandardPipeline.java:641)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java
:172)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i
nvokeNext(StandardPipeline.java:641)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4
80)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.
java:174)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i
nvokeNext(StandardPipeline.java:643)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4
80)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at
org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.j
ava:1040)
at
org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:
1151)
at java.lang.Thread.run(Thread.java:479)

root cause 

java.lang.NoClassDefFoundError: javax/servlet/ServletInputStream
at
mehul.servlet.fileupload.FileUploadServlet.doPost(FileUploadServlet.java
:43)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica
tionFilterChain.java:247)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt
erChain.java:193)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValv
e.java:256)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i
nvokeNext(StandardPipeline.java:643)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4
80)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValv
e.java:191)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i
nvokeNext(StandardPipeline.java:643)
at
org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.ja
va:246)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i
nvokeNext(StandardPipeline.java:641)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4
80)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:241
7)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java
:180)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i
nvokeNext(StandardPipeline.java:643)
at
org.apache.catalina.valves.ErrorDispatch

DO NOT REPLY [Bug 24962] - [math] MathUtils.sign(NaN) returns -1 instead of NaN

2003-11-25 Thread bugzilla
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=24962

[math] MathUtils.sign(NaN) returns -1 instead of NaN





--- Additional Comments From [EMAIL PROTECTED]  2003-11-25 23:06 ---
All we're talking about is consistent behavior with NaN's in this case though,
not dramatically altering the behavior of this function... Does a NaN have a
sign? And is the Complex functionality its used in above become inaccurate when
this is the case? I suggest leaving the method the same name and focusing on the
conditions properly being handled where it is used. All we're really talking
about is what is the proper way to handle NaN, a discussion we often seem to
have ;-) I'm suggesting something liek the following:

/**
 * For a double precision value x, this method returns +1.0 if x >= 0
 * and -1.0 if x < 0.
 * @param x the value, a double
 * @return +1.0 or -1.0, depending on the the sign of x
 */
public static double sign(final double x) {
if (Double.isNaN(x))){
return Double.NaN;
} else if (x >= 0.0) {
return 1.0;
} else {
return -1.0;
}
}

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



Re: [scaffold] component mavenized

2003-11-25 Thread dion
Dirk,

must've missed the request to the repo.

What was it?
--
dIon Gillard, Multitask Consulting
Blog:  http://blogs.codehaus.org/people/dion/



Dirk Verbeeck <[EMAIL PROTECTED]> wrote on 26/11/2003 09:09:59 AM:

> Preview: http://cvs.apache.org/~dirkv/scaffold/
> Will be moved to the main site soon.
> 
> If you want to build it yourself you will need to download:
> Jakarta Lucene 1.2 (http://jakarta.apache.org/lucene/)
> Poolman 2.0.4 (http://sourceforge.net/projects/poolman/)
> 
> I have posted a request to update the maven repo, but they have a bit of 
a 
> backlog ;-)
> 
> -- Dirk
> 
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 


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



DO NOT REPLY [Bug 24995] New: - Cannot get FileUpload working with Tomcat 4.1

2003-11-25 Thread bugzilla
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=24995

Cannot get FileUpload working with Tomcat 4.1

   Summary: Cannot get FileUpload working with Tomcat 4.1
   Product: Commons
   Version: 1.1 Final
  Platform: PC
OS/Version: Windows XP
Status: NEW
  Severity: Blocker
  Priority: Other
 Component: File Upload
AssignedTo: [EMAIL PROTECTED]
ReportedBy: [EMAIL PROTECTED]


I am using Tomcat 4.1 and Commons-FileUpload api. I cant get it working. I get 
the following error:


HTTP Status 500 - Internal Server Error



type Exception report

message Internal Server Error

description The server encountered an internal error (Internal Server Error) 
that prevented it from fulfilling this request.

exception 

javax.servlet.ServletException: Servlet execution threw an exception
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter
(ApplicationFilterChain.java:269)
at org.apache.catalina.core.ApplicationFilterChain.doFilter
(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke
(StandardWrapperValve.java:256)
at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNex
t(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke
(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContextValve.invoke
(StandardContextValve.java:191)
at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNex
t(StandardPipeline.java:643)
at org.apache.catalina.valves.CertificatesValve.invoke
(CertificatesValve.java:246)
at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNex
t(StandardPipeline.java:641)
at org.apache.catalina.core.StandardPipeline.invoke
(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContext.invoke
(StandardContext.java:2417)
at org.apache.catalina.core.StandardHostValve.invoke
(StandardHostValve.java:180)
at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNex
t(StandardPipeline.java:643)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke
(ErrorDispatcherValve.java:171)
at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNex
t(StandardPipeline.java:641)
at org.apache.catalina.valves.ErrorReportValve.invoke
(ErrorReportValve.java:172)
at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNex
t(StandardPipeline.java:641)
at org.apache.catalina.core.StandardPipeline.invoke
(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardEngineValve.invoke
(StandardEngineValve.java:174)
at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNex
t(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke
(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.connector.http.HttpProcessor.process
(HttpProcessor.java:1040)
at org.apache.catalina.connector.http.HttpProcessor.run
(HttpProcessor.java:1151)
at java.lang.Thread.run(Thread.java:479)
root cause 

java.lang.NoClassDefFoundError: javax/servlet/ServletInputStream
at mehul.servlet.fileupload.FileUploadServlet.doPost
(FileUploadServlet.java:43)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter
(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter
(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke
(StandardWrapperValve.java:256)
at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNex
t(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke
(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContextValve.invoke
(StandardContextValve.java:191)
at 
org.apache.catalina.core.StandardPipeline$Stand

Re: [latka]Project alive?

2003-11-25 Thread dion
I wouldn't say active, but it's still under development.
--
dIon Gillard, Multitask Consulting
Blog:  http://blogs.codehaus.org/people/dion/



[EMAIL PROTECTED] (Oliver Heger) wrote on 26/11/2003 05:54:01 AM:

> Hi,
> 
> I have written a tool with similar goals as Latka, but wich uses a 
> little different approach. Maybe it is possible to share some ideas and 
> code, so I wanted to ask if Latka is under active development.
> 
> Regards
> Oli
> 
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 


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



[scaffold] component mavenized

2003-11-25 Thread Dirk Verbeeck
Preview: http://cvs.apache.org/~dirkv/scaffold/
Will be moved to the main site soon.
If you want to build it yourself you will need to download:
Jakarta Lucene 1.2 (http://jakarta.apache.org/lucene/)
Poolman 2.0.4 (http://sourceforge.net/projects/poolman/)
I have posted a request to update the maven repo, but they have a bit of a 
backlog ;-)

-- Dirk



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


Re: [digester] [PATCH] Adding Ant-like properties support

2003-11-25 Thread Simon Kitching
On Wed, 2003-11-26 at 09:52, robert burrell donkin wrote:
> On 24 Nov 2003, at 23:54, Simon Kitching wrote:
> > I'm *really* in favour of providing expansion in body text as well as
> > attributes.
> 
> yep. but i'd favour a sequential approach. remy needs attributes right 
> now, so let's do attributes right now :)
> 
> > I also personally favour an interface rather than an abstract class. 
> > Who
> > knows what implementations people might come up with in the future :
> > retrieve values from LDAP? support emacs macros in variables?.
> > If the "replacement strategy" is an abstract class that brings
> > implementation baggage with it, then it might be more difficult to
> > implement those...
> 
> this would be an abstract class that is (from a higher OOP perspective) 
> an interface but will be implemented in java as an abstract class. it 
> will contain no implementation. most folks will probably subclass the 
> base implementation.
> 
> > On the other hand, an abstract class *does* allow us to expand the
> > "interface" later by adding operations with default implementations,
> > without breaking code. I personally still feel more comfortable with a
> > pure interface in this case, though.
> 
> IMHO being able to maintain backwards compatibility is crucial for a 
> good library. unless i can see the need for different inheritance 
> hierarchies to implement the interface (which is more common in 
> frameworks than library's), experience has taught me that (when 
> developing library code) the flexibility that implementing as an 
> abstract class gives in java pays dividends in long run.


Attached is a complete implementation of the "variable expansion"
feature. I do also have some unit tests for it, but unfortunately they
are still on my home PC so I will have to send them tomorrow.

This code implements the "multiple sources, configurable var marker"
features I talked about earlier. The implementation came together so
well that I am not sure that there is any point in trying to provide an
alternative "simpler" implementation that just supports one source and
"$" as the marker. If you're happy with this, class MultiVarExpander
could just be renamed to BaseVarExpander or similar.

Preferring abstract classes over interfaces is a new "pattern" to me,
but I am willing to give it a go. Class VarExpander is therefore an
abstract class rather than an interface.

Note that this implementation does almost *no* dynamic memory allocation
at all, and therefore should perform very well. Only one "attributes
wrapper" object exists per Digester instance; it is reused each time
startElement(...) is called. I can't think of any reason why
startElement would be called re-entrantly, so this should be safe.

It also implements expansion of text in body text (adds about 2 extra
lines of code).

Regards,

Simon



> 
> - robert
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
Index: src/java/org/apache/commons/digester/Digester.java
===
RCS file: /home/cvspublic/jakarta-commons/digester/src/java/org/apache/commons/digester/Digester.java,v
retrieving revision 1.86
diff -u -r1.86 Digester.java
--- src/java/org/apache/commons/digester/Digester.java	19 Nov 2003 21:05:19 -	1.86
+++ src/java/org/apache/commons/digester/Digester.java	25 Nov 2003 21:57:45 -
@@ -360,6 +360,12 @@
 protected static final String W3C_XML_SCHEMA =
 "http://www.w3.org/2001/XMLSchema";;
 
+/** a map which is looked up to find values for variables */
+private VarExpander varExpander = null;
+
+/** the attributes wrapper (single instance) */
+private VarAttributes varAttributes = new VarAttributes();
+
 
 
 // - Properties
@@ -935,6 +941,14 @@
 }
 
 
+/**
+ * Defines how variables in xml attributes and body text are expanded.
+ * If null, no expansion is performed (the default behaviour).
+ */
+public void setVarExpander(VarExpander expander) {
+varExpander = expander;
+}
+
 // - ContentHandler Methods
 
 
@@ -1038,6 +1052,10 @@
 List rules = getRules().match(namespaceURI, match);
 if ((rules != null) && (rules.size() > 0)) {
 String bodyText = this.bodyText.toString();
+if (varExpander != null) {
+bodyText = varExpander.expand(bodyText); 
+}
+
 for (int i = 0; i < rules.size(); i++) {
 try {
 Rule rule = (Rule) rules.get(i);
@@ -1283,6 +1301,13 @@
 List rules = getRules().match(namespaceURI, match);
 if ((rules != null) && (rules.size() > 0)) {
 String bodyText = this.bodyText.toString();
+
+// variable substitut

DO NOT REPLY [Bug 24962] - [math] MathUtils.sign(NaN) returns -1 instead of NaN

2003-11-25 Thread bugzilla
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=24962

[math] MathUtils.sign(NaN) returns -1 instead of NaN





--- Additional Comments From [EMAIL PROTECTED]  2003-11-25 21:51 ---
Maybe rename the existing sign to signIndicator, then?  Neat to see an actual
reference for this usage, which I only ever encountered in one of my plasma
physics classes as a way to make some algebraic expressions cleaner.

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



Re: [collections] CaseInsensitiveHashMap

2003-11-25 Thread Phil Steitz
--- Janek Bogucki <[EMAIL PROTECTED]> wrote:
> On Tue, 2003-11-25 at 10:37, Phil Steitz wrote:
> > Thinking about this some more, the semantics of keySet() would be 
> > difficult with "CompositeMap" approach that I have suggested above.  We
> 
> > would either have to require that T be idempotent - i.e., T(T(x)) =
> T(x) 
> > or have the user supply a (partial) inverse transformer to return *a* 
> > pre-image for each transformed key.
> > 
> > Phil
> 
> Not quite sure if I understood your point entirely but it would not be
> possible to supply an inverse transformation for the lowercase operation
> because it is a many to one function. Perhaps you covered this with the
> word 'partial'  but I don't see what you mean by that. What's a partial
> inverse transformer?
> 

In the case of toLower(), the identity would work.  What I meant was a
function I satisfying T(I(T(x)) = T(x) -- so that the "inverse" would
return something that would, after transformation, map to the same value.
This function needs to select one of the (potentially many) pre-images of
each object in the range of the transformer. An example is the positive
square root as an "inverse" for the squaring function (or the identity as
"inverse" for toLower()).

This is probably not practical, so I guess either keySet() would be broken
(i.e., gets over the interated keySet would not traverse the values in the
Map)if the transformer is not idempotent or it would have to refer to the
underlying Map, which the decorator could expose.

Phil


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




__
Do you Yahoo!?
Free Pop-Up Blocker - Get it now
http://companion.yahoo.com/

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



cvs commit: jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/generator TestBaseGenerator.java TestAll.java TestGenerator.java

2003-11-25 Thread rwaldhoff
rwaldhoff2003/11/25 11:57:48

  Modified:functor/src/test/org/apache/commons/functor/generator
TestAll.java
  Added:   functor/src/test/org/apache/commons/functor/generator
TestBaseGenerator.java
  Removed: functor/src/test/org/apache/commons/functor/generator
TestGenerator.java
  Log:
  rename TestGenerator to TestBaseGenerator
  
  Revision  ChangesPath
  1.5   +3 -3  
jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/generator/TestAll.java
  
  Index: TestAll.java
  ===
  RCS file: 
/home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/generator/TestAll.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- TestAll.java  25 Nov 2003 19:55:03 -  1.4
  +++ TestAll.java  25 Nov 2003 19:57:48 -  1.5
  @@ -71,7 +71,7 @@
   
   public static Test suite() {
   TestSuite suite = new TestSuite();
  -suite.addTest(TestGenerator.suite());
  +suite.addTest(TestBaseGenerator.suite());
   suite.addTest(TestBaseTransformer.suite());
   suite.addTest(TestIteratorToGeneratorAdapter.suite());
   suite.addTest(org.apache.commons.functor.generator.util.TestAll.suite());
  
  
  
  1.1  
jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/generator/TestBaseGenerator.java
  
  Index: TestBaseGenerator.java
  ===
  /*
   * $Header: 
/home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/generator/TestBaseGenerator.java,v
 1.1 2003/11/25 19:57:48 rwaldhoff Exp $
   * 
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2003 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *notice, this list of conditions and the following disclaimer in
   *the documentation and/or other materials provided with the
   *distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *if any, must include the following acknowledgment:
   *   "This product includes software developed by the
   *Apache Software Foundation (http://www.apache.org/)."
   *Alternately, this acknowledgment may appear in the software itself,
   *if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *Foundation" must not be used to endorse or promote products derived
   *from this software without prior written permission. For written
   *permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache",
   *nor may "Apache" appear in their name, without prior written
   *permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * 
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * .
   *
   */
  
  package org.apache.commons.functor.generator;
  
  import java.util.ArrayList;
  import java.util.Collection;
  import java.util.HashSet;
  import java.util.Iterator;
  import java.util.LinkedList;
  import java.util.List;
  import java.util.NoSuchElementException;
  import java.util.Set;
  
  import junit.framework.Test;
  import junit.framework.TestCase;
  import junit.framework.TestSuite;
  
  import org.apache.commons.fun

cvs commit: jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/generator/util CollectionTransformer.java

2003-11-25 Thread rwaldhoff
rwaldhoff2003/11/25 11:55:03

  Modified:functor/src/java/org/apache/commons/functor/generator
Transformer.java
   functor/src/test/org/apache/commons/functor/generator
TestAll.java
   functor/src/java/org/apache/commons/functor/generator/util
CollectionTransformer.java
  Added:   functor/src/java/org/apache/commons/functor/generator
BaseTransformer.java
   functor/src/test/org/apache/commons/functor/generator
TestBaseTransformer.java
  Log:
  * have Transformer extend UnaryFunction
  * add BaseTransformer
  * add tests
  
  Revision  ChangesPath
  1.2   +6 -4  
jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/generator/Transformer.java
  
  Index: Transformer.java
  ===
  RCS file: 
/home/cvs/jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/generator/Transformer.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Transformer.java  30 Jun 2003 11:00:13 -  1.1
  +++ Transformer.java  25 Nov 2003 19:55:02 -  1.2
  @@ -57,6 +57,8 @@
   
   package org.apache.commons.functor.generator;
   
  +import org.apache.commons.functor.UnaryFunction;
  +
   /**
* Transformers are used to change a [EMAIL PROTECTED] Generator} into something 
else,
* such as a [EMAIL PROTECTED] java.util.Collection}.
  @@ -66,6 +68,6 @@
* @author  Jason Horman ([EMAIL PROTECTED])
*/
   
  -public interface Transformer {
  -public Object transform(Generator generator);
  +public interface Transformer extends UnaryFunction {
  +Object transform(Generator generator);
   }
  
  
  
  1.1  
jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/generator/BaseTransformer.java
  
  Index: BaseTransformer.java
  ===
  /*
   * $Header: 
/home/cvs/jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/generator/BaseTransformer.java,v
 1.1 2003/11/25 19:55:02 rwaldhoff Exp $
   * 
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2003 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *notice, this list of conditions and the following disclaimer in
   *the documentation and/or other materials provided with the
   *distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *if any, must include the following acknowledgment:
   *   "This product includes software developed by the
   *Apache Software Foundation (http://www.apache.org/)."
   *Alternately, this acknowledgment may appear in the software itself,
   *if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *Foundation" must not be used to endorse or promote products derived
   *from this software without prior written permission. For written
   *permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache",
   *nor may "Apache" appear in their name, without prior written
   *permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * 
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * .
   *
   */
  
  p

[latka]Project alive?

2003-11-25 Thread Oliver Heger
Hi,

I have written a tool with similar goals as Latka, but wich uses a 
little different approach. Maybe it is possible to share some ideas and 
code, so I wanted to ask if Latka is under active development.

Regards
Oli


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


cvs commit: jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor TestAlgorithms.java

2003-11-25 Thread rwaldhoff
rwaldhoff2003/11/25 11:44:09

  Modified:functor/src/test/org/apache/commons/functor/core/collection
TestAll.java
   functor/src/test/org/apache/commons/functor
TestAlgorithms.java
  Removed: functor/src/test/org/apache/commons/functor/core/collection
TestCollectionAlgorithms.java
  Log:
  merge TestCollectionAlgorithms into TestAlgorithms, remove it
  
  Revision  ChangesPath
  1.5   +2 -3  
jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/collection/TestAll.java
  
  Index: TestAll.java
  ===
  RCS file: 
/home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/collection/TestAll.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- TestAll.java  25 Nov 2003 19:02:42 -  1.4
  +++ TestAll.java  25 Nov 2003 19:44:08 -  1.5
  @@ -72,7 +72,6 @@
   public static Test suite() {
   TestSuite suite = new TestSuite();
   
  -suite.addTest(TestCollectionAlgorithms.suite());
   suite.addTest(TestFilteredIterator.suite());
   suite.addTest(TestTransformedIterator.suite());
   suite.addTest(TestIsEmpty.suite());
  
  
  
  1.7   +78 -31
jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/TestAlgorithms.java
  
  Index: TestAlgorithms.java
  ===
  RCS file: 
/home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/TestAlgorithms.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- TestAlgorithms.java   25 Nov 2003 19:21:43 -  1.6
  +++ TestAlgorithms.java   25 Nov 2003 19:44:08 -  1.7
  @@ -124,40 +124,30 @@
   // Tests
   // 
   
  -public void testHasPublicConstructor() {
  -// some frameworks work best with instantiable classes
  -assertNotNull(new Algorithms());
  -}
  -
  -public void testApply() {
  -Collection result = 
IteratorToGeneratorAdapter.adapt(Algorithms.apply(list.iterator(),IdentityFunction.instance())).toCollection();
  +public void testCollect() {
  +Collection result = Algorithms.collect(list.iterator());
   assertNotNull(result);
   assertEquals(list.size(),result.size());
   assertEquals(list,result);
  -}
  +}
   
  -public void testApply2() {
  +public void testCollect2() {
   Set set = new HashSet();
  -
assertSame(set,IteratorToGeneratorAdapter.adapt(Algorithms.apply(list.iterator(),IdentityFunction.instance())).to(set));
  +assertSame(set,Algorithms.collect(list.iterator(),set));
   assertEquals(list.size(),set.size());
   for(Iterator iter = list.iterator(); iter.hasNext(); ) {
   assertTrue(set.contains(iter.next()));
   }
  -}
  +}
   
  -public void testApply3() {
  +public void testCollect3() {
   Set set = new HashSet();
  -
assertSame(set,IteratorToGeneratorAdapter.adapt(Algorithms.apply(listWithDuplicates.iterator(),IdentityFunction.instance())).to(set));
  +assertSame(set,Algorithms.collect(listWithDuplicates.iterator(),set));
   assertTrue(listWithDuplicates.size() > set.size());
   for(Iterator iter = listWithDuplicates.iterator(); iter.hasNext(); ) {
   assertTrue(set.contains(iter.next()));
   }
  -}
  -
  -public void testContains() {
  -assertTrue(Algorithms.contains(list.iterator(),equalsThree));
  -assertTrue(!Algorithms.contains(list.iterator(),equalsTwentyThree));
  -}
  +}
   
   public void testDetect() {
   assertEquals(new Integer(3),Algorithms.detect(list.iterator(),equalsThree));
  @@ -167,41 +157,98 @@
   } catch(NoSuchElementException e) {
   // expected
   }
  -}
  +}
   
   public void testDetectIfNone() {
   assertEquals(new 
Integer(3),Algorithms.detect(list.iterator(),equalsThree,"Xyzzy"));
   
assertEquals("Xyzzy",Algorithms.detect(list.iterator(),equalsTwentyThree,"Xyzzy"));
  -}
  +}
   
   public void testForEach() {
   Summer summer = new Summer();
   Algorithms.foreach(list.iterator(),summer);
   assertEquals(sum,summer.sum);
  -}
  +}
   
   public void testSelect1() {
  -Collection result = 
IteratorToGeneratorAdapter.adapt(Algorithms.select(list.iterator(),isEven)).toCollection();
  +Collection result = 
Algorithms.collect(Algorithms.select(list.iterator(),isEven));
   assertNotNull(result);
   assertEquals(evens,result);
  -}
  +}
   
   public vo

cvs commit: jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/core/collection CollectionAlgorithms.java

2003-11-25 Thread rwaldhoff
rwaldhoff2003/11/25 11:39:45

  Modified:functor/src/java/org/apache/commons/functor Algorithms.java
   functor/src/test/org/apache/commons/functor/core/collection
TestCollectionAlgorithms.java
   functor/src/test/org/apache/commons/functor/example
QuicksortExample.java
  Removed: functor/src/java/org/apache/commons/functor/core/collection
CollectionAlgorithms.java
  Log:
  move functionality of CollectionAlgorithms into Algorithms, fix clients, remove 
CollectionAlgorithms
  
  Revision  ChangesPath
  1.11  +66 -3 
jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/Algorithms.java
  
  Index: Algorithms.java
  ===
  RCS file: 
/home/cvs/jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/Algorithms.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- Algorithms.java   25 Nov 2003 19:21:43 -  1.10
  +++ Algorithms.java   25 Nov 2003 19:39:44 -  1.11
  @@ -57,7 +57,10 @@
   
   package org.apache.commons.functor;
   
  +import java.util.ArrayList;
  +import java.util.Collection;
   import java.util.Iterator;
  +import java.util.ListIterator;
   import java.util.NoSuchElementException;
   
   import org.apache.commons.functor.core.collection.FilteredIterator;
  @@ -87,8 +90,68 @@
* @author Jason Horman ([EMAIL PROTECTED])
* @author Rodney Waldhoff
*/
  -public class Algorithms {
  +public final class Algorithms {
   
  +/** Public constructor for bean-ish APIs */
  +public Algorithms() {
  +}
  +
  +public static Collection collect(Iterator iter) {
  +return collect(iter,new ArrayList());
  +}
  +
  +public static Collection collect(Iterator iter, Collection col) {
  +while(iter.hasNext()) {
  +col.add(iter.next());
  +}
  +return col;
  +}
  +
  +/**
  + * [EMAIL PROTECTED] ListIterator#set Set} each element of the
  + * given [EMAIL PROTECTED] ListIterator ListIterator} to
  + * the result of applying the 
  + * given [EMAIL PROTECTED] UnaryFunction UnaryFunction} to
  + * its original value.
  + */
  +public static void transform(ListIterator iter, UnaryFunction func) {
  +while(iter.hasNext()) {
  +iter.set(func.evaluate(iter.next()));
  +}
  +}
  +
  +/**
  + * [EMAIL PROTECTED] Iterator#remove Remove} from the
  + * given [EMAIL PROTECTED] Iterator Iterator} all elements 
  + * that fail to match the
  + * given [EMAIL PROTECTED] UnaryPredicate UnaryPredicate}.
  + * 
  + * @see #remove(Iterator,UnaryPredicate)
  + */
  +public static void retain(Iterator iter, UnaryPredicate pred) {
  +while(iter.hasNext()) {
  +if(!(pred.test(iter.next( {
  +iter.remove();
  +}
  +}
  +}
  +
  +/**
  + * [EMAIL PROTECTED] Iterator#remove Renmove} from the
  + * given [EMAIL PROTECTED] Iterator Iterator} all elements 
  + * that match the
  + * given [EMAIL PROTECTED] UnaryPredicate UnaryPredicate}.
  + * 
  + * @see #retain(Iterator,UnaryPredicate)
  + */
  +public static void remove(Iterator iter, UnaryPredicate pred) {
  +while(iter.hasNext()) {
  +if(pred.test(iter.next())) {
  +iter.remove();
  +}
  +}
  +}
  +
   /**
* Returns an [EMAIL PROTECTED] Iterator} that will apply the given [EMAIL 
PROTECTED] UnaryFunction} to each
* element when accessed.
  
  
  
  1.9   +22 -22
jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/collection/TestCollectionAlgorithms.java
  
  Index: TestCollectionAlgorithms.java
  ===
  RCS file: 
/home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/collection/TestCollectionAlgorithms.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- TestCollectionAlgorithms.java 24 Nov 2003 23:09:13 -  1.8
  +++ TestCollectionAlgorithms.java 25 Nov 2003 19:39:45 -  1.9
  @@ -68,12 +68,12 @@
   import junit.framework.TestCase;
   import junit.framework.TestSuite;
   
  +import org.apache.commons.functor.Algorithms;
   import org.apache.commons.functor.BinaryFunction;
   import org.apache.commons.functor.UnaryFunction;
   import org.apache.commons.functor.UnaryPredicate;
   import org.apache.commons.functor.UnaryProcedure;
   import org.apache.commons.functor.adapter.LeftBoundPredicate;
  -import org.apache.commons.functor.core.IdentityFunction;
   import org.apache.commons.functor.core.IsEqual;
   
   /**
  @@ -128,11 +128,11 @@
   
   public void testHasPublicCon

cvs commit: jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/generator/util NumberRange.java

2003-11-25 Thread rwaldhoff
rwaldhoff2003/11/25 11:24:38

  Modified:functor/src/test/org/apache/commons/functor/generator/util
TestAll.java
  Removed: functor/src/test/org/apache/commons/functor/generator/util
TestNumberRange.java
   functor/src/java/org/apache/commons/functor/generator/util
NumberRange.java
  Log:
  delete NumberRange, functionality moved to IntegerRange and LongRange
  
  Revision  ChangesPath
  1.4   +2 -3  
jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/generator/util/TestAll.java
  
  Index: TestAll.java
  ===
  RCS file: 
/home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/generator/util/TestAll.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- TestAll.java  24 Nov 2003 23:59:21 -  1.3
  +++ TestAll.java  25 Nov 2003 19:24:37 -  1.4
  @@ -72,7 +72,6 @@
   public static Test suite() {
   TestSuite suite = new TestSuite();
   suite.addTest(TestEachElement.suite());
  -suite.addTest(TestNumberRange.suite());
   suite.addTest(TestIntegerRange.suite());
   suite.addTest(TestLongRange.suite());
   return suite;
  
  
  

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



cvs commit: jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor TestAlgorithms.java

2003-11-25 Thread rwaldhoff
rwaldhoff2003/11/25 11:21:43

  Modified:functor/src/java/org/apache/commons/functor Algorithms.java
   functor/src/test/org/apache/commons/functor
TestAlgorithms.java
  Log:
  iterate lazily, using TransformedIterator and FilteredIterator
  
  Revision  ChangesPath
  1.10  +27 -24
jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/Algorithms.java
  
  Index: Algorithms.java
  ===
  RCS file: 
/home/cvs/jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/Algorithms.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- Algorithms.java   25 Nov 2003 18:34:13 -  1.9
  +++ Algorithms.java   25 Nov 2003 19:21:43 -  1.10
  @@ -60,6 +60,9 @@
   import java.util.Iterator;
   import java.util.NoSuchElementException;
   
  +import org.apache.commons.functor.core.collection.FilteredIterator;
  +import org.apache.commons.functor.core.collection.TransformedIterator;
  +import org.apache.commons.functor.core.composite.UnaryNot;
   import org.apache.commons.functor.generator.BaseGenerator;
   import org.apache.commons.functor.generator.Generator;
   import org.apache.commons.functor.generator.IteratorToGeneratorAdapter;
  @@ -87,11 +90,11 @@
   public class Algorithms {
   
   /**
  - * Equivalent to 
  - * [EMAIL PROTECTED] #apply(Generator,UnaryFunction) apply}(new [EMAIL 
PROTECTED] org.apache.commons.functor.generator.IteratorToGeneratorAdapter 
IteratorToGeneratorAdapter}(iter),func).toCollection().iterator().
  + * Returns an [EMAIL PROTECTED] Iterator} that will apply the given [EMAIL 
PROTECTED] UnaryFunction} to each
  + * element when accessed.
*/
   public static final Iterator apply(Iterator iter, UnaryFunction func) {
  -return apply(new 
IteratorToGeneratorAdapter(iter),func).toCollection().iterator();
  +return TransformedIterator.transform(iter,func);
   }
   
   /**
  @@ -259,13 +262,12 @@
   return result[0];
   }
   
  -
   /**
  - * Equivalent to 
  - * [EMAIL PROTECTED] #reject(Generator,UnaryPredicate) reject}(new [EMAIL 
PROTECTED] org.apache.commons.functor.generator.IteratorToGeneratorAdapter 
IteratorToGeneratorAdapter}(iter),pred).toCollection().iterator().
  + * Returns an [EMAIL PROTECTED] Iterator} that will only return elements that DO
  + * NOT match the given predicate.
*/
   public static Iterator reject(Iterator iter, UnaryPredicate pred) {
  -return reject(new IteratorToGeneratorAdapter(iter), 
pred).toCollection().iterator();
  +return FilteredIterator.filter(iter,UnaryNot.not(pred));
   }
   
   /**
  @@ -287,11 +289,11 @@
   }
   
   /**
  - * Equivalent to 
  - * [EMAIL PROTECTED] #select(Generator,UnaryPredicate) select}(new [EMAIL 
PROTECTED] org.apache.commons.functor.generator.IteratorToGeneratorAdapter 
IteratorToGeneratorAdapter}(iter),pred).toCollection().iterator().
  + * Returns an [EMAIL PROTECTED] Iterator} that will only return elements that DO
  + * match the given predicate.
*/
   public static final Iterator select(Iterator iter, UnaryPredicate pred) {
  -return select(new IteratorToGeneratorAdapter(iter), 
pred).toCollection().iterator();
  +return FilteredIterator.filter(iter,pred);
   }
   
   /**
  @@ -314,24 +316,24 @@
   
   /**
* Equivalent to 
  - * [EMAIL PROTECTED] #until(Generator,UnaryPredicate) until}(new [EMAIL 
PROTECTED] org.apache.commons.functor.generator.IteratorToGeneratorAdapter 
IteratorToGeneratorAdapter}(iter),pred).toCollection().iterator().
  + * [EMAIL PROTECTED] #reject(Iterator,UnaryPredicate) 
reject}(iter,pred).
*/
  -public static final Iterator until(Iterator iter, UnaryPredicate pred) {
  -return until(new IteratorToGeneratorAdapter(iter), 
pred).toCollection().iterator();
  +public static final Iterator until(final Iterator iter, final UnaryPredicate 
pred) {
  +return reject(iter,pred);
   }
   
   /**
  - * Returns a [EMAIL PROTECTED] Generator} that will stop when the predicate 
becomes
  - * true. This is useful for imposing [EMAIL PROTECTED] Generator} limits. For 
example:
  - *
  - * 
  - *  EachLine.open(file).until(new Offset(1));
  - * 
  - *
  - * Would only "generate" 1 line from the file before [EMAIL PROTECTED] 
Generator#stop
  - * stopping} the generator.
  + * Equivalent to 
  + * [EMAIL PROTECTED] #reject(Generator,UnaryPredicate) 
reject}(gen,pred).
*/
   public static final Generator until(final Generator gen, final UnaryPredicate 
pred) {
  +return reject(gen,pred);
  +// here's the old version of this code
  +// reject(gen,pred) doesn't call stop()
  +// like this version does.
  +

cvs commit: jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/collection TestTransformedIterator.java TestFilteredIterator.java

2003-11-25 Thread rwaldhoff
rwaldhoff2003/11/25 11:06:42

  Modified:functor/src/java/org/apache/commons/functor/core/collection
FilteredIterator.java TransformedIterator.java
   functor/src/test/org/apache/commons/functor/core/collection
TestTransformedIterator.java
TestFilteredIterator.java
  Log:
  swap order of parameters to match those used in Algorithms
  
  Revision  ChangesPath
  1.2   +6 -6  
jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/core/collection/FilteredIterator.java
  
  Index: FilteredIterator.java
  ===
  RCS file: 
/home/cvs/jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/core/collection/FilteredIterator.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- FilteredIterator.java 25 Nov 2003 19:02:42 -  1.1
  +++ FilteredIterator.java 25 Nov 2003 19:06:42 -  1.2
  @@ -70,7 +70,7 @@
   // constructor
   // 
   
  -public FilteredIterator(UnaryPredicate predicate, Iterator iterator) {
  +public FilteredIterator(Iterator iterator, UnaryPredicate predicate) {
   if(null == iterator || null == predicate) {
   throw new NullPointerException();
   } else {
  @@ -136,14 +136,14 @@
   }
   
   public String toString() {
  -return "FilteredIterator<" + predicate + "," + iterator + ">";
  +return "FilteredIterator<" + iterator + "," + predicate + ">";
   }
   
   // class methods
   // 
   
  -public static Iterator filter(UnaryPredicate pred, Iterator iter) {
  -return null == pred ? iter : (null == iter ? null : new 
FilteredIterator(pred,iter));
  +public static Iterator filter(Iterator iter, UnaryPredicate pred) {
  +return null == pred ? iter : (null == iter ? null : new 
FilteredIterator(iter,pred));
   }

   // private
  
  
  
  1.2   +6 -6  
jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/core/collection/TransformedIterator.java
  
  Index: TransformedIterator.java
  ===
  RCS file: 
/home/cvs/jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/core/collection/TransformedIterator.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TransformedIterator.java  25 Nov 2003 19:02:42 -  1.1
  +++ TransformedIterator.java  25 Nov 2003 19:06:42 -  1.2
  @@ -69,7 +69,7 @@
   // constructor
   // 
   
  -public TransformedIterator(UnaryFunction function, Iterator iterator) {
  +public TransformedIterator(Iterator iterator, UnaryFunction function) {
   if(null == iterator || null == function) {
   throw new NullPointerException();
   } else {
  @@ -121,14 +121,14 @@
   }
   
   public String toString() {
  -return "TransformedIterator<" + function + "," + iterator + ">";
  +return "TransformedIterator<" + iterator + "," + function + ">";
   }
   
   // class methods
   // 
   
  -public static Iterator transform(UnaryFunction func, Iterator iter) {
  -return null == func ? iter : (null == iter ? null : new 
TransformedIterator(func,iter));
  +public static Iterator transform(Iterator iter, UnaryFunction func) {
  +return null == func ? iter : (null == iter ? null : new 
TransformedIterator(iter,func));
   }


  
  
  
  1.2   +16 -16
jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/collection/TestTransformedIterator.java
  
  Index: TestTransformedIterator.java
  ===
  RCS file: 
/home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/collection/TestTransformedIterator.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TestTransformedIterator.java  25 Nov 2003 19:02:42 -  1.1
  +++ TestTransformedIterator.java  25 Nov 2003 19:06:42 -  1.2
  @@ -89,7 +89,7 @@
   public Object makeFunctor() {
   List list = new ArrayList();
   list.add("xyzzy");
  -return 
TransformedIterator.transform(IdentityFunction.instance(),list.iterator());
  +return 
TransformedIterator.transform(list.iterator(),IdentityFunction.instance());
   }
   
   // Lifecycle
  @@ -116,7 +116,7 @@
   
   public void testBasicTransform() {
   Iterator expected = negati

cvs commit: jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/core/collection TestTransformedIterator.java TestFilteredIterator.java TestAll.java TestPredicatedIterator.java

2003-11-25 Thread rwaldhoff
rwaldhoff2003/11/25 11:02:42

  Modified:functor/src/test/org/apache/commons/functor/core/collection
TestAll.java
  Added:   functor/src/java/org/apache/commons/functor/core/collection
FilteredIterator.java TransformedIterator.java
   functor/src/test/org/apache/commons/functor/core/collection
TestTransformedIterator.java
TestFilteredIterator.java
  Removed: functor/src/java/org/apache/commons/functor/core/collection
PredicatedIterator.java
   functor/src/test/org/apache/commons/functor/core/collection
TestPredicatedIterator.java
  Log:
  * rename PredicatedIterator to FilteredIterator
  * add functions and teststo FilteredIterator
  * add TransformedIterator and tests
  
  Revision  ChangesPath
  1.1  
jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/core/collection/FilteredIterator.java
  
  Index: FilteredIterator.java
  ===
  /* 
   * $Header: 
/home/cvs/jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/core/collection/FilteredIterator.java,v
 1.1 2003/11/25 19:02:42 rwaldhoff Exp $
   * 
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2003 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *notice, this list of conditions and the following disclaimer in
   *the documentation and/or other materials provided with the
   *distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *if any, must include the following acknowledgment:
   *   "This product includes software developed by the
   *Apache Software Foundation (http://www.apache.org/)."
   *Alternately, this acknowledgment may appear in the software itself,
   *if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *Foundation" must not be used to endorse or promote products derived 
   *from this software without prior written permission. For written
   *permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache",
   *nor may "Apache" appear in their name, without prior written
   *permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * 
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * .
   *
   */
  package org.apache.commons.functor.core.collection;
  
  import java.util.Iterator;
  import java.util.NoSuchElementException;
  
  import org.apache.commons.functor.UnaryPredicate;
  
  /**
   * @version $Revision: 1.1 $ $Date: 2003/11/25 19:02:42 $
   * @author Rodney Waldhoff
   */
  public final class FilteredIterator implements Iterator {
  
  // constructor
  // 
  
  public FilteredIterator(UnaryPredicate predicate, Iterator iterator) {
  if(null == iterator || null == predicate) {
  throw new NullPointerException();
  } else {
  this.predicate = predicate;
  this.iterator = iterator;
  }
  }
  
  // iterator methods
  // 
  
  /**
   * @see java.util.Iterat

cvs commit: jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor TestAlgorithms.java

2003-11-25 Thread rwaldhoff
rwaldhoff2003/11/25 10:34:14

  Modified:functor/src/java/org/apache/commons/functor Algorithms.java
   functor/src/test/org/apache/commons/functor
TestAlgorithms.java
  Log:
  when given an iterator, return an iterator
  
  Revision  ChangesPath
  1.9   +24 -18
jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/Algorithms.java
  
  Index: Algorithms.java
  ===
  RCS file: 
/home/cvs/jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/Algorithms.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- Algorithms.java   25 Nov 2003 18:22:50 -  1.8
  +++ Algorithms.java   25 Nov 2003 18:34:13 -  1.9
  @@ -67,9 +67,9 @@
   /**
* Utility methods and algorithms for applying functors to [EMAIL PROTECTED] 
Generator}s.
* [EMAIL PROTECTED] Generator}s also define these utility methods as instance 
methods. The
  - * [EMAIL PROTECTED] #apply}, [EMAIL PROTECTED] #select}, and [EMAIL PROTECTED] 
#reject} methods return new
  - * Generators. This becomes useful for constructing nested expressions. For
  - * example:
  + * [EMAIL PROTECTED] #apply apply}, [EMAIL PROTECTED] #select select}, and [EMAIL 
PROTECTED] #reject reject} methods 
  + * return new Generators. This becomes useful for constructing nested expressions. 
  + * For example:
*
* 
*  Algorithms.apply(new EachElement(list), func1)
  @@ -82,14 +82,16 @@
* @since 1.0
* @version $Revision$ $Date$
* @author Jason Horman ([EMAIL PROTECTED])
  + * @author Rodney Waldhoff
*/
   public class Algorithms {
   
   /**
  - * Equivalent to [EMAIL PROTECTED] #apply(Generator,UnaryFunction) 
apply}(new [EMAIL PROTECTED] 
org.apache.commons.functor.generator.IteratorToGeneratorAdapter 
IteratorToGeneratorAdapter}(iter),func).
  + * Equivalent to 
  + * [EMAIL PROTECTED] #apply(Generator,UnaryFunction) apply}(new [EMAIL 
PROTECTED] org.apache.commons.functor.generator.IteratorToGeneratorAdapter 
IteratorToGeneratorAdapter}(iter),func).toCollection().iterator().
*/
  -public static final Generator apply(Iterator iter, UnaryFunction func) {
  -return apply(new IteratorToGeneratorAdapter(iter),func);
  +public static final Iterator apply(Iterator iter, UnaryFunction func) {
  +return apply(new 
IteratorToGeneratorAdapter(iter),func).toCollection().iterator();
   }
   
   /**
  @@ -109,7 +111,8 @@
   }
   
   /**
  - * Equivalent to [EMAIL PROTECTED] #contains(Generator,UnaryPredicate) 
contains}(new [EMAIL PROTECTED] 
org.apache.commons.functor.generator.IteratorToGeneratorAdapter 
IteratorToGeneratorAdapter}(iter),pred).
  + * Equivalent to 
  + * [EMAIL PROTECTED] #contains(Generator,UnaryPredicate) contains}(new 
[EMAIL PROTECTED] org.apache.commons.functor.generator.IteratorToGeneratorAdapter 
IteratorToGeneratorAdapter}(iter),pred).
*/
   public static final boolean contains(Iterator iter, UnaryPredicate pred) {
   return contains(new IteratorToGeneratorAdapter(iter),pred);
  @@ -258,10 +261,11 @@
   
   
   /**
  - * Equivalent to [EMAIL PROTECTED] #reject(Generator,UnaryPredicate) 
reject}(new [EMAIL PROTECTED] 
org.apache.commons.functor.generator.IteratorToGeneratorAdapter 
IteratorToGeneratorAdapter}(iter),pred).
  + * Equivalent to 
  + * [EMAIL PROTECTED] #reject(Generator,UnaryPredicate) reject}(new [EMAIL 
PROTECTED] org.apache.commons.functor.generator.IteratorToGeneratorAdapter 
IteratorToGeneratorAdapter}(iter),pred).toCollection().iterator().
*/
  -public static Generator reject(Iterator iter, UnaryPredicate pred) {
  -return reject(new IteratorToGeneratorAdapter(iter), pred);
  +public static Iterator reject(Iterator iter, UnaryPredicate pred) {
  +return reject(new IteratorToGeneratorAdapter(iter), 
pred).toCollection().iterator();
   }
   
   /**
  @@ -283,10 +287,11 @@
   }
   
   /**
  - * Equivalent to [EMAIL PROTECTED] #select(Generator,UnaryPredicate) 
select}(new [EMAIL PROTECTED] 
org.apache.commons.functor.generator.IteratorToGeneratorAdapter 
IteratorToGeneratorAdapter}(iter),pred).
  + * Equivalent to 
  + * [EMAIL PROTECTED] #select(Generator,UnaryPredicate) select}(new [EMAIL 
PROTECTED] org.apache.commons.functor.generator.IteratorToGeneratorAdapter 
IteratorToGeneratorAdapter}(iter),pred).toCollection().iterator().
*/
  -public static final Generator select(Iterator iter, UnaryPredicate pred) {
  -return select(new IteratorToGeneratorAdapter(iter), pred);
  +public static final Iterator select(Iterator iter, UnaryPredicate pred) {
  +return select(new IteratorToGeneratorAdapter(iter), 
pred).toCollection().iterator();
   }
   
   /**
  @@ -308,10 +313,11 @@
   }
   
   /**
  - * Equival

RE: [DbUtils]Improving the BeanHandler

2003-11-25 Thread Shapira, Yoav

Howdy,

>I'd rather not introduce a dependency on BeanUtils.  It's nice that
>DbUtils can be deployed by itself without any other jars.
>
>We could add an interface that allows you to plugin conversion
strategies.
> We could provide a default implementation that performs the conversion
>that Corby suggests while allowing someone to use BeanUtils behind the
>interface if they wanted.

OK.  This is easy/small enough that I agree the beanutils dependency is
probably overkill.

Yoav Shapira
>
>David
>
>>
>> Of course, this is wishful thinking as I have no spare bandwidth to
work
>> on this with tomcat 5 release coming out...
>>
>> Yoav Shapira
>> Millennium ChemInformatics
>>
>>
>> >-Original Message-
>> >From: Corby Page [mailto:[EMAIL PROTECTED]
>> >Sent: Tuesday, November 25, 2003 12:18 PM
>> >To: [EMAIL PROTECTED]
>> >Subject: [DbUtils]Improving the BeanHandler
>> >
>> >Hi, first off I'd like to say thanks for the DbUtils package. It has
>> been
>> >very helpful for cleaning up my code in places where I have to do
>> manual
>> >persistence.
>> >
>> >I have had to modify the code in order to use the BeanHandler, and I
>> wanted
>> >to offer my modifications as a patch to the codebase.
>> >
>> >Let me run through a quick use-case: I have a bean with a property
>> called
>> >quantity of type double. I tried to populate this bean with a SELECT
>> >statement using the BeanHandler.
>> >
>> >However, the BasicRowProcessor.createBean( ... ) method executes the
>> >following code:
>> >
>> >Object value = rs.getObject(i);
>> >
>> >The return type from my Sybase JDBC Driver here is BigDecimal. Since
>> this
>> >isn't a perfect match for the exposed bean property, it refuses to
>> populate
>> >the property.
>> >
>> >When I code this persistence operation by hand, I use
rs.getDouble(i).
>> This
>> >way, I make the vendor do the work for me. I tell the vendor I
expect a
>> >double return type, and he is responsible for performing the
>> >BigDecimal.doubleValue() conversion.
>> >
>> >So, I have created my own custom RowProcessor that replaces the
>> getObject
>> >call from above with a method that looks like this:
>> >
>> >Object value;
>> >if ( propType.equals( Double.TYPE ) || propType.equals(
>> >Double.class ) )
>> >{
>> >value = new Double( rs.getDouble( index ) );
>> >}
>> >
>> >else
>> >{
>> >value = rs.getObject( index );
>> >}
>> >
>> >This is implemented for all of the appropriate ResultSet methods of
>> course.
>> >Now, we look at the type of the named property, and we call the
>> appropriate
>> >method of the JDBC driver to get the vendor to adapt to that type,
if
>> >possible. This feels a lot more flexible than requiring a bean
property
>> to
>> >precisely match a (possibly arbitrary) default type used by the JDBC
>> >vendor.
>> >
>> >I would be happy to offer this code as a patch to BasicRowProcessor,
as
>> an
>> >alternate RowProcessor that extends BasicRowProcessor, or leave it
up
>> to
>> >you guys to implement if you feel this is a good idea.
>> >
>> >Thanks,
>> >Corby
>> >
>> >
>> >
>>
>-
>> >To unsubscribe, e-mail: [EMAIL PROTECTED]
>> >For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>>
>>
>> This e-mail, including any attachments, is a confidential business
>> communication, and may contain information that is confidential,
>> proprietary and/or privileged.  This e-mail is intended only for the
>> individual(s) to whom it is addressed, and may not be saved, copied,
>> printed, disclosed or used by anyone else.  If you are not the(an)
>> intended recipient, please immediately delete this e-mail from your
>> computer system and notify the sender.  Thank you.
>>
>>
>> -
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>
>
>__
>Do you Yahoo!?
>Free Pop-Up Blocker - Get it now
>http://companion.yahoo.com/
>
>-
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]




This e-mail, including any attachments, is a confidential business communication, and 
may contain information that is confidential, proprietary and/or privileged.  This 
e-mail is intended only for the individual(s) to whom it is addressed, and may not be 
saved, copied, printed, disclosed or used by anyone else.  If you are not the(an) 
intended recipient, please immediately delete this e-mail from your computer system 
and notify the sender.  Thank you.


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



Re: [DbUtils]Improving the BeanHandler

2003-11-25 Thread Juozas Baliuka
"public Object getObject(int i,
Map map)
 throws SQLException"

Doe's somebody tried to use this method ? I am not sure, but looks like it
can be driver specific.
It is trivial to implement converters. It can be something like this:

//delegates convertion for driver

 Object getObject( ResultSet rs, int col, int jdbcType ){

 switch(){
  case Types.INT :
return new Integer(rs.getInt(col));
   ..
   }
}
and

int  []  toJdbcTypes( PropertyDescriptors [] props  ) {

  int [] result = new int[propTypes.length];

  for( int i= 0, len = propTypes.length; i < len; i++ ){

   Integer type =  (Integer)classToJdbcMap.get(props[i].getType());
   if(type == null){
 throw new Exception("register mapping for " + props[i].getType());
   }
   result[i] = type.intValue();

 }


}

This kind of implementation must be performant.







- Original Message -
From: "David Graham" <[EMAIL PROTECTED]>
To: "Jakarta Commons Developers List" <[EMAIL PROTECTED]>
Sent: Tuesday, November 25, 2003 7:49 PM
Subject: Re: [DbUtils]Improving the BeanHandler


>
> --- Corby Page <[EMAIL PROTECTED]> wrote:
> > Hi, first off I'd like to say thanks for the DbUtils package. It has
> > been
> > very helpful for cleaning up my code in places where I have to do manual
> > persistence.
> >
> > I have had to modify the code in order to use the BeanHandler, and I
> > wanted
> > to offer my modifications as a patch to the codebase.
> >
> > Let me run through a quick use-case: I have a bean with a property
> > called
> > quantity of type double. I tried to populate this bean with a SELECT
> > statement using the BeanHandler.
> >
> > However, the BasicRowProcessor.createBean( ... ) method executes the
> > following code:
> >
> > Object value = rs.getObject(i);
> >
> > The return type from my Sybase JDBC Driver here is BigDecimal. Since
> > this
> > isn't a perfect match for the exposed bean property, it refuses to
> > populate
> > the property.
> >
> > When I code this persistence operation by hand, I use rs.getDouble(i).
> > This
> > way, I make the vendor do the work for me. I tell the vendor I expect a
> > double return type, and he is responsible for performing the
> > BigDecimal.doubleValue() conversion.
> >
> > So, I have created my own custom RowProcessor that replaces the
> > getObject
> > call from above with a method that looks like this:
> >
> > Object value;
> > if ( propType.equals( Double.TYPE ) || propType.equals(
> > Double.class ) )
> > {
> > value = new Double( rs.getDouble( index ) );
> > }
> > 
> > else
> > {
> > value = rs.getObject( index );
> > }
> >
> > This is implemented for all of the appropriate ResultSet methods of
> > course.
> > Now, we look at the type of the named property, and we call the
> > appropriate
> > method of the JDBC driver to get the vendor to adapt to that type, if
> > possible. This feels a lot more flexible than requiring a bean property
> > to
> > precisely match a (possibly arbitrary) default type used by the JDBC
> > vendor.
>
> The types returned by rs.getObject() are not arbitrary; they are
> explicitly defined in the JDBC specification.  Your proposal certainly
> looks more flexible than the current implementation.  At least we designed
> with interfaces to make your interim solution possible :-).
>
> >
> > I would be happy to offer this code as a patch to BasicRowProcessor, as
> > an
> > alternate RowProcessor that extends BasicRowProcessor, or leave it up to
> > you guys to implement if you feel this is a good idea.
>
> Please open an enhancement ticket with a patch to BasicRowProcessor and
> test cases attached.  We can review it further after we see the exact code
> changes.
>
> David
>
> >
> > Thanks,
> > Corby
> >
> >
> >
> > -
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
>
>
> __
> Do you Yahoo!?
> Free Pop-Up Blocker - Get it now
> http://companion.yahoo.com/
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>


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



DO NOT REPLY [Bug 24987] - [sql] columns with default values are entered as null

2003-11-25 Thread bugzilla
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=24987

[sql] columns with default values are entered as null





--- Additional Comments From [EMAIL PROTECTED]  2003-11-25 18:25 ---
Or, the default value can be grabbed from the schema XML file and used in the
INSERT statement.  This may be easier.

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



DO NOT REPLY [Bug 24987] New: - [sql] columns with default values are entered as null

2003-11-25 Thread bugzilla
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=24987

[sql] columns with default values are entered as null

   Summary: [sql] columns with default values are entered as null
   Product: Commons
   Version: 1.0 Beta 1
  Platform: Other
OS/Version: Other
Status: NEW
  Severity: Normal
  Priority: Other
 Component: Sandbox
AssignedTo: [EMAIL PROTECTED]
ReportedBy: [EMAIL PROTECTED]


In the generated SQL, it seems that all columns are entered in the INSERT
statements.  If a value has not been provided, it is set to null.  This doesn't
work well with columns which contain default values.

If a property is null and contains a default value, it shouldn't be added to the
INSERT statement.  It should be left out and the database will take care of it.

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



cvs commit: jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/generator/util MaxIterations.java

2003-11-25 Thread rwaldhoff
rwaldhoff2003/11/25 10:23:56

  Removed: functor/src/java/org/apache/commons/functor/generator/util
MaxIterations.java
  Log:
  remove deprecated and now unused MaxIterations

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



cvs commit: jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor BaseFunctorTest.java

2003-11-25 Thread rwaldhoff
rwaldhoff2003/11/25 10:22:50

  Modified:functor/src/java/org/apache/commons/functor Algorithms.java
   functor/src/test/org/apache/commons/functor/generator
TestAll.java
   functor/src/java/org/apache/commons/functor/generator
IteratorToGeneratorAdapter.java
   functor/src/test/org/apache/commons/functor
BaseFunctorTest.java
  Added:   functor/src/test/org/apache/commons/functor/generator
TestIteratorToGeneratorAdapter.java
  Log:
  * add functionality and tests to IteratorToGeneratorAdapater
  * add javadocs to Algorithms
  
  Revision  ChangesPath
  1.8   +11 -11
jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/Algorithms.java
  
  Index: Algorithms.java
  ===
  RCS file: 
/home/cvs/jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/Algorithms.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- Algorithms.java   25 Nov 2003 17:49:35 -  1.7
  +++ Algorithms.java   25 Nov 2003 18:22:50 -  1.8
  @@ -86,7 +86,7 @@
   public class Algorithms {
   
   /**
  - * apply(new IteratorToGeneratorAdapater(iter),func);
  + * Equivalent to [EMAIL PROTECTED] #apply(Generator,UnaryFunction) 
apply}(new [EMAIL PROTECTED] 
org.apache.commons.functor.generator.IteratorToGeneratorAdapter 
IteratorToGeneratorAdapter}(iter),func).
*/
   public static final Generator apply(Iterator iter, UnaryFunction func) {
   return apply(new IteratorToGeneratorAdapter(iter),func);
  @@ -109,7 +109,7 @@
   }
   
   /**
  - * contains(new IteratorToGeneratorAdapater(iter),pred);
  + * Equivalent to [EMAIL PROTECTED] #contains(Generator,UnaryPredicate) 
contains}(new [EMAIL PROTECTED] 
org.apache.commons.functor.generator.IteratorToGeneratorAdapter 
IteratorToGeneratorAdapter}(iter),pred).
*/
   public static final boolean contains(Iterator iter, UnaryPredicate pred) {
   return contains(new IteratorToGeneratorAdapter(iter),pred);
  @@ -139,14 +139,14 @@
   }
   
   /**
  - * detect(new IteratorToGeneratorAdapater(iter), pred);
  + * Equivalent to [EMAIL PROTECTED] #detect(Generator,UnaryPredicate) 
detect}(new [EMAIL PROTECTED] 
org.apache.commons.functor.generator.IteratorToGeneratorAdapter 
IteratorToGeneratorAdapter}(iter),pred).
*/
   public static final Object detect(Iterator iter, UnaryPredicate pred) {
   return detect(new IteratorToGeneratorAdapter(iter), pred);
   }
   
   /**
  - * detect(new IteratorToGeneratorAdapater(iter), pred, ifNone);
  + * Equivalent to [EMAIL PROTECTED] 
#detect(Generator,UnaryPredicate,Object) detect}(new [EMAIL PROTECTED] 
org.apache.commons.functor.generator.IteratorToGeneratorAdapter 
IteratorToGeneratorAdapter}(iter),pred,ifNone).
*/
   public static final Object detect(Iterator iter, UnaryPredicate pred, Object 
ifNone) {
   return detect(new IteratorToGeneratorAdapter(iter), pred, ifNone);
  @@ -206,7 +206,7 @@
   }
   
   /**
  - * foreach(new IteratorToGeneratorAdapater(iter), proc);
  + * Equivalent to [EMAIL PROTECTED] #foreach(Generator,UnaryProcedure) 
foreach}(new [EMAIL PROTECTED] 
org.apache.commons.functor.generator.IteratorToGeneratorAdapter 
IteratorToGeneratorAdapter}(iter),proc).
*/
   public static final void foreach(Iterator iter, UnaryProcedure proc) {
   foreach(new IteratorToGeneratorAdapter(iter), proc);
  @@ -221,7 +221,7 @@
   }
   
   /**
  - * inject(new IteratorToGeneratorAdapater(iter), seed, func);
  + * Equivalent to [EMAIL PROTECTED] 
#inject(Generator,Object,BinaryFunction) inject}(new [EMAIL PROTECTED] 
org.apache.commons.functor.generator.IteratorToGeneratorAdapter 
IteratorToGeneratorAdapter}(iter),seed,func).
*/
   public static final Object inject(Iterator iter, Object seed, BinaryFunction 
func) {
   return inject(new IteratorToGeneratorAdapter(iter), seed, func);
  @@ -258,7 +258,7 @@
   
   
   /**
  - * reject(new IteratorToGeneratorAdapater(iter), pred);
  + * Equivalent to [EMAIL PROTECTED] #reject(Generator,UnaryPredicate) 
reject}(new [EMAIL PROTECTED] 
org.apache.commons.functor.generator.IteratorToGeneratorAdapter 
IteratorToGeneratorAdapter}(iter),pred).
*/
   public static Generator reject(Iterator iter, UnaryPredicate pred) {
   return reject(new IteratorToGeneratorAdapter(iter), pred);
  @@ -283,7 +283,7 @@
   }
   
   /**
  - * select(new IteratorToGeneratorAdapater(iter), pred);
  + * Equivalent to [EMAIL PROTECTED] #select(Generator,UnaryPredicate) 
select}(new [EMAIL PROTECTED] 
org.apache.commons.functor.generator.IteratorToGeneratorAdapter 
IteratorToGeneratorAdapter}(iter),pred).

DO NOT REPLY [Bug 24986] New: - [sql] Output SQL to stream

2003-11-25 Thread bugzilla
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=24986

[sql] Output SQL to stream

   Summary: [sql] Output SQL to stream
   Product: Commons
   Version: 1.0 Beta 1
  Platform: All
OS/Version: All
Status: NEW
  Severity: Enhancement
  Priority: Other
 Component: Sandbox
AssignedTo: [EMAIL PROTECTED]
ReportedBy: [EMAIL PROTECTED]


It would be great if DynaSql could write the SQL statements to a stream instead
of just operating directly on the DataSource.  This could allow commons-sql to
build SQL scripts that can be used in non-java environments.

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



RE: [DbUtils]Improving the BeanHandler

2003-11-25 Thread David Graham

--- "Shapira, Yoav" <[EMAIL PROTECTED]> wrote:
> 
> Howdy,
> I usually prefer the getObject(i) call, and then do something like
> if(object instanceof Number) {
>   object = new Double(((Number) object).doubleValue());
> }
> 
> Or something like that.  But it's just a matter of style.  What I don't
> like about either approach is the Double being somewhat hard-coded.  I
> would look to make DbUtils use commons-beanutils' ConvertUtils and
> related facilities rather than specific conversions.

I'd rather not introduce a dependency on BeanUtils.  It's nice that
DbUtils can be deployed by itself without any other jars.  

We could add an interface that allows you to plugin conversion strategies.
 We could provide a default implementation that performs the conversion
that Corby suggests while allowing someone to use BeanUtils behind the
interface if they wanted.

David

> 
> Of course, this is wishful thinking as I have no spare bandwidth to work
> on this with tomcat 5 release coming out...
> 
> Yoav Shapira
> Millennium ChemInformatics
> 
> 
> >-Original Message-
> >From: Corby Page [mailto:[EMAIL PROTECTED]
> >Sent: Tuesday, November 25, 2003 12:18 PM
> >To: [EMAIL PROTECTED]
> >Subject: [DbUtils]Improving the BeanHandler
> >
> >Hi, first off I'd like to say thanks for the DbUtils package. It has
> been
> >very helpful for cleaning up my code in places where I have to do
> manual
> >persistence.
> >
> >I have had to modify the code in order to use the BeanHandler, and I
> wanted
> >to offer my modifications as a patch to the codebase.
> >
> >Let me run through a quick use-case: I have a bean with a property
> called
> >quantity of type double. I tried to populate this bean with a SELECT
> >statement using the BeanHandler.
> >
> >However, the BasicRowProcessor.createBean( ... ) method executes the
> >following code:
> >
> >Object value = rs.getObject(i);
> >
> >The return type from my Sybase JDBC Driver here is BigDecimal. Since
> this
> >isn't a perfect match for the exposed bean property, it refuses to
> populate
> >the property.
> >
> >When I code this persistence operation by hand, I use rs.getDouble(i).
> This
> >way, I make the vendor do the work for me. I tell the vendor I expect a
> >double return type, and he is responsible for performing the
> >BigDecimal.doubleValue() conversion.
> >
> >So, I have created my own custom RowProcessor that replaces the
> getObject
> >call from above with a method that looks like this:
> >
> >Object value;
> >if ( propType.equals( Double.TYPE ) || propType.equals(
> >Double.class ) )
> >{
> >value = new Double( rs.getDouble( index ) );
> >}
> >
> >else
> >{
> >value = rs.getObject( index );
> >}
> >
> >This is implemented for all of the appropriate ResultSet methods of
> course.
> >Now, we look at the type of the named property, and we call the
> appropriate
> >method of the JDBC driver to get the vendor to adapt to that type, if
> >possible. This feels a lot more flexible than requiring a bean property
> to
> >precisely match a (possibly arbitrary) default type used by the JDBC
> >vendor.
> >
> >I would be happy to offer this code as a patch to BasicRowProcessor, as
> an
> >alternate RowProcessor that extends BasicRowProcessor, or leave it up
> to
> >you guys to implement if you feel this is a good idea.
> >
> >Thanks,
> >Corby
> >
> >
> >
> >-
> >To unsubscribe, e-mail: [EMAIL PROTECTED]
> >For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 
> 
> This e-mail, including any attachments, is a confidential business
> communication, and may contain information that is confidential,
> proprietary and/or privileged.  This e-mail is intended only for the
> individual(s) to whom it is addressed, and may not be saved, copied,
> printed, disclosed or used by anyone else.  If you are not the(an)
> intended recipient, please immediately delete this e-mail from your
> computer system and notify the sender.  Thank you.
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 


__
Do you Yahoo!?
Free Pop-Up Blocker - Get it now
http://companion.yahoo.com/

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



Re: [DbUtils]Improving the BeanHandler

2003-11-25 Thread David Graham

--- Corby Page <[EMAIL PROTECTED]> wrote:
> Hi, first off I'd like to say thanks for the DbUtils package. It has
> been
> very helpful for cleaning up my code in places where I have to do manual
> persistence.
> 
> I have had to modify the code in order to use the BeanHandler, and I
> wanted
> to offer my modifications as a patch to the codebase.
> 
> Let me run through a quick use-case: I have a bean with a property
> called
> quantity of type double. I tried to populate this bean with a SELECT
> statement using the BeanHandler.
> 
> However, the BasicRowProcessor.createBean( ... ) method executes the
> following code:
> 
> Object value = rs.getObject(i);
> 
> The return type from my Sybase JDBC Driver here is BigDecimal. Since
> this
> isn't a perfect match for the exposed bean property, it refuses to
> populate
> the property.
> 
> When I code this persistence operation by hand, I use rs.getDouble(i).
> This
> way, I make the vendor do the work for me. I tell the vendor I expect a
> double return type, and he is responsible for performing the
> BigDecimal.doubleValue() conversion.
> 
> So, I have created my own custom RowProcessor that replaces the
> getObject
> call from above with a method that looks like this:
> 
> Object value;
> if ( propType.equals( Double.TYPE ) || propType.equals(
> Double.class ) )
> {
> value = new Double( rs.getDouble( index ) );
> }
> 
> else
> {
> value = rs.getObject( index );
> }
> 
> This is implemented for all of the appropriate ResultSet methods of
> course.
> Now, we look at the type of the named property, and we call the
> appropriate
> method of the JDBC driver to get the vendor to adapt to that type, if
> possible. This feels a lot more flexible than requiring a bean property
> to
> precisely match a (possibly arbitrary) default type used by the JDBC
> vendor.

The types returned by rs.getObject() are not arbitrary; they are
explicitly defined in the JDBC specification.  Your proposal certainly
looks more flexible than the current implementation.  At least we designed
with interfaces to make your interim solution possible :-).

> 
> I would be happy to offer this code as a patch to BasicRowProcessor, as
> an
> alternate RowProcessor that extends BasicRowProcessor, or leave it up to
> you guys to implement if you feel this is a good idea.

Please open an enhancement ticket with a patch to BasicRowProcessor and
test cases attached.  We can review it further after we see the exact code
changes.

David

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


__
Do you Yahoo!?
Free Pop-Up Blocker - Get it now
http://companion.yahoo.com/

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



cvs commit: jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor TestAlgorithms.java

2003-11-25 Thread rwaldhoff
rwaldhoff2003/11/25 09:49:35

  Modified:functor/src/java/org/apache/commons/functor/generator/util
MaxIterations.java
   functor/src/java/org/apache/commons/functor Algorithms.java
   functor/src/test/org/apache/commons/functor/generator
TestGenerator.java
   functor/src/test/org/apache/commons/functor/generator/util
TestEachElement.java
   functor/src/test/org/apache/commons/functor
TestAlgorithms.java
  Log:
  using Offset instead of MaxIterations
  
  Revision  ChangesPath
  1.3   +2 -3  
jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/generator/util/MaxIterations.java
  
  Index: MaxIterations.java
  ===
  RCS file: 
/home/cvs/jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/generator/util/MaxIterations.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- MaxIterations.java25 Nov 2003 00:23:14 -  1.2
  +++ MaxIterations.java25 Nov 2003 17:49:35 -  1.3
  @@ -73,7 +73,6 @@
* @version $Revision$ $Date$
* @author  Jason Horman ([EMAIL PROTECTED])
*/
  -
   public class MaxIterations implements UnaryPredicate {
   
   /***
  
  
  
  1.7   +4 -5  
jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/Algorithms.java
  
  Index: Algorithms.java
  ===
  RCS file: 
/home/cvs/jakarta-commons-sandbox/functor/src/java/org/apache/commons/functor/Algorithms.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- Algorithms.java   12 Nov 2003 00:50:44 -  1.6
  +++ Algorithms.java   25 Nov 2003 17:49:35 -  1.7
  @@ -81,9 +81,8 @@
*
* @since 1.0
* @version $Revision$ $Date$
  - * @author  Jason Horman ([EMAIL PROTECTED])
  + * @author Jason Horman ([EMAIL PROTECTED])
*/
  -
   public class Algorithms {
   
   /**
  @@ -320,7 +319,7 @@
* true. This is useful for imposing [EMAIL PROTECTED] Generator} limits. For 
example:
*
* 
  - *  EachLine.open(file).until(new MaxIterations(1));
  + *  EachLine.open(file).until(new Offset(1));
* 
*
* Would only "generate" 1 line from the file before [EMAIL PROTECTED] 
Generator#stop
  
  
  
  1.6   +19 -9 
jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/generator/TestGenerator.java
  
  Index: TestGenerator.java
  ===
  RCS file: 
/home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/generator/TestGenerator.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- TestGenerator.java24 Nov 2003 20:12:17 -  1.5
  +++ TestGenerator.java25 Nov 2003 17:49:35 -  1.6
  @@ -57,18 +57,28 @@
   
   package org.apache.commons.functor.generator;
   
  -import junit.framework.TestCase;
  +import java.util.ArrayList;
  +import java.util.Collection;
  +import java.util.HashSet;
  +import java.util.Iterator;
  +import java.util.LinkedList;
  +import java.util.List;
  +import java.util.NoSuchElementException;
  +import java.util.Set;
  +
   import junit.framework.Test;
  +import junit.framework.TestCase;
   import junit.framework.TestSuite;
  -import org.apache.commons.functor.*;
  -import org.apache.commons.functor.core.IsEqual;
  -import org.apache.commons.functor.core.IdentityFunction;
  +
  +import org.apache.commons.functor.BinaryFunction;
  +import org.apache.commons.functor.UnaryPredicate;
  +import org.apache.commons.functor.UnaryProcedure;
   import org.apache.commons.functor.adapter.LeftBoundPredicate;
  +import org.apache.commons.functor.core.IdentityFunction;
  +import org.apache.commons.functor.core.IsEqual;
  +import org.apache.commons.functor.core.Offset;
   import org.apache.commons.functor.generator.util.CollectionTransformer;
   import org.apache.commons.functor.generator.util.EachElement;
  -import org.apache.commons.functor.generator.util.MaxIterations;
  -
  -import java.util.*;
   
   /**
* Tests the Base Generator class.
  @@ -289,7 +299,7 @@
   }
   
   public void testLimit() {
  -Collection col = simpleGenerator.until(new MaxIterations(2)).toCollection();
  +Collection col = simpleGenerator.until(new Offset(2)).toCollection();
   assertEquals("[0, 1]", col.toString());
   }
   
  
  
  
  1.3   +3 -2  
jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/generator/util/TestEachElement.java
  
  Index: TestEachElement.java
  ===
  RCS file: 
/home/cvs/jakarta-commons-sandbox/functo

RE: [DbUtils]Improving the BeanHandler

2003-11-25 Thread Shapira, Yoav

Howdy,
I usually prefer the getObject(i) call, and then do something like
if(object instanceof Number) {
  object = new Double(((Number) object).doubleValue());
}

Or something like that.  But it's just a matter of style.  What I don't
like about either approach is the Double being somewhat hard-coded.  I
would look to make DbUtils use commons-beanutils' ConvertUtils and
related facilities rather than specific conversions.

Of course, this is wishful thinking as I have no spare bandwidth to work
on this with tomcat 5 release coming out...

Yoav Shapira
Millennium ChemInformatics


>-Original Message-
>From: Corby Page [mailto:[EMAIL PROTECTED]
>Sent: Tuesday, November 25, 2003 12:18 PM
>To: [EMAIL PROTECTED]
>Subject: [DbUtils]Improving the BeanHandler
>
>Hi, first off I'd like to say thanks for the DbUtils package. It has
been
>very helpful for cleaning up my code in places where I have to do
manual
>persistence.
>
>I have had to modify the code in order to use the BeanHandler, and I
wanted
>to offer my modifications as a patch to the codebase.
>
>Let me run through a quick use-case: I have a bean with a property
called
>quantity of type double. I tried to populate this bean with a SELECT
>statement using the BeanHandler.
>
>However, the BasicRowProcessor.createBean( ... ) method executes the
>following code:
>
>Object value = rs.getObject(i);
>
>The return type from my Sybase JDBC Driver here is BigDecimal. Since
this
>isn't a perfect match for the exposed bean property, it refuses to
populate
>the property.
>
>When I code this persistence operation by hand, I use rs.getDouble(i).
This
>way, I make the vendor do the work for me. I tell the vendor I expect a
>double return type, and he is responsible for performing the
>BigDecimal.doubleValue() conversion.
>
>So, I have created my own custom RowProcessor that replaces the
getObject
>call from above with a method that looks like this:
>
>Object value;
>if ( propType.equals( Double.TYPE ) || propType.equals(
>Double.class ) )
>{
>value = new Double( rs.getDouble( index ) );
>}
>
>else
>{
>value = rs.getObject( index );
>}
>
>This is implemented for all of the appropriate ResultSet methods of
course.
>Now, we look at the type of the named property, and we call the
appropriate
>method of the JDBC driver to get the vendor to adapt to that type, if
>possible. This feels a lot more flexible than requiring a bean property
to
>precisely match a (possibly arbitrary) default type used by the JDBC
>vendor.
>
>I would be happy to offer this code as a patch to BasicRowProcessor, as
an
>alternate RowProcessor that extends BasicRowProcessor, or leave it up
to
>you guys to implement if you feel this is a good idea.
>
>Thanks,
>Corby
>
>
>
>-
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]




This e-mail, including any attachments, is a confidential business communication, and 
may contain information that is confidential, proprietary and/or privileged.  This 
e-mail is intended only for the individual(s) to whom it is addressed, and may not be 
saved, copied, printed, disclosed or used by anyone else.  If you are not the(an) 
intended recipient, please immediately delete this e-mail from your computer system 
and notify the sender.  Thank you.


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



[DbUtils]Improving the BeanHandler

2003-11-25 Thread Corby Page
Hi, first off I'd like to say thanks for the DbUtils package. It has been
very helpful for cleaning up my code in places where I have to do manual
persistence.

I have had to modify the code in order to use the BeanHandler, and I wanted
to offer my modifications as a patch to the codebase.

Let me run through a quick use-case: I have a bean with a property called
quantity of type double. I tried to populate this bean with a SELECT
statement using the BeanHandler.

However, the BasicRowProcessor.createBean( ... ) method executes the
following code:

Object value = rs.getObject(i);

The return type from my Sybase JDBC Driver here is BigDecimal. Since this
isn't a perfect match for the exposed bean property, it refuses to populate
the property.

When I code this persistence operation by hand, I use rs.getDouble(i). This
way, I make the vendor do the work for me. I tell the vendor I expect a
double return type, and he is responsible for performing the
BigDecimal.doubleValue() conversion.

So, I have created my own custom RowProcessor that replaces the getObject
call from above with a method that looks like this:

Object value;
if ( propType.equals( Double.TYPE ) || propType.equals(
Double.class ) )
{
value = new Double( rs.getDouble( index ) );
}

else
{
value = rs.getObject( index );
}

This is implemented for all of the appropriate ResultSet methods of course.
Now, we look at the type of the named property, and we call the appropriate
method of the JDBC driver to get the vendor to adapt to that type, if
possible. This feels a lot more flexible than requiring a bean property to
precisely match a (possibly arbitrary) default type used by the JDBC
vendor.

I would be happy to offer this code as a patch to BasicRowProcessor, as an
alternate RowProcessor that extends BasicRowProcessor, or leave it up to
you guys to implement if you feel this is a good idea.

Thanks,
Corby



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



RE: [VOTE][RESULT] Release Commons Codec 1.2-rc1

2003-11-25 Thread Gary Gregory
Ag, the new release notes has cr/lf all messed up on windows. The previous
one was fine. Oh well.

Gary

> -Original Message-
> From: Tim O'Brien [mailto:[EMAIL PROTECTED]
> Sent: Monday, November 24, 2003 21:29
> To: Jakarta Commons Developers List
> Subject: Re: [VOTE][RESULT] Release Commons Codec 1.2-rc1
> 
> Alright, a better distribution is published, signed, md5'd.
> RELEASE-NOTES had a few typos, and was missing some items. A small
> detail, but important nonetheless.
> 
> 
> 
> Tim O'Brien wrote:
> 
> > That version of Codec 1.2 I pushed to www.apache.org/dist seems to be
> > alright except for the fact that I bundled an older version of the
> > RELEASE-NOTES.txt.
> >
> > I'm going to regenerate the distributions, re-sign, and repeat the
> > process again.
> >
> > Tim
> >
> > Gary Gregory wrote:
> >
> >> Ah, excellent! Thanks for the update.
> >>
> >> Gary
> >>
> >>
> > 
> >
> >
> > -
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> >
> 
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]


RE: [collections] CaseInsensitiveHashMap

2003-11-25 Thread Arun Thomas
The issue of recreating the original key is exactly the value behind the process that 
Stephen proposes.  While the proposal leads to a more general solution with the 
potential complexity of writing good hash functions, it certainly covers simple cases 
like this - where a transformation is applied to the key, and then the job of 
generating a hash is delegated to the transformed value (which potentially provides a 
good mechanism for generating a hashcode).

This allows the data in the HashTable to remain unchanged, while allowing equality to 
be redefined.

-AMT  

-Original Message-
From: Phil Steitz [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, November 25, 2003 7:38 AM
To: Jakarta Commons Developers List
Subject: Re: [collections] CaseInsensitiveHashMap


Phil Steitz wrote:
> Stephen Colebourne wrote:
> 
>> I would like to propose an alternative solution to the problem that
>> IMO fits
>> well with current [collections] direction.
>>
>> Consider a new Map implementation that acts as a direct replacement 
>> for HashMap, call it HashMapA (A for apache ;-). This class contains 
>> basically the same code as HashMap, although it must be written 
>> without using cut and
>> paste (ie from scratch - Sun licence issues).
>>
>> HashMapA differs from HashMap in that the hashing algorithm and 
>> equals comparison methods are dedicated protected methods. It then 
>> becomes easy for a subclass to be written that compares keys using 
>> case insensitivity (amongst other things). HashMapA would also have a 
>> mapIterator() method to
>> access the new map iterator concept.
>>
>> Finally, there would probably need to be a MapA interface to allow
>> access to
>> the map iterator.
>>  
> 
> 
> I see this more like Janek does -- the CaseInsensitiveHashMap
> requirement is really a key transformation requirement, not a hashing 
> algorithm overriding requirement.  I  think that it would be *much 
> harder* for users of this class to develop well-performing (and 
> reliable) custom hash functions than to supply key transformations.  I 
> may be misunderstanding your proposal.  Please explain more and why in 
> particular it would not be better to set up something similar to 
> TransformedMap that does key transformations on get -- effectively 
> making a composite map, M o T, where T is the tranformer.  The value of 
> this is when T is not 1-1, as in the case of CaseInsensitiveHashMap.
> 
> Phil
> 
> 
Thinking about this some more, the semantics of keySet() would be 
difficult with "CompositeMap" approach that I have suggested above.  We 
would either have to require that T be idempotent - i.e., T(T(x)) = T(x) 
or have the user supply a (partial) inverse transformer to return *a* 
pre-image for each transformed key.

Phil

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




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


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



Re: [collections] CaseInsensitiveHashMap

2003-11-25 Thread Janek Bogucki
On Tue, 2003-11-25 at 10:37, Phil Steitz wrote:
> Thinking about this some more, the semantics of keySet() would be 
> difficult with "CompositeMap" approach that I have suggested above.  We 
> would either have to require that T be idempotent - i.e., T(T(x)) = T(x) 
> or have the user supply a (partial) inverse transformer to return *a* 
> pre-image for each transformed key.
> 
> Phil

Not quite sure if I understood your point entirely but it would not be
possible to supply an inverse transformation for the lowercase operation
because it is a many to one function. Perhaps you covered this with the
word 'partial'  but I don't see what you mean by that. What's a partial
inverse transformer?

-Janek

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



[HiveMind] Pluggable modules?

2003-11-25 Thread Christian Essl
After quite some time, and after reading the Server Side articel
(http://theserverside.com/home/thread.jsp?thread_id=22371) another idea I
had about HiveMind. In the articel Zhengmao Hu posted some code to combine
HiveMind and Spring. I think that shows that people want to have the choice
and it fits good to the glue aproach of HiveMind.
I think HiveMind could integrate other Service frameworks (Carbon
http://carbon.sourceforge.net/ - good thing) if services could be Modules
registered with the Registry. An example:



 
 
factory parameters
 
 

 

 
 
   
 ...
   
   
 
  .
 
   
 
 
 
  ...
 

The factory inerface:
public ModuleFactory{
  public Module[] getModules(List parameters,String modulePrefix, Module
definingModule);
}
Obviously services and config-points gotten from such modules are not
managed by HiveMind but rather by the module implementation.
I think this could also be used to define custom transformers, rules etc,
or even to build a Registry on top another Registry and than intercept
calls to the Registry, load modules from different locations etc.
--
Christian Essl http://jucas.sourceforge.net
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: [collections] CaseInsensitiveHashMap

2003-11-25 Thread Phil Steitz
Phil Steitz wrote:
Stephen Colebourne wrote:

I would like to propose an alternative solution to the problem that 
IMO fits
well with current [collections] direction.

Consider a new Map implementation that acts as a direct replacement for
HashMap, call it HashMapA (A for apache ;-). This class contains 
basically
the same code as HashMap, although it must be written without using 
cut and
paste (ie from scratch - Sun licence issues).

HashMapA differs from HashMap in that the hashing algorithm and equals
comparison methods are dedicated protected methods. It then becomes 
easy for
a subclass to be written that compares keys using case insensitivity
(amongst other things). HashMapA would also have a mapIterator() 
method to
access the new map iterator concept.

Finally, there would probably need to be a MapA interface to allow 
access to
the map iterator.
 


I see this more like Janek does -- the CaseInsensitiveHashMap 
requirement is really a key transformation requirement, not a hashing 
algorithm overriding requirement.  I  think that it would be *much 
harder* for users of this class to develop well-performing (and 
reliable) custom hash functions than to supply key transformations.  I 
may be misunderstanding your proposal.  Please explain more and why in 
particular it would not be better to set up something similar to 
TransformedMap that does key transformations on get -- effectively 
making a composite map, M o T, where T is the tranformer.  The value of 
this is when T is not 1-1, as in the case of CaseInsensitiveHashMap.

Phil


Thinking about this some more, the semantics of keySet() would be 
difficult with "CompositeMap" approach that I have suggested above.  We 
would either have to require that T be idempotent - i.e., T(T(x)) = T(x) 
or have the user supply a (partial) inverse transformer to return *a* 
pre-image for each transformed key.

Phil



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




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


Re: [HiveMind] New interceptor support

2003-11-25 Thread Christian Essl
Oh cool writing an articel. Attached I send you the source. However note 
that this source is not included in HiveMind and if it will ever be 
included it will propably change. (It's more for discussing the idea).

Also Mark is right that an InterceptorFactory can use any technology to 
implement the interceptor. So maybe for the article DynaProxies could be 
fine. (in the test package there is a ServiceInterceptorFactory using a 
DynaProxy - 
org.apache.commons.hivemind.lib.methodinter.test.LogProxyInterceptorFactory 
- it's very easy)

PS.:
Why use another Bytecode generation toolkit when Apache has its own 
(BCEL)?
First I don't realy know BCEL (yes I should change that). Second HiveMind 
already depends on Javassist and it's realy easy to use especially with the 
HiveMind support classes. I will certainly take a look at repast-jellytag.

On Tue, 25 Nov 2003 09:12:44 -0500, Mark R. Diggory 
<[EMAIL PROTECTED]> wrote:

Why use another Bytecode generation toolkit when Apache has its own 
(BCEL)?

I wrote some JellyTags awhile back that used BCEL so that you can 
basically create Bean classes on the fly using BSF. There was some talk 
of making them "Dynabeans" but I got into other projects and that has 
stalled.

http://repast-jellytag.sourceforge.net/bcel/tags.html

ServiceInterceptorFactory is a novel idea which I like, an interceptor 
could be of various implementations (java, BCEL Javassist) and doesn't 
neccessarily need to be something specific to HiveMind, Jelly, what have 
you

-Mark

James Carman wrote:

I like the idea of this hybrid approach!  I am NOT a fan of using 
javassist
to write interceptors.  I am writing an article for TheServerSide.com 
about
HiveMind currently.  Is this code available somewhere?  I don't plan on
demonstrating how to write a purely javassist-based interceptor, as I do 
not
feel it is very intuitive.  However, this simpler approach does seem to 
be a
nice compromise and I would like to present it.

-Original Message-
From: Christian Essl [mailto:[EMAIL PROTECTED] Sent: Tuesday, 
November 25, 2003 7:38 AM
To: [EMAIL PROTECTED]
Subject: [HiveMind] New interceptor support

Javassist is fast and impressingly easy for byte-code generation, 
however it is by no way that comfortable (to code, test and debugg) as 
plain java. Therefore I've implemented an abstract 
ServiceInterceptorFactory which allows the user to attach 
MethodInterceptors to the methods of an interface. (A common pattern 
used by aopalliance, spring, cglib etc). Ie a simple tracing interceptor 
looks like this:

public class TracingMethodInterceptor implements MethodInterceptor

public Object invoke(Invocation invocation, Object target, Object[] 
args) throws Throwable
{
System.out.println("method: "+invocation.getMethod()+" is called with 
args: "+args);
Object ret = invocation.proceed(target, args); //this invokes the next 
method in the interceptor chain
System.out.println("method: "+invocation.getMethod()+" returned: "+args) 
;
return ret;
}
}

Both the interceptor and the Invocation are created using Javassist, 
therefore it is in terms of speed (according to my rudimentary testings) 
between a plain Javaassist interceptor and a dyna-proxy interceptor.

Comparing the existing Hivemind Logging with the same code using the 
MethodInterceptor and with a DynaProxy for 5.000.000 repetitions the 
times (ms) are as follows: (The numbers are not stable but the direction 
is quite clear)

method: Object getObject()
executing MethodLog took: 1000
executing HivemindLog took: 359
executing DynaProxyLog took: 1360
method: void setObject(Object);
executing MethodLog took: 968
executing HivemindLog took: 516
executing DynaProxyLog took: 1766
method (9 prim params): int 
add(int,int,byte,short,char,double,long,float);
executing MethodLog took: 3063 (more primitives and arguments means 
bigger args[] and boxing/unboxing)
executing HivemindLog took: 594
executing DynaProxyLog took: 4031

As I see interceptors for general use should be created using 
javaassist, however other interceptors (which just add some custom AOP 
for some components) could well be implemented using MethodInterceptors. 
Here the higher convinience pays off.




--
Christian Essl http://jucas.sourceforge.net

methodinter.zip
Description: Zip compressed data
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Re: [collections] CaseInsensitiveHashMap

2003-11-25 Thread Phil Steitz
Stephen Colebourne wrote:
I would like to propose an alternative solution to the problem that IMO fits
well with current [collections] direction.
Consider a new Map implementation that acts as a direct replacement for
HashMap, call it HashMapA (A for apache ;-). This class contains basically
the same code as HashMap, although it must be written without using cut and
paste (ie from scratch - Sun licence issues).
HashMapA differs from HashMap in that the hashing algorithm and equals
comparison methods are dedicated protected methods. It then becomes easy for
a subclass to be written that compares keys using case insensitivity
(amongst other things). HashMapA would also have a mapIterator() method to
access the new map iterator concept.
Finally, there would probably need to be a MapA interface to allow access to
the map iterator.
 
I see this more like Janek does -- the CaseInsensitiveHashMap requirement 
is really a key transformation requirement, not a hashing algorithm 
overriding requirement.  I  think that it would be *much harder* for users 
of this class to develop well-performing (and reliable) custom hash 
functions than to supply key transformations.  I may be misunderstanding 
your proposal.  Please explain more and why in particular it would not be 
better to set up something similar to TransformedMap that does key 
transformations on get -- effectively making a composite map, M o T, where 
T is the tranformer.  The value of this is when T is not 1-1, as in the 
case of CaseInsensitiveHashMap.

Phil



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


DO NOT REPLY [Bug 24962] - [math] MathUtils.sign(NaN) returns -1 instead of NaN

2003-11-25 Thread bugzilla
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=24962

[math] MathUtils.sign(NaN) returns -1 instead of NaN





--- Additional Comments From [EMAIL PROTECTED]  2003-11-25 14:35 ---
As the original author of this sign(), I just want to give etymological history.  My 
sign() was 
intended to be used as it apparently is in the static Complex#sqrt:  a way to be able 
to multiply by 
the sign of a number.  In this role, it would not be inconsistent to return NaN for a 
NaN argument, 
but I believe in the particular use that prompted me to think of creating this method, 
an argument 
of 0 should still return +1.  I support renaming this sign() and implementing a new 
version of the 
existing method that has the requested behavior, as my usage is almost certainly less 
common 
than that being requested.  The name "positiveSign" isn't as clear as I'd like, but I 
can't think 
offhand of a better one (the first ones that came to mind were signIsPositive, signum, 
and sgn).

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



DO NOT REPLY [Bug 24962] - [math] MathUtils.sign(NaN) returns -1 instead of NaN

2003-11-25 Thread bugzilla
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=24962

[math] MathUtils.sign(NaN) returns -1 instead of NaN





--- Additional Comments From [EMAIL PROTECTED]  2003-11-25 14:21 ---
I'll only add that the only place MathUtils.sign is used is once in Complex. It
should be easy to test its behavior in this class. It may be fairly easy to
manage testing 

/**
 * 
 */
public static Complex sqrt(Complex z) {
if (z.isNaN()) {
return Complex.NaN;
}

double a = z.getReal();
double b = z.getImaginary();

double t = Math.sqrt((Math.abs(a) + z.abs()) / 2.0);
if (a >= 0.0) {
return new Complex(t, b / (2.0 * t));
} else {
return new Complex(Math.abs(z.getImaginary()) / (2.0 * t),
MathUtils.sign(b) * t);
}
}

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



Re: [HiveMind] New interceptor support

2003-11-25 Thread Mark R. Diggory
Why use another Bytecode generation toolkit when Apache has its own (BCEL)?

I wrote some JellyTags awhile back that used BCEL so that you can 
basically create Bean classes on the fly using BSF. There was some talk 
of making them "Dynabeans" but I got into other projects and that has 
stalled.

http://repast-jellytag.sourceforge.net/bcel/tags.html

ServiceInterceptorFactory is a novel idea which I like, an interceptor 
could be of various implementations (java, BCEL Javassist) and doesn't 
neccessarily need to be something specific to HiveMind, Jelly, what have 
you

-Mark

James Carman wrote:

I like the idea of this hybrid approach!  I am NOT a fan of using javassist
to write interceptors.  I am writing an article for TheServerSide.com about
HiveMind currently.  Is this code available somewhere?  I don't plan on
demonstrating how to write a purely javassist-based interceptor, as I do not
feel it is very intuitive.  However, this simpler approach does seem to be a
nice compromise and I would like to present it.
-Original Message-
From: Christian Essl [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, November 25, 2003 7:38 AM
To: [EMAIL PROTECTED]
Subject: [HiveMind] New interceptor support

Javassist is fast and impressingly easy for byte-code generation, however 
it is by no way that comfortable (to code, test and debugg) as plain java. 
Therefore I've implemented an abstract ServiceInterceptorFactory which 
allows the user to attach MethodInterceptors to the methods of an 
interface. (A common pattern used by aopalliance, spring, cglib etc). Ie a 
simple tracing interceptor looks like this:

public class TracingMethodInterceptor implements MethodInterceptor

 public Object invoke(Invocation invocation, Object target, Object[] args) 
throws Throwable
 {
System.out.println("method: "+invocation.getMethod()+" is called with 
args: "+args);
Object ret = invocation.proceed(target, args); //this invokes the next 
method in the interceptor chain
System.out.println("method: "+invocation.getMethod()+" returned: 
"+args);
return ret;
 }
}

Both the interceptor and the Invocation are created using Javassist, 
therefore it is in terms of speed (according to my rudimentary testings) 
between a plain Javaassist interceptor and a dyna-proxy interceptor.

Comparing the existing Hivemind Logging with the same code using the 
MethodInterceptor and with a DynaProxy for 5.000.000 repetitions the times 
(ms) are as follows: (The numbers are not stable but the direction is quite 
clear)

method: Object getObject()
executing MethodLog took: 1000
executing HivemindLog took: 359
executing DynaProxyLog took: 1360
method: void setObject(Object);
executing MethodLog took: 968
executing HivemindLog took: 516
executing DynaProxyLog took: 1766
method (9 prim params): int add(int,int,byte,short,char,double,long,float);
executing MethodLog took: 3063 (more primitives and arguments means bigger 
args[] and boxing/unboxing)
executing HivemindLog took: 594
executing DynaProxyLog took: 4031

As I see interceptors for general use should be created using javaassist, 
however other interceptors (which just add some custom AOP for some 
components) could well be implemented using MethodInterceptors. Here the 
higher convinience pays off.

--
Mark Diggory
Software Developer
Harvard MIT Data Center
http://www.hmdc.harvard.edu
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


DO NOT REPLY [Bug 24962] - [math] MathUtils.sign(NaN) returns -1 instead of NaN

2003-11-25 Thread bugzilla
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=24962

[math] MathUtils.sign(NaN) returns -1 instead of NaN

[EMAIL PROTECTED] changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
Summary|MathUtils.sign(NaN) returns |[math] MathUtils.sign(NaN)
   |-1 instead of NaN   |returns -1 instead of NaN



--- Additional Comments From [EMAIL PROTECTED]  2003-11-25 14:06 ---
I agree that the normal sign function is defined as you state 
(http://mathworld.wolfram.com/Sign.html) and has caused me some confusion.  
However, I don't want to simply change this method as other parts of [math] 
depend on this definition.  My plans are as follows:
1. change the name of sign to positiveSign (any other name suggestions?)
2. create a new sign method based on Mathworld.

If there are any objections, let's here them.

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



RE: [HiveMind] New interceptor support

2003-11-25 Thread James Carman
I like the idea of this hybrid approach!  I am NOT a fan of using javassist
to write interceptors.  I am writing an article for TheServerSide.com about
HiveMind currently.  Is this code available somewhere?  I don't plan on
demonstrating how to write a purely javassist-based interceptor, as I do not
feel it is very intuitive.  However, this simpler approach does seem to be a
nice compromise and I would like to present it.

-Original Message-
From: Christian Essl [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, November 25, 2003 7:38 AM
To: [EMAIL PROTECTED]
Subject: [HiveMind] New interceptor support


Javassist is fast and impressingly easy for byte-code generation, however 
it is by no way that comfortable (to code, test and debugg) as plain java. 
Therefore I've implemented an abstract ServiceInterceptorFactory which 
allows the user to attach MethodInterceptors to the methods of an 
interface. (A common pattern used by aopalliance, spring, cglib etc). Ie a 
simple tracing interceptor looks like this:

public class TracingMethodInterceptor implements MethodInterceptor

 public Object invoke(Invocation invocation, Object target, Object[] args) 
throws Throwable
 {
System.out.println("method: "+invocation.getMethod()+" is called with 
args: "+args);
Object ret = invocation.proceed(target, args); //this invokes the next 
method in the interceptor chain
System.out.println("method: "+invocation.getMethod()+" returned: 
"+args);
return ret;
 }
}

Both the interceptor and the Invocation are created using Javassist, 
therefore it is in terms of speed (according to my rudimentary testings) 
between a plain Javaassist interceptor and a dyna-proxy interceptor.

Comparing the existing Hivemind Logging with the same code using the 
MethodInterceptor and with a DynaProxy for 5.000.000 repetitions the times 
(ms) are as follows: (The numbers are not stable but the direction is quite 
clear)

method: Object getObject()
executing MethodLog took: 1000
executing HivemindLog took: 359
executing DynaProxyLog took: 1360

method: void setObject(Object);
executing MethodLog took: 968
executing HivemindLog took: 516
executing DynaProxyLog took: 1766

method (9 prim params): int add(int,int,byte,short,char,double,long,float);
executing MethodLog took: 3063 (more primitives and arguments means bigger 
args[] and boxing/unboxing)
executing HivemindLog took: 594
executing DynaProxyLog took: 4031

As I see interceptors for general use should be created using javaassist, 
however other interceptors (which just add some custom AOP for some 
components) could well be implemented using MethodInterceptors. Here the 
higher convinience pays off.

-- 
Christian Essl http://jucas.sourceforge.net

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







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



to the developers of Jelly

2003-11-25 Thread Reinaldo Barreiro, E.
Hi All,

I hope this is the correct list to send this e-mail. 

I have installed Jelly and perused a bit the source code and documentation. 
I'm planning to use it for one of our projects... Well the question I want to ask is: 

Is it possible to define your own functions on a Jelly tag library (the same 
way it is possible on JSP 2.0)? Like in:



${param.value}



In my view that is a very powerfull feature of JSP 2.0. and it would be 
nice to have it in Jelly. My apologies to the developers if the feature is 
already there and I didn't mangage to find how to use it.

Best regards,

Ernesto Reinaldo Barreiro 


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



[HiveMind] New interceptor support

2003-11-25 Thread Christian Essl
Javassist is fast and impressingly easy for byte-code generation, however 
it is by no way that comfortable (to code, test and debugg) as plain java. 
Therefore I've implemented an abstract ServiceInterceptorFactory which 
allows the user to attach MethodInterceptors to the methods of an 
interface. (A common pattern used by aopalliance, spring, cglib etc). Ie a 
simple tracing interceptor looks like this:

public class TracingMethodInterceptor implements MethodInterceptor

public Object invoke(Invocation invocation, Object target, Object[] args) 
throws Throwable
{
   System.out.println("method: "+invocation.getMethod()+" is called with 
args: "+args);
   Object ret = invocation.proceed(target, args); //this invokes the next 
method in the interceptor chain
   System.out.println("method: "+invocation.getMethod()+" returned: 
"+args);
   return ret;
}
}

Both the interceptor and the Invocation are created using Javassist, 
therefore it is in terms of speed (according to my rudimentary testings) 
between a plain Javaassist interceptor and a dyna-proxy interceptor.

Comparing the existing Hivemind Logging with the same code using the 
MethodInterceptor and with a DynaProxy for 5.000.000 repetitions the times 
(ms) are as follows: (The numbers are not stable but the direction is quite 
clear)

method: Object getObject()
executing MethodLog took: 1000
executing HivemindLog took: 359
executing DynaProxyLog took: 1360
method: void setObject(Object);
executing MethodLog took: 968
executing HivemindLog took: 516
executing DynaProxyLog took: 1766
method (9 prim params): int add(int,int,byte,short,char,double,long,float);
executing MethodLog took: 3063 (more primitives and arguments means bigger 
args[] and boxing/unboxing)
executing HivemindLog took: 594
executing DynaProxyLog took: 4031

As I see interceptors for general use should be created using javaassist, 
however other interceptors (which just add some custom AOP for some 
components) could well be implemented using MethodInterceptors. Here the 
higher convinience pays off.

--
Christian Essl http://jucas.sourceforge.net
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


[jira] Updated: (JELLY-98) [patch] forEach items cannot handle comma-separated String

2003-11-25 Thread jira
The following issue has been updated:

Updater: Jörg Schaible (mailto:[EMAIL PROTECTED])
   Date: Tue, 25 Nov 2003 5:56 AM
Comment:
support of comma-separated lists as iterator
Changes:
 Attachment changed to ExpressionSupport.java.diff
-
For a full history of the issue, see:

  http://jira.codehaus.org/secure/ViewIssue.jspa?key=JELLY-98&page=history

-
View the issue:

  http://jira.codehaus.org/secure/ViewIssue.jspa?key=JELLY-98


Here is an overview of the issue:
-
Key: JELLY-98
Summary: [patch] forEach items cannot handle comma-separated String
   Type: Bug

 Status: Unassigned
   Priority: Major

 Original Estimate: 5 minutes
 Time Spent: Unknown
  Remaining: 5 minutes

Project: jelly
   Versions:
 1.1-beta-1

   Assignee: 
   Reporter: Jörg Schaible

Created: Tue, 25 Nov 2003 5:54 AM
Updated: Tue, 25 Nov 2003 5:56 AM
Environment: N/A

Description:
According to JSTL 1.0 docs (ch 6.1.1) the "items" attribute of a "forEach" tag can 
contain a comma-separated String (applies also to new JSTL version of J2EE 1.4). This 
was not implemented. Patch provided, needs an upgrade of the dependency to 
commons-lang to version 2.0.



-
JIRA INFORMATION:
This message is automatically generated by JIRA.

If you think it was sent incorrectly contact one of the administrators:
   http://jira.codehaus.org/secure/Administrators.jspa

If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


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



[jira] Updated: (JELLY-98) [patch] forEach items cannot handle comma-separated String

2003-11-25 Thread jira
The following issue has been updated:

Updater: J?rg Schaible (mailto:[EMAIL PROTECTED])
   Date: Tue, 25 Nov 2003 5:56 AM
Comment:
new dependency to commons-lang-2.0
Changes:
 Attachment changed to project.xml.diff
-
For a full history of the issue, see:

  http://jira.codehaus.org/secure/ViewIssue.jspa?key=JELLY-98&page=history

-
View the issue:

  http://jira.codehaus.org/secure/ViewIssue.jspa?key=JELLY-98


Here is an overview of the issue:
-
Key: JELLY-98
Summary: [patch] forEach items cannot handle comma-separated String
   Type: Bug

 Status: Unassigned
   Priority: Major

 Original Estimate: 5 minutes
 Time Spent: Unknown
  Remaining: 5 minutes

Project: jelly
   Versions:
 1.1-beta-1

   Assignee: 
   Reporter: J?rg Schaible

Created: Tue, 25 Nov 2003 5:54 AM
Updated: Tue, 25 Nov 2003 5:56 AM
Environment: N/A

Description:
According to JSTL 1.0 docs (ch 6.1.1) the "items" attribute of a "forEach" tag can 
contain a comma-separated String (applies also to new JSTL version of J2EE 1.4). This 
was not implemented. Patch provided, needs an upgrade of the dependency to 
commons-lang to version 2.0.



-
JIRA INFORMATION:
This message is automatically generated by JIRA.

If you think it was sent incorrectly contact one of the administrators:
   http://jira.codehaus.org/secure/Administrators.jspa

If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


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



[jira] Created: (JELLY-98) [patch] forEach items cannot handle comma-separated String

2003-11-25 Thread jira
Message:

  A new issue has been created in JIRA.

-
View the issue:

  http://jira.codehaus.org/secure/ViewIssue.jspa?key=JELLY-98


Here is an overview of the issue:
-
Key: JELLY-98
Summary: [patch] forEach items cannot handle comma-separated String
   Type: Bug

 Status: Unassigned
   Priority: Major

 Original Estimate: 5 minutes
 Time Spent: Unknown
  Remaining: 5 minutes

Project: jelly
   Versions:
 1.1-beta-1

   Assignee: 
   Reporter: J?rg Schaible

Created: Tue, 25 Nov 2003 5:54 AM
Updated: Tue, 25 Nov 2003 5:54 AM
Environment: N/A

Description:
According to JSTL 1.0 docs (ch 6.1.1) the "items" attribute of a "forEach" tag can 
contain a comma-separated String (applies also to new JSTL version of J2EE 1.4). This 
was not implemented. Patch provided, needs an upgrade of the dependency to 
commons-lang to version 2.0.



-
JIRA INFORMATION:
This message is automatically generated by JIRA.

If you think it was sent incorrectly contact one of the administrators:
   http://jira.codehaus.org/secure/Administrators.jspa

If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


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



Re: [math] Contribution to o.a.c.math.distribution - NormalDistribution

2003-11-25 Thread Piotr Kochański
Mark,

> Piotr,
> 
> I will add these in, I'd like to work to see us move to have a separate 
> package for CDF's (I expect to place the Gamma and Beta functions there 
> as well and to unify all these CDF style functions under one interface.
> 
> Basically we would have:
> 
> o.a.c.math.function
> 
> Beta
> Gamma
> Normal
> FastNormal
> PreciseNormal
> ...
> 
> o.a.c.math.distribution
> Normal
> Gamma
> Binomial
> 

That sounds ok. as a side effect there will be error function (Erf(x))
available,
which is just normal CDF with a different normalization (as far as I can
rememeber).

> > In fact the fast algorithm
> > is precise enough to be used in a majority of real-life
> > applications (especially in social sciences).
> > 
> > Code which calculates CDF is in the mentioned files, the code
> > for the inverse CDF is in the NormalDistributionImpl.java. This
> > is what really matters.
> 
> Is it logical to consider having the inverse available in the Function 
> interface and not the Distribution?

This would add some flexibility - now some functions are kind of
hidden in the distributions - one might want to use them without knowing
about normal or any other distribution. 

Separation of functions from the particular application - here it is some 
utility to play with normal, t, etc. distribution - is reasonable. 

Math could be used then by people who has no idea what is 
normal distribution but still need the normal integral.

> > I am not quite convinced that for probability p=0 and p=1 inverse CDF
> > should
> > return NaN, maybe a better solution would be to return
> > Double.NEGATIVE_INFINITY
> > for p=0 and Double.POSITIVE_INFINITY for p=1. Any suggestions?
> > 
> 
> Well in the mathematical solution they would be infinite, wouldn't they? 
> In such case this may be logical. I suspect if p<0 or p>1 they should be 
> NaN.

Yes, I guess so, having some free time I'll go through all distribution
functions and patch this. The NaN has also some meaning since in practice
it should never happen that p=0 or p=1 statistics never gives 100%
answers...
 

Cheers

Piotr Kochanski

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



Jelly: Build from CVS fails a lot of unit tests

2003-11-25 Thread Jörg Schaible
Hello Jelly developers,

if I build Jelly with the sources from CSV the build with maven fails because of a lot 
JUnit errors (see below). Did I miss something?

Regards,
Jörg


test:test:
[junit] Running org.apache.commons.jelly.core.TestArgTag
[junit] Tests run: 16, Failures: 0, Errors: 0, Time elapsed: 0,46 sec
[junit] Running org.apache.commons.jelly.core.TestChooseTag
[junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0,781 sec
[junit] [ERROR] TEST org.apache.commons.jelly.core.TestChooseTag FAILED
[junit] Running org.apache.commons.jelly.core.TestIncludeTag
[junit] Tests run: 4, Failures: 0, Errors: 0, Time elapsed: 0,711 sec
[junit] Running org.apache.commons.jelly.core.TestInvokeStaticTag
[junit] Tests run: 3, Failures: 0, Errors: 0, Time elapsed: 0,791 sec
[junit] Running org.apache.commons.jelly.core.TestInvokeTag
[junit] Tests run: 4, Failures: 0, Errors: 3, Time elapsed: 0,871 sec
[junit] [ERROR] TEST org.apache.commons.jelly.core.TestInvokeTag FAILED
[junit] Running org.apache.commons.jelly.core.TestNewTag
[junit] Tests run: 8, Failures: 0, Errors: 5, Time elapsed: 0,921 sec
[junit] [ERROR] TEST org.apache.commons.jelly.core.TestNewTag FAILED
[junit] Running org.apache.commons.jelly.core.TestSwitchTag
[junit] Tests run: 10, Failures: 0, Errors: 0, Time elapsed: 0,921 sec
[junit] Running org.apache.commons.jelly.expression.TestDynaBeans
[junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 0,49 sec
[junit] Running org.apache.commons.jelly.expression.TestExpressions
[junit] Tests run: 3, Failures: 0, Errors: 3, Time elapsed: 0,461 sec
[junit] [ERROR] TEST org.apache.commons.jelly.expression.TestExpressions FAILED
[junit] Running org.apache.commons.jelly.impl.TestTagLibraryResolver
[junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 0,381 sec
[junit] Running org.apache.commons.jelly.test.impl.TestEmbedded
[junit] Tests run: 2, Failures: 0, Errors: 2, Time elapsed: 0,691 sec
[junit] [ERROR] TEST org.apache.commons.jelly.test.impl.TestEmbedded FAILED
[junit] Running org.apache.commons.jelly.test.xml.TestCData
[junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0,701 sec
[junit] [ERROR] TEST org.apache.commons.jelly.test.xml.TestCData FAILED
[junit] Running org.apache.commons.jelly.test.xml.TestDefaultNamespaceFilter
[junit] Tests run: 2, Failures: 0, Errors: 0, Time elapsed: 0,792 sec
[junit] Running org.apache.commons.jelly.test.xml.TestDummyXMLOutput
[junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 0,671 sec
[junit] Running org.apache.commons.jelly.test.xml.TestNonexistentTags
[junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 0,671 sec
[junit] Running org.apache.commons.jelly.test.xml.TestXMLParserCache
[junit] Tests run: 2, Failures: 0, Errors: 0, Time elapsed: 0,891 sec
[junit] Running org.apache.commons.jelly.test.xml.TestXMLValidation
[junit] Tests run: 3, Failures: 0, Errors: 0, Time elapsed: 0,821 sec
[junit] Running org.apache.commons.jelly.TestCoreTags
[junit] Tests run: 3, Failures: 0, Errors: 3, Time elapsed: 0,761 sec
[junit] [ERROR] TEST org.apache.commons.jelly.TestCoreTags FAILED
[junit] Running org.apache.commons.jelly.TestJelly
[junit] this should always workthis should always workthis should always workthis 
should always work
[junit] 
[junit] Created a new bean: [EMAIL PROTECTED];city=London]
[junit] 
[junit] 
[junit] 
[junit] Created a new bean: [EMAIL PROTECTED];city=London]
[junit] 
[junit] 
[junit]
 
[junit] Created a new bean: [EMAIL PROTECTED];city=Atlanta]
[junit] 
[junit] Tests run: 14, Failures: 0, Errors: 0, Time elapsed: 0,291 sec
[junit] Running org.apache.commons.jelly.TestJellyContext
[junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 0,411 sec
[junit] Running org.apache.commons.jelly.TestTrim
[junit] Tests run: 3, Failures: 0, Errors: 3, Time elapsed: 0,39 sec
[junit] [ERROR] TEST org.apache.commons.jelly.TestTrim FAILED

BUILD FAILED
File.. file:/C:/Dokumente und 
Einstellungen/jos/.maven/plugins/maven-test-plugin-1.4/
Element... fail
Line.. 130
Column 54
There were test failures.
Total time: 29 seconds
Finished at: Tue Nov 25 12:08:11 CET 2003

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



DO NOT REPLY [Bug 24966] New: - NullPointer with Oracle 9 driver

2003-11-25 Thread bugzilla
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=24966

NullPointer with Oracle 9 driver

   Summary: NullPointer with Oracle 9 driver
   Product: Commons
   Version: 1.1 Final
  Platform: PC
OS/Version: Windows XP
Status: NEW
  Severity: Normal
  Priority: Other
 Component: Dbcp
AssignedTo: [EMAIL PROTECTED]
ReportedBy: [EMAIL PROTECTED]


As per post on mailing list:

I've recently upgraded to the latest version of Tomcat (4.1.29), which
includes DBCP 1.1, over 1.0 in previous versions.

On starting my application and attempting to logon to it, it falls over
with a NullPointerException, included here:
java.lang.NullPointerException
at
oracle.jdbc.driver.ScrollableResultSet.close(ScrollableResultSet.java:14
9)
at
org.apache.commons.dbcp.DelegatingResultSet.close(DelegatingResultSet.ja
va:193)
at
org.apache.commons.dbcp.DelegatingResultSet.close(DelegatingResultSet.ja
va:193)
at
org.apache.commons.dbcp.DelegatingPreparedStatement.passivate(Delegating
PreparedStatement.java:298)
at
org.apache.commons.dbcp.DelegatingPreparedStatement.close(DelegatingPrep
aredStatement.java:185)
at
com.pcmsgroup.v21.star.framework.persistence.BaseDbDAO.releaseResources(
BaseDbDAO.java:205)
at
com.pcmsgroup.v21.star.persistence.logon.LogonDbDAO.fetchByLogonName(Log
onDbDAO.java:149)
at
com.pcmsgroup.v21.star.domain.logon.Logon.logon(Logon.java:95)
at
com.pcmsgroup.v21.star.service.logon.LogonService.logon(LogonService.jav
a:52)
at
com.pcmsgroup.v21.star.application.logon.LogonCtrl.process(LogonCtrl.jav
a:87)
at
com.pcmsgroup.v21.star.framework.application.BaseCtrl.execute(BaseCtrl.j
ava:180)
at
org.apache.struts.action.RequestProcessor.processActionPerform(RequestPr
ocessor.java:484)
at
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:
274)
at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica
tionFilterChain.java:247)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt
erChain.java:193)
at
com.pcmsgroup.v21.star.application.logon.LogonFilter.doFilter(LogonFilte
r.java:168)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica
tionFilterChain.java:213)
...

I've looked around the web, and in your CVS, and think that this is a
bug.

The code in
com.pcmsgroup.v21.star.framework.persistence.BaseDbDAO.releaseResources
is as follows:

  public final void releaseResources(Connection connection,
PreparedStatement ps, ResultSet rs) throws PersistenceException
  {
try
{
  if (rs != null)
  {
rs.close();
  }
  if (ps != null)
  {
ps.close();
  }
  if (connection != null)
  {
// get the Factory
ConnectionFactory factory = ConnectionFactory.getInstance();
// turn the Connection back to pool
factory.releaseConnection(connection);
  }
}
catch (SQLException sqle)
{
  thisLog.error("Failed to release resources", sqle);
}
catch (Exception e)
{
  thisLog.error("Failed to release resources", e);
  throw new PersistenceException(e);
}
  }

As you can see, we close ResultSet, PreparedStatement and Connection in
the reverse order of that which we
got them in. On DBCP 1.0, this used to work fine. According to the JDK
API docs: "When a Statement object is 
closed, its current ResultSet object, if one exists, is also closed."
Thus closing the statement after closing the
result set is safe.

However, for DBCP 1.1, a change was made to DelegatingPreparedStatement
(version 1.6 to 1.7), to "ensure 
PreparedStatment can only be closed once", which entailed changing:

 public void close() throws SQLException {
 passivate();
 _stmt.close();
 }

to:

 public void close() throws SQLException {
 _stmt.close();
 passivate();
 }

I believe this has introduced my problem and is a bug. As now, following
the logic:

- The statement is closed, and in accordance with the JDK docs, the
result set is closed.
- The passivate method is then called, which calls ResultSet.close on
the underlying result set,
  regardless of whether it has been closed already.
- This causes the underlying result set, which is already close