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/21 05:23:14 UTC

[jira] Created: (SANDBOX-159) [finder] Make FileFilter implementations public classes in their own package.

[finder] Make FileFilter implementations public classes in their own package.
-----------------------------------------------------------------------------

                 Key: SANDBOX-159
                 URL: http://issues.apache.org/jira/browse/SANDBOX-159
             Project: Commons Sandbox
          Issue Type: Improvement
          Components: Finder
            Reporter: Niall Pemberton
         Attachments: finder-filters-package.txt

I'm attaching a patch which extracts the FileFilter implementations out of the FindingFilter class into a separate "filters" package. This will allow them to be re-used in conjunction with a new CompositeFilter.

I've created a new CompositeFilter implementation (which FindingFilter is now based on) which can do AND or OR processing which I think will allow quite powerful FileFilter implementations to be created - since CompositeFilters themselves can be used as component FileFilters for more complex CompositeFilters.

For example to select files which are less than 1MB and have been modified in the last 20 days

    CompositeFilter filter1 = new CompositeFilter(false, true);
    filter1.addFilter(new SizeFilter(false, "-1m"));
    filter1.addFilter(new TimeFilter(false, 20, false));

As a by-product IMO it will also make creating test cases for the individual FileFilter implementations easier.

-- 
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: (SANDBOX-159) [finder] Make FileFilter implementations public classes in their own package.

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

Sorry, only just read your comment after I commited it all in one go. I've summarized additional changes below:

I've removed the dependency on Commons IO (see comments below on NameFilter and PathFilter).

The extracted FileFilter implementations also have the following changes/corrections:

1) Created new AbstractFileFilter and CompositeFilter classes
2) EmptyFilter now checks that directories contain no files
3) SizeFilter has switched to using bytes (from blocks) and caters for specifying sizes in Byes, KB, MG and GB. It also can now do "equals", "less than" and "greater than"
4) NameFilter - removed the dependency on Commons IO (by copying the 2 methods used from FilenameUtils) - same for PathFilter which now extends NameFilter.
5) RegexFilter now caches the java.util.regex.Pattern
6) All the FileFilter implementations are now Serializable

I modified Finder and FindingFilter to use static versions of CanReadFilter, CanWriteFilter, EmptyFilter and TypeFilter and also changed FindingFilter so that FileFilter implementations could be passed in through the "options" Map. FindingFilter now extends the new CompositeFilter class.

I also corrected a couple of mistakes (incorrect method names) in FileFinderTest and changed it so that it still works with the above changes.

> [finder] Make FileFilter implementations public classes in their own package.
> -----------------------------------------------------------------------------
>
>                 Key: SANDBOX-159
>                 URL: http://issues.apache.org/jira/browse/SANDBOX-159
>             Project: Commons Sandbox
>          Issue Type: Improvement
>          Components: Finder
>            Reporter: Niall Pemberton
>         Attachments: finder-filters-package.txt
>
>
> I'm attaching a patch which extracts the FileFilter implementations out of the FindingFilter class into a separate "filters" package. This will allow them to be re-used in conjunction with a new CompositeFilter.
> I've created a new CompositeFilter implementation (which FindingFilter is now based on) which can do AND or OR processing which I think will allow quite powerful FileFilter implementations to be created - since CompositeFilters themselves can be used as component FileFilters for more complex CompositeFilters.
> For example to select files which are less than 1MB and have been modified in the last 20 days
>     CompositeFilter filter1 = new CompositeFilter(false, true);
>     filter1.addFilter(new SizeFilter(false, "-1m"));
>     filter1.addFilter(new TimeFilter(false, 20, false));
> As a by-product IMO it will also make creating test cases for the individual FileFilter implementations easier.

-- 
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: (SANDBOX-159) [finder] Make FileFilter implementations public classes in their own package.

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

Niall Pemberton updated SANDBOX-159:
------------------------------------

    Attachment: finder-filters-package.txt

