You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by "Niall Pemberton (JIRA)" <ji...@apache.org> on 2006/07/23 05:18:14 UTC

[jira] Created: (IO-86) Add FileFinder back into Commons IO

Add FileFinder back into Commons IO
-----------------------------------

                 Key: IO-86
                 URL: http://issues.apache.org/jira/browse/IO-86
             Project: Commons IO
          Issue Type: New Feature
    Affects Versions: 1.2
            Reporter: Niall Pemberton
         Attachments: FileFinder.java, FileFinderTestCase.java

I'd like to propose adding a "FileFinder" back into Commons IO. This is a simplified version of what was recently moved out of Commons IO into the "finder" component currently in the sandbox.

I believe this is a simpler, more generic implementation than the finder component and therefore would be considered suitable for inclusion in Commons IO. Although simpler it could be used as the basis for achieving the finder component's aims - namely to emulate the unix find command.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


[jira] Commented: (IO-86) Add DirectoryWalker based on FileFinder

Posted by "Stephen Colebourne (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/IO-86?page=comments#action_12441483 ] 
            
Stephen Colebourne commented on IO-86:
--------------------------------------

Why a boolean? Firstly, because it reduces the jar file size slightly (each class is an overhead), but secondly because I wanted the handlers to be able to ignore the cancellation request (which they can't do with an exception because its too late by that point).

What you're suggesting now could almost argue for no cancellation behaviour at all - what does CancelledOperation(Exception) give over throwing an IOException directly?

I do agree that the code I checked in doesn't support the internal model of cancellation. This could be fixed by adding a setCancelled() method and a boolean flag. Maybe we are worrying too much about the sync cost of volatile?

> Add DirectoryWalker based on FileFinder
> ---------------------------------------
>
>                 Key: IO-86
>                 URL: http://issues.apache.org/jira/browse/IO-86
>             Project: Commons IO
>          Issue Type: New Feature
>          Components: Utilities
>    Affects Versions: 1.2
>            Reporter: Niall Pemberton
>             Fix For: 1.3
>
>         Attachments: FileFinder.java, FileFinderTestCase.java, io-DirectoryWalker-cancellation-2.patch, io-filefinder-start-end.patch
>
>
> I'd like to propose adding a "FileFinder" back into Commons IO. This is a simplified version of what was recently moved out of Commons IO into the "finder" component currently in the sandbox.
> I believe this is a simpler, more generic implementation than the finder component and therefore would be considered suitable for inclusion in Commons IO. Although simpler it could be used as the basis for achieving the finder component's aims - namely to emulate the unix find command.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


[jira] Commented: (IO-86) Add FileFinder back into Commons IO

Posted by "Henri Yandell (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/IO-86?page=comments#action_12422867 ] 
            
Henri Yandell commented on IO-86:
---------------------------------

Looking in the code - <p> tags in the javadoc need to be correct XHTML.

> Add FileFinder back into Commons IO
> -----------------------------------
>
>                 Key: IO-86
>                 URL: http://issues.apache.org/jira/browse/IO-86
>             Project: Commons IO
>          Issue Type: New Feature
>    Affects Versions: 1.2
>            Reporter: Niall Pemberton
>             Fix For: 1.3
>
>         Attachments: FileFinder.java, FileFinderTestCase.java
>
>
> I'd like to propose adding a "FileFinder" back into Commons IO. This is a simplified version of what was recently moved out of Commons IO into the "finder" component currently in the sandbox.
> I believe this is a simpler, more generic implementation than the finder component and therefore would be considered suitable for inclusion in Commons IO. Although simpler it could be used as the basis for achieving the finder component's aims - namely to emulate the unix find command.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


[jira] Commented: (IO-86) Add DirectoryWalker based on FileFinder

Posted by "Stephen Colebourne (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/IO-86?page=comments#action_12440680 ] 
            
Stephen Colebourne commented on IO-86:
--------------------------------------

Next question. What about exceptions, notably IOException, which is a checked exception. Should DirectoryWalker
- allow each method to throw IOException
- handle them
- leave it up to subclasses to catch them in each individual method.

> Add DirectoryWalker based on FileFinder
> ---------------------------------------
>
>                 Key: IO-86
>                 URL: http://issues.apache.org/jira/browse/IO-86
>             Project: Commons IO
>          Issue Type: New Feature
>          Components: Utilities
>    Affects Versions: 1.2
>            Reporter: Niall Pemberton
>             Fix For: 1.3
>
>         Attachments: FileFinder.java, FileFinderTestCase.java, io-DirectoryWalker-cancellation-2.patch, io-filefinder-start-end.patch
>
>
> I'd like to propose adding a "FileFinder" back into Commons IO. This is a simplified version of what was recently moved out of Commons IO into the "finder" component currently in the sandbox.
> I believe this is a simpler, more generic implementation than the finder component and therefore would be considered suitable for inclusion in Commons IO. Although simpler it could be used as the basis for achieving the finder component's aims - namely to emulate the unix find command.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


[jira] Updated: (IO-86) Add FileFinder back into Commons IO

Posted by "Niall Pemberton (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/IO-86?page=all ]

Niall Pemberton updated IO-86:
------------------------------

    Attachment: FileFinder.java
                FileFinderTestCase.java

> Add FileFinder back into Commons IO
> -----------------------------------
>
>                 Key: IO-86
>                 URL: http://issues.apache.org/jira/browse/IO-86
>             Project: Commons IO
>          Issue Type: New Feature
>    Affects Versions: 1.2
>            Reporter: Niall Pemberton
>         Attachments: FileFinder.java, FileFinderTestCase.java
>
>
> I'd like to propose adding a "FileFinder" back into Commons IO. This is a simplified version of what was recently moved out of Commons IO into the "finder" component currently in the sandbox.
> I believe this is a simpler, more generic implementation than the finder component and therefore would be considered suitable for inclusion in Commons IO. Although simpler it could be used as the basis for achieving the finder component's aims - namely to emulate the unix find command.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


[jira] Commented: (IO-86) Add FileFinder back into Commons IO

Posted by "Henri Yandell (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/IO-86?page=comments#action_12422868 ] 
            
Henri Yandell commented on IO-86:
---------------------------------

I like the API - a nice simplification on the Observer pattern stuff I had. I'd rename the FileCleaner example to something else - we already have a FileCleaner and it's got quite the different functionality. 

Otherwise - +1 to including it. Either make the commit yourself with the fixed <p>'s and FIleCleaner bit, or attach again and I'll happily commit. I'm not sure over the protected methods - are they the right API for the user:

* should the big doDirectory method be private
* should the event methods all be:  handleXxx and not doXxx. 
* should any other event methods exist - start and end of the whole find? 
* should we add the cancel() method that somebody asked for in [finder]. Seems easier with this implementation.

> Add FileFinder back into Commons IO
> -----------------------------------
>
>                 Key: IO-86
>                 URL: http://issues.apache.org/jira/browse/IO-86
>             Project: Commons IO
>          Issue Type: New Feature
>    Affects Versions: 1.2
>            Reporter: Niall Pemberton
>             Fix For: 1.3
>
>         Attachments: FileFinder.java, FileFinderTestCase.java
>
>
> I'd like to propose adding a "FileFinder" back into Commons IO. This is a simplified version of what was recently moved out of Commons IO into the "finder" component currently in the sandbox.
> I believe this is a simpler, more generic implementation than the finder component and therefore would be considered suitable for inclusion in Commons IO. Although simpler it could be used as the basis for achieving the finder component's aims - namely to emulate the unix find command.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


[jira] Updated: (IO-86) Add DirectoryWalker based on FileFinder

Posted by "Stephen Colebourne (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/IO-86?page=all ]

Stephen Colebourne updated IO-86:
---------------------------------

    Component/s: Utilities

> Add DirectoryWalker based on FileFinder
> ---------------------------------------
>
>                 Key: IO-86
>                 URL: http://issues.apache.org/jira/browse/IO-86
>             Project: Commons IO
>          Issue Type: New Feature
>          Components: Utilities
>    Affects Versions: 1.2
>            Reporter: Niall Pemberton
>             Fix For: 1.3
>
>         Attachments: FileFinder.java, FileFinderTestCase.java, io-DirectoryWalker-cancellation-2.patch, io-filefinder-start-end.patch
>
>
> I'd like to propose adding a "FileFinder" back into Commons IO. This is a simplified version of what was recently moved out of Commons IO into the "finder" component currently in the sandbox.
> I believe this is a simpler, more generic implementation than the finder component and therefore would be considered suitable for inclusion in Commons IO. Although simpler it could be used as the basis for achieving the finder component's aims - namely to emulate the unix find command.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


[jira] Commented: (IO-86) Add FileFinder back into Commons IO

Posted by "Stephen Colebourne (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/IO-86?page=comments#action_12422896 ] 
            
Stephen Colebourne commented on IO-86:
--------------------------------------

Hold off any patches for now, I'm working on it...

> Add FileFinder back into Commons IO
> -----------------------------------
>
>                 Key: IO-86
>                 URL: http://issues.apache.org/jira/browse/IO-86
>             Project: Commons IO
>          Issue Type: New Feature
>    Affects Versions: 1.2
>            Reporter: Niall Pemberton
>             Fix For: 1.3
>
>         Attachments: FileFinder.java, FileFinderTestCase.java, io-filefinder-start-end.patch
>
>
> I'd like to propose adding a "FileFinder" back into Commons IO. This is a simplified version of what was recently moved out of Commons IO into the "finder" component currently in the sandbox.
> I believe this is a simpler, more generic implementation than the finder component and therefore would be considered suitable for inclusion in Commons IO. Although simpler it could be used as the basis for achieving the finder component's aims - namely to emulate the unix find command.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


[jira] Commented: (IO-86) Add DirectoryWalker based on FileFinder

Posted by "Stephen Colebourne (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/IO-86?page=comments#action_12435308 ] 
            
Stephen Colebourne commented on IO-86:
--------------------------------------

Should we have cancel() functionality in DirectoryWalker?

This could be achieved by having a volatile boolean cancel flag and a cancel method. However there would be a performance penalty for systems that don't need this (volatile is a part sync).

We could leave cancel out of DirecoryWalker, as its easy to add to subclasses - check the cancel flag at the start of handleFile and in handleDirectory.

I think I'd prefer this to be a subclasses responsibility.

> Add DirectoryWalker based on FileFinder
> ---------------------------------------
>
>                 Key: IO-86
>                 URL: http://issues.apache.org/jira/browse/IO-86
>             Project: Commons IO
>          Issue Type: New Feature
>    Affects Versions: 1.2
>            Reporter: Niall Pemberton
>             Fix For: 1.3
>
>         Attachments: FileFinder.java, FileFinderTestCase.java, io-filefinder-start-end.patch
>
>
> I'd like to propose adding a "FileFinder" back into Commons IO. This is a simplified version of what was recently moved out of Commons IO into the "finder" component currently in the sandbox.
> I believe this is a simpler, more generic implementation than the finder component and therefore would be considered suitable for inclusion in Commons IO. Although simpler it could be used as the basis for achieving the finder component's aims - namely to emulate the unix find command.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


[jira] Commented: (IO-86) Add FileFinder back into Commons IO

Posted by "Stephen Colebourne (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/IO-86?page=comments#action_12422889 ] 
            
Stephen Colebourne commented on IO-86:
--------------------------------------

Its only a small addition to [io] and appears to make sense now.

One minor nit is that the most of the [io] code doesn't use XHTML, but instead:
  Para1
  <p>
  Para2
  <p>
  Para3
This is done to make the javadoc more readable when viewing it as source. 

I also think that there should be some way to perform subclass processing before and after the find.

> Add FileFinder back into Commons IO
> -----------------------------------
>
>                 Key: IO-86
>                 URL: http://issues.apache.org/jira/browse/IO-86
>             Project: Commons IO
>          Issue Type: New Feature
>    Affects Versions: 1.2
>            Reporter: Niall Pemberton
>             Fix For: 1.3
>
>         Attachments: FileFinder.java, FileFinderTestCase.java
>
>
> I'd like to propose adding a "FileFinder" back into Commons IO. This is a simplified version of what was recently moved out of Commons IO into the "finder" component currently in the sandbox.
> I believe this is a simpler, more generic implementation than the finder component and therefore would be considered suitable for inclusion in Commons IO. Although simpler it could be used as the basis for achieving the finder component's aims - namely to emulate the unix find command.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


[jira] Commented: (IO-86) Add DirectoryWalker based on FileFinder

Posted by "Niall Pemberton (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/IO-86?page=comments#action_12436582 ] 
            
Niall Pemberton commented on IO-86:
-----------------------------------

Providing something for cancellation is a good idea, but I agree we shouldn't introduce any performance penalty when many implementations may not require it. How about putting in some of the plumbing to facilitate this, but leave out implementing the cancel flag - just have an isCancelled() method that returns false that people can then override/implement in whatever way they want?

> Add DirectoryWalker based on FileFinder
> ---------------------------------------
>
>                 Key: IO-86
>                 URL: http://issues.apache.org/jira/browse/IO-86
>             Project: Commons IO
>          Issue Type: New Feature
>    Affects Versions: 1.2
>            Reporter: Niall Pemberton
>             Fix For: 1.3
>
>         Attachments: FileFinder.java, FileFinderTestCase.java, io-filefinder-start-end.patch
>
>
> I'd like to propose adding a "FileFinder" back into Commons IO. This is a simplified version of what was recently moved out of Commons IO into the "finder" component currently in the sandbox.
> I believe this is a simpler, more generic implementation than the finder component and therefore would be considered suitable for inclusion in Commons IO. Although simpler it could be used as the basis for achieving the finder component's aims - namely to emulate the unix find command.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


[jira] Updated: (IO-86) Add DirectoryWalker based on FileFinder

Posted by "Niall Pemberton (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/IO-86?page=all ]

Niall Pemberton updated IO-86:
------------------------------

    Attachment: io-DirectoryWalker-cancellation-3.patch

OK I don't buy the jar size argument :) - but the second point about ignoring cancellation requests is valid, which is why I proposed removing those checks and the isCancelled() method. You're right though it doesn't leave much - except a bit of plumbing that makes it slightly easier for people to implement.

What CancellationException gives you is 1) The ability to trap that behaviour and 2) extend the behaviour to pass additional info to the handleCancelled() method. I also think that using an exception improves the readability/simplicity of the class and gives people the option to choose where in the DirectoryWalker structure to implement cancellation decision logic.

