[jira] [Created] (VFS-400) Selector based on regular expressions

classic Classic list List threaded Threaded
13 messages Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Created] (VFS-400) Selector based on regular expressions

ASF GitHub Bot (Jira)
Selector based on regular expressions
-------------------------------------

                 Key: VFS-400
                 URL: https://issues.apache.org/jira/browse/VFS-400
             Project: Commons VFS
          Issue Type: New Feature
    Affects Versions: 2.1
            Reporter: Rikard Oxenstrand
            Priority: Minor


In the long todo list there was a post about adding a file selector based on regular expressions. I had need for that for a specific project so I built a simple class that seems to work. I'm kind of new to open source contribution though so I'm not sure if i should just commit it to trunk. Here is the code:
{code:title=Bar.java|borderStyle=solid}
/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.apache.commons.vfs2;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * A {@link FileSelector} that selects based on regular expressions matched against base filename.
 *
 * @since 2.1
 */
public class FileRegexSelector implements FileSelector
{

    /**
     * The extensions to select.
     */
    private Pattern pattern = null;

    /**
     * Creates a new selector for the given extensions.
     *
     * @param extensions
     *            The extensions to be included by this selector.
     */
    public FileRegexSelector(String regex)
    {
    this.pattern = Pattern.compile(regex);
    }

    /**
     * Determines if a file or folder should be selected.
     * @param fileInfo
     *            The file selection information.
     * @return true if the file should be selected, false otherwise.
     */
    public boolean includeFile(final FileSelectInfo fileInfo)
    {
        if (this.pattern == null)
        {
            return false;
        }
    Matcher matcher = this.pattern.matcher(fileInfo.getFile().getName().getBaseName());
        return matcher.matches();
    }

    /**
     * Determines whether a folder should be traversed.
     *
     * @param fileInfo
     *            The file selection information.
     * @return true if descendents should be traversed, fase otherwise.
     */
    public boolean traverseDescendents(final FileSelectInfo fileInfo)
    {
        return true;
    }
}
{code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] [Updated] (VFS-400) Selector based on regular expressions

ASF GitHub Bot (Jira)

     [ https://issues.apache.org/jira/browse/VFS-400?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Rikard Oxenstrand updated VFS-400:
----------------------------------

    Description:
In the long todo list there was a post about adding a file selector based on regular expressions. I had need for that for a specific project so I built a simple class that seems to work. I'm kind of new to open source contribution though so I'm not sure if i should just commit it to trunk. Here is the code:
{code:title=FileRegexSelector.java|borderStyle=solid}
/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.apache.commons.vfs2;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * A {@link FileSelector} that selects based on regular expressions matched against base filename.
 *
 * @since 2.1
 */
public class FileRegexSelector implements FileSelector
{

    /**
     * The extensions to select.
     */
    private Pattern pattern = null;

    /**
     * Creates a new selector for the given extensions.
     *
     * @param extensions
     *            The extensions to be included by this selector.
     */
    public FileRegexSelector(String regex)
    {
    this.pattern = Pattern.compile(regex);
    }

    /**
     * Determines if a file or folder should be selected.
     * @param fileInfo
     *            The file selection information.
     * @return true if the file should be selected, false otherwise.
     */
    public boolean includeFile(final FileSelectInfo fileInfo)
    {
        if (this.pattern == null)
        {
            return false;
        }
    Matcher matcher = this.pattern.matcher(fileInfo.getFile().getName().getBaseName());
        return matcher.matches();
    }

    /**
     * Determines whether a folder should be traversed.
     *
     * @param fileInfo
     *            The file selection information.
     * @return true if descendents should be traversed, fase otherwise.
     */
    public boolean traverseDescendents(final FileSelectInfo fileInfo)
    {
        return true;
    }
}
{code}

  was:
In the long todo list there was a post about adding a file selector based on regular expressions. I had need for that for a specific project so I built a simple class that seems to work. I'm kind of new to open source contribution though so I'm not sure if i should just commit it to trunk. Here is the code:
{code:title=Bar.java|borderStyle=solid}
/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.apache.commons.vfs2;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * A {@link FileSelector} that selects based on regular expressions matched against base filename.
 *
 * @since 2.1
 */
public class FileRegexSelector implements FileSelector
{

    /**
     * The extensions to select.
     */
    private Pattern pattern = null;

    /**
     * Creates a new selector for the given extensions.
     *
     * @param extensions
     *            The extensions to be included by this selector.
     */
    public FileRegexSelector(String regex)
    {
    this.pattern = Pattern.compile(regex);
    }

    /**
     * Determines if a file or folder should be selected.
     * @param fileInfo
     *            The file selection information.
     * @return true if the file should be selected, false otherwise.
     */
    public boolean includeFile(final FileSelectInfo fileInfo)
    {
        if (this.pattern == null)
        {
            return false;
        }
    Matcher matcher = this.pattern.matcher(fileInfo.getFile().getName().getBaseName());
        return matcher.matches();
    }

    /**
     * Determines whether a folder should be traversed.
     *
     * @param fileInfo
     *            The file selection information.
     * @return true if descendents should be traversed, fase otherwise.
     */
    public boolean traverseDescendents(final FileSelectInfo fileInfo)
    {
        return true;
    }
}
{code}

   

> Selector based on regular expressions
> -------------------------------------
>
>                 Key: VFS-400
>                 URL: https://issues.apache.org/jira/browse/VFS-400
>             Project: Commons VFS
>          Issue Type: New Feature
>    Affects Versions: 2.1
>            Reporter: Rikard Oxenstrand
>            Priority: Minor
>
> In the long todo list there was a post about adding a file selector based on regular expressions. I had need for that for a specific project so I built a simple class that seems to work. I'm kind of new to open source contribution though so I'm not sure if i should just commit it to trunk. Here is the code:
> {code:title=FileRegexSelector.java|borderStyle=solid}
> /*
>  * Licensed to the Apache Software Foundation (ASF) under one or more
>  * contributor license agreements.  See the NOTICE file distributed with
>  * this work for additional information regarding copyright ownership.
>  * The ASF licenses this file to You under the Apache License, Version 2.0
>  * (the "License"); you may not use this file except in compliance with
>  * the License.  You may obtain a copy of the License at
>  *
>  *      http://www.apache.org/licenses/LICENSE-2.0
>  *
>  * Unless required by applicable law or agreed to in writing, software
>  * distributed under the License is distributed on an "AS IS" BASIS,
>  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
>  * See the License for the specific language governing permissions and
>  * limitations under the License.
>  */
> package org.apache.commons.vfs2;
> import java.util.regex.Matcher;
> import java.util.regex.Pattern;
> /**
>  * A {@link FileSelector} that selects based on regular expressions matched against base filename.
>  *
>  * @since 2.1
>  */
> public class FileRegexSelector implements FileSelector
> {
>     /**
>      * The extensions to select.
>      */
>     private Pattern pattern = null;
>     /**
>      * Creates a new selector for the given extensions.
>      *
>      * @param extensions
>      *            The extensions to be included by this selector.
>      */
>     public FileRegexSelector(String regex)
>     {
>     this.pattern = Pattern.compile(regex);
>     }
>     /**
>      * Determines if a file or folder should be selected.
>      * @param fileInfo
>      *            The file selection information.
>      * @return true if the file should be selected, false otherwise.
>      */
>     public boolean includeFile(final FileSelectInfo fileInfo)
>     {
>         if (this.pattern == null)
>         {
>             return false;
>         }
>     Matcher matcher = this.pattern.matcher(fileInfo.getFile().getName().getBaseName());
>         return matcher.matches();
>     }
>     /**
>      * Determines whether a folder should be traversed.
>      *
>      * @param fileInfo
>      *            The file selection information.
>      * @return true if descendents should be traversed, fase otherwise.
>      */
>     public boolean traverseDescendents(final FileSelectInfo fileInfo)
>     {
>         return true;
>     }
> }
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] [Commented] (VFS-400) Selector based on regular expressions

