Re: [CLI] Version 2 Proposal (take 5)
Hi Rami, I was happy to see that someone has done something to cli. I was using the cli 1 heavily in my project and ran constantly into problems and had to patch it and add extension (resulting in spaghetti code). I have been thinking about building a new cli package from scratch but now I saw your mail. If you want to have your problems addressed you need to send mails to the list. It is of little use to the group if you find bugs and don't report them. Previously on this list I began a discussion on the new design for CLI 2. When you see these discussions please don't remain silent, join in. The more viewpoints the better. -John K - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-commons-sandbox/configuration/src/java/org/apache/commons/configuration JNDIConfiguration.java
epugh 2003/10/17 01:11:22 Modified:configuration/src/java/org/apache/commons/configuration JNDIConfiguration.java Log: Fix PMD spotted error... Revision ChangesPath 1.11 +3 -2 jakarta-commons-sandbox/configuration/src/java/org/apache/commons/configuration/JNDIConfiguration.java Index: JNDIConfiguration.java === RCS file: /home/cvs/jakarta-commons-sandbox/configuration/src/java/org/apache/commons/configuration/JNDIConfiguration.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- JNDIConfiguration.java12 Oct 2003 09:32:30 - 1.10 +++ JNDIConfiguration.java17 Oct 2003 08:11:22 - 1.11 @@ -307,7 +307,8 @@ key = StringUtils.replace(key, ., /); try { -Object object = getContext().lookup(key); + // throws a NamingException if JNDI doesn't contain the key. +getContext().lookup(key); return true; } catch (javax.naming.NamingException ne) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-commons-sandbox/configuration/src/java/org/apache/commons/configuration BaseConfiguration.java AbstractConfiguration.java
epugh 2003/10/17 01:11:52 Modified:configuration/xdocs changes.xml configuration/src/java/org/apache/commons/configuration BaseConfiguration.java AbstractConfiguration.java Log: Patch from Oliver Heger to faciliate extending configuration classes Revision ChangesPath 1.3 +4 -0 jakarta-commons-sandbox/configuration/xdocs/changes.xml Index: changes.xml === RCS file: /home/cvs/jakarta-commons-sandbox/configuration/xdocs/changes.xml,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- changes.xml 7 Oct 2003 10:58:56 - 1.2 +++ changes.xml 17 Oct 2003 08:11:52 - 1.3 @@ -7,6 +7,10 @@ body release version=1.0-dev-4 date= + action dev=oheger type=update + AbstractConfiguration addProperty now delegates to an abstract addPropertyDirect + implemented by BaseConfiguration. + /action action dev=kshaposhnikov type=update Changed getString() method to throw a NoSuchElementException instead of if the configuration property doesn't exist. 1.16 +35 -2 jakarta-commons-sandbox/configuration/src/java/org/apache/commons/configuration/BaseConfiguration.java Index: BaseConfiguration.java === RCS file: /home/cvs/jakarta-commons-sandbox/configuration/src/java/org/apache/commons/configuration/BaseConfiguration.java,v retrieving revision 1.15 retrieving revision 1.16 diff -u -r1.15 -r1.16 --- BaseConfiguration.java12 Oct 2003 09:32:30 - 1.15 +++ BaseConfiguration.java17 Oct 2003 08:11:52 - 1.16 @@ -79,6 +79,7 @@ * @author a href=mailto:[EMAIL PROTECTED]Martin Poeschl/a * @author a href=mailto:[EMAIL PROTECTED]Henning P. Schmiedehausen/a * @author a href=mailto:[EMAIL PROTECTED]Konstantin Shaposhnikov/a + * @author a href=mailto:[EMAIL PROTECTED]Oliver Heger/a * * @version $Id$ */ @@ -115,7 +116,39 @@ */ protected void addPropertyDirect(String key, Object obj) { -store.put(key, obj); +Object o = getPropertyDirect(key); +Object objAdd = null; + +if(o == null) +{ +objAdd = obj; +} +else +{ +if (o instanceof Container) +{ +((Container) o).add(obj); +} +else +{ +// The token key is not a container. +Container c = new Container(); + +// There is an element. Put it into the container +// at the first position +c.add(o); + +// Now gobble up the supplied object +c.add(obj); + +objAdd = c; +} +} + +if(objAdd != null) +{ +store.put(key, objAdd); +} } /** 1.3 +9 -55 jakarta-commons-sandbox/configuration/src/java/org/apache/commons/configuration/AbstractConfiguration.java Index: AbstractConfiguration.java === RCS file: /home/cvs/jakarta-commons-sandbox/configuration/src/java/org/apache/commons/configuration/AbstractConfiguration.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- AbstractConfiguration.java12 Oct 2003 09:32:30 - 1.2 +++ AbstractConfiguration.java17 Oct 2003 08:11:52 - 1.3 @@ -69,6 +69,7 @@ * then you should implement only abstract methods from this class. * * @author a href=mailto:[EMAIL PROTECTED]Konstantin Shaposhnikov/a + * @author a href=mailto:[EMAIL PROTECTED]Oliver Heger/a * @version $Id$ */ public abstract class AbstractConfiguration implements Configuration @@ -124,11 +125,13 @@ */ public void addProperty(String key, Object token) { -List tokenAdd = null; - if (token instanceof String) { -tokenAdd = processString((String) token); +for(Iterator it = processString((String) token).iterator(); +it.hasNext();) +{ +addPropertyDirect(key, it.next()); +} } else if (token instanceof Collection) { @@ -136,59 +139,10 @@ { addProperty(key, it.next()); } -return; -} -else -{ -tokenAdd = new Vector(1); -tokenAdd.add(token); -} - -Object o = getPropertyDirect(key); - -if (o instanceof
cvs commit: jakarta-commons-sandbox/configuration project.xml
epugh 2003/10/17 01:12:07 Modified:configuration project.xml Log: Add new reports. Revision ChangesPath 1.32 +23 -2 jakarta-commons-sandbox/configuration/project.xml Index: project.xml === RCS file: /home/cvs/jakarta-commons-sandbox/configuration/project.xml,v retrieving revision 1.31 retrieving revision 1.32 diff -u -r1.31 -r1.32 --- project.xml 7 Oct 2003 10:58:57 - 1.31 +++ project.xml 17 Oct 2003 08:12:07 - 1.32 @@ -111,6 +111,11 @@ email[EMAIL PROTECTED]/email organizationscand.com/organization /contributor +contributor + nameOliver Heger/name + idoheger/id + email[EMAIL PROTECTED]/email +/contributor /contributors dependencies @@ -154,7 +159,7 @@ /dependency dependency idcommons-beanutils/id - version1.5/version + version1.7-dev/version properties war.bundle.jartrue/war.bundle.jar /properties @@ -239,4 +244,20 @@ jars /jars /build + reports +reportmaven-jdepend-plugin/report +reportmaven-checkstyle-plugin/report +reportmaven-changes-plugin/report +reportmaven-changelog-plugin/report +reportmaven-file-activity-plugin/report +reportmaven-developer-activity-plugin/report +reportmaven-javadoc-plugin/report +reportmaven-jxr-plugin/report +reportmaven-junit-report-plugin/report +reportmaven-tasklist-plugin/report +reportmaven-pmd-plugin/report +reportmaven-simian-plugin/report +reportmaven-faq-plugin/report +reportmaven-jcoverage-plugin/report + /reports /project - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-commons-sandbox/configuration/xdocs tasks.xml index.xml
epugh 2003/10/17 01:30:07 Modified:configuration/xdocs tasks.xml index.xml Log: Doco enhancements Revision ChangesPath 1.7 +4 -0 jakarta-commons-sandbox/configuration/xdocs/tasks.xml Index: tasks.xml === RCS file: /home/cvs/jakarta-commons-sandbox/configuration/xdocs/tasks.xml,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- tasks.xml 21 Jun 2003 22:11:03 - 1.6 +++ tasks.xml 17 Oct 2003 08:30:06 - 1.7 @@ -46,6 +46,10 @@ Need to be able to retrieve configuration values from JDBC datasource. /li + li + strongJDBC backed by Hibernate/strong + Would love to have a JDBC version backed with Hibernate. + /li /ul /subsection 1.5 +25 -7 jakarta-commons-sandbox/configuration/xdocs/index.xml Index: index.xml === RCS file: /home/cvs/jakarta-commons-sandbox/configuration/xdocs/index.xml,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- index.xml 2 Jun 2003 17:29:35 - 1.4 +++ index.xml 17 Oct 2003 08:30:06 - 1.5 @@ -10,17 +10,35 @@ /properties body -section name=Configuration +section name=Intro + p + Configuration is a project to provide a generic Configuration + interface and allow the source of the +values to vary. It + provides easy typed access to single, as well as lists of + configuration values based on a 'key': +source![CDATA[ + Double double = Configuration.getDouble(some_double_value); +]]/source + /p + p + Right now you can load properties from a simple properties file, + a properties file in a jar, an XML file, JNDI settings, as well as use +a mix different sources using a ConfigurationFactory and CompositeConfiguration. + /p + p + Custom configuration objects are very easy to create now by just subclassing + AbstractConfiguration. This works similar to how AbstractList works. + /p +/section +section name=History p This code originated in JServ, was brought into Turbine, moved to Velocity and improved, and then moved into the Commons as ExtendedProperties. The code in -ExtendedProperties is a little unweildly and deals -specifically with properties files. We wanted to use a -general Configuration interface and allow the source of the -values to vary. Right now you can load properties from a simple -properties file, an XML file, JNDI settings, as well as use -a mix different sources using a ConfigurationFactory. +ExtendedProperties is a little unwieldly and deals +specifically with properties files. Eventually it was added to +the Commons sandbox project. /p /section /body - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-commons-sandbox/configuration project.properties
epugh 2003/10/17 01:30:21 Modified:configuration project.properties Log: Fix formatting of file. Revision ChangesPath 1.7 +3 -1 jakarta-commons-sandbox/configuration/project.properties Index: project.properties === RCS file: /home/cvs/jakarta-commons-sandbox/configuration/project.properties,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- project.properties7 Jun 2003 06:23:32 - 1.6 +++ project.properties17 Oct 2003 08:30:21 - 1.7 @@ -13,6 +13,8 @@ maven.checkstyle.format = turbine -maven.junit.fork=true#cactus settings. Make sure to point to your Tomcat! +maven.junit.fork=true + +#cactus settings. Make sure to point to your Tomcat! maven.cactus.tomcat4x.home = c:/java/tomcat maven.cactus.webxml=src/test-cactus/testapp/WEB-INF/web.xml - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-commons-sandbox/configuration .cvsignore
epugh 2003/10/17 01:30:52 Modified:configuration .cvsignore Log: Ignore jcoverage .ser file Revision ChangesPath 1.5 +1 -0 jakarta-commons-sandbox/configuration/.cvsignore Index: .cvsignore === RCS file: /home/cvs/jakarta-commons-sandbox/configuration/.cvsignore,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- .cvsignore31 Dec 2002 04:41:04 - 1.4 +++ .cvsignore17 Oct 2003 08:30:52 - 1.5 @@ -9,3 +9,4 @@ lib .classpath .project +*.ser - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: [configuration][PATCH]addProperty
Oliver, I have applied your patch. Do you want to check things out? I also added in some more maven reports. I thought our coverage with unit tests was going to be steller, but according to JCoverage, we only have 59% coverage of the code base. At any rate, let me know how things go.. I am updating the website as I write this... Eric -Original Message- From: Oliver Heger [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 14, 2003 1:58 PM To: Jakarta Commons Developer List; [EMAIL PROTECTED] Subject: [configuration][PATCH]addProperty Eric, I have created the patch for refactoring the addProperty() method. AbstractConfiguration.addProperty() now only handles collection and string properties with multiple values and then delegates to the abstract addPropertyDirect() method. The stuff with the containers was moved to BaseConfiguration.addPropertyDirect(). The unit tests run fine. There is a little thing more I changed: I made the nested Container class in AbstractConfiguration static. The reason is that I have a static nested class HierarchicalProperties.Node that needs to create instances of Container. This is impossible with Container being nonstatic unless I make the Node class nonstatic, too; but I don't like that because it would make usage of this class more complicated for clients of HierarchicalProperties (normally clients need not access this class directly, but there might be cases where it could make sense). Was there any specific reason for making Container nonstatic? Regards Oli - Original Message - From: Eric Pugh [EMAIL PROTECTED] To: 'Oliver Heger' [EMAIL PROTECTED]; 'Jakarta Commons Developers List' [EMAIL PROTECTED] Sent: Tuesday, October 14, 2003 10:40 AM Subject: RE: [configuration]HierarchicalConfiguration Oliver, So, if I understand properly, the reason is so that we refactor out the code so that you don't have to do a cut'n'paste job from the AbstractConfiguration to your new subclass.. Seems reasonable enough.. Why don't you submit a patch with your next chunk of code then? Oh, and the attachements came through okay for me! Eric - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: [VOTE][NET] Release Commons/Net v1.1.0
+0 for me as well -- haven't had time to test ;( Yoav Shapira Millennium ChemInformatics -Original Message- From: Henri Yandell [mailto:[EMAIL PROTECTED] Sent: Friday, October 17, 2003 12:42 AM To: Jakarta Commons Developers List Subject: Re:[VOTE][NET] Release Commons/Net v1.1.0 +0 On Wed, 15 Oct 2003, [EMAIL PROTECTED] wrote: This is a call for a vote to release version 1.1.0 of Commons/Net. Links to the release canidate and changes may be found on the Commons/Net web site. +1 - 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] 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]
[lang] or [ThreadPool] contribution: ParalellThreadGuard
A common problem for networked applications accepting multiple connections in individual threads that cannot control the socket accept() paralellity (as the JDK1.4 ORB) need to restrict the resources somewhere else. For this purpose we designed a ParalellThreadGuard class that can be used as follows: private ParalellThreadGuard guard = new ParalellThreadGuard(THREADS_ACTIVE, THREADS_ENQUEUE, THREADS_TIMEOUT); ... public void guardedMethod() throws RejectedException { guard.register(); // might throw a RejectedException try { ... // do something with your limited resources here } finally { guard.release(); } } This class seems to fit to the [lang] area, but might also fit in the scope of the sandboxed [ThreadPool] package. I can contribute it to Apache with the proper licence header if someone sees it fitting. Cheers, Christoph Reck // /* * $RCSfile: ParalellThreadGuard.java $ * * $Revision: 1.0 $ * $Date: 2003/10/16 $ * author: [EMAIL PROTECTED] * * Copyright: Deutsches Zentrum fuer Luft und Raumfahrt (DLR) 2003 */ // import java.util.LinkedList; /** * This guard provides two methods code[EMAIL PROTECTED] #register()}/code and * code[EMAIL PROTECTED] #release()}/code to limit the amount of threads * accessing a set of guarded methods. Usage:p * pre... * ParalellThreadGuard guard = new ParalellThreadGuard(4, 10, 0); * ... * public ReturnValue guardedMethod(...) throws RejectedException * { *guard.register(); // might throw a RejectedException *try *{ * ... // do something with your limited resources here *} *finally *{ * guard.release(); *} * } * ... * /pre * * @author [EMAIL PROTECTED] */ public class ParalellThreadGuard { private final static boolean WITH_TRACE = false; private intallowedThreads; private intqueueLimit; private intqueueTimeout; private LinkedList threadQueue; private intactiveThreads; static final String CLASS_ID = @(#) $Id: $, Copyright DLR 2003; /** * Constructor. * @param _allowedThreads The number of threads that are allowed to pass *registration without enqueing. * @param _queueLimit The maximum threads allowed in the queue before *throwing a codeRejectedException/code. * @param _queueTimeout The maximum time in milliseconds a thread may be *stopped in coderegister/code before throwing a *codeRejectedException/code, a value of 0 will *allow waiting indefinitely. */ public ParalellThreadGuard( int _allowedThreads, int _queueLimit, int _queueTimeout ) { allowedThreads = _allowedThreads; queueLimit = _queueLimit; queueTimeout = _queueTimeout; threadQueue= new LinkedList(); activeThreads = 0; } /** * Returns codetrue/code if no threads are active or pending. */ public boolean isIdle() { return (activeThreads + threadQueue.size()) == 0; } /** * Returns the currently active thread count. */ public int getActiveThreads() { return activeThreads; } /** * Returns the amount of threads pending for execution. */ public int getPendingThreads() { return threadQueue.size(); } /** * Register a thread in this guard, use [EMAIL PROTECTED] #release} to release the * guard and possibly re-start an enqueued thread. * * @throws RejectedException Either because to many threads are already * pending or this thread was enqueued but exceeded the timeout. */ public void register() throws RejectedException { // guard this method boolean allowExceution = true; Thread currentThread = Thread.currentThread(); if( WITH_TRACE ) traceMessage( testing ); synchronized(threadQueue) { // check resource limit to avoid excessive queue size int pending = threadQueue.size(); if( pending = queueLimit ) { throw( new RejectedException( Too many paralell calls ( + (pending + activeThreads + 1) + + (queueLimit + activeThreads) + ) to guardedMethod() ) ); } if( (activeThreads + pending) = allowedThreads ) { // enqueue the thread allowExceution = false; threadQueue.add( currentThread ); if( WITH_TRACE ) traceMessage( enqueued ); } } // wait for execution permission long waittime = queueTimeout; long timeout = (waittime 0) ? System.currentTimeMillis() + queueTimeout : Long.MAX_VALUE; while( !allowExceution ) { try { synchronized(currentThread) { if (waittime 0)
RE: [lang] or [ThreadPool] contribution: ParalellThreadGuard
Howdy, So this is kind of like the Sync implementations in Doug Lea's util-concurrent package? (http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/in tro.html) I ask because the above package will be java.util.concurrent in JDK 1.5. So if commons-lang wants to have something similar for earlier JDK versions, it'd be nice if the names matched ;) Yoav Shapira Millennium ChemInformatics -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Friday, October 17, 2003 10:29 AM To: Jakarta Commons Developers List Subject: [lang] or [ThreadPool] contribution: ParalellThreadGuard A common problem for networked applications accepting multiple connections in individual threads that cannot control the socket accept() paralellity (as the JDK1.4 ORB) need to restrict the resources somewhere else. For this purpose we designed a ParalellThreadGuard class that can be used as follows: private ParalellThreadGuard guard = new ParalellThreadGuard(THREADS_ACTIVE, THREADS_ENQUEUE, THREADS_TIMEOUT); ... public void guardedMethod() throws RejectedException { guard.register(); // might throw a RejectedException try { ... // do something with your limited resources here } finally { guard.release(); } } This class seems to fit to the [lang] area, but might also fit in the scope of the sandboxed [ThreadPool] package. I can contribute it to Apache with the proper licence header if someone sees it fitting. Cheers, Christoph Reck 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: [configuration][PATCH]addProperty
Eric, thank you, I checked it out and everything seems to be fine. At the moment I am still working on a Configuration implementation that is able to store hierarchical properties in a more suitable structure. I plan to write an alternative version of DOM4jConfiguration that makes use of this class to provide better support for tree-like XML documents. I also want to implement a first approach for a Digester (or general XML-enabled) interface. I hope that I can soon deliver some results. Then we can talk about some optimizations and how this stuff can be integrated best with the actual code base. A coverage rate of 59% for the unit tests seems to be indeed quite low. I promise to keep an eye on this with my own classes. Oli - Original Message - From: Eric Pugh [EMAIL PROTECTED] To: 'Oliver Heger' [EMAIL PROTECTED]; 'Jakarta Commons Developer List' [EMAIL PROTECTED] Sent: Friday, October 17, 2003 10:31 AM Subject: RE: [configuration][PATCH]addProperty Oliver, I have applied your patch. Do you want to check things out? I also added in some more maven reports. I thought our coverage with unit tests was going to be steller, but according to JCoverage, we only have 59% coverage of the code base. At any rate, let me know how things go.. I am updating the website as I write this... Eric - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[all] why junit 3.7 instead of 3.8.1?
The subject pretty much says it all... why do the majority of commons projects depend on junit 3.7 instead of 3.8.1? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: [all] why junit 3.7 instead of 3.8.1?
Howdy, The usual reason for not-latest dependencies: when you start using X (X = JUnit here), you start with a given version, e.g. 3.7. Everything works fine, there's no urgent reason to upgrade, we're all busy, so it stays the same. Yoav Shapira Millennium ChemInformatics -Original Message- From: __matthewHawthorne [mailto:[EMAIL PROTECTED] Sent: Friday, October 17, 2003 1:41 PM To: Jakarta Commons Developers List Subject: [all] why junit 3.7 instead of 3.8.1? The subject pretty much says it all... why do the majority of commons projects depend on junit 3.7 instead of 3.8.1? - 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]
cvs commit: jakarta-commons-sandbox/io/src/test/org/apache/commons/io FileUtilsTestCase.java
matth 2003/10/17 13:15:46 Modified:io/src/java/org/apache/commons/io FileUtils.java io/src/test/org/apache/commons/io FileUtilsTestCase.java Added: io/src/java/org/apache/commons/io/input package.html io/src/java/org/apache/commons/io/output package.html Log: Bugzilla #22738 from yours truly. Revision ChangesPath 1.16 +24 -22 jakarta-commons-sandbox/io/src/java/org/apache/commons/io/FileUtils.java Index: FileUtils.java === RCS file: /home/cvs/jakarta-commons-sandbox/io/src/java/org/apache/commons/io/FileUtils.java,v retrieving revision 1.15 retrieving revision 1.16 diff -u -r1.15 -r1.16 --- FileUtils.java13 Oct 2003 07:04:52 - 1.15 +++ FileUtils.java17 Oct 2003 20:15:46 - 1.16 @@ -57,11 +57,12 @@ import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; -import java.io.InputStream; import java.io.IOException; +import java.io.InputStream; import java.net.URL; +import java.util.ArrayList; +import java.util.Collection; import java.util.Date; -import java.util.Vector; /** * This class provides basic facilities for manipulating files and file paths. @@ -241,16 +242,6 @@ } /** - * Creates a file handle. - * - * @param fileName The name of the file. - * @return A codeFile/code instance. - */ -public static File getFile(String fileName) { -return new File(fileName); -} - -/** * Given a directory and an array of extensions... return an array of * compliant files. * @@ -264,9 +255,9 @@ String directory, String[] extensions) { -Vector files = new Vector(); +Collection files = new ArrayList(); -java.io.File currentDir = new java.io.File(directory); +File currentDir = new File(directory); String[] unknownFiles = currentDir.list(); @@ -279,7 +270,7 @@ directory + System.getProperty(file.separator) + unknownFiles[i]; -java.io.File currentFile = new java.io.File(currentFileName); +File currentFile = new java.io.File(currentFileName); if (currentFile.isDirectory()) { @@ -293,14 +284,14 @@ String[] fetchFiles = getFilesFromExtension(currentFileName, extensions); -files = blendFilesToVector(files, fetchFiles); +files = blendFiles(files, fetchFiles); } else { //ok... add the file String add = currentFile.getAbsolutePath(); if (isValidFile(add, extensions)) { -files.addElement(add); +files.add(add); } @@ -310,7 +301,7 @@ //ok... move the Vector into the files list... String[] foundFiles = new String[files.size()]; -files.copyInto(foundFiles); +files.toArray(foundFiles); return foundFiles; @@ -319,13 +310,13 @@ /** * Private hepler method for getFilesFromExtension() */ -private static Vector blendFilesToVector(Vector v, String[] files) { +private static Collection blendFiles(Collection c, String[] files) { for (int i = 0; i files.length; ++i) { -v.addElement(files[i]); +c.add(files[i]); } -return v; +return c; } /** @@ -1270,6 +1261,17 @@ throws Exception { String content = fileRead(inFileName); fileWrite(outFileName, content); +} + +/** + * Creates a file handle. + * + * @param fileName The name of the file. + * @return A codeFile/code instance. + * @deprecated Use [EMAIL PROTECTED] java.io.File#Constructor(String)} + */ +public static File getFile(String fileName) { +return new File(fileName); } } 1.1 jakarta-commons-sandbox/io/src/java/org/apache/commons/io/input/package.html Index: package.html === Implementations of input classes, such as |InputStream| and |Reader|. 1.1 jakarta-commons-sandbox/io/src/java/org/apache/commons/io/output/package.html Index: package.html === Implementations of output classes, such as |OutputStream| and |Writer|. 1.4 +317 -62 jakarta-commons-sandbox/io/src/test/org/apache/commons/io/FileUtilsTestCase.java Index: FileUtilsTestCase.java
cvs commit: jakarta-commons-sandbox/io project.xml
matth 2003/10/17 13:16:18 Modified:io project.xml Log: Bugzilla #22738 from yours truly. Revision ChangesPath 1.11 +4 -1 jakarta-commons-sandbox/io/project.xml Index: project.xml === RCS file: /home/cvs/jakarta-commons-sandbox/io/project.xml,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- project.xml 22 Sep 2003 18:08:18 - 1.10 +++ project.xml 17 Oct 2003 20:16:18 - 1.11 @@ -23,7 +23,9 @@ gumpRepositoryIdjakarta-io/gumpRepositoryId description -Commons.IO is a package of Java utility classes for ther classes that are in java.io's hierarchy, or are considered to be so standard and of such high reuse as to justify existence in java.io. +Commons.IO is a package of Java utility classes for java.io's +hierarchy. Classes in this package are considered to be so standard +and of such high reuse as to justify existence in java.io. /description shortDescriptionJava Common IO Components/shortDescription @@ -165,6 +167,7 @@ aspectSourceDirectory/ !-- Unit test classes -- +!-- TODO Organize test inclusions and exclusions -- unitTest includes include**/*Test*/include - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [Chain] [PATCH] tabs to spaces, log name fix
otisg wrote: Patch attached. Just converted a bunch of tabs to spaces (4) and fixed one instance of incorrect Log name (result of copy/paste from another class). Otis Maybe it's my mail-reader, but the patch didn't seem to come through. As Matt mentioned, you can try attaching it to a bugzilla ticket, or pasting it into the text of the message. (There's no so much [Chain] traffic that it would get lost at this point.) -Ted. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
DO NOT REPLY [Bug 22738] - [io] Improved FileUtils tests
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT http://nagoya.apache.org/bugzilla/show_bug.cgi?id=22738. 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=22738 [io] Improved FileUtils tests [EMAIL PROTECTED] changed: What|Removed |Added Status|NEW |RESOLVED Resolution||FIXED - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [Chain]: k2d2 framework
Ted Husted wrote: otisg wrote: k2d2 looks like a concrete implementation of an API that is defined within the k2d2 framework itself. The implementation allows generic components to be assembled in a chain, and connected with blocking queues. I guess this is where the concreteness of k2d2 shows - it is more than just the API. However, Chain also has some concrete implementations, so I was wondering why not also provide a concrete implementation that k2d2 provides, but change it to implement Chain's API, not the one that k2d2 defines internally. I guess that would be up to the k2d2 community, then. :) The concrete implementations we have now are either minimal or based on published specifications, like the Servlet and Portlet APIs and JavaServer Faces. These are as much as proofs of concept as anything else. I have wondered where implementations for more specialized usage might live. For example, a StrutsContext or ActionCommand (brrr/), or a Velocity Context that implemented the Chain Context, or likewise for the many other packages that implement a Context and/or a Command interface. My inclination would be that they should live in the communities that can best support them. So if k2d2 wanted to base their implementation on Chain, then that implementation might be live in the k2d2 CVS. Likewise for implementations that catered to the Struts or Velocity communities. My feeling that commons-chain should only contain concrete implementations that are truly generic (like LookupCommand), plus context (and perhaps command) implementations for platforms (o.a.c.c.web and friends). Something like a StrutsContext should live in jakarta-struts, VelocityContext in jakarta-velocity, and so on. -Ted. Craig - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-commons-sandbox/dbutils/src/java/org/apache/commons/dbutils/driver StringTrimmedResultSet.java
dgraham 2003/10/17 16:15:55 Modified:dbutils/src/java/org/apache/commons/dbutils/driver StringTrimmedResultSet.java Log: Override getObject() methods and trim returned Strings. Revision ChangesPath 1.4 +74 -15 jakarta-commons-sandbox/dbutils/src/java/org/apache/commons/dbutils/driver/StringTrimmedResultSet.java Index: StringTrimmedResultSet.java === RCS file: /home/cvs/jakarta-commons-sandbox/dbutils/src/java/org/apache/commons/dbutils/driver/StringTrimmedResultSet.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- StringTrimmedResultSet.java 15 Oct 2003 02:26:41 - 1.3 +++ StringTrimmedResultSet.java 17 Oct 2003 23:15:55 - 1.4 @@ -63,12 +63,14 @@ import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; +import java.util.Map; /** * Wraps a codeResultSet/code to trim strings returned by the - * codegetString/code methods. + * codegetString()/code and codegetObject()/code methods. * - * @author a href=[EMAIL PROTECTED]Steven Caswell/a + * @author a href=[EMAIL PROTECTED]Steven Caswell/a + * @author David Graham * @version $Id$ */ public class StringTrimmedResultSet extends ResultSetWrapper { @@ -89,8 +91,8 @@ * Constructs a new instance of codeStringTrimmedResultSet/code * to wrap the specified codeResultSet/code and codeStatement/code. */ -public StringTrimmedResultSet(ResultSet rs, Statement st) { -super(rs, st); +public StringTrimmedResultSet(ResultSet rs, Statement stmt) { +super(rs, stmt); this.rs = rs; } @@ -100,13 +102,13 @@ * language. Control characters, including whitespace, are removed from * both ends of the string, handling null by returning null. * - * @param column the SQL name of the column + * @param columnName the SQL name of the column * @return the column value; if the value is SQL NULL, the value returned * is codenull/code * @throws SQLException if a database access error occurs */ -public String getString(String column) throws SQLException { -String value = this.rs.getString(column); +public String getString(String columnName) throws SQLException { +String value = this.rs.getString(columnName); return (value == null) ? null : value.trim(); } @@ -116,13 +118,70 @@ * language. Control characters, including whitespace, are removed from * both ends of the string, handling null by returning null. * - * @param idx the first column is 1, the second is 2, ... - * @return the column value; if the value is SQL NULL, the value returned + * @param columnIndex The first column is 1, the second is 2, ... + * @return The column value; if the value is SQL NULL, the value returned * is codenull/code * @throws SQLException if a database access error occurs */ -public String getString(int idx) throws SQLException { -String value = this.rs.getString(idx); +public String getString(int columnIndex) throws SQLException { +String value = this.rs.getString(columnIndex); return (value == null) ? null : value.trim(); } + +/** + * If the object is a codeString/code, it is trimmed before returning + * from this method. + * @throws SQLException + * @see java.sql.ResultSet#getObject(int, java.util.Map) + */ +public Object getObject(int columnIndex, Map map) throws SQLException { +Object obj = this.rs.getObject(columnIndex, map); +if (obj instanceof String) { +obj = ((String) obj).trim(); +} +return obj; +} + +/** + * If the object is a codeString/code, it is trimmed before returning + * from this method. + * @throws SQLException + * @see java.sql.ResultSet#getObject(int) + */ +public Object getObject(int columnIndex) throws SQLException { +Object obj = this.rs.getObject(columnIndex); +if (obj instanceof String) { +obj = ((String) obj).trim(); +} +return obj; +} + +/** + * If the object is a codeString/code, it is trimmed before returning + * from this method. + * @throws SQLException + * @see java.sql.ResultSet#getObject(java.lang.String, java.util.Map) + */ +public Object getObject(String columnName, Map map) throws SQLException { +Object obj = this.rs.getObject(columnName, map); +if (obj instanceof String) { +obj = ((String) obj).trim(); +} +return obj; +} + +/** + * If the object is a
cvs commit: jakarta-commons-sandbox/dbutils/src/java/org/apache/commons/dbutils BasicResultSetConverter.java
dgraham 2003/10/17 16:22:44 Modified:dbutils/src/java/org/apache/commons/dbutils BasicResultSetConverter.java Log: Ignore null column values for primitive types instead of setting the bean property to the default value for the primitive. This allows any defaults set in the bean class to not get overwritten. If the bean doesn't define a special default value it would be set to the primitive default anyway. Revision ChangesPath 1.4 +7 -23 jakarta-commons-sandbox/dbutils/src/java/org/apache/commons/dbutils/BasicResultSetConverter.java Index: BasicResultSetConverter.java === RCS file: /home/cvs/jakarta-commons-sandbox/dbutils/src/java/org/apache/commons/dbutils/BasicResultSetConverter.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- BasicResultSetConverter.java 16 Oct 2003 05:00:20 - 1.3 +++ BasicResultSetConverter.java 17 Oct 2003 23:22:44 - 1.4 @@ -98,24 +98,7 @@ */ private static final BasicResultSetConverter instance = new BasicResultSetConverter(); - -/** - * If a column was null, and the bean property is a primitive type, set - * the property to the default value for its type. - */ -private static final Map defaultValues = new HashMap(); - -static { -defaultValues.put(int.class, new Integer(0)); -defaultValues.put(short.class, new Short((short) 0)); -defaultValues.put(byte.class, new Byte((byte) 0)); -defaultValues.put(float.class, new Float(0f)); -defaultValues.put(double.class, new Double(0.0)); -defaultValues.put(long.class, new Long(0L)); -defaultValues.put(boolean.class, Boolean.FALSE); -defaultValues.put(char.class, new Character('\u')); -} - + /** * Returns the Singleton instance of this class. */ @@ -162,10 +145,11 @@ Object value = rs.getObject(i); if (rs.wasNull() pd[j].getPropertyType().isPrimitive()) { -value = defaultValues.get(pd[j].getPropertyType()); +continue; } callSetter(pd[j], obj, value); +break; } } } @@ -311,7 +295,7 @@ * @throws DbException if introspection failed. */ private PropertyDescriptor[] propertyDescriptors(Class c) { -// TODO Cache BeanInfo classes for better performance? +// Introspector caches BeanInfo classes for better performance BeanInfo beanInfo = null; try { beanInfo = Introspector.getBeanInfo(c); - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-commons-sandbox/dbutils/src/java/org/apache/commons/dbutils BasicResultSetConverter.java
dgraham 2003/10/17 16:37:57 Modified:dbutils/src/java/org/apache/commons/dbutils BasicResultSetConverter.java Log: Don't call a bean property's setter method if the type of object returned from the database doesn't match the setter method signature. This allows clients to use toBean() to populate most properties and then fill in the rest with custom code without having to catch an exception from toBean(). Revision ChangesPath 1.5 +12 -6 jakarta-commons-sandbox/dbutils/src/java/org/apache/commons/dbutils/BasicResultSetConverter.java Index: BasicResultSetConverter.java === RCS file: /home/cvs/jakarta-commons-sandbox/dbutils/src/java/org/apache/commons/dbutils/BasicResultSetConverter.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- BasicResultSetConverter.java 17 Oct 2003 23:22:44 - 1.4 +++ BasicResultSetConverter.java 17 Oct 2003 23:37:57 - 1.5 @@ -253,11 +253,17 @@ * @throws DbException if an error occurs setting the property. */ private void callSetter(PropertyDescriptor pd, Object target, Object value) { +Method setter = pd.getWriteMethod(); -try { -Method setter = pd.getWriteMethod(); +if (setter == null) { +return; +} + +Class[] params = setter.getParameterTypes(); -if (setter != null) { +try { +// Don't call setter if the value object isn't the right type +if (value == null || params[0].isInstance(value)) { setter.invoke(target, new Object[] { value }); } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-commons-sandbox/dbutils/src/java/org/apache/commons/dbutils BasicResultSetConverter.java
dgraham 2003/10/17 16:48:58 Modified:dbutils/src/java/org/apache/commons/dbutils BasicResultSetConverter.java Log: Added CaseInsensitiveHashMap inner class for the toMap() implementation to use. Databases don't handle column name casing the same so we normalize all names to lowercase strings. Revision ChangesPath 1.6 +39 -4 jakarta-commons-sandbox/dbutils/src/java/org/apache/commons/dbutils/BasicResultSetConverter.java Index: BasicResultSetConverter.java === RCS file: /home/cvs/jakarta-commons-sandbox/dbutils/src/java/org/apache/commons/dbutils/BasicResultSetConverter.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- BasicResultSetConverter.java 17 Oct 2003 23:37:57 - 1.5 +++ BasicResultSetConverter.java 17 Oct 2003 23:48:58 - 1.6 @@ -72,6 +72,7 @@ import java.sql.SQLException; import java.util.ArrayList; import java.util.HashMap; +import java.util.Iterator; import java.util.List; import java.util.Map; @@ -230,7 +231,7 @@ // See interface for javadoc. public Map toMap(ResultSet rs) throws SQLException { -Map result = new HashMap(); +Map result = new CaseInsensitiveHashMap(); ResultSetMetaData rsmd = rs.getMetaData(); int cols = rsmd.getColumnCount(); @@ -311,6 +312,40 @@ } return beanInfo.getPropertyDescriptors(); +} + +/** + * A Map that converts all keys to lowercase Strings for case insensitive + * lookups. This is needed for the toMap() implementation because + * databases don't consistenly handle the casing of column names. + */ +private static class CaseInsensitiveHashMap extends HashMap { + +public boolean containsKey(Object key) { +return super.containsKey(key.toString().toLowerCase()); +} + +public Object get(Object key) { +return super.get(key.toString().toLowerCase()); +} + +public Object put(Object key, Object value) { +return super.put(key.toString().toLowerCase(), value); +} + +public void putAll(Map m) { +Iterator iter = m.keySet().iterator(); +while (iter.hasNext()) { +Object key = iter.next(); +Object value = m.get(key); +this.put(key, value); +} +} + +public Object remove(Object key) { +return super.remove(key.toString().toLowerCase()); +} + } } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-commons-sandbox/dbutils/src/java/org/apache/commons/dbutils ResultSetIterator.java ResultSetIteratorV1.java DbUtils.java
dgraham 2003/10/17 17:11:52 Modified:dbutils/src/java/org/apache/commons/dbutils ResultSetIterator.java ResultSetIteratorV1.java DbUtils.java Log: Removed the DbUtils.iterateResultSet() methods and made the ResultSetIterator classes public for clients to use directly. Clients shouldn't have to ask DbUtils for an iterator when this is easier: Iterator i = new ResultSetIterator(rs); Added javadoc to ResultSetIterator as well as the ability to specify the processor used to convert rows into Object[]s. Revision ChangesPath 1.6 +51 -10 jakarta-commons-sandbox/dbutils/src/java/org/apache/commons/dbutils/ResultSetIterator.java Index: ResultSetIterator.java === RCS file: /home/cvs/jakarta-commons-sandbox/dbutils/src/java/org/apache/commons/dbutils/ResultSetIterator.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- ResultSetIterator.java16 Oct 2003 04:21:11 - 1.5 +++ ResultSetIterator.java18 Oct 2003 00:11:52 - 1.6 @@ -66,19 +66,51 @@ import java.util.Iterator; /** - * A version of ResultSetIterator that is simpler, but needs isLast which - * Oracle fails to offer. As such this is sidelined until Oracle adds - * features. + * p + * Wraps a codeResultSet/code in an codeIterator/code. This is useful + * when you want to present a non-database application layer with domain + * neutral data. + * /p + * + * p + * This implementation requires the codeResultSet.isLast()/code method + * to be implemented. + * /p * * @author Henri Yandell + * @author David Graham */ -class ResultSetIterator implements Iterator { +public class ResultSetIterator implements Iterator { +/** + * The wrapped codeResultSet/code. + */ private ResultSet rs = null; - + +/** + * The processor to use when converting a row into an Object[]. + */ +private ResultSetConverter convert = BasicResultSetConverter.instance(); + +/** + * Constructor for ResultSetIterator. + * @param rs Wrap this codeResultSet/code in an codeIterator/code. + */ public ResultSetIterator(ResultSet rs) { this.rs = rs; } + +/** + * Constructor for ResultSetIterator. + * @param rs Wrap this codeResultSet/code in an codeIterator/code. + * @param convert The processor to use when converting a row into an + * codeObject[]/code. Defaults to a + * codeBasicResultSetConverter/code. + */ +public ResultSetIterator(ResultSet rs, ResultSetConverter convert) { +this.rs = rs; +this.convert = convert; +} public boolean hasNext() { try { @@ -91,10 +123,16 @@ } } +/** + * Returns the next row as an codeObject[]/code. + * @return An codeObject[]/code with the same number of elements as + * columns in the codeResultSet/code. + * @see java.util.Iterator#next() + */ public Object next() { try { rs.next(); -return BasicResultSetConverter.instance().toArray(rs); +return this.convert.toArray(rs); } catch (SQLException e) { // TODO Logging? @@ -103,8 +141,11 @@ } } +/** + * Deletes the current row from the codeResultSet/code. + * @see java.util.Iterator#remove() + */ public void remove() { - try { this.rs.deleteRow(); 1.6 +14 -5 jakarta-commons-sandbox/dbutils/src/java/org/apache/commons/dbutils/ResultSetIteratorV1.java Index: ResultSetIteratorV1.java === RCS file: /home/cvs/jakarta-commons-sandbox/dbutils/src/java/org/apache/commons/dbutils/ResultSetIteratorV1.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- ResultSetIteratorV1.java 16 Oct 2003 04:21:11 - 1.5 +++ ResultSetIteratorV1.java 18 Oct 2003 00:11:52 - 1.6 @@ -65,10 +65,19 @@ import java.sql.SQLException; import java.util.Iterator; -class ResultSetIteratorV1 implements Iterator { +/** + * A version of ResultSetIterator that doesn't require isLast() which + * Oracle fails to offer. + * + * @author Henri Yandell + * @author David Graham + */ +public class ResultSetIteratorV1 implements Iterator { private ResultSet rs; + private boolean hasNextCalledLast = false; + private Object val = null; public ResultSetIteratorV1(ResultSet rs) { @@ -95,7 +104,7 @@ try { rs.next(); this.val = BasicResultSetConverter.instance().toArray(rs); -
cvs commit: jakarta-commons-sandbox/dbutils/src/java/org/apache/commons/dbutils BeanListHandler.java
dgraham 2003/10/17 18:00:31 Added: dbutils/src/java/org/apache/commons/dbutils BeanListHandler.java Log: Renamed BeanCollectionHandler to BeanListHandler because ResultSets are always sorted in some order. Clients must be able to depend on the order of beans being the same as the order of rows. Also, added ability to specify the processor to use when converting rows into beans. Revision ChangesPath 1.1 jakarta-commons-sandbox/dbutils/src/java/org/apache/commons/dbutils/BeanListHandler.java Index: BeanListHandler.java === /* * $Header: /home/cvs/jakarta-commons-sandbox/dbutils/src/java/org/apache/commons/dbutils/BeanListHandler.java,v 1.1 2003/10/18 01:00:31 dgraham Exp $ * $Revision: 1.1 $ * $Date: 2003/10/18 01:00:31 $ * * * * 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 acknowledgement: * This product includes software developed by the *Apache Software Foundation (http://www.apache.org/). *Alternately, this acknowledgement may appear in the software itself, *if and wherever such third-party acknowledgements 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 names 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 * http://www.apache.org/. * */ package org.apache.commons.dbutils; import java.sql.ResultSet; import java.sql.SQLException; /** * codeResultSetHandler/code implementation that converts the first * codeResultSet/code column into an Object. * * @see ResultSetHandler * * @author Juozas Baliuka * @author David Graham */ public class BeanListHandler implements ResultSetHandler { /** * The Class of beans produced by this handler. */ private Class type = null; /** * The ResultSetConverter implementation to use when converting rows * into beans. */ private ResultSetConverter convert = BasicResultSetConverter.instance(); /** * Creates a new instance of BeanListHandler. * * @param type The Class that objects returned from codehandle()/code * are created from. */ public BeanListHandler(Class type) { this.type = type; } /** * Creates a new instance of BeanListHandler. * * @param type The Class that objects returned from codehandle()/code * are created from. * @param convert The codeResultSetConverter/code implementation * to use when converting rows into beans. */ public BeanListHandler(Class type,
cvs commit: jakarta-commons-sandbox/dbutils/src/java/org/apache/commons/dbutils BeanCollectionHandler.java
dgraham 2003/10/17 18:00:42 Removed: dbutils/src/java/org/apache/commons/dbutils BeanCollectionHandler.java Log: Renamed BeanCollectionHandler to BeanListHandler because ResultSets are always sorted in some order. Clients must be able to depend on the order of beans being the same as the order of rows. Also, added ability to specify the processor to use when converting rows into beans. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-commons-sandbox/dbutils/src/java/org/apache/commons/dbutils BeanHandler.java CollectionHandler.java
dgraham 2003/10/17 18:07:25 Modified:dbutils/src/java/org/apache/commons/dbutils BeanHandler.java CollectionHandler.java Log: Added the ability to specify the processor to use when converting rows instead of always using the basic implementation. Revision ChangesPath 1.5 +23 -6 jakarta-commons-sandbox/dbutils/src/java/org/apache/commons/dbutils/BeanHandler.java Index: BeanHandler.java === RCS file: /home/cvs/jakarta-commons-sandbox/dbutils/src/java/org/apache/commons/dbutils/BeanHandler.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- BeanHandler.java 16 Oct 2003 04:21:11 - 1.4 +++ BeanHandler.java 18 Oct 2003 01:07:25 - 1.5 @@ -78,6 +78,12 @@ * The Class of beans produced by this handler. */ private Class type = null; + +/** + * The ResultSetConverter implementation to use when converting rows + * into beans. + */ +private ResultSetConverter convert = BasicResultSetConverter.instance(); /** * Creates a new instance of BeanHandler. @@ -88,6 +94,19 @@ public BeanHandler(Class type) { this.type = type; } + +/** + * Creates a new instance of BeanHandler. + * + * @param type The Class that objects returned from codehandle()/code + * are created from. + * @param convert The codeResultSetConverter/code implementation + * to use when converting rows into beans. + */ +public BeanHandler(Class type, ResultSetConverter convert) { +this.type = type; +this.convert = convert; +} /** * Convert the first row of the codeResultSet/code into a bean with the @@ -102,9 +121,7 @@ public Object handle(ResultSet rs, Object[] params, Object userObject) throws SQLException { -return rs.next() -? BasicResultSetConverter.instance().toBean(rs, this.type) -: null; +return rs.next() ? this.convert.toBean(rs, this.type) : null; } } 1.4 +20 -5 jakarta-commons-sandbox/dbutils/src/java/org/apache/commons/dbutils/CollectionHandler.java Index: CollectionHandler.java === RCS file: /home/cvs/jakarta-commons-sandbox/dbutils/src/java/org/apache/commons/dbutils/CollectionHandler.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- CollectionHandler.java16 Oct 2003 04:21:11 - 1.3 +++ CollectionHandler.java18 Oct 2003 01:07:25 - 1.4 @@ -78,6 +78,22 @@ public class CollectionHandler implements ResultSetHandler { /** + * The ResultSetConverter implementation to use when converting rows + * into Object[]s. + */ +private ResultSetConverter convert = BasicResultSetConverter.instance(); + +/** + * Creates a new instance of CollectionHandler. + * + * @param convert The codeResultSetConverter/code implementation + * to use when converting rows into Object[]s. + */ +public CollectionHandler(ResultSetConverter convert) { +this.convert = convert; +} + +/** * Convert each row's columns into an codeObject[]/code and store them * in a codeList/code in the same order they are returned from the * codeResultSet.next()/code method. @@ -93,9 +109,8 @@ List result = new ArrayList(); -ResultSetConverter convert = BasicResultSetConverter.instance(); while (rs.next()) { -result.add(convert.toArray(rs)); +result.add(this.convert.toArray(rs)); } return result; - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-commons-sandbox/chain STATUS.html
martinc 2003/10/17 22:28:58 Modified:chainSTATUS.html Log: Add myself as a committer. Revision ChangesPath 1.2 +2 -1 jakarta-commons-sandbox/chain/STATUS.html Index: STATUS.html === RCS file: /home/cvs/jakarta-commons-sandbox/chain/STATUS.html,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- STATUS.html 11 Aug 2003 04:44:16 - 1.1 +++ STATUS.html 18 Oct 2003 05:28:58 - 1.2 @@ -59,6 +59,7 @@ component to ensure that it continues to meet a variety of needs./p ul lia href=mailto:[EMAIL PROTECTED]Craig McClanahan/a/li +lia href=mailto:[EMAIL PROTECTED]Martin Cooper/a/li liTBD/li /ul - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-commons-sandbox/chain/src/test/org/apache/commons/chain/web/servlet MockHttpServletRequest.java MockHttpServletResponse.java ServletGetLocaleCommandTestCase.java ServletSetLocaleCommandTestCase.java
martinc 2003/10/17 22:30:19 Modified:chain/src/java/org/apache/commons/chain/generic CopyCommand.java LookupCommand.java RemoveCommand.java chain/src/java/org/apache/commons/chain/impl CatalogBase.java chain/src/java/org/apache/commons/chain/web AbstractGetLocaleCommand.java AbstractSetLocaleCommand.java chain/src/java/org/apache/commons/chain/web/faces FacesGetLocaleCommand.java FacesSetLocaleCommand.java FacesWebContext.java chain/src/java/org/apache/commons/chain/web/portlet PortletGetLocaleCommand.java PortletSessionScopeMap.java PortletSetLocaleCommand.java PortletWebContext.java chain/src/java/org/apache/commons/chain/web/servlet ServletGetLocaleCommand.java ServletSetLocaleCommand.java ServletWebContext.java chain/src/test/org/apache/commons/chain/config ConfigParserTestCase.java TestChain.java TestCommand.java chain/src/test/org/apache/commons/chain/impl AddingCommand.java DelegatingCommand.java DelegatingFilter.java ExceptionCommand.java ExceptionFilter.java NonDelegatingCommand.java NonDelegatingFilter.java chain/src/test/org/apache/commons/chain/web/servlet MockHttpServletRequest.java MockHttpServletResponse.java ServletGetLocaleCommandTestCase.java ServletSetLocaleCommandTestCase.java Log: Replace tabs with spaces. Revision ChangesPath 1.5 +15 -15 jakarta-commons-sandbox/chain/src/java/org/apache/commons/chain/generic/CopyCommand.java Index: CopyCommand.java === RCS file: /home/cvs/jakarta-commons-sandbox/chain/src/java/org/apache/commons/chain/generic/CopyCommand.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- CopyCommand.java 12 Oct 2003 09:10:54 - 1.4 +++ CopyCommand.java 18 Oct 2003 05:30:18 - 1.5 @@ -89,7 +89,7 @@ */ public String getFromKey() { - return (this.fromKey); +return (this.fromKey); } @@ -101,7 +101,7 @@ */ public void setFromKey(String fromKey) { - this.fromKey = fromKey; +this.fromKey = fromKey; } @@ -114,7 +114,7 @@ */ public String getToKey() { - return (this.toKey); +return (this.toKey); } @@ -126,7 +126,7 @@ */ public void setToKey(String toKey) { - this.toKey = toKey; +this.toKey = toKey; } @@ -169,16 +169,16 @@ */ public boolean execute(Context context) throws Exception { - Object value = this.value; +Object value = this.value; if (value == null) { context.get(getFromKey()); } - if (value != null) { - context.put(getToKey(), value); - } else { - context.remove(getToKey()); - } - return (false); +if (value != null) { +context.put(getToKey(), value); +} else { +context.remove(getToKey()); +} +return (false); } 1.5 +31 -31 jakarta-commons-sandbox/chain/src/java/org/apache/commons/chain/generic/LookupCommand.java Index: LookupCommand.java === RCS file: /home/cvs/jakarta-commons-sandbox/chain/src/java/org/apache/commons/chain/generic/LookupCommand.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- LookupCommand.java12 Oct 2003 09:10:54 - 1.4 +++ LookupCommand.java18 Oct 2003 05:30:18 - 1.5 @@ -103,7 +103,7 @@ */ public String getCatalogKey() { - return (this.catalogKey); +return (this.catalogKey); } @@ -116,7 +116,7 @@ */ public void setCatalogKey(String catalogKey) { - this.catalogKey = catalogKey; +this.catalogKey = catalogKey; } @@ -130,7 +130,7 @@ */ public String getName() { - return (this.name); +return (this.name); } @@ -143,7 +143,7 @@ */ public void setName(String name) { - this.name = name; +this.name = name; } @@ -157,7 +157,7 @@ */ public String getNameKey() { - return (this.nameKey); +return (this.nameKey);
DO NOT REPLY [Bug 23839] - cookies aren't working?
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT http://nagoya.apache.org/bugzilla/show_bug.cgi?id=23839. 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=23839 cookies aren't working? --- Additional Comments From [EMAIL PROTECTED] 2003-10-17 06:41 --- RFC 2965 which specifies cookies defines a special handling for local domains, which are extended by a dummy .local to generate a domain name. However, I don't know whether that is implemented in HTTP Client. Try using jadzia.local as the domain. Also, cookies are specified to be sensitive to the port over which they have been sent. Again, I am not sure whether HTTP Client implements port sensitive cookies. If it does, your cookie will only be sent to port 80 unless you specify otherwise. I hope that helps, Roland - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
DO NOT REPLY [Bug 23839] - cookies aren't working?
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT http://nagoya.apache.org/bugzilla/show_bug.cgi?id=23839. 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=23839 cookies aren't working? [EMAIL PROTECTED] changed: What|Removed |Added Status|REOPENED|RESOLVED Resolution||INVALID --- Additional Comments From [EMAIL PROTECTED] 2003-10-17 07:12 --- Yeah, right. But what does the warning message say this time around? WARNING: Invalid cookie state: path not specified I believe it is self-explanatory. The good news is that your domain attribute is just fine. You may want to experiment with CookieSpec#match method to find out what attributes are required for a cookie to match a given host, path, secure attribute and so on. Hope this helps Oleg - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
DO NOT REPLY [Bug 23866] - Invalid cookie causing IllegalArgumentException
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT http://nagoya.apache.org/bugzilla/show_bug.cgi?id=23866. 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=23866 Invalid cookie causing IllegalArgumentException --- Additional Comments From [EMAIL PROTECTED] 2003-10-17 07:22 --- Mike, I just felt that throwing a runtime exception in case of syntactically invalid parameters was not quite right. I would much rather prefer Cookie constructors to throw MalformedCookieException, but we cannot change API at this point. I'll rework the patch in a minute. Oleg - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
DO NOT REPLY [Bug 23839] - cookies aren't working?
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT http://nagoya.apache.org/bugzilla/show_bug.cgi?id=23839. 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=23839 cookies aren't working? --- Additional Comments From [EMAIL PROTECTED] 2003-10-17 08:59 --- Oh my, shame on me. RTFM... read that fine message. I'm gonna try. Thanks. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Cookie Troubles
Hi Oleg, i applied your (second) patch regarding the Exceptions thrown by bad Cookies. I haven't been able to really test it, because today the website doesn't seem to send those Cookies anymore that have been troubling me yesterday. But from looking at the code, the patch should address my problem. The website's Cookies still are not parsed, because they also send invalid date strings, but i cannot expect HttpClient to parse every junk it encounters. I'm happy now, that reponse handling is not aborted because of bad Cookies. Looking forward to pluggable Cookie parsing in HttpClient 2.1. Cheers, Oliver - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
DO NOT REPLY [Bug 23866] - Invalid cookie causing IllegalArgumentException
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT http://nagoya.apache.org/bugzilla/show_bug.cgi?id=23866. 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=23866 Invalid cookie causing IllegalArgumentException --- Additional Comments From [EMAIL PROTECTED] 2003-10-17 09:56 --- Hello Oleg, I don't want to start a religious debate about the use of checked and unchecked exceptions. The policy I have adopted for years after reading an article about the problem is: - unchecked if the caller could have avoided the problem by using the class/method/object correctly, e.g. by passing valid arguments, performing necessary initializations, and so on - unchecked if the problem is outside of the callers control, such as network connectivity, file system errors, and so on Based on this policy, throwing a RuntimeException for bad parameters is appropriate. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
DO NOT REPLY [Bug 15435] - New Preferences Architecture
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT http://nagoya.apache.org/bugzilla/show_bug.cgi?id=15435. 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=15435 New Preferences Architecture --- Additional Comments From [EMAIL PROTECTED] 2003-10-17 16:24 --- Created an attachment (id=8609) Follow-up patch 3 (take 2) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
DO NOT REPLY [Bug 15435] - New Preferences Architecture
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT http://nagoya.apache.org/bugzilla/show_bug.cgi?id=15435. 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=15435 New Preferences Architecture --- Additional Comments From [EMAIL PROTECTED] 2003-10-17 16:26 --- New patch adds receive buffer size parameter for HttpConnection and HttpConnectionManager classes. Folks, any feedback on the follow-up patch 3 so far? Oleg - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: DO NOT REPLY [Bug 15435] - New Preferences Architecture
Hi Oleg, Sorry for being a little slow on this patch. I took a quick look at it a few days ago, but did not have enough time to make any useful comments. I will look again this weekend. Mike [EMAIL PROTECTED] wrote: DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT http://nagoya.apache.org/bugzilla/show_bug.cgi?id=15435. 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=15435 New Preferences Architecture --- Additional Comments From [EMAIL PROTECTED] 2003-10-17 16:26 --- New patch adds receive buffer size parameter for HttpConnection and HttpConnectionManager classes. Folks, any feedback on the follow-up patch 3 so far? Oleg - 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]