| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| FileScanner |
|
| 1.0;1 |
| 1 | /* | |
| 2 | * Licensed to the Apache Software Foundation (ASF) under one or more | |
| 3 | * contributor license agreements. See the NOTICE file distributed with | |
| 4 | * this work for additional information regarding copyright ownership. | |
| 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 | |
| 6 | * (the "License"); you may not use this file except in compliance with | |
| 7 | * the License. You may obtain a copy of the License at | |
| 8 | * | |
| 9 | * http://www.apache.org/licenses/LICENSE-2.0 | |
| 10 | * | |
| 11 | * Unless required by applicable law or agreed to in writing, software | |
| 12 | * distributed under the License is distributed on an "AS IS" BASIS, | |
| 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 14 | * See the License for the specific language governing permissions and | |
| 15 | * limitations under the License. | |
| 16 | * | |
| 17 | */ | |
| 18 | package org.owasp.dependencycheck.org.apache.tools.ant; | |
| 19 | ||
| 20 | import java.io.File; | |
| 21 | ||
| 22 | /** | |
| 23 | * An interface used to describe the actions required of any type of | |
| 24 | * directory scanner. | |
| 25 | * | |
| 26 | */ | |
| 27 | public interface FileScanner { | |
| 28 | /** | |
| 29 | * Adds default exclusions to the current exclusions set. | |
| 30 | */ | |
| 31 | void addDefaultExcludes(); | |
| 32 | ||
| 33 | /** | |
| 34 | * Returns the base directory to be scanned. | |
| 35 | * This is the directory which is scanned recursively. | |
| 36 | * | |
| 37 | * @return the base directory to be scanned | |
| 38 | */ | |
| 39 | File getBasedir(); | |
| 40 | ||
| 41 | /** | |
| 42 | * Returns the names of the directories which matched at least one of the | |
| 43 | * include patterns and at least one of the exclude patterns. | |
| 44 | * The names are relative to the base directory. | |
| 45 | * | |
| 46 | * @return the names of the directories which matched at least one of the | |
| 47 | * include patterns and at least one of the exclude patterns. | |
| 48 | */ | |
| 49 | String[] getExcludedDirectories(); | |
| 50 | ||
| 51 | /** | |
| 52 | * Returns the names of the files which matched at least one of the | |
| 53 | * include patterns and at least one of the exclude patterns. | |
| 54 | * The names are relative to the base directory. | |
| 55 | * | |
| 56 | * @return the names of the files which matched at least one of the | |
| 57 | * include patterns and at least one of the exclude patterns. | |
| 58 | * | |
| 59 | */ | |
| 60 | String[] getExcludedFiles(); | |
| 61 | ||
| 62 | /** | |
| 63 | * Returns the names of the directories which matched at least one of the | |
| 64 | * include patterns and none of the exclude patterns. | |
| 65 | * The names are relative to the base directory. | |
| 66 | * | |
| 67 | * @return the names of the directories which matched at least one of the | |
| 68 | * include patterns and none of the exclude patterns. | |
| 69 | */ | |
| 70 | String[] getIncludedDirectories(); | |
| 71 | ||
| 72 | /** | |
| 73 | * Returns the names of the files which matched at least one of the | |
| 74 | * include patterns and none of the exclude patterns. | |
| 75 | * The names are relative to the base directory. | |
| 76 | * | |
| 77 | * @return the names of the files which matched at least one of the | |
| 78 | * include patterns and none of the exclude patterns. | |
| 79 | */ | |
| 80 | String[] getIncludedFiles(); | |
| 81 | ||
| 82 | /** | |
| 83 | * Returns the names of the directories which matched none of the include | |
| 84 | * patterns. The names are relative to the base directory. | |
| 85 | * | |
| 86 | * @return the names of the directories which matched none of the include | |
| 87 | * patterns. | |
| 88 | */ | |
| 89 | String[] getNotIncludedDirectories(); | |
| 90 | ||
| 91 | /** | |
| 92 | * Returns the names of the files which matched none of the include | |
| 93 | * patterns. The names are relative to the base directory. | |
| 94 | * | |
| 95 | * @return the names of the files which matched none of the include | |
| 96 | * patterns. | |
| 97 | */ | |
| 98 | String[] getNotIncludedFiles(); | |
| 99 | ||
| 100 | /** | |
| 101 | * Scans the base directory for files which match at least one include | |
| 102 | * pattern and don't match any exclude patterns. | |
| 103 | * | |
| 104 | * @exception IllegalStateException if the base directory was set | |
| 105 | * incorrectly (i.e. if it is <code>null</code>, doesn't exist, | |
| 106 | * or isn't a directory). | |
| 107 | */ | |
| 108 | void scan() throws IllegalStateException; | |
| 109 | ||
| 110 | /** | |
| 111 | * Sets the base directory to be scanned. This is the directory which is | |
| 112 | * scanned recursively. All '/' and '\' characters should be replaced by | |
| 113 | * <code>File.separatorChar</code>, so the separator used need not match | |
| 114 | * <code>File.separatorChar</code>. | |
| 115 | * | |
| 116 | * @param basedir The base directory to scan. | |
| 117 | * Must not be <code>null</code>. | |
| 118 | */ | |
| 119 | void setBasedir(String basedir); | |
| 120 | ||
| 121 | /** | |
| 122 | * Sets the base directory to be scanned. This is the directory which is | |
| 123 | * scanned recursively. | |
| 124 | * | |
| 125 | * @param basedir The base directory for scanning. | |
| 126 | * Should not be <code>null</code>. | |
| 127 | */ | |
| 128 | void setBasedir(File basedir); | |
| 129 | ||
| 130 | /** | |
| 131 | * Sets the list of exclude patterns to use. | |
| 132 | * | |
| 133 | * @param excludes A list of exclude patterns. | |
| 134 | * May be <code>null</code>, indicating that no files | |
| 135 | * should be excluded. If a non-<code>null</code> list is | |
| 136 | * given, all elements must be non-<code>null</code>. | |
| 137 | */ | |
| 138 | void setExcludes(String[] excludes); | |
| 139 | ||
| 140 | /** | |
| 141 | * Sets the list of include patterns to use. | |
| 142 | * | |
| 143 | * @param includes A list of include patterns. | |
| 144 | * May be <code>null</code>, indicating that all files | |
| 145 | * should be included. If a non-<code>null</code> | |
| 146 | * list is given, all elements must be | |
| 147 | * non-<code>null</code>. | |
| 148 | */ | |
| 149 | void setIncludes(String[] includes); | |
| 150 | ||
| 151 | /** | |
| 152 | * Sets whether or not the file system should be regarded as case sensitive. | |
| 153 | * | |
| 154 | * @param isCaseSensitive whether or not the file system should be | |
| 155 | * regarded as a case sensitive one | |
| 156 | */ | |
| 157 | void setCaseSensitive(boolean isCaseSensitive); | |
| 158 | } |