ASF GitHub Bot (Jira)
In reply to this post by ASF GitHub Bot (Jira)

    [ https://issues.apache.org/jira/browse/VFS-400?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13201184#comment-13201184 ]

Adrian Crum commented on VFS-400:
---------------------------------

Please convert your code to a patch file and attach the patch file to this issue. When attaching your file, be sure to grant the ASF permission to use your code.
               

> Selector based on regular expressions
> -------------------------------------
>
>                 Key: VFS-400
>                 URL: https://issues.apache.org/jira/browse/VFS-400
>             Project: Commons VFS
>          Issue Type: New Feature
>    Affects Versions: 2.1
>            Reporter: Rikard Oxenstrand
>            Priority: Minor
>
> In the long todo list there was a post about adding a file selector based on regular expressions. I had need for that for a specific project so I built a simple class that seems to work. I'm kind of new to open source contribution though so I'm not sure if i should just commit it to trunk. Here is the code:
> {code:title=FileRegexSelector.java|borderStyle=solid}
> /*
>  * Licensed to the Apache Software Foundation (ASF) under one or more
>  * contributor license agreements.  See the NOTICE file distributed with
>  * this work for additional information regarding copyright ownership.
>  * The ASF licenses this file to You under the Apache License, Version 2.0
>  * (the "License"); you may not use this file except in compliance with
>  * the License.  You may obtain a copy of the License at
>  *
>  *      http://www.apache.org/licenses/LICENSE-2.0
>  *
>  * Unless required by applicable law or agreed to in writing, software
>  * distributed under the License is distributed on an "AS IS" BASIS,
>  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
>  * See the License for the specific language governing permissions and
>  * limitations under the License.
>  */
> package org.apache.commons.vfs2;
> import java.util.regex.Matcher;
> import java.util.regex.Pattern;
> /**
>  * A {@link FileSelector} that selects based on regular expressions matched against base filename.
>  *
>  * @since 2.1
>  */
> public class FileRegexSelector implements FileSelector
> {
>     /**
>      * The extensions to select.
>      */
>     private Pattern pattern = null;
>     /**
>      * Creates a new selector for the given extensions.
>      *
>      * @param extensions
>      *            The extensions to be included by this selector.
>      */
>     public FileRegexSelector(String regex)
>     {
>     this.pattern = Pattern.compile(regex);
>     }
>     /**
>      * Determines if a file or folder should be selected.
>      * @param fileInfo
>      *            The file selection information.
>      * @return true if the file should be selected, false otherwise.
>      */
>     public boolean includeFile(final FileSelectInfo fileInfo)
>     {
>         if (this.pattern == null)
>         {
>             return false;
>         }
>     Matcher matcher = this.pattern.matcher(fileInfo.getFile().getName().getBaseName());
>         return matcher.matches();
>     }
>     /**
>      * Determines whether a folder should be traversed.
>      *
>      * @param fileInfo
>      *            The file selection information.
>      * @return true if descendents should be traversed, fase otherwise.
>      */
>     public boolean traverseDescendents(final FileSelectInfo fileInfo)
>     {
>         return true;
>     }
> }
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] [Issue Comment Edited] (VFS-400) Selector based on regular expressions

