Subversion Repositories XServices

Rev

Rev 198 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 198 Rev 199
Line 13... Line 13...
13
 *   See the License for the specific language governing permissions and
13
 *   See the License for the specific language governing permissions and
14
 *   limitations under the License.
14
 *   limitations under the License.
15
 */
15
 */
16
package net.brutex.xservices.util;
16
package net.brutex.xservices.util;
Line -... Line 17...
-
 
17
 
-
 
18
import lombok.extern.slf4j.Slf4j;
17
 
19
 
18
import java.io.IOException;
20
import java.io.IOException;
19
import java.nio.file.FileSystems;
21
import java.nio.file.FileSystems;
20
import java.nio.file.FileVisitResult;
22
import java.nio.file.FileVisitResult;
21
import java.nio.file.Path;
23
import java.nio.file.Path;
Line 24... Line 26...
24
import java.nio.file.attribute.BasicFileAttributes;
26
import java.nio.file.attribute.BasicFileAttributes;
25
import java.util.ArrayList;
27
import java.util.ArrayList;
26
import java.util.List;
28
import java.util.List;
Line 27... Line -...
27
 
-
 
28
 
-
 
29
import org.apache.logging.log4j.LogManager;
-
 
30
import org.apache.logging.log4j.Logger;
-
 
Line 31... Line 29...
31
 
29
 
32
import net.brutex.xservices.types.FileInfoType;
30
 
33
 
31
 
34
// TODO: Auto-generated Javadoc
32
// TODO: Auto-generated Javadoc
35
/**
33
/**
36
 * The Class FileWalker.
34
 * The Class FileWalker.
-
 
35
 *
37
 *
36
 * @author Brian Rosenberger, bru(at)brutex.de
Line 38... Line 37...
38
 * @author Brian Rosenberger, bru(at)brutex.de
37
 */
39
 */
38
@Slf4j
Line 49... Line 48...
49
	private long total=0;
48
	private long total=0;
Line 50... Line 49...
50
	
49
	
51
	/** The pattern. */
50
	/** The pattern. */
Line 52... Line -...
52
	private final String pattern;
-
 
53
	
-
 
54
	/** The logger. */
-
 
55
	private static final Logger logger = LogManager.getLogger();
51
	private final String pattern;
Line 56... Line 52...
56
 
52
	
57
	List<Path> list;
53
	List<Path> list;
58
	
54
	
Line 76... Line 72...
76
 	 *
72
 	 *
77
 	 * @param file the file
73
 	 * @param file the file
78
 	 */
74
 	 */
79
 	void find(Path file) {
75
 	void find(Path file) {
80
        Path name = file.getFileName();
76
        Path name = file.getFileName();
81
        logger.trace("Compare file " + file.toString() + " against pattern '"+pattern+"'.");
77
        log.debug("Compare file '{}' against pattern '{}'.", file, pattern);
82
        total++;
78
        total++;
83
        if (name != null && matcher.matches(name)) {
79
        if (name != null && matcher.matches(name)) {
84
            list.add(file);
80
            list.add(file);
85
			logger.debug("Added file " + file.toString() + " to the result set.");
81
			log.debug("Added file '{}' to the result set.", file);
86
			num++;
82
			num++;
87
        }
83
        }
88
    }
84
    }
Line 89... Line 85...
89
 
85
 
Line 116... Line 112...
116
     * @see java.nio.file.SimpleFileVisitor#visitFileFailed(java.lang.Object, java.io.IOException)
112
     * @see java.nio.file.SimpleFileVisitor#visitFileFailed(java.lang.Object, java.io.IOException)
117
     */
113
     */
118
    @Override
114
    @Override
119
    public FileVisitResult visitFileFailed(Path file,
115
    public FileVisitResult visitFileFailed(Path file,
120
            IOException exc) {
116
            IOException exc) {
121
        logger.warn(String.format("Failed to include file '%s'.", file.toString()));
117
        log.warn("Failed to include file '{}'.", file);
122
        return FileVisitResult.CONTINUE;
118
        return FileVisitResult.CONTINUE;
123
    }
119
    }
Line 124... Line 120...
124
    
120
    
125
    /**
121
    /**