Following your comments about exceptions I now think we sould add IOException to every method and have the cancel exception extend IOException.

Attaching a patch with what I'd like to see it look like - haven't updated the class javadocs or tests, will do if this gets agreement.

> Add DirectoryWalker based on FileFinder
> ---------------------------------------
>
>                 Key: IO-86
>                 URL: http://issues.apache.org/jira/browse/IO-86
>             Project: Commons IO
>          Issue Type: New Feature
>          Components: Utilities
>    Affects Versions: 1.2
>            Reporter: Niall Pemberton
>             Fix For: 1.3
>
>         Attachments: FileFinder.java, FileFinderTestCase.java, io-DirectoryWalker-cancellation-3.patch, io-filefinder-start-end.patch
>
>
> I'd like to propose adding a "FileFinder" back into Commons IO. This is a simplified version of what was recently moved out of Commons IO into the "finder" component currently in the sandbox.
> I believe this is a simpler, more generic implementation than the finder component and therefore would be considered suitable for inclusion in Commons IO. Although simpler it could be used as the basis for achieving the finder component's aims - namely to emulate the unix find command.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


[jira] Commented: (IO-86) Add DirectoryWalker based on FileFinder

Posted by "Niall Pemberton (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/IO-86?page=comments#action_12441815 ] 
            