ASF GitHub Bot (Jira)
In reply to this post by ASF GitHub Bot (Jira)

    [ https://issues.apache.org/jira/browse/VFS-400?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13201188#comment-13201188 ]

Rikard Oxenstrand edited comment on VFS-400 at 2/6/12 10:09 AM:
----------------------------------------------------------------

Draft implementation of the function. Uploaded as attachment.
               
      was (Author: rikard.oxenstrand):
    Draft implementation of the function.
                 

> Selector based on regular expressions
> -------------------------------------
>
>                 Key: VFS-400
>                 URL: https://issues.apache.org/jira/browse/VFS-400
>             Project: Commons VFS
>          Issue Type: New Feature
>    Affects Versions: 2.1
>            Reporter: Rikard Oxenstrand
>            Priority: Minor
>         Attachments: FileRegexSelector.java.patch
>
>
> In the long todo list there was a post about adding a file selector based on regular expressions. I had need for that for a specific project so I built a simple class that seems to work. I'm kind of new to open source contribution though so I'm not sure if i should just commit it to trunk. Here is the code:
> {code:title=FileRegexSelector.java|borderStyle=solid}
> /*
>  * Licensed to the Apache Software Foundation (ASF) under one or more
>  * contributor license agreements.  See the NOTICE file distributed with
>  * this work for additional information regarding copyright ownership.
>  * The ASF licenses this file to You under the Apache License, Version 2.0
>  * (the "License"); you may not use this file except in compliance with
>  * the License.  You may obtain a copy of the License at
>  *
>  *      http://www.apache.org/licenses/LICENSE-2.0
>  *
>  * Unless required by applicable law or agreed to in writing, software
>  * distributed under the License is distributed on an "AS IS" BASIS,
>  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
>  * See the License for the specific language governing permissions and
>  * limitations under the License.
>  */
> package org.apache.commons.vfs2;
> import java.util.regex.Matcher;
> import java.util.regex.Pattern;
> /**
>  * A {@link FileSelector} that selects based on regular expressions matched against base filename.
>  *
>  * @since 2.1
>  */
> public class FileRegexSelector implements FileSelector
> {
>     /**
>      * The extensions to select.
>      */
>     private Pattern pattern = null;
>     /**
>      * Creates a new selector for the given extensions.
>      *
>      * @param extensions
>      *            The extensions to be included by this selector.
>      */
>     public FileRegexSelector(String regex)
>     {
>     this.pattern = Pattern.compile(regex);
>     }
>     /**
>      * Determines if a file or folder should be selected.
>      * @param fileInfo
>      *            The file selection information.
>      * @return true if the file should be selected, false otherwise.
>      */
>     public boolean includeFile(final FileSelectInfo fileInfo)
>     {
>         if (this.pattern == null)
>         {
>             return false;
>         }
>     Matcher matcher = this.pattern.matcher(fileInfo.getFile().getName().getBaseName());
>         return matcher.matches();
>     }
>     /**
>      * Determines whether a folder should be traversed.
>      *
>      * @param fileInfo
>      *            The file selection information.
>      * @return true if descendents should be traversed, fase otherwise.
>      */
>     public boolean traverseDescendents(final FileSelectInfo fileInfo)
>     {
>         return true;
>     }
> }
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] [Updated] (VFS-400) Selector based on regular expressions

ASF GitHub Bot (Jira)
In reply to this post by ASF GitHub Bot (Jira)

     [ https://issues.apache.org/jira/browse/VFS-400?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Rikard Oxenstrand updated VFS-400:
----------------------------------

    Attachment: FileRegexSelector.java.patch

Draft implementation of the function.
               

> Selector based on regular expressions
> -------------------------------------
>
>                 Key: VFS-400
>                 URL: https://issues.apache.org/jira/browse/VFS-400
>             Project: Commons VFS
>          Issue Type: New Feature
>    Affects Versions: 2.1
>            Reporter: Rikard Oxenstrand
>            Priority: Minor
>         Attachments: FileRegexSelector.java.patch
>
>
> In the long todo list there was a post about adding a file selector based on regular expressions. I had need for that for a specific project so I built a simple class that seems to work. I'm kind of new to open source contribution though so I'm not sure if i should just commit it to trunk. Here is the code:
> {code:title=FileRegexSelector.java|borderStyle=solid}
> /*
>  * Licensed to the Apache Software Foundation (ASF) under one or more
>  * contributor license agreements.  See the NOTICE file distributed with
>  * this work for additional information regarding copyright ownership.
>  * The ASF licenses this file to You under the Apache License, Version 2.0
>  * (the "License"); you may not use this file except in compliance with
>  * the License.  You may obtain a copy of the License at
>  *
>  *      http://www.apache.org/licenses/LICENSE-2.0
>  *
>  * Unless required by applicable law or agreed to in writing, software
>  * distributed under the License is distributed on an "AS IS" BASIS,
>  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
>  * See the License for the specific language governing permissions and
>  * limitations under the License.
>  */
> package org.apache.commons.vfs2;
> import java.util.regex.Matcher;
> import java.util.regex.Pattern;
> /**
>  * A {@link FileSelector} that selects based on regular expressions matched against base filename.
>  *
>  * @since 2.1
>  */
> public class FileRegexSelector implements FileSelector
> {
>     /**
>      * The extensions to select.
>      */
>     private Pattern pattern = null;
>     /**
>      * Creates a new selector for the given extensions.
>      *
>      * @param extensions
>      *            The extensions to be included by this selector.
>      */
>     public FileRegexSelector(String regex)
>     {
>     this.pattern = Pattern.compile(regex);
>     }
>     /**
>      * Determines if a file or folder should be selected.
>      * @param fileInfo
>      *            The file selection information.
>      * @return true if the file should be selected, false otherwise.
>      */
>     public boolean includeFile(final FileSelectInfo fileInfo)
>     {
>         if (this.pattern == null)
>         {
>             return false;
>         }
>     Matcher matcher = this.pattern.matcher(fileInfo.getFile().getName().getBaseName());
>         return matcher.matches();
>     }
>     /**
>      * Determines whether a folder should be traversed.
>      *
>      * @param fileInfo
>      *            The file selection information.
>      * @return true if descendents should be traversed, fase otherwise.
>      */
>     public boolean traverseDescendents(final FileSelectInfo fileInfo)
>     {
>         return true;
>     }
> }
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] [Commented] (VFS-400) Selector based on regular expressions

