org.jboss.deployment.scanner
Class DeploymentFilter

java.lang.Object
  extended by org.jboss.deployment.scanner.DeploymentFilter
All Implemented Interfaces:
FileFilter, org.jboss.net.protocol.URLLister.URLFilter

public class DeploymentFilter
extends Object
implements FileFilter, org.jboss.net.protocol.URLLister.URLFilter

A simple filter for the URLDeploymentScanner. Three arrays are maintained for checking: a prefix, suffix, and match array. If the filename starts with any of the prefixes, ends with any of the suffixes, or exactly matches any of the matches, then the accepts method will return false. NOTE: the arrays *must* be sorted for the string matching to work, and suffixes use the 'reverseComparator'

Version:
$Revision: 1.6.6.4 $
Author:
somebody@jboss.org

Constructor Summary
DeploymentFilter()
          Use the default values for suffixes, prefixes, and matches
DeploymentFilter(String[] matches, String[] prefixes, String[] suffixes)
          Create using a custom set of matches, prefixes, and suffixes.
 
Method Summary
 boolean accept(File file)
          If the filename matches any string in the prefix, suffix, or matches array, return false.
 boolean accept(URL baseURL, String memberName)
           
 void addPrefix(String prefix)
           
 void addPrefixes(String[] prefixes)
           
 void addSuffix(String suffix)
           
 void addSuffixes(String[] suffixes)
           
 void delPrefix(String prefix)
           
 void delPrefixes(String[] prefixes)
           
 void delSuffix(String suffix)
           
 void delSuffixes(String[] suffixes)
           
 String[] getMatches()
           
 String[] getPrefixes()
           
 String[] getSuffixes()
           
 void setMatches(String[] matches)
           
 void setPrefixes(String[] prefixes)
           
 void setSuffixes(String[] suffixes)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DeploymentFilter

public DeploymentFilter()
Use the default values for suffixes, prefixes, and matches


DeploymentFilter

public DeploymentFilter(String[] matches,
                        String[] prefixes,
                        String[] suffixes)
Create using a custom set of matches, prefixes, and suffixes. If any of these arrays are null, then the corresponding default will be substituted.

Method Detail

addPrefix

public void addPrefix(String prefix)

addPrefixes

public void addPrefixes(String[] prefixes)

delPrefix

public void delPrefix(String prefix)

delPrefixes

public void delPrefixes(String[] prefixes)

addSuffix

public void addSuffix(String suffix)

addSuffixes

public void addSuffixes(String[] suffixes)

delSuffix

public void delSuffix(String suffix)

delSuffixes

public void delSuffixes(String[] suffixes)

getSuffixes

public String[] getSuffixes()

setSuffixes

public void setSuffixes(String[] suffixes)

getPrefixes

public String[] getPrefixes()

setPrefixes

public void setPrefixes(String[] prefixes)

getMatches

public String[] getMatches()

setMatches

public void setMatches(String[] matches)

accept

public boolean accept(File file)
If the filename matches any string in the prefix, suffix, or matches array, return false. Perhaps a bit of overkill, but this method operates in log(n) time, where n is the size of the arrays.

Specified by:
accept in interface FileFilter
Parameters:
file - The file to be tested
Returns:
false if the filename matches any of the prefixes, suffixes, or matches.

accept

public boolean accept(URL baseURL,
                      String memberName)
Specified by:
accept in interface org.jboss.net.protocol.URLLister.URLFilter


Copyright © 2002 JBoss Group, LLC. All Rights Reserved.