creadur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rdon...@apache.org
Subject svn commit: r1462838 - in /creadur/tentacles/trunk/src/main/java/org/apache/creadur/tentacles: IsArchiveInPath.java Main.java
Date Sat, 30 Mar 2013 18:41:27 GMT
Author: rdonkin
Date: Sat Mar 30 18:41:27 2013
New Revision: 1462838

URL: http://svn.apache.org/r1462838
Log:
Move out nested type

Added:
    creadur/tentacles/trunk/src/main/java/org/apache/creadur/tentacles/IsArchiveInPath.java
  (with props)
Modified:
    creadur/tentacles/trunk/src/main/java/org/apache/creadur/tentacles/Main.java

Added: creadur/tentacles/trunk/src/main/java/org/apache/creadur/tentacles/IsArchiveInPath.java
URL: http://svn.apache.org/viewvc/creadur/tentacles/trunk/src/main/java/org/apache/creadur/tentacles/IsArchiveInPath.java?rev=1462838&view=auto
==============================================================================
--- creadur/tentacles/trunk/src/main/java/org/apache/creadur/tentacles/IsArchiveInPath.java
(added)
+++ creadur/tentacles/trunk/src/main/java/org/apache/creadur/tentacles/IsArchiveInPath.java
Sat Mar 30 18:41:27 2013
@@ -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

Propchange: creadur/tentacles/trunk/src/main/java/org/apache/creadur/tentacles/IsArchiveInPath.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: creadur/tentacles/trunk/src/main/java/org/apache/creadur/tentacles/Main.java
URL: http://svn.apache.org/viewvc/creadur/tentacles/trunk/src/main/java/org/apache/creadur/tentacles/Main.java?rev=1462838&r1=1462837&r2=1462838&view=diff
==============================================================================
--- creadur/tentacles/trunk/src/main/java/org/apache/creadur/tentacles/Main.java (original)
+++ creadur/tentacles/trunk/src/main/java/org/apache/creadur/tentacles/Main.java Sat Mar 30
18:41:27 2013
@@ -20,7 +20,6 @@ import static org.apache.creadur.tentacl
 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 @@ public class Main {
             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 @@ public class Main {
         return new File(this.repository, name);
     }
 
-    private boolean isValidArchive(final String path) {
-        return path.matches(".*\\.(jar|zip|war|ear|tar.gz)");
-    }
 }



Mime
View raw message