ASF GitHub Bot (Jira)
In reply to this post by ASF GitHub Bot (Jira)

    [ https://issues.apache.org/jira/browse/VFS-400?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13201992#comment-13201992 ]

Ralph Goers commented on VFS-400:
---------------------------------

Sorry to be a pain but do you happen to have a unit test that can verify the functionality? That will save us from having to develop one.
               

> Selector based on regular expressions
> -------------------------------------
>
>                 Key: VFS-400
>                 URL: https://issues.apache.org/jira/browse/VFS-400
>             Project: Commons VFS
>          Issue Type: New Feature
>    Affects Versions: 2.1
>            Reporter: Rikard Oxenstrand
>            Priority: Minor
>         Attachments: FileRegexSelector.java.patch
>
>
> In the long todo list there was a post about adding a file selector based on regular expressions. I had need for that for a specific project so I built a simple class that seems to work. I'm kind of new to open source contribution though so I'm not sure if i should just commit it to trunk. Here is the code:
> {code:title=FileRegexSelector.java|borderStyle=solid}
> /*
>  * Licensed to the Apache Software Foundation (ASF) under one or more
>  * contributor license agreements.  See the NOTICE file distributed with
>  * this work for additional information regarding copyright ownership.
>  * The ASF licenses this file to You under the Apache License, Version 2.0
>  * (the "License"); you may not use this file except in compliance with
>  * the License.  You may obtain a copy of the License at
>  *
>  *      http://www.apache.org/licenses/LICENSE-2.0
>  *
>  * Unless required by applicable law or agreed to in writing, software
>  * distributed under the License is distributed on an "AS IS" BASIS,
>  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
>  * See the License for the specific language governing permissions and
>  * limitations under the License.
>  */
> package org.apache.commons.vfs2;
> import java.util.regex.Matcher;
> import java.util.regex.Pattern;
> /**
>  * A {@link FileSelector} that selects based on regular expressions matched against base filename.
>  *
>  * @since 2.1
>  */
> public class FileRegexSelector implements FileSelector
> {
>     /**
>      * The extensions to select.
>      */
>     private Pattern pattern = null;
>     /**
>      * Creates a new selector for the given extensions.
>      *
>      * @param extensions
>      *            The extensions to be included by this selector.
>      */
>     public FileRegexSelector(String regex)
>     {
>     this.pattern = Pattern.compile(regex);
>     }
>     /**
>      * Determines if a file or folder should be selected.
>      * @param fileInfo
>      *            The file selection information.
>      * @return true if the file should be selected, false otherwise.
>      */
>     public boolean includeFile(final FileSelectInfo fileInfo)
>     {
>         if (this.pattern == null)
>         {
>             return false;
>         }
>     Matcher matcher = this.pattern.matcher(fileInfo.getFile().getName().getBaseName());
>         return matcher.matches();
>     }
>     /**
>      * Determines whether a folder should be traversed.
>      *
>      * @param fileInfo
>      *            The file selection information.
>      * @return true if descendents should be traversed, fase otherwise.
>      */
>     public boolean traverseDescendents(final FileSelectInfo fileInfo)
>     {
>         return true;
>     }
> }
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] [Commented] (VFS-400) Selector based on regular expressions