Niall Pemberton commented on IO-86:
-----------------------------------

I see using an exception as a better mechanism for stopping the processing (unwinding from the recursively called walk method) - dropping straight out. Primarily it simplifies the walk() method by not having to to have the "lifecycle" methods return a boolean which is then checked after each of the methods that can indicate a "cancellation". This in my view makes the class easier to understand, simpler and more elegant. It also means that any of the "lifecycle" methods can initiate the cancellation and the user is not tied to a particular strategy we have decided. I think this point is important - we shouldn't have any checks for cancellation - the user puts as many/few checks as they want in whatever places.

I don't understand your point about hidden dangers of a user implementing cancellation - anyone creating an implementation needs to understand how this class works and if we javadoc it well enough it should be reasonably clear what they need to do. I'm happy to put effort into that until you think it good enough. I also don't agree with your point about the exception being good design internally, but not externally. Its just a control mechanism to stop processing - no different in my mind than using booleans - just more elegant. It works both ways.

If we do a full cancellation implementation that is geared only for cancellation by external processes then I think we limit the potential use of this implementation. My first use for this is not in a multi-threaded situation and cancellation would be internally initiated.

I don't mind adding getters/setters for a "volatile" boolean cancelled indicator (presuming that volatile variables only have a performance hit when accessed - have't ever used them myself before) - and even a convenience method that checks and throws the cancellation execption - as long as we leave it for the user to implement the decision logic in the place that they want and the manner that they want it. That way we provode a powerful framework class that works in either circumstances (cancellation initiated either by an external process or internally).

> Add DirectoryWalker based on FileFinder
> ---------------------------------------
>
>                 Key: IO-86
>                 URL: http://issues.apache.org/jira/browse/IO-86
>             Project: Commons IO
>          Issue Type: New Feature
>          Components: Utilities
>    Affects Versions: 1.2
>            Reporter: Niall Pemberton
>             Fix For: 1.3
>
>         Attachments: FileFinder.java, FileFinderTestCase.java, io-DirectoryWalker-cancellation-3.patch, io-filefinder-start-end.patch
>
>
> I'd like to propose adding a "FileFinder" back into Commons IO. This is a simplified version of what was recently moved out of Commons IO into the "finder" component currently in the sandbox.
> I believe this is a simpler, more generic implementation than the finder component and therefore would be considered suitable for inclusion in Commons IO. Although simpler it could be used as the basis for achieving the finder component's aims - namely to emulate the unix find command.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


[jira] Commented: (IO-86) Add DirectoryWalker based on FileFinder

Posted by "Stephen Colebourne (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/IO-86?page=comments#action_12447997 ] 
            
Stephen Colebourne commented on IO-86:
--------------------------------------

I may also need to add the collection of results to the exception. Without it, the code that receives the exception can't see the files that have been processed unless it created the collection itself (which most clients won't do)

> Add DirectoryWalker based on FileFinder
> ---------------------------------------
>
>                 Key: IO-86
>                 URL: http://issues.apache.org/jira/browse/IO-86
>             Project: Commons IO
>          Issue Type: New Feature
>          Components: Utilities
>    Affects Versions: 1.2
>            Reporter: Niall Pemberton
>             Fix For: 1.3
>
>         Attachments: FileFinder.java, FileFinderTestCase.java, io-DirectoryWalker-cancellation-3.patch, io-filefinder-start-end.patch, io.patch
>
>
> I'd like to propose adding a "FileFinder" back into Commons IO. This is a simplified version of what was recently moved out of Commons IO into the "finder" component currently in the sandbox.
> I believe this is a simpler, more generic implementation than the finder component and therefore would be considered suitable for inclusion in Commons IO. Although simpler it could be used as the basis for achieving the finder component's aims - namely to emulate the unix find command.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


[jira] Commented: (IO-86) Add DirectoryWalker based on FileFinder

Posted by "Stephen Colebourne (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/IO-86?page=comments#action_12441581 ] 
            
