Move out nested type
git-svn-id: https://svn.apache.org/repos/asf/creadur/tentacles/trunk@1462838 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/src/main/java/org/apache/creadur/tentacles/IsArchiveInPath.java b/src/main/java/org/apache/creadur/tentacles/IsArchiveInPath.java
new file mode 100644
index 0000000..792b6d8
--- /dev/null
+++ b/src/main/java/org/apache/creadur/tentacles/IsArchiveInPath.java
@@ -0,0 +1,42 @@
+/**
+ * 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.creadur.tentacles;
+
+import java.io.File;
+import java.io.FileFilter;
+
+final class IsArchiveInPath implements FileFilter {
+
+ private final String pathNameFilter;
+
+ IsArchiveInPath(final String pathNameFilter) {
+ super();
+ this.pathNameFilter = pathNameFilter;
+ }
+
+ @Override
+ public boolean accept(final File pathname) {
+ final String path = pathname.getAbsolutePath();
+ return path.matches(this.pathNameFilter) && isValidArchive(path);
+ }
+
+ private boolean isValidArchive(final String path) {
+ return path.matches(".*\\.(jar|zip|war|ear|tar.gz)");
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/org/apache/creadur/tentacles/Main.java b/src/main/java/org/apache/creadur/tentacles/Main.java
index 9e4b9f9..0489312 100644
--- a/src/main/java/org/apache/creadur/tentacles/Main.java
+++ b/src/main/java/org/apache/creadur/tentacles/Main.java
@@ -20,7 +20,6 @@
import static org.apache.creadur.tentacles.RepositoryType.LOCAL_FILE_SYSTEM;
import java.io.File;
-import java.io.FileFilter;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
@@ -346,15 +345,10 @@
final File file =
new File(this.configuration.getStagingRepositoryURI());
final List<File> collect =
- this.fileSystem.collect(file, new FileFilter() {
- @Override
- public boolean accept(final File pathname) {
- final String path = pathname.getAbsolutePath();
- return path.matches(Main.this.configuration
- .getFileRepositoryPathNameFilter())
- && isValidArchive(path);
- }
- });
+ this.fileSystem.collect(
+ file,
+ new IsArchiveInPath(this.configuration
+ .getFileRepositoryPathNameFilter()));
for (final File f : collect) {
files.add(copyToMirror(f));
@@ -688,7 +682,4 @@
return new File(this.repository, name);
}
- private boolean isValidArchive(final String path) {
- return path.matches(".*\\.(jar|zip|war|ear|tar.gz)");
- }
}