ASF GitHub Bot (Jira)
In reply to this post by ASF GitHub Bot (Jira)

    [ https://issues.apache.org/jira/browse/VFS-400?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13202200#comment-13202200 ]

Rikard Oxenstrand commented on VFS-400:
---------------------------------------

No, I have no experience with unit tests. The class is quite similar to FileExtensionSelector so there is probably not so much work if you copy and modify the FileExtensionSelectorTest class. I don't have the time right now but in the beginning of march I can probably read up and do it.
               

> Selector based on regular expressions
> -------------------------------------
>
>                 Key: VFS-400
>                 URL: https://issues.apache.org/jira/browse/VFS-400
>             Project: Commons VFS
>          Issue Type: New Feature
>    Affects Versions: 2.1
>            Reporter: Rikard Oxenstrand
>            Priority: Minor
>         Attachments: FileRegexSelector.java.patch
>
>
> In the long todo list there was a post about adding a file selector based on regular expressions. I had need for that for a specific project so I built a simple class that seems to work. I'm kind of new to open source contribution though so I'm not sure if i should just commit it to trunk. Here is the code:
> {code:title=FileRegexSelector.java|borderStyle=solid}
> /*
>  * Licensed to the Apache Software Foundation (ASF) under one or more
>  * contributor license agreements.  See the NOTICE file distributed with
>  * this work for additional information regarding copyright ownership.
>  * The ASF licenses this file to You under the Apache License, Version 2.0
>  * (the "License"); you may not use this file except in compliance with
>  * the License.  You may obtain a copy of the License at
>  *
>  *      http://www.apache.org/licenses/LICENSE-2.0
>  *
>  * Unless required by applicable law or agreed to in writing, software
>  * distributed under the License is distributed on an "AS IS" BASIS,
>  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
>  * See the License for the specific language governing permissions and
>  * limitations under the License.
>  */
> package org.apache.commons.vfs2;
> import java.util.regex.Matcher;
> import java.util.regex.Pattern;
> /**
>  * A {@link FileSelector} that selects based on regular expressions matched against base filename.
>  *
>  * @since 2.1
>  */
> public class FileRegexSelector implements FileSelector
> {
>     /**
>      * The extensions to select.
>      */
>     private Pattern pattern = null;
>     /**
>      * Creates a new selector for the given extensions.
>      *
>      * @param extensions
>      *            The extensions to be included by this selector.
>      */
>     public FileRegexSelector(String regex)
>     {
>     this.pattern = Pattern.compile(regex);
>     }
>     /**
>      * Determines if a file or folder should be selected.
>      * @param fileInfo
>      *            The file selection information.
>      * @return true if the file should be selected, false otherwise.
>      */
>     public boolean includeFile(final FileSelectInfo fileInfo)
>     {
>         if (this.pattern == null)
>         {
>             return false;
>         }
>     Matcher matcher = this.pattern.matcher(fileInfo.getFile().getName().getBaseName());
>         return matcher.matches();
>     }
>     /**
>      * Determines whether a folder should be traversed.
>      *
>      * @param fileInfo
>      *            The file selection information.
>      * @return true if descendents should be traversed, fase otherwise.
>      */
>     public boolean traverseDescendents(final FileSelectInfo fileInfo)
>     {
>         return true;
>     }
> }
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] [Commented] (VFS-400) Selector based on regular expressions

ASF GitHub Bot (Jira)
In reply to this post by ASF GitHub Bot (Jira)

    [ https://issues.apache.org/jira/browse/VFS-400?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13203628#comment-13203628 ]

Gary D. Gregory commented on VFS-400:
-------------------------------------

This impl works on base file names only.

Why not match against the whole URI string?

Or, should we have a BaseFileNameRegExFileSelector (as the one supplied) and a RegExFileSelector?
               

> Selector based on regular expressions
> -------------------------------------
>
>                 Key: VFS-400
>                 URL: https://issues.apache.org/jira/browse/VFS-400
>             Project: Commons VFS
>          Issue Type: New Feature
>    Affects Versions: 2.1
>            Reporter: Rikard Oxenstrand
>            Priority: Minor
>         Attachments: FileRegexSelector.java.patch
>
>
> In the long todo list there was a post about adding a file selector based on regular expressions. I had need for that for a specific project so I built a simple class that seems to work. I'm kind of new to open source contribution though so I'm not sure if i should just commit it to trunk. Here is the code:
> {code:title=FileRegexSelector.java|borderStyle=solid}
> /*
>  * Licensed to the Apache Software Foundation (ASF) under one or more
>  * contributor license agreements.  See the NOTICE file distributed with
>  * this work for additional information regarding copyright ownership.
>  * The ASF licenses this file to You under the Apache License, Version 2.0
>  * (the "License"); you may not use this file except in compliance with
>  * the License.  You may obtain a copy of the License at
>  *
>  *      http://www.apache.org/licenses/LICENSE-2.0
>  *
>  * Unless required by applicable law or agreed to in writing, software
>  * distributed under the License is distributed on an "AS IS" BASIS,
>  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
>  * See the License for the specific language governing permissions and
>  * limitations under the License.
>  */
> package org.apache.commons.vfs2;
> import java.util.regex.Matcher;
> import java.util.regex.Pattern;
> /**
>  * A {@link FileSelector} that selects based on regular expressions matched against base filename.
>  *
>  * @since 2.1
>  */
> public class FileRegexSelector implements FileSelector
> {
>     /**
>      * The extensions to select.
>      */
>     private Pattern pattern = null;
>     /**
>      * Creates a new selector for the given extensions.
>      *
>      * @param extensions
>      *            The extensions to be included by this selector.
>      */
>     public FileRegexSelector(String regex)
>     {
>     this.pattern = Pattern.compile(regex);
>     }
>     /**
>      * Determines if a file or folder should be selected.
>      * @param fileInfo
>      *            The file selection information.
>      * @return true if the file should be selected, false otherwise.
>      */
>     public boolean includeFile(final FileSelectInfo fileInfo)
>     {
>         if (this.pattern == null)
>         {
>             return false;
>         }
>     Matcher matcher = this.pattern.matcher(fileInfo.getFile().getName().getBaseName());
>         return matcher.matches();
>     }
>     /**
>      * Determines whether a folder should be traversed.
>      *
>      * @param fileInfo
>      *            The file selection information.
>      * @return true if descendents should be traversed, fase otherwise.
>      */
>     public boolean traverseDescendents(final FileSelectInfo fileInfo)
>     {
>         return true;
>     }
> }
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] [Commented] (VFS-400) Selector based on regular expressions