Stephen Colebourne commented on IO-86:
--------------------------------------

This is beginning to feel like a can of worms.

With the exception/handleCancelled combination, why do we need handleCancelled? We are asking the user to write all the logic to determmine cancellation and handle it by throwing the exception, so why not handle the cancellation fully at that point? Is there enough benefit to justify the combination?

Also, I think that there may be a hidden danger/issue. A user writing a public cancel method to be called in another thread may just throw CancellationException and expect the operation to end, which of course it won't. Instead, they have to write all the boolean handling logic to trap in the directory and file levels of the looping. My point here is that while an exception is probably the right design choice in a single-threaded world for this problem, it doesn't strike me as such in a muti-threaded world.

Perhaps this can be javadoced so users only throw CancellationException from the right thread, but it surely makes the class riskier.

You are correct though in saying that it would allow more data to be transferred to handleCancelled(). This can be worked around using instance variables in the subclass, or handling at the point of identifying the problem. At this point, we hit a problem of not having real-life users yet.

So, my preferred solution is to add the boolean cancelled field to DirectoryWalker together with a setCancelled(boolean) method. This means a full cancel solution is provided (which is a nice value add for the class), and documented, but doesn't prevent a subclass using an exception to achieve the same effect if it desires.

> Add DirectoryWalker based on FileFinder
> ---------------------------------------
>
>                 Key: IO-86
>                 URL: http://issues.apache.org/jira/browse/IO-86
>             Project: Commons IO
>          Issue Type: New Feature
>          Components: Utilities
>    Affects Versions: 1.2
>            Reporter: Niall Pemberton
>             Fix For: 1.3
>
>         Attachments: FileFinder.java, FileFinderTestCase.java, io-DirectoryWalker-cancellation-3.patch, io-filefinder-start-end.patch
>
>
> I'd like to propose adding a "FileFinder" back into Commons IO. This is a simplified version of what was recently moved out of Commons IO into the "finder" component currently in the sandbox.
> I believe this is a simpler, more generic implementation than the finder component and therefore would be considered suitable for inclusion in Commons IO. Although simpler it could be used as the basis for achieving the finder component's aims - namely to emulate the unix find command.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


[jira] Closed: (IO-86) Add DirectoryWalker based on FileFinder

Posted by "Stephen Colebourne (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/IO-86?page=all ]

Stephen Colebourne closed IO-86.
--------------------------------

    Resolution: Fixed

I'm closing this, as I think its done to everyones satisfaction now.

> Add DirectoryWalker based on FileFinder
> ---------------------------------------
>
>                 Key: IO-86
>                 URL: http://issues.apache.org/jira/browse/IO-86
>             Project: Commons IO
>          Issue Type: New Feature
>          Components: Utilities
>    Affects Versions: 1.2
>            Reporter: Niall Pemberton
>             Fix For: 1.3
>
>         Attachments: FileFinder.java, FileFinderTestCase.java, io-DirectoryWalker-cancellation-3.patch, io-filefinder-start-end.patch, io.patch
>
>
> I'd like to propose adding a "FileFinder" back into Commons IO. This is a simplified version of what was recently moved out of Commons IO into the "finder" component currently in the sandbox.
> I believe this is a simpler, more generic implementation than the finder component and therefore would be considered suitable for inclusion in Commons IO. Although simpler it could be used as the basis for achieving the finder component's aims - namely to emulate the unix find command.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


[jira] Commented: (IO-86) Add DirectoryWalker based on FileFinder

Posted by "Niall Pemberton (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/IO-86?page=comments#action_12440737 ] 
            
Niall Pemberton commented on IO-86:
-----------------------------------

IMO using an Exception to control the cancellation process was a (slightly) more elegant way to implement that behaviour. It also provides a more extensible mechanism for cancellations originating from within DirectoryWalker - since it can be thrown from any of the methods and custom implementations of CancelledOperation can be used to pass additional information to the handleCancelled() method.

I envisaged two scenarios for cancellation - "externally" by another thread and "internally" from within a DirectoryWalker implementation. The isCancelled() method was solely for the former, but I'm starting to think that this doesn't add much (one dummy method and 2 checks) and it would be better to just let users put in cancelled checks and throw exceptions wherever they want. Doing this makes DirectoryWalker a simpler class - which is a good thing IMO.

What was the reason for replacing the use of an exception with a boolean - was it just stylistic or do you have reasons of substance? Anyway my preference would be to revert to (alomost) my original patch - without isCancelled() and the 2 checks.

Good point about exceptions - I think we should declare them on each method - then implementations can choose what to do with them when they implement a call to the top walk() method. limiting them to just IOExceptions seems narrow, since implementations may want to throw all sorts of exceptions, not just IOExceptions.

> Add DirectoryWalker based on FileFinder
> ---------------------------------------
>
>                 Key: IO-86
>                 URL: http://issues.apache.org/jira/browse/IO-86
>             Project: Commons IO
>          Issue Type: New Feature
>          Components: Utilities
>    Affects Versions: 1.2
>            Reporter: Niall Pemberton
>             Fix For: 1.3
>
>         Attachments: FileFinder.java, FileFinderTestCase.java, io-DirectoryWalker-cancellation-2.patch, io-filefinder-start-end.patch
>
>
> I'd like to propose adding a "FileFinder" back into Commons IO. This is a simplified version of what was recently moved out of Commons IO into the "finder" component currently in the sandbox.
> I believe this is a simpler, more generic implementation than the finder component and therefore would be considered suitable for inclusion in Commons IO. Although simpler it could be used as the basis for achieving the finder component's aims - namely to emulate the unix find command.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


[jira] Commented: (IO-86) Add FileFinder back into Commons IO

Posted by "Henri Yandell (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/IO-86?page=comments#action_12426974 ] 
            
Henri Yandell commented on IO-86:
---------------------------------

On Mario's VFS comment:

I suspect we'll never have IO depending on VFS - it's lower level architectually; but having Finder dependent on a VFSWalker (in addition to IO's TreeWalker) seems like a great idea. 

> Add FileFinder back into Commons IO
> -----------------------------------
>
>                 Key: IO-86
>                 URL: http://issues.apache.org/jira/browse/IO-86
>             Project: Commons IO
>          Issue Type: New Feature
>    Affects Versions: 1.2
>            Reporter: Niall Pemberton
>             Fix For: 1.3
>
>         Attachments: FileFinder.java, FileFinderTestCase.java, io-filefinder-start-end.patch
>
>
> I'd like to propose adding a "FileFinder" back into Commons IO. This is a simplified version of what was recently moved out of Commons IO into the "finder" component currently in the sandbox.
> I believe this is a simpler, more generic implementation than the finder component and therefore would be considered suitable for inclusion in Commons IO. Although simpler it could be used as the basis for achieving the finder component's aims - namely to emulate the unix find command.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


[jira] Commented: (IO-86) Add FileFinder back into Commons IO

Posted by "Niall Pemberton (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/IO-86?page=comments#action_12422926 ] 
            
Niall Pemberton commented on IO-86:
-----------------------------------

I'm happy with the changes you made, except for a couple of minor points wrt to DirectoryWalker:

1) I think the handleDirectoryEnd() method should be within the "if (process)" check - so that its not executed if handleDirectoryStart() returns false.
2) How about returning the result List from the handleEnd() method? That would make it easy if someone wanted to process the results further and return a different List instance if they required:

    protected List handleEnd(List results) {
        // do nothing - overridable by subclass
        return results;
    }

On the issue of whether FileFinder is now needed or not - I agree it adds minimal value - except as an example DirectoryWalker implementation. I don't mind if you get rid of it or not.

Niall


> Add FileFinder back into Commons IO
> -----------------------------------
>
>                 Key: IO-86
>                 URL: http://issues.apache.org/jira/browse/IO-86
>             Project: Commons IO
>          Issue Type: New Feature
>    Affects Versions: 1.2
>            Reporter: Niall Pemberton
>             Fix For: 1.3
>
>         Attachments: FileFinder.java, FileFinderTestCase.java, io-filefinder-start-end.patch
>
>
> I'd like to propose adding a "FileFinder" back into Commons IO. This is a simplified version of what was recently moved out of Commons IO into the "finder" component currently in the sandbox.
> I believe this is a simpler, more generic implementation than the finder component and therefore would be considered suitable for inclusion in Commons IO. Although simpler it could be used as the basis for achieving the finder component's aims - namely to emulate the unix find command.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


[jira] Updated: (IO-86) Add DirectoryWalker based on FileFinder

Posted by "Niall Pemberton (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/IO-86?page=all ]

Niall Pemberton updated IO-86:
------------------------------

    Attachment: io-DirectoryWalker-cancellation-2.patch

Revised patch for cancel functionality

> Add DirectoryWalker based on FileFinder
> ---------------------------------------
>
>                 Key: IO-86
>                 URL: http://issues.apache.org/jira/browse/IO-86
>             Project: Commons IO
>          Issue Type: New Feature
>    Affects Versions: 1.2
>            Reporter: Niall Pemberton
>             Fix For: 1.3
>
>         Attachments: FileFinder.java, FileFinderTestCase.java, io-DirectoryWalker-cancellation-2.patch, io-filefinder-start-end.patch
>
>
> I'd like to propose adding a "FileFinder" back into Commons IO. This is a simplified version of what was recently moved out of Commons IO into the "finder" component currently in the sandbox.
> I believe this is a simpler, more generic implementation than the finder component and therefore would be considered suitable for inclusion in Commons IO. Although simpler it could be used as the basis for achieving the finder component's aims - namely to emulate the unix find command.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


[jira] Updated: (IO-86) Add DirectoryWalker based on FileFinder

Posted by "Niall Pemberton (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/IO-86?page=all ]

Niall Pemberton updated IO-86:
------------------------------

    Attachment: io-DirectoryWalker-cancellation.patch

Adding a patch for "cancellation processing plumbing"

> Add DirectoryWalker based on FileFinder
> ---------------------------------------
>
>                 Key: IO-86
>                 URL: http://issues.apache.org/jira/browse/IO-86
>             Project: Commons IO
>          Issue Type: New Feature
>    Affects Versions: 1.2
>            Reporter: Niall Pemberton
>             Fix For: 1.3
>
>         Attachments: FileFinder.java, FileFinderTestCase.java, io-DirectoryWalker-cancellation.patch, io-filefinder-start-end.patch
>
>
> I'd like to propose adding a "FileFinder" back into Commons IO. This is a simplified version of what was recently moved out of Commons IO into the "finder" component currently in the sandbox.
> I believe this is a simpler, more generic implementation than the finder component and therefore would be considered suitable for inclusion in Commons IO. Although simpler it could be used as the basis for achieving the finder component's aims - namely to emulate the unix find command.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


[jira] Commented: (IO-86) Add FileFinder back into Commons IO

Posted by "Mario Ivankovits (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/IO-86?page=comments#action_12422927 ] 
            
Mario Ivankovits commented on IO-86:
------------------------------------

Hmmm ... I liked the idea to have a separate component like finder which can become a complicated piece of code. Later I thought we can refactor out the filesystem access (in particula java.io.File) into its own "mini-VFS" class which will be used through a factory so we can plugin VFS into Finder.

But maybe we can do this in IO too, can we?

> Add FileFinder back into Commons IO
> -----------------------------------
>
>                 Key: IO-86
>                 URL: http://issues.apache.org/jira/browse/IO-86
>             Project: Commons IO
>          Issue Type: New Feature
>    Affects Versions: 1.2
>            Reporter: Niall Pemberton
>             Fix For: 1.3
>
>         Attachments: FileFinder.java, FileFinderTestCase.java, io-filefinder-start-end.patch
>
>
> I'd like to propose adding a "FileFinder" back into Commons IO. This is a simplified version of what was recently moved out of Commons IO into the "finder" component currently in the sandbox.
> I believe this is a simpler, more generic implementation than the finder component and therefore would be considered suitable for inclusion in Commons IO. Although simpler it could be used as the basis for achieving the finder component's aims - namely to emulate the unix find command.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


[jira] Commented: (IO-86) Add DirectoryWalker based on FileFinder

Posted by "Niall Pemberton (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/IO-86?page=comments#action_12447992 ] 
            
Niall Pemberton commented on IO-86:
-----------------------------------

I'm happy with what you propose.

As a side note, although my first planned real use for this is in a non multi-threaded task (a scheduled job for spidering some files) I had a play with it and JDK 1.6 and it worked v.nicely - theres a new Desktop class with which you can open/edit files using the native application associated with the file type e.g. pdf files open in Acrobat Reader

   http://download.java.net/jdk6/docs/api/java/awt/Desktop.html

The combination of FileFilters, DirectoryWalker and Desktop look like a good combination - I haven't used Lucene, but add in text search and that would be a powerful cross platform app - maybe candidate for a lab?


