Re: [csv] CSVRecord implements Map

2014-01-16 Thread sebb
On 17 January 2014 00:57, Gary Gregory  wrote:
> On Thu, Jan 16, 2014 at 7:24 PM, sebb  wrote:
>
>> On 16 January 2014 20:58, Gary Gregory  wrote:
>> > On Thu, Jan 16, 2014 at 7:49 AM, Emmanuel Bourg 
>> wrote:
>> >
>> >> Le 15/01/2014 14:04, Gary Gregory a écrit :
>> >>
>> >> > Uh, I want to go the other way around. See my use case.
>> >>
>> >> Why isn't this suitable to your use case? You could write:
>> >>
>> >>factory.create(record.toMap());
>> >>
>> >> and then remove the create(CSVRecord) method with the duplicated
>> >> implementation.
>> >>
>> >> What am I missing?
>> >>
>> >
>> > That would work. What is still not clean or OO is that toMap() means
>> > nothing when no headers are defined.
>> >
>> > I've split the record into a mapped record subclass here:
>> >
>> > https://issues.apache.org/jira/browse/CSV-104
>> >
>> > Thoughts?
>> >
>> > We can still have toMap() implemented on top of the code now, but it
>> would
>> > have to return null if there are no headers.
>>
>> Why not return an empty Map?
>>
>
> An empty map is, well, empty but the record is not empty, so that's kinda
> confusing,

Depends on the method Javadoc whether it is confusing or not.

If toMap() is defined to return the empty Map if there are no column
names, then that is clear to me.

AFAICT an empty map cannot be generated otherwise.

Or is there a situation where an empty map means something usefully
distinct from no header names?