ASF GitHub Bot (Jira)
In reply to this post by ASF GitHub Bot (Jira)

    [ https://issues.apache.org/jira/browse/VFS-400?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13204401#comment-13204401 ]

Rikard Oxenstrand commented on VFS-400:
---------------------------------------

My thought was to use this to filter out files based on some naming standard (Prefixed/suffixed file names) and didn't want to involve directories since the directory/server names could include the filter criteria if you change location of the files. But I guess that it could be useful to filter out certain sub-directories in some scenarios.

How about using getPath instead (fileInfo.getFile().getName().getPath())? Then you can filter on both directories and files while still being able to move the files to a different location without any need to change the filter expression. The part of the URI that is before the path is already filtered when you resolve the file.
               

> Selector based on regular expressions
> -------------------------------------
>
>                 Key: VFS-400
>                 URL: https://issues.apache.org/jira/browse/VFS-400
>             Project: Commons VFS
>          Issue Type: New Feature
>    Affects Versions: 2.1
>            Reporter: Rikard Oxenstrand
>            Priority: Minor
>         Attachments: FileRegexSelector.java.patch
>
>
> In the long todo list there was a post about adding a file selector based on regular expressions. I had need for that for a specific project so I built a simple class that seems to work. I'm kind of new to open source contribution though so I'm not sure if i should just commit it to trunk. Here is the code:
> {code:title=FileRegexSelector.java|borderStyle=solid}
> /*
>  * Licensed to the Apache Software Foundation (ASF) under one or more
>  * contributor license agreements.  See the NOTICE file distributed with
>  * this work for additional information regarding copyright ownership.
>  * The ASF licenses this file to You under the Apache License, Version 2.0
>  * (the "License"); you may not use this file except in compliance with
>  * the License.  You may obtain a copy of the License at
>  *
>  *      http://www.apache.org/licenses/LICENSE-2.0
>  *
>  * Unless required by applicable law or agreed to in writing, software
>  * distributed under the License is distributed on an "AS IS" BASIS,
>  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
>  * See the License for the specific language governing permissions and
>  * limitations under the License.
>  */
> package org.apache.commons.vfs2;
> import java.util.regex.Matcher;
> import java.util.regex.Pattern;
> /**
>  * A {@link FileSelector} that selects based on regular expressions matched against base filename.
>  *
>  * @since 2.1
>  */
> public class FileRegexSelector implements FileSelector
> {
>     /**
>      * The extensions to select.
>      */
>     private Pattern pattern = null;
>     /**
>      * Creates a new selector for the given extensions.
>      *
>      * @param extensions
>      *            The extensions to be included by this selector.
>      */
>     public FileRegexSelector(String regex)
>     {
>     this.pattern = Pattern.compile(regex);
>     }
>     /**
>      * Determines if a file or folder should be selected.
>      * @param fileInfo
>      *            The file selection information.
>      * @return true if the file should be selected, false otherwise.
>      */
>     public boolean includeFile(final FileSelectInfo fileInfo)
>     {
>         if (this.pattern == null)
>         {
>             return false;
>         }
>     Matcher matcher = this.pattern.matcher(fileInfo.getFile().getName().getBaseName());
>         return matcher.matches();
>     }
>     /**
>      * Determines whether a folder should be traversed.
>      *
>      * @param fileInfo
>      *            The file selection information.
>      * @return true if descendents should be traversed, fase otherwise.
>      */
>     public boolean traverseDescendents(final FileSelectInfo fileInfo)
>     {
>         return true;
>     }
> }
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] [Commented] (VFS-400) Add a FileSelector based on regular expressions

ASF GitHub Bot (Jira)
In reply to this post by ASF GitHub Bot (Jira)

    [ https://issues.apache.org/jira/browse/VFS-400?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13204970#comment-13204970 ]

Gary D. Gregory commented on VFS-400:
-------------------------------------

I committed a first cut called {{PatternFileSelector}} with the unit test {{PatternFileSelectorTest}}
               

> Add a FileSelector based on regular expressions
> -----------------------------------------------
>
>                 Key: VFS-400
>                 URL: https://issues.apache.org/jira/browse/VFS-400
>             Project: Commons VFS
>          Issue Type: New Feature
>    Affects Versions: 2.1
>            Reporter: Rikard Oxenstrand
>            Priority: Minor
>         Attachments: FileRegexSelector.java.patch
>
>
> In the long todo list there was a post about adding a file selector based on regular expressions. I had need for that for a specific project so I built a simple class that seems to work. I'm kind of new to open source contribution though so I'm not sure if i should just commit it to trunk. Here is the code:
> {code:title=FileRegexSelector.java|borderStyle=solid}
> /*
>  * Licensed to the Apache Software Foundation (ASF) under one or more
>  * contributor license agreements.  See the NOTICE file distributed with
>  * this work for additional information regarding copyright ownership.
>  * The ASF licenses this file to You under the Apache License, Version 2.0
>  * (the "License"); you may not use this file except in compliance with
>  * the License.  You may obtain a copy of the License at
>  *
>  *      http://www.apache.org/licenses/LICENSE-2.0
>  *
>  * Unless required by applicable law or agreed to in writing, software
>  * distributed under the License is distributed on an "AS IS" BASIS,
>  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
>  * See the License for the specific language governing permissions and
>  * limitations under the License.
>  */
> package org.apache.commons.vfs2;
> import java.util.regex.Matcher;
> import java.util.regex.Pattern;
> /**
>  * A {@link FileSelector} that selects based on regular expressions matched against base filename.
>  *
>  * @since 2.1
>  */
> public class FileRegexSelector implements FileSelector
> {
>     /**
>      * The extensions to select.
>      */
>     private Pattern pattern = null;
>     /**
>      * Creates a new selector for the given extensions.
>      *
>      * @param extensions
>      *            The extensions to be included by this selector.
>      */
>     public FileRegexSelector(String regex)
>     {
>     this.pattern = Pattern.compile(regex);
>     }
>     /**
>      * Determines if a file or folder should be selected.
>      * @param fileInfo
>      *            The file selection information.
>      * @return true if the file should be selected, false otherwise.
>      */
>     public boolean includeFile(final FileSelectInfo fileInfo)
>     {
>         if (this.pattern == null)
>         {
>             return false;
>         }
>     Matcher matcher = this.pattern.matcher(fileInfo.getFile().getName().getBaseName());
>         return matcher.matches();
>     }
>     /**
>      * Determines whether a folder should be traversed.
>      *
>      * @param fileInfo
>      *            The file selection information.
>      * @return true if descendents should be traversed, fase otherwise.
>      */
>     public boolean traverseDescendents(final FileSelectInfo fileInfo)
>     {
>         return true;
>     }
> }
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] [Updated] (VFS-400) Add a FileSelector based on regular expressions

