Return-Path: X-Original-To: apmail-manifoldcf-commits-archive@www.apache.org Delivered-To: apmail-manifoldcf-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 77EC217B87 for ; Sat, 18 Oct 2014 22:26:46 +0000 (UTC) Received: (qmail 59500 invoked by uid 500); 18 Oct 2014 22:26:45 -0000 Delivered-To: apmail-manifoldcf-commits-archive@manifoldcf.apache.org Received: (qmail 59447 invoked by uid 500); 18 Oct 2014 22:26:45 -0000 Mailing-List: contact commits-help@manifoldcf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@manifoldcf.apache.org Delivered-To: mailing list commits@manifoldcf.apache.org Received: (qmail 59438 invoked by uid 99); 18 Oct 2014 22:26:45 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 18 Oct 2014 22:26:45 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 18 Oct 2014 22:26:22 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 2F2ED238897A; Sat, 18 Oct 2014 22:26:21 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1632854 - /manifoldcf/trunk/connectors/hdfs/connector/src/main/java/org/apache/manifoldcf/agents/output/hdfs/HDFSOutputConnector.java Date: Sat, 18 Oct 2014 22:26:21 -0000 To: commits@manifoldcf.apache.org From: molgun@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20141018222621.2F2ED238897A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: molgun Date: Sat Oct 18 22:26:20 2014 New Revision: 1632854 URL: http://svn.apache.org/r1632854 Log: Added activity logging for HDFS output connector. Modified: manifoldcf/trunk/connectors/hdfs/connector/src/main/java/org/apache/manifoldcf/agents/output/hdfs/HDFSOutputConnector.java Modified: manifoldcf/trunk/connectors/hdfs/connector/src/main/java/org/apache/manifoldcf/agents/output/hdfs/HDFSOutputConnector.java URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/hdfs/connector/src/main/java/org/apache/manifoldcf/agents/output/hdfs/HDFSOutputConnector.java?rev=1632854&r1=1632853&r2=1632854&view=diff ============================================================================== --- manifoldcf/trunk/connectors/hdfs/connector/src/main/java/org/apache/manifoldcf/agents/output/hdfs/HDFSOutputConnector.java (original) +++ manifoldcf/trunk/connectors/hdfs/connector/src/main/java/org/apache/manifoldcf/agents/output/hdfs/HDFSOutputConnector.java Sat Oct 18 22:26:20 2014 @@ -286,10 +286,11 @@ public class HDFSOutputConnector extends Path path = new Path(strBuff.toString()); Long startTime = new Long(System.currentTimeMillis()); - createFile(path, document.getBinaryStream()); + createFile(path, document.getBinaryStream(),activities,documentURI); activities.recordActivity(startTime, INGEST_ACTIVITY, new Long(document.getBinaryLength()), documentURI, "OK", null); return DOCUMENTSTATUS_ACCEPTED; } catch (URISyntaxException e) { + activities.recordActivity(null,INGEST_ACTIVITY,new Long(document.getBinaryLength()),documentURI,activities.EXCEPTION,"Rejected due to URISyntaxException"); handleURISyntaxException(e); return DOCUMENTSTATUS_REJECTED; } @@ -320,11 +321,13 @@ public class HDFSOutputConnector extends strBuff.append(documentURItoFilePath(documentURI)); Path path = new Path(strBuff.toString()); Long startTime = new Long(System.currentTimeMillis()); - deleteFile(path); + deleteFile(path,activities,documentURI); activities.recordActivity(startTime, REMOVE_ACTIVITY, null, documentURI, "OK", null); } catch (JSONException e) { + activities.recordActivity(null,REMOVE_ACTIVITY,null,documentURI,activities.EXCEPTION,"Rejected due to JSONException."); handleJSONException(e); } catch (URISyntaxException e) { + activities.recordActivity(null,REMOVE_ACTIVITY,null,documentURI,activities.EXCEPTION,"Rejected due to URISyntaxException."); handleURISyntaxException(e); } } @@ -649,7 +652,7 @@ public class HDFSOutputConnector extends } } - protected void createFile(Path path, InputStream input) + protected void createFile(Path path, InputStream input,IOutputAddActivity activities, String documentURI) throws ManifoldCFException, ServiceInterruption { CreateFileThread t = new CreateFileThread(getSession(), path, input); try { @@ -657,13 +660,17 @@ public class HDFSOutputConnector extends t.finishUp(); } catch (InterruptedException e) { t.interrupt(); + activities.recordActivity(null,INGEST_ACTIVITY,null,documentURI,activities.EXCEPTION,"Rejected due to InterruptedException."); throw new ManifoldCFException("Interrupted: "+e.getMessage(),e,ManifoldCFException.INTERRUPTED); } catch (java.net.SocketTimeoutException e) { + activities.recordActivity(null,INGEST_ACTIVITY,null,documentURI,activities.EXCEPTION,"Rejected due to SocketTimeoutException."); handleIOException(e); } catch (InterruptedIOException e) { t.interrupt(); + activities.recordActivity(null,INGEST_ACTIVITY,null,documentURI,activities.EXCEPTION,"Rejected due to InterruptedIOException."); handleIOException(e); } catch (IOException e) { + activities.recordActivity(null,INGEST_ACTIVITY,null,documentURI,activities.EXCEPTION,"Rejected due to IOException."); handleIOException(e); } } @@ -703,7 +710,7 @@ public class HDFSOutputConnector extends } } - protected void deleteFile(Path path) + protected void deleteFile(Path path,IOutputRemoveActivity activities,String documentURI) throws ManifoldCFException, ServiceInterruption { // Establish a session DeleteFileThread t = new DeleteFileThread(getSession(),path); @@ -712,13 +719,17 @@ public class HDFSOutputConnector extends t.finishUp(); } catch (InterruptedException e) { t.interrupt(); + activities.recordActivity(null,REMOVE_ACTIVITY,null,documentURI,activities.EXCEPTION,"Rejected due to InterruptedException."); throw new ManifoldCFException("Interrupted: "+e.getMessage(),e,ManifoldCFException.INTERRUPTED); } catch (java.net.SocketTimeoutException e) { + activities.recordActivity(null,REMOVE_ACTIVITY,null,documentURI,activities.EXCEPTION,"Rejected due to SocketTimeoutException."); handleIOException(e); } catch (InterruptedIOException e) { t.interrupt(); + activities.recordActivity(null,REMOVE_ACTIVITY,null,documentURI,activities.EXCEPTION,"Rejected due to InterruptedIOException."); handleIOException(e); } catch (IOException e) { + activities.recordActivity(null,REMOVE_ACTIVITY,null,documentURI,activities.EXCEPTION,"Rejected due to IOException."); handleIOException(e); } }