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 BC37B110C8 for ; Tue, 3 Jun 2014 18:51:25 +0000 (UTC) Received: (qmail 3928 invoked by uid 500); 3 Jun 2014 18:51:25 -0000 Delivered-To: apmail-manifoldcf-commits-archive@manifoldcf.apache.org Received: (qmail 3880 invoked by uid 500); 3 Jun 2014 18:51:25 -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 3873 invoked by uid 99); 3 Jun 2014 18:51:25 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 03 Jun 2014 18:51:25 +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; Tue, 03 Jun 2014 18:51:24 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 0DB12238896F; Tue, 3 Jun 2014 18:51:00 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1599751 - in /manifoldcf/branches/CONNECTORS-946/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler: interfaces/IJobManager.java jobs/JobManager.java jobs/Jobs.java system/CrawlerAgent.java Date: Tue, 03 Jun 2014 18:50:59 -0000 To: commits@manifoldcf.apache.org From: kwright@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20140603185100.0DB12238896F@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: kwright Date: Tue Jun 3 18:50:59 2014 New Revision: 1599751 URL: http://svn.apache.org/r1599751 Log: Flesh out interlock checks, but not done yet; registration/deregistration has issues. Modified: manifoldcf/branches/CONNECTORS-946/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/interfaces/IJobManager.java manifoldcf/branches/CONNECTORS-946/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/JobManager.java manifoldcf/branches/CONNECTORS-946/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/Jobs.java manifoldcf/branches/CONNECTORS-946/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/CrawlerAgent.java Modified: manifoldcf/branches/CONNECTORS-946/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/interfaces/IJobManager.java URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-946/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/interfaces/IJobManager.java?rev=1599751&r1=1599750&r2=1599751&view=diff ============================================================================== --- manifoldcf/branches/CONNECTORS-946/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/interfaces/IJobManager.java (original) +++ manifoldcf/branches/CONNECTORS-946/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/interfaces/IJobManager.java Tue Jun 3 18:50:59 2014 @@ -125,6 +125,13 @@ public interface IJobManager public boolean checkIfOutputReference(String connectionName) throws ManifoldCFException; + /** See if there's a reference to a transformation connection name. + *@param connectionName is the name of the connection. + *@return true if there is a reference, false otherwise. + */ + public boolean checkIfTransformationReference(String connectionName) + throws ManifoldCFException; + /** Get the job IDs associated with a given connection name. *@param connectionName is the name of the connection. *@return the set of job id's associated with that connection. @@ -955,6 +962,22 @@ public interface IJobManager public void noteOutputConnectionChange(String connectionName) throws ManifoldCFException; + /** Note the deregistration of a transformation connector used by the specified connections. + * This method will be called when the connector is deregistered. Jobs that use these connections + * must therefore enter appropriate states. + *@param connectionNames is the set of connection names. + */ + public void noteTransformationConnectorDeregistration(String[] connectionNames) + throws ManifoldCFException; + + /** Note the registration of a transformation connector used by the specified connections. + * This method will be called when a connector is registered, on which the specified + * connections depend. + *@param connectionNames is the set of connection names. + */ + public void noteTransformationConnectorRegistration(String[] connectionNames) + throws ManifoldCFException; + /** Delete jobs in need of being deleted (which are marked "ready for delete"). * This method is meant to be called periodically to perform delete processing on jobs. */ Modified: manifoldcf/branches/CONNECTORS-946/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/JobManager.java URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-946/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/JobManager.java?rev=1599751&r1=1599750&r2=1599751&view=diff ============================================================================== --- manifoldcf/branches/CONNECTORS-946/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/JobManager.java (original) +++ manifoldcf/branches/CONNECTORS-946/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/JobManager.java Tue Jun 3 18:50:59 2014 @@ -488,6 +488,32 @@ public class JobManager implements IJobM } } + /** Note the deregistration of a transformation connector used by the specified connections. + * This method will be called when the connector is deregistered. Jobs that use these connections + * must therefore enter appropriate states. + *@param connectionNames is the set of connection names. + */ + @Override + public void noteTransformationConnectorDeregistration(String[] connectionNames) + throws ManifoldCFException + { + // This is problematic; we need a different bit in the job state for every transformation in the job pipeline + // MHL + } + + /** Note the registration of a transformation connector used by the specified connections. + * This method will be called when a connector is registered, on which the specified + * connections depend. + *@param connectionNames is the set of connection names. + */ + @Override + public void noteTransformationConnectorRegistration(String[] connectionNames) + throws ManifoldCFException + { + // This is problematic; we need a different bit in the job state for every transformation in the job pipeline + // MHL + } + /** Note a change in output connection configuration. * This method will be called whenever a connection's configuration is modified, or when an external target config change * is signalled. @@ -632,6 +658,17 @@ public class JobManager implements IJobM return jobs.checkIfOutputReference(connectionName); } + /** See if there's a reference to a transformation connection name. + *@param connectionName is the name of the connection. + *@return true if there is a reference, false otherwise. + */ + @Override + public boolean checkIfTransformationReference(String connectionName) + throws ManifoldCFException + { + return jobs.checkIfTransformationReference(connectionName); + } + /** Get the job IDs associated with a given connection name. *@param connectionName is the name of the connection. *@return the set of job id's associated with that connection. Modified: manifoldcf/branches/CONNECTORS-946/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/Jobs.java URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-946/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/Jobs.java?rev=1599751&r1=1599750&r2=1599751&view=diff ============================================================================== --- manifoldcf/branches/CONNECTORS-946/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/Jobs.java (original) +++ manifoldcf/branches/CONNECTORS-946/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/Jobs.java Tue Jun 3 18:50:59 2014 @@ -2821,6 +2821,21 @@ public class Jobs extends org.apache.man return set.getRowCount() > 0; } + /** See if there's a reference to a transformation connection name. + *@param connectionName is the name of the connection. + *@return true if there is a reference, false otherwise. + */ + public boolean checkIfTransformationReference(String connectionName) + throws ManifoldCFException + { + ArrayList list = new ArrayList(); + String query = buildConjunctionClause(list,new ClauseDescription[]{ + new UnitaryClause(pipelineManager.transformationNameField,connectionName)}); + IResultSet set = performQuery("SELECT "+pipelineManager.ownerIDField+" FROM "+pipelineManager.getTableName()+ + " WHERE "+query,list,new StringSet(getJobsKey()),null); + return set.getRowCount() > 0; + } + /** Get the job IDs associated with a given connection name. *@param connectionName is the name of the connection. *@return the set of job id's associated with that connection. Modified: manifoldcf/branches/CONNECTORS-946/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/CrawlerAgent.java URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-946/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/CrawlerAgent.java?rev=1599751&r1=1599750&r2=1599751&view=diff ============================================================================== --- manifoldcf/branches/CONNECTORS-946/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/CrawlerAgent.java (original) +++ manifoldcf/branches/CONNECTORS-946/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/CrawlerAgent.java Tue Jun 3 18:50:59 2014 @@ -290,8 +290,9 @@ public class CrawlerAgent implements IAg public boolean isTransformationConnectionInUse(IThreadContext threadContext, String connName) throws ManifoldCFException { - // MHL - return false; + // Check with job manager. + IJobManager jobManager = JobManagerFactory.make(threadContext); + return jobManager.checkIfTransformationReference(connName); } /** Note the deregistration of a set of transformation connections. @@ -301,7 +302,9 @@ public class CrawlerAgent implements IAg public void noteTransformationConnectorDeregistration(IThreadContext threadContext, String[] connectionNames) throws ManifoldCFException { - // MHL + // Notify job manager + IJobManager jobManager = JobManagerFactory.make(threadContext); + jobManager.noteTransformationConnectorDeregistration(connectionNames); } /** Note the registration of a set of transformation connections. @@ -311,7 +314,9 @@ public class CrawlerAgent implements IAg public void noteTransformationConnectorRegistration(IThreadContext threadContext, String[] connectionNames) throws ManifoldCFException { - // MHL + // Notify job manager + IJobManager jobManager = JobManagerFactory.make(threadContext); + jobManager.noteTransformationConnectorRegistration(connectionNames); } /** Note a change in configuration for a transformation connection.