You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@chukwa.apache.org by ey...@apache.org on 2010/12/12 02:36:58 UTC

svn commit: r1044751 - in /incubator/chukwa/trunk/src/java/org/apache/hadoop/chukwa/datacollection/adaptor: DirTailingAdaptor.java RegExDirTailingAdaptor.java

Author: eyang
Date: Sun Dec 12 01:36:58 2010
New Revision: 1044751

URL: http://svn.apache.org/viewvc?rev=1044751&view=rev
Log:
CHUKWA-562. Added RegExDirTailingAdaptor. (Deepak Deshpande via Eric Yang)

Added:
    incubator/chukwa/trunk/src/java/org/apache/hadoop/chukwa/datacollection/adaptor/RegExDirTailingAdaptor.java
Modified:
    incubator/chukwa/trunk/src/java/org/apache/hadoop/chukwa/datacollection/adaptor/DirTailingAdaptor.java

Modified: incubator/chukwa/trunk/src/java/org/apache/hadoop/chukwa/datacollection/adaptor/DirTailingAdaptor.java
URL: http://svn.apache.org/viewvc/incubator/chukwa/trunk/src/java/org/apache/hadoop/chukwa/datacollection/adaptor/DirTailingAdaptor.java?rev=1044751&r1=1044750&r2=1044751&view=diff
==============================================================================
--- incubator/chukwa/trunk/src/java/org/apache/hadoop/chukwa/datacollection/adaptor/DirTailingAdaptor.java (original)
+++ incubator/chukwa/trunk/src/java/org/apache/hadoop/chukwa/datacollection/adaptor/DirTailingAdaptor.java Sun Dec 12 01:36:58 2010
@@ -133,7 +133,7 @@ public class DirTailingAdaptor extends A
     }else if(args.length == 3){
      baseDir = new File(args[0]);
      this.wildCharacter = args[ 1 ];
-     fileFilter = new WildcardFileFilter( this.wildCharacter );
+     fileFilter = getFileFilter();
      adaptorName = args[2]; 
     }else{
      log.warn("bad syntax in DirTailingAdaptor args");
@@ -150,4 +150,14 @@ public class DirTailingAdaptor extends A
     return lastSweepStartTime;
   }
 
+  /**
+   * Returns {@link IOFileFilter} constructed using the wild character. Subclasses can override this method 
+   * return their own version of {@link IOFileFilter} instance.
+   *  
+   * @return {@link IOFileFilter} constructed using the wild character. Subclasses can override this method 
+   * return their own version of {@link IOFileFilter} instance.
+   */
+  protected IOFileFilter getFileFilter() {
+  	return new WildcardFileFilter( this.wildCharacter );
+  }
 }

Added: incubator/chukwa/trunk/src/java/org/apache/hadoop/chukwa/datacollection/adaptor/RegExDirTailingAdaptor.java
URL: http://svn.apache.org/viewvc/incubator/chukwa/trunk/src/java/org/apache/hadoop/chukwa/datacollection/adaptor/RegExDirTailingAdaptor.java?rev=1044751&view=auto
==============================================================================
--- incubator/chukwa/trunk/src/java/org/apache/hadoop/chukwa/datacollection/adaptor/RegExDirTailingAdaptor.java (added)
+++ incubator/chukwa/trunk/src/java/org/apache/hadoop/chukwa/datacollection/adaptor/RegExDirTailingAdaptor.java Sun Dec 12 01:36:58 2010
@@ -0,0 +1,38 @@
+/*
+ * 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.hadoop.chukwa.datacollection.adaptor;
+
+import org.apache.commons.io.filefilter.IOFileFilter;
+import org.apache.commons.io.filefilter.RegexFileFilter;
+
+/**
+ * 
+ */
+public class RegExDirTailingAdaptor extends DirTailingAdaptor {
+
+	/*
+	 * (non-Javadoc)
+	 * @see org.apache.hadoop.chukwa.datacollection.adaptor.DirTailingAdaptor#getFileFilter()
+	 */
+	@Override
+	public IOFileFilter getFileFilter ( ) {
+		return new RegexFileFilter( this.wildCharacter);
+	}
+
+}