ASF GitHub Bot (Jira)
In reply to this post by ASF GitHub Bot (Jira)

     [ https://issues.apache.org/jira/browse/VFS-400?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Gary D. Gregory updated VFS-400:
--------------------------------

    Summary: Add a FileSelector based on regular expressions  (was: Selector based on regular expressions)
   

> Add a FileSelector based on regular expressions
> -----------------------------------------------
>
>                 Key: VFS-400
>                 URL: https://issues.apache.org/jira/browse/VFS-400
>             Project: Commons VFS
>          Issue Type: New Feature
>    Affects Versions: 2.1
>            Reporter: Rikard Oxenstrand
>            Priority: Minor
>         Attachments: FileRegexSelector.java.patch
>
>
> In the long todo list there was a post about adding a file selector based on regular expressions. I had need for that for a specific project so I built a simple class that seems to work. I'm kind of new to open source contribution though so I'm not sure if i should just commit it to trunk. Here is the code:
> {code:title=FileRegexSelector.java|borderStyle=solid}
> /*
>  * Licensed to the Apache Software Foundation (ASF) under one or more
>  * contributor license agreements.  See the NOTICE file distributed with
>  * this work for additional information regarding copyright ownership.
>  * The ASF licenses this file to You under the Apache License, Version 2.0
>  * (the "License"); you may not use this file except in compliance with
>  * the License.  You may obtain a copy of the License at
>  *
>  *      http://www.apache.org/licenses/LICENSE-2.0
>  *
>  * Unless required by applicable law or agreed to in writing, software
>  * distributed under the License is distributed on an "AS IS" BASIS,
>  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
>  * See the License for the specific language governing permissions and
>  * limitations under the License.
>  */
> package org.apache.commons.vfs2;
> import java.util.regex.Matcher;
> import java.util.regex.Pattern;
> /**
>  * A {@link FileSelector} that selects based on regular expressions matched against base filename.
>  *
>  * @since 2.1
>  */
> public class FileRegexSelector implements FileSelector
> {
>     /**
>      * The extensions to select.
>      */
>     private Pattern pattern = null;
>     /**
>      * Creates a new selector for the given extensions.
>      *
>      * @param extensions
>      *            The extensions to be included by this selector.
>      */
>     public FileRegexSelector(String regex)
>     {
>     this.pattern = Pattern.compile(regex);
>     }
>     /**
>      * Determines if a file or folder should be selected.
>      * @param fileInfo
>      *            The file selection information.
>      * @return true if the file should be selected, false otherwise.
>      */
>     public boolean includeFile(final FileSelectInfo fileInfo)
>     {
>         if (this.pattern == null)
>         {
>             return false;
>         }
>     Matcher matcher = this.pattern.matcher(fileInfo.getFile().getName().getBaseName());
>         return matcher.matches();
>     }
>     /**
>      * Determines whether a folder should be traversed.
>      *
>      * @param fileInfo
>      *            The file selection information.
>      * @return true if descendents should be traversed, fase otherwise.
>      */
>     public boolean traverseDescendents(final FileSelectInfo fileInfo)
>     {
>         return true;
>     }
> }
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] [Updated] (VFS-400) Add a FileSelector based on regular expressions