> whereas null is clearly something that does exist. If toMap() is
> only in the subclass, then there is no problem.
>
> The alternative is to create a real map with columns name "Column1",
> "Column2", and so on. But then that would be confusing because
> record.get("Column1) would give you null whereas
> record.toMap().get("Column1") would give you a value. Then we get to talk
> about having "Column1", "Column2"... as the default column names if none
> are provided... kinda too clever.

Yuk.

> All of this to say that over time it is likely as we need to provide more
> APIs, and it seems easier to say null than an empty structure. First
> toMap(), then toProperties() and so on.

I don't think that follows.

> The KISS solution is toMap() -> null for unmapped records IMO.

IMO the empty map is better.

> Gary
>
>
>>
>> > Gary
>> >
>> >
>> >>
>> >> Emmanuel Bourg
>> >>
>> >>
>> >> -
>> >> To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
>> >> For additional commands, e-mail: dev-h...@commons.apache.org
>> >>
>> >>
>> >
>> >
>> > --
>> > E-Mail: garydgreg...@gmail.com | ggreg...@apache.org
>> > Java Persistence with Hibernate, Second Edition<
>> http://www.manning.com/bauer3/>
>> > JUnit in Action, Second Edition 
>> > Spring Batch in Action 
>> > Blog: http://garygregory.wordpress.com
>> > Home: http://garygregory.com/
>> > Tweet! http://twitter.com/GaryGregory
>>
>> -
>> To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
>> For additional commands, e-mail: dev-h...@commons.apache.org
>>
>>
>
>
> --
> E-Mail: garydgreg...@gmail.com | ggreg...@apache.org
> Java Persistence with Hibernate, Second 
> Edition
> JUnit in Action, Second Edition 
> Spring Batch in Action 
> Blog: http://garygregory.wordpress.com
> Home: http://garygregory.com/
> Tweet! http://twitter.com/GaryGregory

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[continuum] BUILD FAILURE: Apache Commons JCS - Apache Commons (Group (shared) Maven 3 Build Definition (Java 1.6))

2014-01-16 Thread Apache Continuum
Online report : 
https://continuum-ci.apache.org/continuum/buildResult.action?buildId=27814&projectId=286

Build statistics:
  State: Failed
  Previous Build: No previous build.
  Started at: Fri 17 Jan 2014 01:21:47 +
  Finished at: Fri 17 Jan 2014 01:25:23 +
  Total time: 3m 35s
  Build Trigger: Forced
  Build Number: 1
  Exit code: 1
  Building machine hostname: continuum-vm
  Operating system : Linux(unknown)
  Java Home version : 
  java version "1.6.0_27"
  OpenJDK Runtime Environment (IcedTea6 1.12.6) 
(6b27-1.12.6-1ubuntu0.12.04.4)
  OpenJDK 64-Bit Server VM (build 20.0-b12, mixed mode)

  Builder version :
  Apache Maven 3.0.5 (r01de14724cdef164cd33c7c8c2fe155faf9602da; 
2013-02-19 13:51:28+)
  Maven home: /opt/apache-maven-3.0.5
  Java version: 1.6.0_27, vendor: Sun Microsystems Inc.
  Java home: /usr/lib/jvm/java-6-openjdk-amd64/jre
  Default locale: en_US, platform encoding: ANSI_X3.4-1968
  OS name: "linux", version: "3.2.0-53-generic", arch: "amd64", family: 
"unix"


SCM Changes:

No files changed


Dependencies Changes:

No dependencies changed



Build Definition:

POM filename: pom.xml
Goals: clean deploy   
Arguments: --batch-mode -Pjava-1.6 -Dgpg.skip -Prelease
Build Fresh: false
Always Build: false
Default Build Definition: true
Schedule: COMMONS_SCHEDULE
Profile Name: Maven 3.0.5
Description: Group (shared) Maven 3 Build Definition (Java 1.6)


Test Summary:

Tests: 403
Failures: 6
Errors: 0
Success Rate: 98
Total time: 142.242


Test Failures:


BasicRemoteCacheClientServerUnitTest
testSinglePut :
  junit.framework.AssertionFailedError
  junit.framework.AssertionFailedError: Wrong number of puts expected:<1> but 
was:<0>
at junit.framework.Assert.fail(Assert.java:47)
at junit.framework.Assert.failNotEquals(Assert.java:282)
at junit.framework.Assert.assertEquals(Assert.java:64)
at junit.framework.Assert.assertEquals(Assert.java:201)
at 
org.apache.commons.jcs.auxiliary.remote.server.BasicRemoteCacheClientServerUnitTest.testSinglePut(BasicRemoteCacheClientServerUnitTest.java:94)


testPutRemove :
  junit.framework.AssertionFailedError
  junit.framework.AssertionFailedError: Wrong number of puts expected:<1> but 
was:<0>
at junit.framework.Assert.fail(Assert.java:47)
at junit.framework.Assert.failNotEquals(Assert.java:282)
at junit.framework.Assert.assertEquals(Assert.java:64)
at junit.framework.Assert.assertEquals(Assert.java:201)
at 
org.apache.commons.jcs.auxiliary.remote.server.BasicRemoteCacheClientServerUnitTest.testPutRemove(BasicRemoteCacheClientServerUnitTest.java:133)


testPutAndListen :
  junit.framework.AssertionFailedError
  junit.framework.AssertionFailedError: Wrong number of puts expected:<1> but 
was:<0>
at junit.framework.Assert.fail(Assert.java:47)
at junit.framework.Assert.failNotEquals(Assert.java:282)
at junit.framework.Assert.assertEquals(Assert.java:64)
at junit.framework.Assert.assertEquals(Assert.java:201)
at 
org.apache.commons.jcs.auxiliary.remote.server.BasicRemoteCacheClientServerUnitTest.testPutAndListen(BasicRemoteCacheClientServerUnitTest.java:182)


testPutaMultipleAndListen :
  junit.framework.AssertionFailedError
  junit.framework.AssertionFailedError: Wrong number of puts expected:<100> but 
was:<0>
at junit.framework.Assert.fail(Assert.java:47)
at junit.framework.Assert.failNotEquals(Assert.java:282)
at junit.framework.Assert.assertEquals(Assert.java:64)
at junit.framework.Assert.assertEquals(Assert.java:201)
at 
org.apache.commons.jcs.auxiliary.remote.server.BasicRemoteCacheClientServerUnitTest.testPutaMultipleAndListen(BasicRemoteCacheClientServerUnitTest.java:226)


  FileDiskCacheUnitTest
testRemoveIfLimitIsSetAndReached_Reached :
  junit.framework.AssertionFailedError
  junit.framework.AssertionFailedError: Should be null.
at junit.framework.Assert.fail(Assert.java:47)
at junit.framework.Assert.assertTrue(Assert.java:20)
at junit.framework.Assert.assertNull(Assert.java:233)
at 
org.apache.commons

Re: [csv] CSVRecord implements Map

2014-01-16 Thread Gary Gregory
On Thu, Jan 16, 2014 at 7:24 PM, sebb  wrote:

> On 16 January 2014 20:58, Gary Gregory  wrote:
> > On Thu, Jan 16, 2014 at 7:49 AM, Emmanuel Bourg 
> wrote:
> >
> >> Le 15/01/2014 14:04, Gary Gregory a écrit :
> >>
> >> > Uh, I want to go the other way around. See my use case.
> >>
> >> Why isn't this suitable to your use case? You could write:
> >>
> >>factory.create(record.toMap());
> >>
> >> and then remove the create(CSVRecord) method with the duplicated
> >> implementation.
> >>
> >> What am I missing?
> >>
> >
> > That would work. What is still not clean or OO is that toMap() means
> > nothing when no headers are defined.
> >
> > I've split the record into a mapped record subclass here:
> >
> > https://issues.apache.org/jira/browse/CSV-104
> >
> > Thoughts?
> >
> > We can still have toMap() implemented on top of the code now, but it
> would
> > have to return null if there are no headers.
>
> Why not return an empty Map?
>

An empty map is, well, empty but the record is not empty, so that's kinda
confusing, whereas null is clearly something that does exist. If toMap() is
only in the subclass, then there is no problem.

The alternative is to create a real map with columns name "Column1",
"Column2", and so on. But then that would be confusing because
record.get("Column1) would give you null whereas
record.toMap().get("Column1") would give you a value. Then we get to talk
about having "Column1", "Column2"... as the default column names if none
are provided... kinda too clever.

All of this to say that over time it is likely as we need to provide more
APIs, and it seems easier to say null than an empty structure. First
toMap(), then toProperties() and so on.

The KISS solution is toMap() -> null for unmapped records IMO.

Gary


>
> > Gary
> >
> >
> >>
> >> Emmanuel Bourg
> >>
> >>
> >> -
> >> To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
> >> For additional commands, e-mail: dev-h...@commons.apache.org
> >>
> >>
> >
> >
> > --
> > E-Mail: garydgreg...@gmail.com | ggreg...@apache.org
> > Java Persistence with Hibernate, Second Edition<
> http://www.manning.com/bauer3/>
> > JUnit in Action, Second Edition 
> > Spring Batch in Action 
> > Blog: http://garygregory.wordpress.com
> > Home: http://garygregory.com/
> > Tweet! http://twitter.com/GaryGregory
>
> -
> To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
> For additional commands, e-mail: dev-h...@commons.apache.org
>
>


-- 
E-Mail: garydgreg...@gmail.com | ggreg...@apache.org
Java Persistence with Hibernate, Second Edition
JUnit in Action, Second Edition 
Spring Batch in Action 
Blog: http://garygregory.wordpress.com
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory


Re: [VFS] Fix up pom so it works with Commons release profile

2014-01-16 Thread Gary Gregory
Sebb,

Please modify the POMs and whatever else as you see fit.

It sure would be nice to release 2.1.

Gary


On Thu, Jan 16, 2014 at 7:22 PM, sebb  wrote:

> At present, the VFS poms use the "apache-release" profile from the
> Apache pom, and override some bits of it that don't suit Commons.
>
> However, this is also done by the Commons parent pom which provides
> its own "release" profile.
>
> This is not ideal as VFS uses a different process for releasing code
> from all other Commons components.
>
> VFS is a multi-module project, which makes it a bit trickier to deal
> with assemblies etc.
>
> However as far as I can tell, it is relatively simple to fix VFS.
>
> Change VFS parent pom to disable the assembly plugin for itself and
> all inheriting poms
>
> Change VFS distribution pom to re-enable the assembly plugin and
> change the profile "apache-release" to "release"
>
> -
> To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
> For additional commands, e-mail: dev-h...@commons.apache.org
>
>


-- 
E-Mail: garydgreg...@gmail.com | ggreg...@apache.org
Java Persistence with Hibernate, Second Edition
JUnit in Action, Second Edition 
Spring Batch in Action 
Blog: http://garygregory.wordpress.com
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory


Re: [csv] CSVRecord implements Map

2014-01-16 Thread sebb
On 16 January 2014 20:58, Gary Gregory  wrote:
> On Thu, Jan 16, 2014 at 7:49 AM, Emmanuel Bourg  wrote:
>
>> Le 15/01/2014 14:04, Gary Gregory a écrit :
>>
>> > Uh, I want to go the other way around. See my use case.
>>
>> Why isn't this suitable to your use case? You could write:
>>
>>factory.create(record.toMap());
>>
>> and then remove the create(CSVRecord) method with the duplicated
>> implementation.
>>
>> What am I missing?
>>
>
> That would work. What is still not clean or OO is that toMap() means
> nothing when no headers are defined.
>
> I've split the record into a mapped record subclass here:
>
> https://issues.apache.org/jira/browse/CSV-104
>
> Thoughts?
>
> We can still have toMap() implemented on top of the code now, but it would
> have to return null if there are no headers.

Why not return an empty Map?

> Gary
>
>
>>
>> Emmanuel Bourg
>>
>>
>> -
>> To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
>> For additional commands, e-mail: dev-h...@commons.apache.org
>>
>>
>
>
> --
> E-Mail: garydgreg...@gmail.com | ggreg...@apache.org
> Java Persistence with Hibernate, Second 
> Edition
> JUnit in Action, Second Edition 
> Spring Batch in Action 
> Blog: http://garygregory.wordpress.com
> Home: http://garygregory.com/
> Tweet! http://twitter.com/GaryGregory

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[VFS] Fix up pom so it works with Commons release profile

2014-01-16 Thread sebb
At present, the VFS poms use the "apache-release" profile from the
Apache pom, and override some bits of it that don't suit Commons.

However, this is also done by the Commons parent pom which provides
its own "release" profile.

This is not ideal as VFS uses a different process for releasing code
from all other Commons components.

VFS is a multi-module project, which makes it a bit trickier to deal
with assemblies etc.

However as far as I can tell, it is relatively simple to fix VFS.

Change VFS parent pom to disable the assembly plugin for itself and
all inheriting poms

Change VFS distribution pom to re-enable the assembly plugin and
change the profile "apache-release" to "release"

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



Re: [csv] CSVRecord implements Map

2014-01-16 Thread Emmanuel Bourg
Le 16/01/2014 21:58, Gary Gregory a écrit :

> That would work. What is still not clean or OO is that toMap() means
> nothing when no headers are defined.

Well, so be it.


> I've split the record into a mapped record subclass here:
> 
> https://issues.apache.org/jira/browse/CSV-104
> 
> Thoughts?

I'm not sure to like it. I assume a header is used in a majority of
cases, so people will end up using CSVMappedRecord almost exclusively
and that won't make a big difference with the current CSVRecord.

Also, I had some hope to later be able to parametrize the format and
have an automatic object creation on parsing (using annotations).
Something like:

CSVFormat format = CSVFormat.DEFAULT.withType(Person.class);
for (Person person : format.parse(in)) {
...
}

It's ruined by the record type parameter on CSVFormat.


> We can still have toMap() implemented on top of the code now, but it would
> have to return null if there are no headers.

That's fine for me.

Emmanuel Bourg


-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



Re: [csv] CSVRecord implements Map

2014-01-16 Thread Gary Gregory
On Thu, Jan 16, 2014 at 7:49 AM, Emmanuel Bourg  wrote:

> Le 15/01/2014 14:04, Gary Gregory a écrit :
>
> > Uh, I want to go the other way around. See my use case.
>
> Why isn't this suitable to your use case? You could write:
>
>factory.create(record.toMap());
>
> and then remove the create(CSVRecord) method with the duplicated
> implementation.
>
> What am I missing?
>

That would work. What is still not clean or OO is that toMap() means
nothing when no headers are defined.

I've split the record into a mapped record subclass here:

https://issues.apache.org/jira/browse/CSV-104

Thoughts?

We can still have toMap() implemented on top of the code now, but it would
have to return null if there are no headers.

Gary


>
> Emmanuel Bourg
>
>
> -
> To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
> For additional commands, e-mail: dev-h...@commons.apache.org
>
>


-- 
E-Mail: garydgreg...@gmail.com | ggreg...@apache.org
Java Persistence with Hibernate, Second Edition
JUnit in Action, Second Edition 
Spring Batch in Action 
Blog: http://garygregory.wordpress.com
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory


[VOTE] Release Compress 1.7 based on RC2

2014-01-16 Thread Stefan Bodewig
Hi all

compared to RC1 there is no code change only the Javadocs of the
_internal package are even more discouraging and the directory tree
insite the tarballs/zips should hold the correct version number.

Compress 1.7 RC2 is available for review here:
https://dist.apache.org/repos/dist/dev/commons/compress/
(svn revision 4100)

  Maven artifacts are here:

https://repository.apache.org/content/repositories/orgapachecommons-1002/org/apache/commons/commons-compress/1.7/

  Details of changes since 1.7 are in the release notes:
https://dist.apache.org/repos/dist/dev/commons/compress/RELEASE-NOTES.txt
http://people.apache.org/~bodewig/cc-1.7/changes-report.html

  I have tested this with JDK 1.6 and 1.7 using maven3.

  The tag is here:

http://svn.apache.org/repos/asf/commons/proper/compress/tags/COMPRESS-1.7-RC2/
(svn revision 1558773)

  Site:
http://people.apache.org/~bodewig/cc-1.7/
  (note I will create a Javadocs for 1.7, take a look at the trunk
javadocs for now - and this is not going to be the website I'll
publish after the release, I'll merge the canges made in the tag and
build the site again from trunk)

  Clirr Report (compared to 1.6):
http://people.apache.org/~bodewig/cc-1.7/clirr-report.html

  RAT Report:
http://people.apache.org/~bodewig/cc-1.7/rat-report.html

  KEYS:
  http://www.apache.org/dist/commons/KEYS
  
  Please review the release candidate and vote.
  This vote will close no sooner that 72 hours from now, i.e. after 2000
  GMT 19-January 2014

  [ ] +1 Release these artifacts
  [ ] +0 OK, but...
  [ ] -0 OK, but really should fix...
  [ ] -1 I oppose this release because...

Stefan

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



Re: [csv] CSVRecord implements Map

2014-01-16 Thread Emmanuel Bourg
Le 15/01/2014 14:04, Gary Gregory a écrit :

> Uh, I want to go the other way around. See my use case.

Why isn't this suitable to your use case? You could write:

   factory.create(record.toMap());

and then remove the create(CSVRecord) method with the duplicated
implementation.

What am I missing?

Emmanuel Bourg


-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



Re: [csv] CSVRecord implements Map

2014-01-16 Thread Emmanuel Bourg
Le 16/01/2014 07:04, Gary Gregory a écrit :

> Thoughts?

I don't mind improving how the internal state of CSVRecord is stored,
but that shouldn't cause a regression in the usability and make it
harder to access the record by key or by index.

I don't think the size of a CSVRecord is really an issue. The actual
mapping is already shared between the instances, and a CSVRecord is a
very short lived object in general.

Emmanuel Bourg


-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



Fwd: ApacheCon NA 2014 Travel Assistance Applications now open!

2014-01-16 Thread sebb
-- Forwarded message --
From: lewis john mcgibbney 
Date: 15 January 2014 16:41
Subject: ApacheCon NA 2014 Travel Assistance Applications now open!
To: p...@apache.org
Cc: travel-assista...@apache.org


To: p...@apache.org
Reply-To: travel-assista...@apache.org

Hi pmcs@,

The Travel Assistance Committee (TAC) are pleased to announce that travel
assistance applications for ApacheCon North America 2014 are now open! This
announcement serves as a purpose for you (pmcs@) to let members of your
community know about both ApacheConNA 2014 and about the TAC assistance to
attend. Could you please forward this announcement to your community, along
if possible with information on how your project is involved in ApacheCon
this year?

ApacheConNA will be held in Denver, Colorado, April 7-9, 2014.

TAC exists to help those that would like to attend ApacheCon events, but
are unable to do so for financial reasons. For more info on this years
applications and qualifying criteria please visit the TAC website at <
http://www.apache.org/travel/ >.   Applications are already open, so don't
delay!

*The important date*...

   - Friday February 7th 2014 - TAC applications close.

Applicants have until the the closing date above to submit their
applications (which should contain as much supporting material as required
to efficiently and accurately process your request), this will enable TAC
to announce successful awards shortly afterwards.

As usual TAC expects to deal with a range of applications from a diverse
range of backgrounds. We therefore encourage (as always) anyone thinking
about sending in an application to do so ASAP.

We look forward to greeting everyone in Denver, Colorado in April.

Kind Regards

Lewis

(On behalf of the Travel Assistance Committee)

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



Re: [csv] CSVRecord implements Map

2014-01-16 Thread Adrian Crum

CSVRecordMap implements Map {
CSVRecordMap(CSVRecord record) {
}
}

Use the Map implementation to access the record in a Map-like way, use 
the CSVRecord instance to access the record in a List-like way.


Adrian Crum
Sandglass Software
www.sandglass-software.com

On 1/16/2014 1:04 AM, Gary Gregory wrote:

Maybe we _should_ revisit splitting the record class. Now, we have the
following slots:

CSVRecord:
comment : String
mapping : Map
recordNumber : long
values : String[]

If we take out mapping and put in it a subclass, that reduces the "size" of
the plain record by 25%:

CSVRecord:
comment : String
recordNumber : long
values : String[]

CSVRecordMap extends CSVRecord
mapping : Map

or:

CSVRecordMap extends CSVRecord implements Map
mapping : Map


Thoughts?

Gary


On Wed, Jan 15, 2014 at 11:22 AM, Emmanuel Bourg  wrote:


Le 15/01/2014 07:17, Benedikt Ritter a écrit :

A wrapper of some kind like Adrian suggested sounds like the way to go
here. Maybe we could have something like:

Map map = CSVRecordUtils.toMap(record);


I had something like that in mind too, but I would rather use
record.toMap() and avoid exposing a new class.

Emmanuel Bourg


-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org







-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org