> [finder] Make FileFilter implementations public classes in their own package.
> -----------------------------------------------------------------------------
>
>                 Key: SANDBOX-159
>                 URL: http://issues.apache.org/jira/browse/SANDBOX-159
>             Project: Commons Sandbox
>          Issue Type: Improvement
>          Components: Finder
>            Reporter: Niall Pemberton
>         Attachments: finder-filters-package.txt
>
>
> I'm attaching a patch which extracts the FileFilter implementations out of the FindingFilter class into a separate "filters" package. This will allow them to be re-used in conjunction with a new CompositeFilter.
> I've created a new CompositeFilter implementation (which FindingFilter is now based on) which can do AND or OR processing which I think will allow quite powerful FileFilter implementations to be created - since CompositeFilters themselves can be used as component FileFilters for more complex CompositeFilters.
> For example to select files which are less than 1MB and have been modified in the last 20 days
>     CompositeFilter filter1 = new CompositeFilter(false, true);
>     filter1.addFilter(new SizeFilter(false, "-1m"));
>     filter1.addFilter(new TimeFilter(false, 20, false));
> As a by-product IMO it will also make creating test cases for the individual FileFilter implementations easier.

-- 
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: (SANDBOX-159) [finder] Make FileFilter implementations public classes in their own package.

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

Henri Yandell closed SANDBOX-159.
---------------------------------

    Resolution: Fixed

I think this is a finished issue.

> [finder] Make FileFilter implementations public classes in their own package.
> -----------------------------------------------------------------------------
>
>                 Key: SANDBOX-159
>                 URL: http://issues.apache.org/jira/browse/SANDBOX-159
>             Project: Commons Sandbox
>          Issue Type: Improvement
>          Components: Finder
>            Reporter: Niall Pemberton
>         Attachments: finder-filters-package.txt
>
>
> I'm attaching a patch which extracts the FileFilter implementations out of the FindingFilter class into a separate "filters" package. This will allow them to be re-used in conjunction with a new CompositeFilter.
> I've created a new CompositeFilter implementation (which FindingFilter is now based on) which can do AND or OR processing which I think will allow quite powerful FileFilter implementations to be created - since CompositeFilters themselves can be used as component FileFilters for more complex CompositeFilters.
> For example to select files which are less than 1MB and have been modified in the last 20 days
>     CompositeFilter filter1 = new CompositeFilter(false, true);
>     filter1.addFilter(new SizeFilter(false, "-1m"));
>     filter1.addFilter(new TimeFilter(false, 20, false));
> As a by-product IMO it will also make creating test cases for the individual FileFilter implementations easier.

-- 
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: (SANDBOX-159) [finder] Make FileFilter implementations public classes in their own package.

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

+1, go for it.

Looks like there are a few different types of things fixed - so commits per action would be good if possible.

> [finder] Make FileFilter implementations public classes in their own package.
> -----------------------------------------------------------------------------
>
>                 Key: SANDBOX-159
>                 URL: http://issues.apache.org/jira/browse/SANDBOX-159
>             Project: Commons Sandbox
>          Issue Type: Improvement
>          Components: Finder
>            Reporter: Niall Pemberton
>         Attachments: finder-filters-package.txt
>
>
> I'm attaching a patch which extracts the FileFilter implementations out of the FindingFilter class into a separate "filters" package. This will allow them to be re-used in conjunction with a new CompositeFilter.
> I've created a new CompositeFilter implementation (which FindingFilter is now based on) which can do AND or OR processing which I think will allow quite powerful FileFilter implementations to be created - since CompositeFilters themselves can be used as component FileFilters for more complex CompositeFilters.
> For example to select files which are less than 1MB and have been modified in the last 20 days
>     CompositeFilter filter1 = new CompositeFilter(false, true);
>     filter1.addFilter(new SizeFilter(false, "-1m"));
>     filter1.addFilter(new TimeFilter(false, 20, false));
> As a by-product IMO it will also make creating test cases for the individual FileFilter implementations easier.

-- 
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