> Add DirectoryWalker based on FileFinder
> ---------------------------------------
>
>                 Key: IO-86
>                 URL: http://issues.apache.org/jira/browse/IO-86
>             Project: Commons IO
>          Issue Type: New Feature
>          Components: Utilities
>    Affects Versions: 1.2
>            Reporter: Niall Pemberton
>             Fix For: 1.3
>
>         Attachments: FileFinder.java, FileFinderTestCase.java, io-DirectoryWalker-cancellation-3.patch, io-filefinder-start-end.patch, io.patch
>
>
> I'd like to propose adding a "FileFinder" back into Commons IO. This is a simplified version of what was recently moved out of Commons IO into the "finder" component currently in the sandbox.
> I believe this is a simpler, more generic implementation than the finder component and therefore would be considered suitable for inclusion in Commons IO. Although simpler it could be used as the basis for achieving the finder component's aims - namely to emulate the unix find command.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


[jira] Updated: (IO-86) Add DirectoryWalker based on FileFinder

Posted by "Stephen Colebourne (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/IO-86?page=all ]

Stephen Colebourne updated IO-86:
---------------------------------

    Summary: Add DirectoryWalker based on FileFinder  (was: Add FileFinder back into Commons IO)

> Add DirectoryWalker based on FileFinder
> ---------------------------------------
>
>                 Key: IO-86
>                 URL: http://issues.apache.org/jira/browse/IO-86
>             Project: Commons IO
>          Issue Type: New Feature
>    Affects Versions: 1.2
>            Reporter: Niall Pemberton
>             Fix For: 1.3
>
>         Attachments: FileFinder.java, FileFinderTestCase.java, io-filefinder-start-end.patch
>
>
> I'd like to propose adding a "FileFinder" back into Commons IO. This is a simplified version of what was recently moved out of Commons IO into the "finder" component currently in the sandbox.
> I believe this is a simpler, more generic implementation than the finder component and therefore would be considered suitable for inclusion in Commons IO. Although simpler it could be used as the basis for achieving the finder component's aims - namely to emulate the unix find command.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


[jira] Updated: (IO-86) Add DirectoryWalker based on FileFinder

Posted by "Niall Pemberton (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/IO-86?page=all ]

Niall Pemberton updated IO-86:
------------------------------

    Attachment:     (was: io-DirectoryWalker-cancellation-2.patch)

> Add DirectoryWalker based on FileFinder
> ---------------------------------------
>
>                 Key: IO-86
>                 URL: http://issues.apache.org/jira/browse/IO-86
>             Project: Commons IO
>          Issue Type: New Feature
>          Components: Utilities
>    Affects Versions: 1.2
>            Reporter: Niall Pemberton
>             Fix For: 1.3
>
>         Attachments: FileFinder.java, FileFinderTestCase.java, io-DirectoryWalker-cancellation-3.patch, io-filefinder-start-end.patch
>
>
> I'd like to propose adding a "FileFinder" back into Commons IO. This is a simplified version of what was recently moved out of Commons IO into the "finder" component currently in the sandbox.
> I believe this is a simpler, more generic implementation than the finder component and therefore would be considered suitable for inclusion in Commons IO. Although simpler it could be used as the basis for achieving the finder component's aims - namely to emulate the unix find command.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


[jira] Commented: (IO-86) Add FileFinder back into Commons IO

Posted by "Stephen Colebourne (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/IO-86?page=comments#action_12422902 ] 
            
Stephen Colebourne commented on IO-86:
--------------------------------------

I've committed a more radical change to the finder. If people don't like it, then it can be backed out.

FileFinder was suffering from doing two tasks - finding files and being a generic mechanism for altering files. The impact of this was that the example deleter would have a public method 'find' that deleted half your filing system! Not a good thing.

I created a new abstract class DirectoryWalker which handles the generic directory walking. FileFinder is then a specific subclass.

My problem now is that FileFinder doesn't do any more than FileUtils.listFiles(filter). So why do we need it?

PS. DirectoryWalker could use a test class, but I'm out of time now. And my mail server is down...

> Add FileFinder back into Commons IO
> -----------------------------------
>
>                 Key: IO-86
>                 URL: http://issues.apache.org/jira/browse/IO-86
>             Project: Commons IO
>          Issue Type: New Feature
>    Affects Versions: 1.2
>            Reporter: Niall Pemberton
>             Fix For: 1.3
>
>         Attachments: FileFinder.java, FileFinderTestCase.java, io-filefinder-start-end.patch
>
>
> I'd like to propose adding a "FileFinder" back into Commons IO. This is a simplified version of what was recently moved out of Commons IO into the "finder" component currently in the sandbox.
> I believe this is a simpler, more generic implementation than the finder component and therefore would be considered suitable for inclusion in Commons IO. Although simpler it could be used as the basis for achieving the finder component's aims - namely to emulate the unix find command.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


[jira] Updated: (IO-86) Add FileFinder back into Commons IO

Posted by "Niall Pemberton (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/IO-86?page=all ]

Niall Pemberton updated IO-86:
------------------------------

    Attachment: io-filefinder-start-end.patch

I originally had the javadoc not using XHTML and changed it following Henri's comment. I'm happy to switch it back, but will wait until there is agreement.

Subclass processing before and after the find can be achieved either by overriding the find(File) method and inserting before/after processing around a call to super.find(file) - or by putting the code in the handleStartDirectory()/handleEndDirectory() methods and checking that the "depth=0". Is this not enough?

If not  I'm attaching a patch to add handleFindStart() / handleFindEnd() methods - let me know if you think it suitable.


> Add FileFinder back into Commons IO
> -----------------------------------
>
>                 Key: IO-86
>                 URL: http://issues.apache.org/jira/browse/IO-86
>             Project: Commons IO
>          Issue Type: New Feature
>    Affects Versions: 1.2
>            Reporter: Niall Pemberton
>             Fix For: 1.3
>
>         Attachments: FileFinder.java, FileFinderTestCase.java, io-filefinder-start-end.patch
>
>
> I'd like to propose adding a "FileFinder" back into Commons IO. This is a simplified version of what was recently moved out of Commons IO into the "finder" component currently in the sandbox.
> I believe this is a simpler, more generic implementation than the finder component and therefore would be considered suitable for inclusion in Commons IO. Although simpler it could be used as the basis for achieving the finder component's aims - namely to emulate the unix find command.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


[jira] Updated: (IO-86) Add DirectoryWalker based on FileFinder

Posted by "Niall Pemberton (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/IO-86?page=all ]

Niall Pemberton updated IO-86:
------------------------------

    Attachment:     (was: io-DirectoryWalker-cancellation.patch)

> Add DirectoryWalker based on FileFinder
> ---------------------------------------
>
>                 Key: IO-86
>                 URL: http://issues.apache.org/jira/browse/IO-86
>             Project: Commons IO
>          Issue Type: New Feature
>    Affects Versions: 1.2
>            Reporter: Niall Pemberton
>             Fix For: 1.3
>
>         Attachments: FileFinder.java, FileFinderTestCase.java, io-DirectoryWalker-cancellation-2.patch, io-filefinder-start-end.patch
>
>
> I'd like to propose adding a "FileFinder" back into Commons IO. This is a simplified version of what was recently moved out of Commons IO into the "finder" component currently in the sandbox.
> I believe this is a simpler, more generic implementation than the finder component and therefore would be considered suitable for inclusion in Commons IO. Although simpler it could be used as the basis for achieving the finder component's aims - namely to emulate the unix find command.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


[jira] Commented: (IO-86) Add FileFinder back into Commons IO

Posted by "Niall Pemberton (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/IO-86?page=comments#action_12423131 ] 
            
Niall Pemberton commented on IO-86:
-----------------------------------

I've deleted the FileFinder implementation and re-named FileFinderTestCase to DirectoryWalkerTestCase.

I've also made the following changes to DirectoryWalker:
  - Change DirectoryWalker methods to use a Collection rather than List for the results
  - Move the handleDirectoryEnd() method within the "process" check
  - Change method signature for "walk" to walk(File, Collection) - that way the implementation used for results is not fixed by DirectoryWalker

> Add FileFinder back into Commons IO
> -----------------------------------
>
>                 Key: IO-86
>                 URL: http://issues.apache.org/jira/browse/IO-86
>             Project: Commons IO
>          Issue Type: New Feature
>    Affects Versions: 1.2
>            Reporter: Niall Pemberton
>             Fix For: 1.3
>
>         Attachments: FileFinder.java, FileFinderTestCase.java, io-filefinder-start-end.patch
>
>
> I'd like to propose adding a "FileFinder" back into Commons IO. This is a simplified version of what was recently moved out of Commons IO into the "finder" component currently in the sandbox.
> I believe this is a simpler, more generic implementation than the finder component and therefore would be considered suitable for inclusion in Commons IO. Although simpler it could be used as the basis for achieving the finder component's aims - namely to emulate the unix find command.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


[jira] Updated: (IO-86) Add FileFinder back into Commons IO

Posted by "Niall Pemberton (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/IO-86?page=all ]

Niall Pemberton updated IO-86:
------------------------------

    Attachment:     (was: FileFinderTestCase.java)

> Add FileFinder back into Commons IO
> -----------------------------------
>
>                 Key: IO-86
>                 URL: http://issues.apache.org/jira/browse/IO-86
>             Project: Commons IO
>          Issue Type: New Feature
>    Affects Versions: 1.2
>            Reporter: Niall Pemberton
>         Attachments: FileFinder.java, FileFinderTestCase.java
>
>
> I'd like to propose adding a "FileFinder" back into Commons IO. This is a simplified version of what was recently moved out of Commons IO into the "finder" component currently in the sandbox.
> I believe this is a simpler, more generic implementation than the finder component and therefore would be considered suitable for inclusion in Commons IO. Although simpler it could be used as the basis for achieving the finder component's aims - namely to emulate the unix find command.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


[jira] Commented: (IO-86) Add FileFinder back into Commons IO

Posted by "Niall Pemberton (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/IO-86?page=comments#action_12422871 ] 
            
Niall Pemberton commented on IO-86:
-----------------------------------

OK I've commited this with the following changes:
- changed method names from doXxxx to handleXxxx
- made handleDirectory() method private
- javadoc corrected to XHTML
- renamed the FileCleaner example to FileDelete

I'll leave this JIRA issue open for the moment, in case there are comments/objections

> Add FileFinder back into Commons IO
> -----------------------------------
>
>                 Key: IO-86
>                 URL: http://issues.apache.org/jira/browse/IO-86
>             Project: Commons IO
>          Issue Type: New Feature
>    Affects Versions: 1.2
>            Reporter: Niall Pemberton
>             Fix For: 1.3
>
>         Attachments: FileFinder.java, FileFinderTestCase.java
>
>
> I'd like to propose adding a "FileFinder" back into Commons IO. This is a simplified version of what was recently moved out of Commons IO into the "finder" component currently in the sandbox.
> I believe this is a simpler, more generic implementation than the finder component and therefore would be considered suitable for inclusion in Commons IO. Although simpler it could be used as the basis for achieving the finder component's aims - namely to emulate the unix find command.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


[jira] Commented: (IO-86) Add FileFinder back into Commons IO

Posted by "Stephen Colebourne (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/IO-86?page=comments#action_12423207 ] 
            
Stephen Colebourne commented on IO-86:
--------------------------------------

One role for FileFinder would be if it had lots of set methods to setup the file filters to use. I'm not sure how viable that would be (random idea...)

I agree with the change to Collection.

For the handleDirectoryEnd(), I wonder if we should add a handleDirectory() method which returns the boolean. Thus the calls would be:
if (handleDirectory == true) {
  handleDirectoryStart
  ...
  handleDirectoryEnd
}

> Add FileFinder back into Commons IO
> -----------------------------------
>
>                 Key: IO-86
>                 URL: http://issues.apache.org/jira/browse/IO-86
>             Project: Commons IO
>          Issue Type: New Feature
>    Affects Versions: 1.2
>            Reporter: Niall Pemberton
>             Fix For: 1.3
>
>         Attachments: FileFinder.java, FileFinderTestCase.java, io-filefinder-start-end.patch
>
>
> I'd like to propose adding a "FileFinder" back into Commons IO. This is a simplified version of what was recently moved out of Commons IO into the "finder" component currently in the sandbox.
> I believe this is a simpler, more generic implementation than the finder component and therefore would be considered suitable for inclusion in Commons IO. Although simpler it could be used as the basis for achieving the finder component's aims - namely to emulate the unix find command.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


[jira] Updated: (IO-86) Add FileFinder back into Commons IO

Posted by "Niall Pemberton (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/IO-86?page=all ]

Niall Pemberton updated IO-86:
------------------------------

    Attachment: FileFinderTestCase.java

> Add FileFinder back into Commons IO
> -----------------------------------
>
>                 Key: IO-86
>                 URL: http://issues.apache.org/jira/browse/IO-86
>             Project: Commons IO
>          Issue Type: New Feature
>    Affects Versions: 1.2
>            Reporter: Niall Pemberton
>         Attachments: FileFinder.java, FileFinderTestCase.java
>
>
> I'd like to propose adding a "FileFinder" back into Commons IO. This is a simplified version of what was recently moved out of Commons IO into the "finder" component currently in the sandbox.
> I believe this is a simpler, more generic implementation than the finder component and therefore would be considered suitable for inclusion in Commons IO. Although simpler it could be used as the basis for achieving the finder component's aims - namely to emulate the unix find command.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


[jira] Updated: (IO-86) Add FileFinder back into Commons IO

Posted by "Henri Yandell (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/IO-86?page=all ]

Henri Yandell updated IO-86:
----------------------------

    Fix Version/s: 1.3

No reason not to have this on the 1.3 list I think.

> Add FileFinder back into Commons IO
> -----------------------------------
>
>                 Key: IO-86
>                 URL: http://issues.apache.org/jira/browse/IO-86
>             Project: Commons IO
>          Issue Type: New Feature
>    Affects Versions: 1.2
>            Reporter: Niall Pemberton
>             Fix For: 1.3
>
>         Attachments: FileFinder.java, FileFinderTestCase.java
>
>
> I'd like to propose adding a "FileFinder" back into Commons IO. This is a simplified version of what was recently moved out of Commons IO into the "finder" component currently in the sandbox.
> I believe this is a simpler, more generic implementation than the finder component and therefore would be considered suitable for inclusion in Commons IO. Although simpler it could be used as the basis for achieving the finder component's aims - namely to emulate the unix find command.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


[jira] Commented: (IO-86) Add DirectoryWalker based on FileFinder

Posted by "Stephen Colebourne (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/IO-86?page=comments#action_12441855 ] 
            
Stephen Colebourne commented on IO-86:
--------------------------------------

It sounds like you have a use case for this which I don't have at present. I suggest that you commit your code and we make minor tweaks from there. The aim should be simple internal and external cancellation, well documented. Oh and can we ensure the exception class ends in 'Exception'?

BTW, I think that the performance of one volatile boolean relative to an IO operation is going to be absolutely insignificant!

> Add DirectoryWalker based on FileFinder
> ---------------------------------------
>
>                 Key: IO-86
>                 URL: http://issues.apache.org/jira/browse/IO-86
>             Project: Commons IO
>          Issue Type: New Feature
>          Components: Utilities
>    Affects Versions: 1.2
>            Reporter: Niall Pemberton
>             Fix For: 1.3
>
>         Attachments: FileFinder.java, FileFinderTestCase.java, io-DirectoryWalker-cancellation-3.patch, io-filefinder-start-end.patch
>
>
> I'd like to propose adding a "FileFinder" back into Commons IO. This is a simplified version of what was recently moved out of Commons IO into the "finder" component currently in the sandbox.
> I believe this is a simpler, more generic implementation than the finder component and therefore would be considered suitable for inclusion in Commons IO. Although simpler it could be used as the basis for achieving the finder component's aims - namely to emulate the unix find command.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


[jira] Commented: (IO-86) Add DirectoryWalker based on FileFinder

Posted by "Stephen Colebourne (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/IO-86?page=comments#action_12440679 ] 
            
Stephen Colebourne commented on IO-86:
--------------------------------------

I've comitted a change for cancellation based on this patch but without the exception. I used a boolean instead. It also allows cancellation to be ignored if required.



> Add DirectoryWalker based on FileFinder
> ---------------------------------------
>
>                 Key: IO-86
>                 URL: http://issues.apache.org/jira/browse/IO-86
>             Project: Commons IO
>          Issue Type: New Feature
>          Components: Utilities
>    Affects Versions: 1.2
>            Reporter: Niall Pemberton
>             Fix For: 1.3
>
>         Attachments: FileFinder.java, FileFinderTestCase.java, io-DirectoryWalker-cancellation-2.patch, io-filefinder-start-end.patch
>
>
> I'd like to propose adding a "FileFinder" back into Commons IO. This is a simplified version of what was recently moved out of Commons IO into the "finder" component currently in the sandbox.
> I believe this is a simpler, more generic implementation than the finder component and therefore would be considered suitable for inclusion in Commons IO. Although simpler it could be used as the basis for achieving the finder component's aims - namely to emulate the unix find command.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


[jira] Updated: (IO-86) Add DirectoryWalker based on FileFinder

Posted by "Stephen Colebourne (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/IO-86?page=all ]

Stephen Colebourne updated IO-86:
---------------------------------

    Attachment: io.patch

After some consideration, I would like to add in a little more structure for the external use case of cancellation. Niall, I believe that this actually fits with your original proposal.

This patch adds a handleIsCancelled() method, but leaves the implementation up to the subclass. The subclass is still free to ignore this method and do their own thing if they need to, but IMO this method simplifies the cross thread collaboration for most external cancellation use cases.

If adopted, a test is needed for this patch.

> Add DirectoryWalker based on FileFinder
> ---------------------------------------
>
>                 Key: IO-86
>                 URL: http://issues.apache.org/jira/browse/IO-86
>             Project: Commons IO
>          Issue Type: New Feature
>          Components: Utilities
>    Affects Versions: 1.2
>            Reporter: Niall Pemberton
>             Fix For: 1.3
>
>         Attachments: FileFinder.java, FileFinderTestCase.java, io-DirectoryWalker-cancellation-3.patch, io-filefinder-start-end.patch, io.patch
>
>
> I'd like to propose adding a "FileFinder" back into Commons IO. This is a simplified version of what was recently moved out of Commons IO into the "finder" component currently in the sandbox.
> I believe this is a simpler, more generic implementation than the finder component and therefore would be considered suitable for inclusion in Commons IO. Although simpler it could be used as the basis for achieving the finder component's aims - namely to emulate the unix find command.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


[jira] Commented: (IO-86) Add DirectoryWalker based on FileFinder

Posted by "Niall Pemberton (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/IO-86?page=comments#action_12441912 ] 
            
Niall Pemberton commented on IO-86:
-----------------------------------

OK, changed committed. IMO internal and external cancellation are now well documented and the exception is called "CancelException".

> Add DirectoryWalker based on FileFinder
> ---------------------------------------
>
>                 Key: IO-86
>                 URL: http://issues.apache.org/jira/browse/IO-86
>             Project: Commons IO
>          Issue Type: New Feature
>          Components: Utilities
>    Affects Versions: 1.2
>            Reporter: Niall Pemberton
>             Fix For: 1.3
>
>         Attachments: FileFinder.java, FileFinderTestCase.java, io-DirectoryWalker-cancellation-3.patch, io-filefinder-start-end.patch
>
>
> I'd like to propose adding a "FileFinder" back into Commons IO. This is a simplified version of what was recently moved out of Commons IO into the "finder" component currently in the sandbox.
> I believe this is a simpler, more generic implementation than the finder component and therefore would be considered suitable for inclusion in Commons IO. Although simpler it could be used as the basis for achieving the finder component's aims - namely to emulate the unix find command.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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