You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@manifoldcf.apache.org by kw...@apache.org on 2014/06/04 20:29:04 UTC
svn commit: r1600413 -
/manifoldcf/branches/CONNECTORS-946/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/ManifoldCF.java
Author: kwright
Date: Wed Jun 4 18:29:04 2014
New Revision: 1600413
URL: http://svn.apache.org/r1600413
Log:
More transformationconnection api stuff
Modified:
manifoldcf/branches/CONNECTORS-946/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/ManifoldCF.java
Modified: manifoldcf/branches/CONNECTORS-946/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/ManifoldCF.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-946/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/ManifoldCF.java?rev=1600413&r1=1600412&r2=1600413&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-946/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/ManifoldCF.java (original)
+++ manifoldcf/branches/CONNECTORS-946/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/ManifoldCF.java Wed Jun 4 18:29:04 2014
@@ -3389,6 +3389,41 @@ public class ManifoldCF extends org.apac
}
return WRITERESULT_FOUND;
}
+
+ /** Write transformation connection.
+ */
+ protected static int apiWriteTransformationConnection(IThreadContext tc, Configuration output, Configuration input, String connectionName)
+ throws ManifoldCFException
+ {
+ ConfigurationNode connectionNode = findConfigurationNode(input,API_TRANSFORMATIONCONNECTIONNODE);
+ if (connectionNode == null)
+ throw new ManifoldCFException("Input argument must have '"+API_TRANSFORMATIONCONNECTIONNODE+"' field");
+
+ // Turn the configuration node into a TransformationConnection
+ org.apache.manifoldcf.agents.transformationconnection.TransformationConnection transformationConnection = new org.apache.manifoldcf.agents.transformationconnection.TransformationConnection();
+ processTransformationConnection(transformationConnection,connectionNode);
+
+ if (transformationConnection.getName() == null)
+ transformationConnection.setName(connectionName);
+ else
+ {
+ if (!transformationConnection.getName().equals(connectionName))
+ throw new ManifoldCFException("Connection name in path and in object must agree");
+ }
+
+ try
+ {
+ // Save the connection.
+ ITransformationConnectionManager connectionManager = TransformationConnectionManagerFactory.make(tc);
+ if (connectionManager.save(transformationConnection))
+ return WRITERESULT_CREATED;
+ }
+ catch (ManifoldCFException e)
+ {
+ createErrorNode(output,e);
+ }
+ return WRITERESULT_FOUND;
+ }
/** Write authority connection.
*/
@@ -3612,6 +3647,11 @@ public class ManifoldCF extends org.apac
String connectionName = decodeAPIPathElement(path.substring("outputconnections/".length()));
return apiWriteOutputConnection(tc,output,input,connectionName);
}
+ else if (path.startsWith("transformationconnections/"))
+ {
+ String connectionName = decodeAPIPathElement(path.substring("transformationconnections/".length()));
+ return apiWriteTransformationConnection(tc,output,input,connectionName);
+ }
else if (path.startsWith("mappingconnections/"))
{
String connectionName = decodeAPIPathElement(path.substring("mappingconnections/".length()));