ASF GitHub Bot (Jira)
In reply to this post by ASF GitHub Bot (Jira)

     [ https://issues.apache.org/jira/browse/VFS-400?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Gary D. Gregory updated VFS-400:
--------------------------------

    Comment: was deleted

(was: Implemented as org.apache.commons.vfs2.PatternFileSelector.)
   

> Add a FileSelector based on regular expressions
> -----------------------------------------------
>
>                 Key: VFS-400
>                 URL: https://issues.apache.org/jira/browse/VFS-400
>             Project: Commons VFS
>          Issue Type: New Feature
>    Affects Versions: 2.1
>            Reporter: Rikard Oxenstrand
>            Priority: Minor
>             Fix For: 2.1
>
>         Attachments: FileRegexSelector.java.patch
>
>
> In the long todo list there was a post about adding a file selector based on regular expressions. I had need for that for a specific project so I built a simple class that seems to work. I'm kind of new to open source contribution though so I'm not sure if i should just commit it to trunk. Here is the code:
> {code:title=FileRegexSelector.java|borderStyle=solid}
> /*
>  * Licensed to the Apache Software Foundation (ASF) under one or more
>  * contributor license agreements.  See the NOTICE file distributed with
>  * this work for additional information regarding copyright ownership.
>  * The ASF licenses this file to You under the Apache License, Version 2.0
>  * (the "License"); you may not use this file except in compliance with
>  * the License.  You may obtain a copy of the License at
>  *
>  *      http://www.apache.org/licenses/LICENSE-2.0
>  *
>  * Unless required by applicable law or agreed to in writing, software
>  * distributed under the License is distributed on an "AS IS" BASIS,
>  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
>  * See the License for the specific language governing permissions and
>  * limitations under the License.
>  */
> package org.apache.commons.vfs2;
> import java.util.regex.Matcher;
> import java.util.regex.Pattern;
> /**
>  * A {@link FileSelector} that selects based on regular expressions matched against base filename.
>  *
>  * @since 2.1
>  */
> public class FileRegexSelector implements FileSelector
> {
>     /**
>      * The extensions to select.
>      */
>     private Pattern pattern = null;
>     /**
>      * Creates a new selector for the given extensions.
>      *
>      * @param extensions
>      *            The extensions to be included by this selector.
>      */
>     public FileRegexSelector(String regex)
>     {
>     this.pattern = Pattern.compile(regex);
>     }
>     /**
>      * Determines if a file or folder should be selected.
>      * @param fileInfo
>      *            The file selection information.
>      * @return true if the file should be selected, false otherwise.
>      */
>     public boolean includeFile(final FileSelectInfo fileInfo)
>     {
>         if (this.pattern == null)
>         {
>             return false;
>         }
>     Matcher matcher = this.pattern.matcher(fileInfo.getFile().getName().getBaseName());
>         return matcher.matches();
>     }
>     /**
>      * Determines whether a folder should be traversed.
>      *
>      * @param fileInfo
>      *            The file selection information.
>      * @return true if descendents should be traversed, fase otherwise.
>      */
>     public boolean traverseDescendents(final FileSelectInfo fileInfo)
>     {
>         return true;
>     }
> }
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] [Resolved] (VFS-400) Add a FileSelector based on regular expressions

ASF GitHub Bot (Jira)
In reply to this post by ASF GitHub Bot (Jira)

     [ https://issues.apache.org/jira/browse/VFS-400?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Gary D. Gregory resolved VFS-400.
---------------------------------

       Resolution: Fixed
    Fix Version/s: 2.1

Implemented as org.apache.commons.vfs2.PatternFileSelector.
               

> Add a FileSelector based on regular expressions
> -----------------------------------------------
>
>                 Key: VFS-400
>                 URL: https://issues.apache.org/jira/browse/VFS-400
>             Project: Commons VFS
>          Issue Type: New Feature
>    Affects Versions: 2.1
>            Reporter: Rikard Oxenstrand
>            Priority: Minor
>             Fix For: 2.1
>
>         Attachments: FileRegexSelector.java.patch
>
>
> In the long todo list there was a post about adding a file selector based on regular expressions. I had need for that for a specific project so I built a simple class that seems to work. I'm kind of new to open source contribution though so I'm not sure if i should just commit it to trunk. Here is the code:
> {code:title=FileRegexSelector.java|borderStyle=solid}
> /*
>  * Licensed to the Apache Software Foundation (ASF) under one or more
>  * contributor license agreements.  See the NOTICE file distributed with
>  * this work for additional information regarding copyright ownership.
>  * The ASF licenses this file to You under the Apache License, Version 2.0
>  * (the "License"); you may not use this file except in compliance with
>  * the License.  You may obtain a copy of the License at
>  *
>  *      http://www.apache.org/licenses/LICENSE-2.0
>  *
>  * Unless required by applicable law or agreed to in writing, software
>  * distributed under the License is distributed on an "AS IS" BASIS,
>  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
>  * See the License for the specific language governing permissions and
>  * limitations under the License.
>  */
> package org.apache.commons.vfs2;
> import java.util.regex.Matcher;
> import java.util.regex.Pattern;
> /**
>  * A {@link FileSelector} that selects based on regular expressions matched against base filename.
>  *
>  * @since 2.1
>  */
> public class FileRegexSelector implements FileSelector
> {
>     /**
>      * The extensions to select.
>      */
>     private Pattern pattern = null;
>     /**
>      * Creates a new selector for the given extensions.
>      *
>      * @param extensions
>      *            The extensions to be included by this selector.
>      */
>     public FileRegexSelector(String regex)
>     {
>     this.pattern = Pattern.compile(regex);
>     }
>     /**
>      * Determines if a file or folder should be selected.
>      * @param fileInfo
>      *            The file selection information.
>      * @return true if the file should be selected, false otherwise.
>      */
>     public boolean includeFile(final FileSelectInfo fileInfo)
>     {
>         if (this.pattern == null)
>         {
>             return false;
>         }
>     Matcher matcher = this.pattern.matcher(fileInfo.getFile().getName().getBaseName());
>         return matcher.matches();
>     }
>     /**
>      * Determines whether a folder should be traversed.
>      *
>      * @param fileInfo
>      *            The file selection information.
>      * @return true if descendents should be traversed, fase otherwise.
>      */
>     public boolean traverseDescendents(final FileSelectInfo fileInfo)
>     {
>         return true;
>     }
> }
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira