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/05/31 13:54:52 UTC

svn commit: r1598862 - in /manifoldcf/branches/CONNECTORS-946: connectors/ connectors/nulltransformation/ connectors/nulltransformation/connector/ connectors/nulltransformation/connector/src/ connectors/nulltransformation/connector/src/main/ connectors...

Author: kwright
Date: Sat May 31 11:54:51 2014
New Revision: 1598862

URL: http://svn.apache.org/r1598862
Log:
Add null transformation connector

Added:
    manifoldcf/branches/CONNECTORS-946/connectors/nulltransformation/
    manifoldcf/branches/CONNECTORS-946/connectors/nulltransformation/build.xml   (with props)
    manifoldcf/branches/CONNECTORS-946/connectors/nulltransformation/connector/
    manifoldcf/branches/CONNECTORS-946/connectors/nulltransformation/connector/src/
    manifoldcf/branches/CONNECTORS-946/connectors/nulltransformation/connector/src/main/
    manifoldcf/branches/CONNECTORS-946/connectors/nulltransformation/connector/src/main/java/
    manifoldcf/branches/CONNECTORS-946/connectors/nulltransformation/connector/src/main/java/org/
    manifoldcf/branches/CONNECTORS-946/connectors/nulltransformation/connector/src/main/java/org/apache/
    manifoldcf/branches/CONNECTORS-946/connectors/nulltransformation/connector/src/main/java/org/apache/manifoldcf/
    manifoldcf/branches/CONNECTORS-946/connectors/nulltransformation/connector/src/main/java/org/apache/manifoldcf/agents/
    manifoldcf/branches/CONNECTORS-946/connectors/nulltransformation/connector/src/main/java/org/apache/manifoldcf/agents/transformation/
    manifoldcf/branches/CONNECTORS-946/connectors/nulltransformation/connector/src/main/java/org/apache/manifoldcf/agents/transformation/NullConnector.java   (with props)
    manifoldcf/branches/CONNECTORS-946/connectors/nulltransformation/pom.xml   (with props)
    manifoldcf/branches/CONNECTORS-946/framework/agents/src/main/java/org/apache/manifoldcf/agents/DefineTransformationConnection.java   (with props)
    manifoldcf/branches/CONNECTORS-946/framework/agents/src/main/java/org/apache/manifoldcf/agents/DeleteTransformationConnection.java   (with props)
    manifoldcf/branches/CONNECTORS-946/framework/agents/src/main/java/org/apache/manifoldcf/agents/RegisterTransformation.java   (with props)
    manifoldcf/branches/CONNECTORS-946/framework/agents/src/main/java/org/apache/manifoldcf/agents/SynchronizeTransformations.java   (with props)
    manifoldcf/branches/CONNECTORS-946/framework/agents/src/main/java/org/apache/manifoldcf/agents/UnRegisterAllTransformations.java   (with props)
    manifoldcf/branches/CONNECTORS-946/framework/agents/src/main/java/org/apache/manifoldcf/agents/UnRegisterTransformation.java   (with props)
    manifoldcf/branches/CONNECTORS-946/framework/agents/src/main/java/org/apache/manifoldcf/agents/interfaces/ITransformationConnectorPool.java   (with props)
    manifoldcf/branches/CONNECTORS-946/framework/agents/src/main/java/org/apache/manifoldcf/agents/interfaces/TransformationConnectorPoolFactory.java   (with props)
    manifoldcf/branches/CONNECTORS-946/framework/agents/src/main/java/org/apache/manifoldcf/agents/transformationconnectorpool/
    manifoldcf/branches/CONNECTORS-946/framework/agents/src/main/java/org/apache/manifoldcf/agents/transformationconnectorpool/TransformationConnectorPool.java   (with props)
Modified:
    manifoldcf/branches/CONNECTORS-946/connectors/pom.xml
    manifoldcf/branches/CONNECTORS-946/framework/agents/src/main/java/org/apache/manifoldcf/agents/system/AgentsDaemon.java
    manifoldcf/branches/CONNECTORS-946/framework/agents/src/main/java/org/apache/manifoldcf/agents/system/IdleCleanupThread.java
    manifoldcf/branches/CONNECTORS-946/framework/agents/src/main/java/org/apache/manifoldcf/agents/transformation/BaseTransformationConnector.java
    manifoldcf/branches/CONNECTORS-946/framework/buildfiles/connector-build.xml
    manifoldcf/branches/CONNECTORS-946/framework/example-common/connectors.xml

Added: manifoldcf/branches/CONNECTORS-946/connectors/nulltransformation/build.xml
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-946/connectors/nulltransformation/build.xml?rev=1598862&view=auto
==============================================================================
--- manifoldcf/branches/CONNECTORS-946/connectors/nulltransformation/build.xml (added)
+++ manifoldcf/branches/CONNECTORS-946/connectors/nulltransformation/build.xml Sat May 31 11:54:51 2014
@@ -0,0 +1,40 @@
+<!--
+ 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.
+-->
+
+<project name="nulltransformation" default="all">
+
+    <property environment="env"/>
+    <condition property="mcf-dist" value="${env.MCFDISTPATH}">
+        <isset property="env.MCFDISTPATH"/>
+    </condition>
+    <property name="abs-dist" location="../../dist"/>
+    <condition property="mcf-dist" value="${abs-dist}">
+        <not>
+            <isset property="env.MCFDISTPATH"/>
+        </not>
+    </condition>
+
+    <import file="${mcf-dist}/connector-build.xml"/>
+
+    <target name="deliver-transformation" depends="mcf-connector-build.deliver-connector">
+        <antcall target="general-add-transformation-connector">
+            <param name="connector-label" value="Null"/>
+            <param name="connector-class" value="org.apache.manifoldcf.agents.transformation.nullconnector.NullConnector"/>
+        </antcall>
+    </target>
+
+</project>

Propchange: manifoldcf/branches/CONNECTORS-946/connectors/nulltransformation/build.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: manifoldcf/branches/CONNECTORS-946/connectors/nulltransformation/build.xml
------------------------------------------------------------------------------
    svn:keywords = Id

Added: manifoldcf/branches/CONNECTORS-946/connectors/nulltransformation/connector/src/main/java/org/apache/manifoldcf/agents/transformation/NullConnector.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-946/connectors/nulltransformation/connector/src/main/java/org/apache/manifoldcf/agents/transformation/NullConnector.java?rev=1598862&view=auto
==============================================================================
--- manifoldcf/branches/CONNECTORS-946/connectors/nulltransformation/connector/src/main/java/org/apache/manifoldcf/agents/transformation/NullConnector.java (added)
+++ manifoldcf/branches/CONNECTORS-946/connectors/nulltransformation/connector/src/main/java/org/apache/manifoldcf/agents/transformation/NullConnector.java Sat May 31 11:54:51 2014
@@ -0,0 +1,101 @@
+/* $Id$ */
+
+/**
+* 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.manifoldcf.agents.interfaces;
+
+import org.apache.manifoldcf.core.interfaces.*;
+import org.apache.manifoldcf.agents.interfaces.*;
+
+import java.io.*;
+import java.util.*;
+
+/** This connector works as a transformation connector, but does nothing other than logging.
+*
+*/
+public class NullConnector extends org.apache.manifoldcf.agents.transformation.BaseTransformationConnector
+{
+  public static final String _rcsid = "@(#)$Id$";
+
+  protected static final String ACTIVITY_PROCESS = "process";
+
+  protected static final String[] activitiesList = new String[]{ACTIVITY_PROCESS};
+  
+  /** Return a list of activities that this connector generates.
+  * The connector does NOT need to be connected before this method is called.
+  *@return the set of activities.
+  */
+  @Override
+  public String[] getActivitiesList()
+  {
+    return activitiesList;
+  }
+
+  /** Add (or replace) a document in the output data store using the connector.
+  * This method presumes that the connector object has been configured, and it is thus able to communicate with the output data store should that be
+  * necessary.
+  * The OutputSpecification is *not* provided to this method, because the goal is consistency, and if output is done it must be consistent with the
+  * output description, since that was what was partly used to determine if output should be taking place.  So it may be necessary for this method to decode
+  * an output description string in order to determine what should be done.
+  *@param documentURI is the URI of the document.  The URI is presumed to be the unique identifier which the output data store will use to process
+  * and serve the document.  This URI is constructed by the repository connector which fetches the document, and is thus universal across all output connectors.
+  *@param outputDescription is the description string that was constructed for this document by the getOutputDescription() method.
+  *@param document is the document data to be processed (handed to the output data store).
+  *@param authorityNameString is the name of the authority responsible for authorizing any access tokens passed in with the repository document.  May be null.
+  *@param activities is the handle to an object that the implementer of a pipeline connector may use to perform operations, such as logging processing activity,
+  * or sending a modified document to the next stage in the pipeline.
+  *@return the document status (accepted or permanently rejected).
+  */
+  @Override
+  public int addOrReplaceDocument(String documentURI, String pipelineDescription, RepositoryDocument document, String authorityNameString, IOutputAddActivity activities)
+    throws ManifoldCFException, ServiceInterruption
+  {
+    long startTime = System.currentTimeMillis();
+    String resultCode = "OK";
+    String description = null;
+    Long length = null;
+    try
+    {
+      long binaryLength = document.getBinaryLength();
+      int rval = activities.sendDocument(document);
+      length =  new Long(binaryLength);
+      resultCode = (rval == DOCUMENTSTATUS_ACCEPTED)?"ACCEPTED":"REJECTED";
+      return rval;
+    }
+    catch (ServiceInterruption e)
+    {
+      resultCode = "SERVICEINTERRUPTION";
+      description = e.getMessage();
+      throw e;
+    }
+    catch (ManifoldCFException e)
+    {
+      resultCode = "EXCEPTION";
+      description = e.getMessage();
+      throw e;
+    }
+    finally
+    {
+      activities.recordActivity(new Long(startTime), ACTIVITY_PROCESS, length, documentURI,
+        resultCode, description);
+    }
+
+  }
+
+}
+
+

Propchange: manifoldcf/branches/CONNECTORS-946/connectors/nulltransformation/connector/src/main/java/org/apache/manifoldcf/agents/transformation/NullConnector.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: manifoldcf/branches/CONNECTORS-946/connectors/nulltransformation/connector/src/main/java/org/apache/manifoldcf/agents/transformation/NullConnector.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: manifoldcf/branches/CONNECTORS-946/connectors/nulltransformation/pom.xml
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-946/connectors/nulltransformation/pom.xml?rev=1598862&view=auto
==============================================================================
--- manifoldcf/branches/CONNECTORS-946/connectors/nulltransformation/pom.xml (added)
+++ manifoldcf/branches/CONNECTORS-946/connectors/nulltransformation/pom.xml Sat May 31 11:54:51 2014
@@ -0,0 +1,354 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <parent>
+    <groupId>org.apache.manifoldcf</groupId>
+    <artifactId>mcf-connectors</artifactId>
+    <version>1.7-SNAPSHOT</version>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
+  </properties>
+
+  <artifactId>mcf-nulltransformation-connector</artifactId>
+  <name>ManifoldCF - Connectors - Null Transformation</name>
+
+  <build>
+    <defaultGoal>integration-test</defaultGoal>
+    <sourceDirectory>${basedir}/connector/src/main/java</sourceDirectory>
+    <testSourceDirectory>${basedir}/connector/src/test/java</testSourceDirectory>
+    <resources>
+      <resource>
+        <directory>${basedir}/connector/src/main/native2ascii</directory>
+        <includes>
+          <include>**/*.properties</include>
+        </includes>
+      </resource>
+      <resource>
+        <directory>${basedir}/connector/src/main/resources</directory>
+        <includes>
+          <include>**/*.html</include>
+          <include>**/*.js</include>
+        </includes>
+      </resource>
+    </resources> 
+    <testResources>
+      <testResource>
+        <directory>${basedir}/connector/src/test/resources</directory>
+      </testResource>
+    </testResources>
+
+    <plugins>
+
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>native2ascii-maven-plugin</artifactId>
+        <version>1.0-beta-1</version>
+        <configuration>
+            <workDir>target/classes</workDir>
+        </configuration>
+        <executions>
+            <execution>
+                <id>native2ascii-utf8</id>
+                <goals>
+                    <goal>native2ascii</goal>
+                </goals>
+                <configuration>
+                    <encoding>UTF8</encoding>
+                    <includes>
+                      <include>**/*.properties</include>
+                    </includes>
+                </configuration>
+            </execution>
+        </executions>
+      </plugin>
+
+      <!-- Test plugin configuration -->
+      <plugin>
+        <artifactId>maven-dependency-plugin</artifactId>
+        <executions>
+           <execution>
+            <id>copy-war</id>
+            <phase>generate-resources</phase>
+            <goals>
+              <goal>copy</goal>
+            </goals>
+            <configuration>
+              <outputDirectory>target/dependency</outputDirectory>
+              <artifactItems>
+                <artifactItem>
+                  <groupId>${project.groupId}</groupId>
+                  <artifactId>mcf-api-service</artifactId>
+                  <version>${project.version}</version>
+                  <type>war</type>
+                  <overWrite>false</overWrite>
+                  <destFileName>mcf-api-service.war</destFileName>
+                </artifactItem>
+                <artifactItem>
+                  <groupId>${project.groupId}</groupId>
+                  <artifactId>mcf-authority-service</artifactId>
+                  <version>${project.version}</version>
+                  <type>war</type>
+                  <overWrite>false</overWrite>
+                  <destFileName>mcf-authority-service.war</destFileName>
+                </artifactItem>
+                <artifactItem>
+                  <groupId>${project.groupId}</groupId>
+                  <artifactId>mcf-crawler-ui</artifactId>
+                  <version>${project.version}</version>
+                  <type>war</type>
+                  <overWrite>false</overWrite>
+                  <destFileName>mcf-crawler-ui.war</destFileName>
+                </artifactItem>
+              </artifactItems>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <configuration>
+          <excludes>
+            <exclude>**/*Postgresql*.java</exclude>
+            <exclude>**/*MySQL*.java</exclude>
+          </excludes>
+          <forkMode>always</forkMode>
+          <workingDirectory>target/test-output</workingDirectory>
+        </configuration>
+      </plugin>
+
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-failsafe-plugin</artifactId>
+        <version>2.12.3</version>
+        <configuration>
+          <skipTests>${skipITs}</skipTests>
+          <systemPropertyVariables>
+            <crawlerWarPath>../dependency/mcf-crawler-ui.war</crawlerWarPath>
+            <authorityserviceWarPath>../dependency/mcf-authority-service.war</authorityserviceWarPath>
+            <apiWarPath>../dependency/mcf-api-service.war</apiWarPath>
+          </systemPropertyVariables>
+          <excludes>
+            <exclude>**/*Postgresql*.java</exclude>
+            <exclude>**/*MySQL*.java</exclude>
+          </excludes>
+          <forkMode>always</forkMode>
+          <workingDirectory>target/test-output</workingDirectory>
+        </configuration>
+        <executions>
+          <execution>
+            <id>integration-test</id>
+            <goals>
+              <goal>integration-test</goal>
+            </goals>
+          </execution>
+          <execution>
+            <id>verify</id>
+            <goals>
+              <goal>verify</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+
+    </plugins>
+  </build>
+  
+  <dependencies>
+    <dependency>
+      <groupId>${project.groupId}</groupId>
+      <artifactId>mcf-core</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>${project.groupId}</groupId>
+      <artifactId>mcf-agents</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>${project.groupId}</groupId>
+      <artifactId>mcf-ui-core</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    
+    <!-- Testing dependencies -->
+    
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>${junit.version}</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>${project.groupId}</groupId>
+      <artifactId>mcf-core</artifactId>
+      <version>${project.version}</version>
+      <type>test-jar</type>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>${project.groupId}</groupId>
+      <artifactId>mcf-agents</artifactId>
+      <version>${project.version}</version>
+      <type>test-jar</type>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>${project.groupId}</groupId>
+      <artifactId>mcf-pull-agent</artifactId>
+      <version>${project.version}</version>
+      <type>test-jar</type>
+      <scope>test</scope>
+    </dependency>
+
+    <dependency>
+      <groupId>postgresql</groupId>
+      <artifactId>postgresql</artifactId>
+      <version>${postgresql.version}</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.hsqldb</groupId>
+      <artifactId>hsqldb</artifactId>
+      <version>${hsqldb.version}</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.derby</groupId>
+      <artifactId>derby</artifactId>
+      <version>${derby.version}</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>mysql</groupId>
+      <artifactId>mysql-connector-java</artifactId>
+      <version>${mysql.version}</version>
+      <scope>test</scope>
+    </dependency>
+
+    <dependency>
+      <groupId>${project.groupId}</groupId>
+      <artifactId>mcf-api-service</artifactId>
+      <version>${project.version}</version>
+      <type>war</type>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>${project.groupId}</groupId>
+      <artifactId>mcf-authority-service</artifactId>
+      <version>${project.version}</version>
+      <type>war</type>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>${project.groupId}</groupId>
+      <artifactId>mcf-crawler-ui</artifactId>
+      <version>${project.version}</version>
+      <type>war</type>
+      <scope>test</scope>
+    </dependency>
+
+    <dependency>
+      <groupId>org.eclipse.jetty</groupId>
+      <artifactId>jetty-server</artifactId>
+      <version>${jetty.version}</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.eclipse.jetty</groupId>
+      <artifactId>jetty-util</artifactId>
+      <version>${jetty.version}</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.eclipse.jetty</groupId>
+      <artifactId>jetty-webapp</artifactId>
+      <version>${jetty.version}</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.eclipse.jetty</groupId>
+      <artifactId>jetty-servlet</artifactId>
+      <version>${jetty.version}</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.eclipse.jetty</groupId>
+      <artifactId>jetty-http</artifactId>
+      <version>${jetty.version}</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.eclipse.jetty</groupId>
+      <artifactId>jetty-io</artifactId>
+      <version>${jetty.version}</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.eclipse.jetty</groupId>
+      <artifactId>jetty-security</artifactId>
+      <version>${jetty.version}</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.eclipse.jetty</groupId>
+      <artifactId>jetty-continuation</artifactId>
+      <version>${jetty.version}</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.eclipse.jetty</groupId>
+      <artifactId>jetty-xml</artifactId>
+      <version>${jetty.version}</version>
+      <scope>test</scope>
+    </dependency>
+
+    <dependency>
+      <groupId>org.mortbay.jetty</groupId>
+      <artifactId>jsp-api-2.1-glassfish</artifactId>
+      <version>${glassfish.version}</version>
+      <scope>test</scope>
+    </dependency>    
+    <dependency>
+      <groupId>org.mortbay.jetty</groupId>
+      <artifactId>jsp-2.1-glassfish</artifactId>
+      <version>${glassfish.version}</version>
+      <scope>test</scope>
+    </dependency>
+    
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-api</artifactId>
+      <version>${slf4j.version}</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-simple</artifactId>
+      <version>${slf4j.version}</version>
+      <scope>test</scope>
+    </dependency>
+
+  </dependencies>
+</project>

Propchange: manifoldcf/branches/CONNECTORS-946/connectors/nulltransformation/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: manifoldcf/branches/CONNECTORS-946/connectors/nulltransformation/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: manifoldcf/branches/CONNECTORS-946/connectors/pom.xml
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-946/connectors/pom.xml?rev=1598862&r1=1598861&r2=1598862&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-946/connectors/pom.xml (original)
+++ manifoldcf/branches/CONNECTORS-946/connectors/pom.xml Sat May 31 11:54:51 2014
@@ -42,6 +42,7 @@
     <module>ldap</module>
     <module>nullauthority</module>
     <module>nulloutput</module>
+    <module>nulltransformation</module>
     <module>rss</module>
     <module>sharepoint</module>
     <module>solr</module>

Added: manifoldcf/branches/CONNECTORS-946/framework/agents/src/main/java/org/apache/manifoldcf/agents/DefineTransformationConnection.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-946/framework/agents/src/main/java/org/apache/manifoldcf/agents/DefineTransformationConnection.java?rev=1598862&view=auto
==============================================================================
--- manifoldcf/branches/CONNECTORS-946/framework/agents/src/main/java/org/apache/manifoldcf/agents/DefineTransformationConnection.java (added)
+++ manifoldcf/branches/CONNECTORS-946/framework/agents/src/main/java/org/apache/manifoldcf/agents/DefineTransformationConnection.java Sat May 31 11:54:51 2014
@@ -0,0 +1,93 @@
+/* $Id$ */
+
+/**
+* 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.manifoldcf.agents;
+
+import java.io.*;
+import org.apache.manifoldcf.core.interfaces.*;
+import org.apache.manifoldcf.agents.interfaces.*;
+import org.apache.manifoldcf.agents.system.ManifoldCF;
+import java.util.*;
+
+/** This class is used to define a transformation connection.
+*/
+public class DefineTransformationConnection
+{
+        public static final String _rcsid = "@(#)$Id$";
+
+        private DefineTransformationConnection()
+        {
+        }
+
+
+        public static void main(String[] args)
+        {
+                if (args.length < 4)
+                {
+                        System.err.println("Usage: DefineTransformationConnection <connection_name> <description> <connector_class> <pool_max> <param1>=<value1> ...");
+                        System.exit(1);
+                }
+
+                String connectionName = args[0];
+                String description = args[1];
+                String connectorClass = args[2];
+                String poolMax = args[3];
+
+
+                try
+                {
+                        IThreadContext tc = ThreadContextFactory.make();
+                        ManifoldCF.initializeEnvironment(tc);
+                        ITransformationConnectionManager mgr = TransformationConnectionManagerFactory.make(tc);
+                        ITransformationConnection conn = mgr.create();
+                        conn.setName(connectionName);
+                        conn.setDescription(description);
+                        conn.setClassName(connectorClass);
+                        conn.setMaxConnections(new Integer(poolMax).intValue());
+                        ConfigParams x = conn.getConfigParams();
+                        int i = 4;
+                        while (i < args.length)
+                        {
+                                String arg = args[i++];
+                                // Parse
+                                int pos = arg.indexOf("=");
+                                if (pos == -1)
+                                        throw new ManifoldCFException("Argument missing =");
+                                String name = arg.substring(0,pos);
+                                String value = arg.substring(pos+1);
+                                if (name.endsWith("assword"))
+                                        x.setObfuscatedParameter(name,value);
+                                else
+                                        x.setParameter(name,value);
+                        }
+
+                        // Now, save
+                        mgr.save(conn);
+
+                }
+                catch (Exception e)
+                {
+                        e.printStackTrace();
+                        System.exit(2);
+                }
+        }
+
+
+
+                
+}

Propchange: manifoldcf/branches/CONNECTORS-946/framework/agents/src/main/java/org/apache/manifoldcf/agents/DefineTransformationConnection.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: manifoldcf/branches/CONNECTORS-946/framework/agents/src/main/java/org/apache/manifoldcf/agents/DefineTransformationConnection.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: manifoldcf/branches/CONNECTORS-946/framework/agents/src/main/java/org/apache/manifoldcf/agents/DeleteTransformationConnection.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-946/framework/agents/src/main/java/org/apache/manifoldcf/agents/DeleteTransformationConnection.java?rev=1598862&view=auto
==============================================================================
--- manifoldcf/branches/CONNECTORS-946/framework/agents/src/main/java/org/apache/manifoldcf/agents/DeleteTransformationConnection.java (added)
+++ manifoldcf/branches/CONNECTORS-946/framework/agents/src/main/java/org/apache/manifoldcf/agents/DeleteTransformationConnection.java Sat May 31 11:54:51 2014
@@ -0,0 +1,65 @@
+/* $Id$ */
+
+/**
+* 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.manifoldcf.agents;
+
+import java.io.*;
+import org.apache.manifoldcf.core.interfaces.*;
+import org.apache.manifoldcf.agents.interfaces.*;
+import org.apache.manifoldcf.agents.system.ManifoldCF;
+import java.util.*;
+
+/** This class is a command that is used to delete a transformation connection.
+*/
+public class DeleteTransformationConnection
+{
+        public static final String _rcsid = "@(#)$Id$";
+
+        private DeleteTransformationConnection()
+        {
+        }
+
+
+        public static void main(String[] args)
+        {
+                if (args.length != 1)
+                {
+                        System.err.println("Usage: DeleteTransformationConnection <connection_name>");
+                        System.exit(1);
+                }
+
+                String connectionName = args[0];
+                try
+                {
+                        IThreadContext tc = ThreadContextFactory.make();
+                        ManifoldCF.initializeEnvironment(tc);
+                        ITransformationConnectionManager mgr = TransformationConnectionManagerFactory.make(tc);
+                        mgr.delete(connectionName);
+
+                }
+                catch (Exception e)
+                {
+                        e.printStackTrace();
+                        System.exit(2);
+                }
+        }
+
+
+
+                
+}

Propchange: manifoldcf/branches/CONNECTORS-946/framework/agents/src/main/java/org/apache/manifoldcf/agents/DeleteTransformationConnection.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: manifoldcf/branches/CONNECTORS-946/framework/agents/src/main/java/org/apache/manifoldcf/agents/DeleteTransformationConnection.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: manifoldcf/branches/CONNECTORS-946/framework/agents/src/main/java/org/apache/manifoldcf/agents/RegisterTransformation.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-946/framework/agents/src/main/java/org/apache/manifoldcf/agents/RegisterTransformation.java?rev=1598862&view=auto
==============================================================================
--- manifoldcf/branches/CONNECTORS-946/framework/agents/src/main/java/org/apache/manifoldcf/agents/RegisterTransformation.java (added)
+++ manifoldcf/branches/CONNECTORS-946/framework/agents/src/main/java/org/apache/manifoldcf/agents/RegisterTransformation.java Sat May 31 11:54:51 2014
@@ -0,0 +1,79 @@
+/* $Id$ */
+
+/**
+* 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.manifoldcf.agents;
+
+import org.apache.manifoldcf.core.interfaces.*;
+import org.apache.manifoldcf.agents.interfaces.*;
+import org.apache.manifoldcf.agents.system.*;
+
+/**
+ * Register a transformation connector class
+ */
+public class RegisterTransformation extends TransactionalAgentsInitializationCommand
+{
+  public static final String _rcsid = "@(#)$Id$";
+
+  private final String className;
+  private final String description;
+
+  public RegisterTransformation(String className, String description)
+  {
+
+    this.className = className;
+    this.description = description;
+  }
+
+  protected void doExecute(IThreadContext tc) throws ManifoldCFException
+  {
+    ITransformationConnectorManager mgr = TransformationConnectorManagerFactory.make(tc);
+    ITransformationConnectionManager connManager = TransformationConnectionManagerFactory.make(tc);
+    // First, register connector
+    mgr.registerConnector(description,className);
+    // Then, signal to all jobs that might depend on this connector that they can switch state
+    // Find the connection names that come with this class
+    String[] connectionNames = connManager.findConnectionsForConnector(className);
+    // For all connection names, notify all agents of the registration
+    AgentManagerFactory.noteTransformationConnectorRegistration(tc,connectionNames);
+    Logging.root.info("Successfully registered transformation connector '"+className+"'");
+  }
+
+  public static void main(String[] args)
+  {
+    if (args.length != 2)
+    {
+      System.err.println("Usage: RegisterTransformation <classname> <description>");
+      System.exit(1);
+    }
+
+    String className = args[0];
+    String description = args[1];
+
+    try
+    {
+      RegisterTransformation registerTransformation = new RegisterTransformation(className, description);
+      registerTransformation.execute();
+      System.err.println("Successfully registered transformation connector '"+className+"'");
+    }
+    catch (ManifoldCFException e)
+    {
+      e.printStackTrace();
+      System.exit(1);
+    }
+  }
+}

Propchange: manifoldcf/branches/CONNECTORS-946/framework/agents/src/main/java/org/apache/manifoldcf/agents/RegisterTransformation.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: manifoldcf/branches/CONNECTORS-946/framework/agents/src/main/java/org/apache/manifoldcf/agents/RegisterTransformation.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: manifoldcf/branches/CONNECTORS-946/framework/agents/src/main/java/org/apache/manifoldcf/agents/SynchronizeTransformations.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-946/framework/agents/src/main/java/org/apache/manifoldcf/agents/SynchronizeTransformations.java?rev=1598862&view=auto
==============================================================================
--- manifoldcf/branches/CONNECTORS-946/framework/agents/src/main/java/org/apache/manifoldcf/agents/SynchronizeTransformations.java (added)
+++ manifoldcf/branches/CONNECTORS-946/framework/agents/src/main/java/org/apache/manifoldcf/agents/SynchronizeTransformations.java Sat May 31 11:54:51 2014
@@ -0,0 +1,107 @@
+/* $Id$ */
+
+/**
+* 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.manifoldcf.agents;
+
+import org.apache.manifoldcf.core.interfaces.*;
+import org.apache.manifoldcf.agents.interfaces.*;
+import org.apache.manifoldcf.agents.system.*;
+
+/**
+ * Un-register all registered transformation connector classes that can't be found
+ */
+public class SynchronizeTransformations extends BaseAgentsInitializationCommand
+{
+  public static final String _rcsid = "@(#)$Id$";
+
+  public SynchronizeTransformations()
+  {
+  }
+
+  protected void doExecute(IThreadContext tc) throws ManifoldCFException
+  {
+    IDBInterface database = DBInterfaceFactory.make(tc,
+      ManifoldCF.getMasterDatabaseName(),
+      ManifoldCF.getMasterDatabaseUsername(),
+      ManifoldCF.getMasterDatabasePassword());
+    ITransformationConnectorManager mgr = TransformationConnectorManagerFactory.make(tc);
+    ITransformationConnectionManager connManager = TransformationConnectionManagerFactory.make(tc);
+    IResultSet classNames = mgr.getConnectors();
+    int i = 0;
+    while (i < classNames.getRowCount())
+    {
+      IResultRow row = classNames.getRow(i++);
+      String className = (String)row.getValue("classname");
+      try
+      {
+        TransformationConnectorFactory.getConnectorNoCheck(className);
+      }
+      catch (ManifoldCFException e)
+      {
+        // Deregistration should be done in a transaction
+        database.beginTransaction();
+        try
+        {
+          // Find the connection names that come with this class
+          String[] connectionNames = connManager.findConnectionsForConnector(className);
+          // For all connection names, notify all agents of the deregistration
+          AgentManagerFactory.noteTransformationConnectorDeregistration(tc,connectionNames);
+          // Now that all jobs have been placed into an appropriate state, actually do the deregistration itself.
+          mgr.removeConnector(className);
+        }
+        catch (ManifoldCFException e2)
+        {
+          database.signalRollback();
+          throw e2;
+        }
+        catch (Error e2)
+        {
+          database.signalRollback();
+          throw e2;
+        }
+        finally
+        {
+          database.endTransaction();
+        }
+      }
+    }
+    Logging.root.info("Successfully synchronized all transformations");
+  }
+
+
+  public static void main(String[] args)
+  {
+    if (args.length > 0)
+    {
+      System.err.println("Usage: SynchronizeTransformations");
+      System.exit(1);
+    }
+
+    try
+    {
+      SynchronizeTransformations synchronizeTransformations = new SynchronizeTransformations();
+      synchronizeTransformations.execute();
+      System.err.println("Successfully synchronized all transformations");
+    }
+    catch (ManifoldCFException e)
+    {
+      e.printStackTrace();
+      System.exit(1);
+    }
+  }
+}

Propchange: manifoldcf/branches/CONNECTORS-946/framework/agents/src/main/java/org/apache/manifoldcf/agents/SynchronizeTransformations.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: manifoldcf/branches/CONNECTORS-946/framework/agents/src/main/java/org/apache/manifoldcf/agents/SynchronizeTransformations.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: manifoldcf/branches/CONNECTORS-946/framework/agents/src/main/java/org/apache/manifoldcf/agents/UnRegisterAllTransformations.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-946/framework/agents/src/main/java/org/apache/manifoldcf/agents/UnRegisterAllTransformations.java?rev=1598862&view=auto
==============================================================================
--- manifoldcf/branches/CONNECTORS-946/framework/agents/src/main/java/org/apache/manifoldcf/agents/UnRegisterAllTransformations.java (added)
+++ manifoldcf/branches/CONNECTORS-946/framework/agents/src/main/java/org/apache/manifoldcf/agents/UnRegisterAllTransformations.java Sat May 31 11:54:51 2014
@@ -0,0 +1,100 @@
+/* $Id$ */
+
+/**
+* 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.manifoldcf.agents;
+
+import org.apache.manifoldcf.core.interfaces.*;
+import org.apache.manifoldcf.agents.interfaces.*;
+import org.apache.manifoldcf.agents.system.*;
+
+/**
+ * Un-register all current transformation connector classes
+ */
+public class UnRegisterAllTransformations extends BaseAgentsInitializationCommand
+{
+  public static final String _rcsid = "@(#)$Id$";
+
+  public UnRegisterAllTransformations()
+  {
+  }
+
+  protected void doExecute(IThreadContext tc) throws ManifoldCFException
+  {
+    IDBInterface database = DBInterfaceFactory.make(tc,
+      ManifoldCF.getMasterDatabaseName(),
+      ManifoldCF.getMasterDatabaseUsername(),
+      ManifoldCF.getMasterDatabasePassword());
+    ITransformationConnectorManager mgr = TransformationConnectorManagerFactory.make(tc);
+    ITransformationConnectionManager connManager = TransformationConnectionManagerFactory.make(tc);
+    IResultSet classNames = mgr.getConnectors();
+    int i = 0;
+    while (i < classNames.getRowCount())
+    {
+      IResultRow row = classNames.getRow(i++);
+      String className = (String)row.getValue("classname");
+      // Deregistration should be done in a transaction
+      database.beginTransaction();
+      try
+      {
+        // Find the connection names that come with this class
+        String[] connectionNames = connManager.findConnectionsForConnector(className);
+        // For all connection names, notify all agents of the deregistration
+        AgentManagerFactory.noteTransformationConnectorDeregistration(tc,connectionNames);
+        // Now that all jobs have been placed into an appropriate state, actually do the deregistration itself.
+        mgr.unregisterConnector(className);
+      }
+      catch (ManifoldCFException e)
+      {
+        database.signalRollback();
+        throw e;
+      }
+      catch (Error e)
+      {
+        database.signalRollback();
+        throw e;
+      }
+      finally
+      {
+        database.endTransaction();
+      }
+    }
+    Logging.root.info("Successfully unregistered all transformation connectors");
+  }
+
+
+  public static void main(String[] args)
+  {
+    if (args.length > 0)
+    {
+      System.err.println("Usage: UnRegisterAllTransformations");
+      System.exit(1);
+    }
+
+    try
+    {
+      UnRegisterAllTransformations unRegisterAllTransformations = new UnRegisterAllTransformations();
+      unRegisterAllTransformations.execute();
+      System.err.println("Successfully unregistered all transformation connectors");
+    }
+    catch (ManifoldCFException e)
+    {
+      e.printStackTrace();
+      System.exit(1);
+    }
+  }
+}

Propchange: manifoldcf/branches/CONNECTORS-946/framework/agents/src/main/java/org/apache/manifoldcf/agents/UnRegisterAllTransformations.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: manifoldcf/branches/CONNECTORS-946/framework/agents/src/main/java/org/apache/manifoldcf/agents/UnRegisterAllTransformations.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: manifoldcf/branches/CONNECTORS-946/framework/agents/src/main/java/org/apache/manifoldcf/agents/UnRegisterTransformation.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-946/framework/agents/src/main/java/org/apache/manifoldcf/agents/UnRegisterTransformation.java?rev=1598862&view=auto
==============================================================================
--- manifoldcf/branches/CONNECTORS-946/framework/agents/src/main/java/org/apache/manifoldcf/agents/UnRegisterTransformation.java (added)
+++ manifoldcf/branches/CONNECTORS-946/framework/agents/src/main/java/org/apache/manifoldcf/agents/UnRegisterTransformation.java Sat May 31 11:54:51 2014
@@ -0,0 +1,74 @@
+/* $Id$ */
+
+/**
+* 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.manifoldcf.agents;
+
+import org.apache.manifoldcf.core.interfaces.*;
+import org.apache.manifoldcf.agents.interfaces.*;
+import org.apache.manifoldcf.agents.system.*;
+
+/**
+ * Un-register a transformation connector class
+ */
+public class UnRegisterTransformation extends TransactionalAgentsInitializationCommand
+{
+  public static final String _rcsid = "@(#)$Id$";
+
+  private final String className;
+
+  public UnRegisterTransformation(String className)
+  {
+    this.className = className;
+  }
+
+  protected void doExecute(IThreadContext tc) throws ManifoldCFException
+  {
+    ITransformationConnectorManager mgr = TransformationConnectorManagerFactory.make(tc);
+    ITransformationConnectionManager connManager = TransformationConnectionManagerFactory.make(tc);
+    // Find the connection names that come with this class
+    String[] connectionNames = connManager.findConnectionsForConnector(className);
+    // For all connection names, notify all agents of the deregistration
+    AgentManagerFactory.noteTransformationConnectorDeregistration(tc,connectionNames);
+    // Now that all jobs have been placed into an appropriate state, actually do the deregistration itself.
+    mgr.unregisterConnector(className);
+    Logging.root.info("Successfully unregistered transformation connector '"+className+"'");
+  }
+
+  public static void main(String[] args)
+  {
+    if (args.length != 1)
+    {
+      System.err.println("Usage: UnRegisterTransformation <classname>");
+      System.exit(1);
+    }
+
+    String className = args[0];
+
+    try
+    {
+      UnRegisterTransformation unRegisterTransformation = new UnRegisterTransformation(className);
+      unRegisterTransformation.execute();
+      System.err.println("Successfully unregistered transformation connector '"+className+"'");
+    }
+    catch (ManifoldCFException e)
+    {
+      e.printStackTrace();
+      System.exit(1);
+    }
+  }
+}

Propchange: manifoldcf/branches/CONNECTORS-946/framework/agents/src/main/java/org/apache/manifoldcf/agents/UnRegisterTransformation.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: manifoldcf/branches/CONNECTORS-946/framework/agents/src/main/java/org/apache/manifoldcf/agents/UnRegisterTransformation.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: manifoldcf/branches/CONNECTORS-946/framework/agents/src/main/java/org/apache/manifoldcf/agents/interfaces/ITransformationConnectorPool.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-946/framework/agents/src/main/java/org/apache/manifoldcf/agents/interfaces/ITransformationConnectorPool.java?rev=1598862&view=auto
==============================================================================
--- manifoldcf/branches/CONNECTORS-946/framework/agents/src/main/java/org/apache/manifoldcf/agents/interfaces/ITransformationConnectorPool.java (added)
+++ manifoldcf/branches/CONNECTORS-946/framework/agents/src/main/java/org/apache/manifoldcf/agents/interfaces/ITransformationConnectorPool.java Sat May 31 11:54:51 2014
@@ -0,0 +1,81 @@
+/* $Id$ */
+
+/**
+* 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.manifoldcf.agents.interfaces;
+
+import org.apache.manifoldcf.core.interfaces.*;
+
+import java.util.*;
+import java.io.*;
+
+/** An object implementing this interface functions as a pool of transformation connectors.
+* Coordination and allocation among cluster members is managed within. 
+* These objects are thread-local, so do not share them among threads.
+*/
+public interface ITransformationConnectorPool
+{
+  public static final String _rcsid = "@(#)$Id$";
+
+  /** Get multiple transformation connectors, all at once.  Do this in a particular order
+  * so that any connector exhaustion will not cause a deadlock.
+  *@param orderingKeys are the keys which determine in what order the connectors are obtained.
+  *@param transformationConnections are the connections to use the build the connector instances.
+  */
+  public ITransformationConnector[] grabMultiple(String[] orderingKeys, ITransformationConnection[] transformationConnections)
+    throws ManifoldCFException;
+
+  /** Get a transformation connector.
+  * The connector is specified by a transformation connection object.
+  *@param transformationConnection is the output connection to base the connector instance on.
+  */
+  public ITransformationConnector grab(ITransformationConnection transformationConnection)
+    throws ManifoldCFException;
+
+  /** Release multiple transformation connectors.
+  *@param connections are the connections describing the instances to release.
+  *@param connectors are the connector instances to release.
+  */
+  public void releaseMultiple(ITransformationConnection[] connections, ITransformationConnector[] connectors)
+    throws ManifoldCFException;
+
+  /** Release a transformation connector.
+  *@param connection is the connection describing the instance to release.
+  *@param connector is the connector to release.
+  */
+  public void release(ITransformationConnection connection, ITransformationConnector connector)
+    throws ManifoldCFException;
+
+  /** Idle notification for inactive transformation connector handles.
+  * This method polls all inactive handles.
+  */
+  public void pollAllConnectors()
+    throws ManifoldCFException;
+
+  /** Flush only those connector handles that are currently unused.
+  */
+  public void flushUnusedConnectors()
+    throws ManifoldCFException;
+
+  /** Clean up all open transformation connector handles.
+  * This method is called when the connector pool needs to be flushed,
+  * to free resources.
+  */
+  public void closeAllConnectors()
+    throws ManifoldCFException;
+
+}

Propchange: manifoldcf/branches/CONNECTORS-946/framework/agents/src/main/java/org/apache/manifoldcf/agents/interfaces/ITransformationConnectorPool.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: manifoldcf/branches/CONNECTORS-946/framework/agents/src/main/java/org/apache/manifoldcf/agents/interfaces/ITransformationConnectorPool.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: manifoldcf/branches/CONNECTORS-946/framework/agents/src/main/java/org/apache/manifoldcf/agents/interfaces/TransformationConnectorPoolFactory.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-946/framework/agents/src/main/java/org/apache/manifoldcf/agents/interfaces/TransformationConnectorPoolFactory.java?rev=1598862&view=auto
==============================================================================
--- manifoldcf/branches/CONNECTORS-946/framework/agents/src/main/java/org/apache/manifoldcf/agents/interfaces/TransformationConnectorPoolFactory.java (added)
+++ manifoldcf/branches/CONNECTORS-946/framework/agents/src/main/java/org/apache/manifoldcf/agents/interfaces/TransformationConnectorPoolFactory.java Sat May 31 11:54:51 2014
@@ -0,0 +1,55 @@
+/* $Id$ */
+
+/**
+* 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.manifoldcf.agents.interfaces;
+
+import org.apache.manifoldcf.core.interfaces.*;
+import org.apache.manifoldcf.agents.system.ManifoldCF;
+
+import java.util.*;
+
+/** Transformation connector pool manager factory.
+*/
+public class TransformationConnectorPoolFactory
+{
+  public static final String _rcsid = "@(#)$Id$";
+
+  // name to use in thread context pool of objects
+  private final static String objectName = "_TransformationConnectorPoolMgr_";
+
+  private TransformationConnectorPoolFactory()
+  {
+  }
+
+  /** Make a transformation connector pool handle.
+  *@param tc is the thread context.
+  *@return the handle.
+  */
+  public static ITransformationConnectorPool make(IThreadContext tc)
+    throws ManifoldCFException
+  {
+    Object o = tc.get(objectName);
+    if (o == null || !(o instanceof ITransformationConnectorPool))
+    {
+      o = new org.apache.manifoldcf.agents.transformationconnectorpool.TransformationConnectorPool(tc);
+      tc.save(objectName,o);
+    }
+    return (ITransformationConnectorPool)o;
+  }
+
+}

Propchange: manifoldcf/branches/CONNECTORS-946/framework/agents/src/main/java/org/apache/manifoldcf/agents/interfaces/TransformationConnectorPoolFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: manifoldcf/branches/CONNECTORS-946/framework/agents/src/main/java/org/apache/manifoldcf/agents/interfaces/TransformationConnectorPoolFactory.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: manifoldcf/branches/CONNECTORS-946/framework/agents/src/main/java/org/apache/manifoldcf/agents/system/AgentsDaemon.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-946/framework/agents/src/main/java/org/apache/manifoldcf/agents/system/AgentsDaemon.java?rev=1598862&r1=1598861&r2=1598862&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-946/framework/agents/src/main/java/org/apache/manifoldcf/agents/system/AgentsDaemon.java (original)
+++ manifoldcf/branches/CONNECTORS-946/framework/agents/src/main/java/org/apache/manifoldcf/agents/system/AgentsDaemon.java Sat May 31 11:54:51 2014
@@ -173,6 +173,7 @@ public class AgentsDaemon
     }
     // Done.
     OutputConnectorPoolFactory.make(threadContext).flushUnusedConnectors();
+    TransformationConnectorPoolFactory.make(threadContext).flushUnusedConnectors();
   }
 
   protected static String getAgentsClassServiceType(String agentClassName)

Modified: manifoldcf/branches/CONNECTORS-946/framework/agents/src/main/java/org/apache/manifoldcf/agents/system/IdleCleanupThread.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-946/framework/agents/src/main/java/org/apache/manifoldcf/agents/system/IdleCleanupThread.java?rev=1598862&r1=1598861&r2=1598862&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-946/framework/agents/src/main/java/org/apache/manifoldcf/agents/system/IdleCleanupThread.java (original)
+++ manifoldcf/branches/CONNECTORS-946/framework/agents/src/main/java/org/apache/manifoldcf/agents/system/IdleCleanupThread.java Sat May 31 11:54:51 2014
@@ -55,6 +55,8 @@ public class IdleCleanupThread extends T
       ICacheManager cacheManager = CacheManagerFactory.make(threadContext);
       // Get the output connector pool handle
       IOutputConnectorPool outputConnectorPool = OutputConnectorPoolFactory.make(threadContext);
+      // Get the transformation connector pool handle
+      ITransformationConnectorPool transformationConnectorPool = TransformationConnectorPoolFactory.make(threadContext);
       // Throttler subsystem
       IThrottleGroups throttleGroups = ThrottleGroupsFactory.make(threadContext);
       
@@ -90,6 +92,7 @@ public class IdleCleanupThread extends T
           
           // Do the cleanup
           outputConnectorPool.pollAllConnectors();
+          transformationConnectorPool.pollAllConnectors();
           // Poll connection bins
           throttleGroups.poll();
           // Expire objects

Modified: manifoldcf/branches/CONNECTORS-946/framework/agents/src/main/java/org/apache/manifoldcf/agents/transformation/BaseTransformationConnector.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-946/framework/agents/src/main/java/org/apache/manifoldcf/agents/transformation/BaseTransformationConnector.java?rev=1598862&r1=1598861&r2=1598862&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-946/framework/agents/src/main/java/org/apache/manifoldcf/agents/transformation/BaseTransformationConnector.java (original)
+++ manifoldcf/branches/CONNECTORS-946/framework/agents/src/main/java/org/apache/manifoldcf/agents/transformation/BaseTransformationConnector.java Sat May 31 11:54:51 2014
@@ -81,7 +81,7 @@ public abstract class BaseTransformation
   public boolean checkMimeTypeIndexable(String pipelineDescription, String mimeType, IOutputCheckActivity checkActivity)
     throws ManifoldCFException, ServiceInterruption
   {
-    return true;
+    return checkActivity.checkMimeTypeIndexable(mimeType);
   }
 
   /** Pre-determine whether a document (passed here as a File object) is acceptable or not.  This method is
@@ -96,7 +96,7 @@ public abstract class BaseTransformation
   public boolean checkDocumentIndexable(String pipelineDescription, File localFile, IOutputCheckActivity checkActivity)
     throws ManifoldCFException, ServiceInterruption
   {
-    return true;
+    return checkActivity.checkDocumentIndexable(localFile);
   }
 
   /** Pre-determine whether a document's length is acceptable.  This method is used
@@ -110,7 +110,21 @@ public abstract class BaseTransformation
   public boolean checkLengthIndexable(String pipelineDescription, long length, IOutputCheckActivity checkActivity)
     throws ManifoldCFException, ServiceInterruption
   {
-    return true;
+    return checkActivity.checkLengthIndexable(length);
+  }
+
+  /** Pre-determine whether a document's URL is acceptable.  This method is used
+  * to help filter out documents that cannot be indexed in advance.
+  *@param pipelineDescription is the document's pipeline version string, for this connection.
+  *@param url is the URL of the document.
+  *@param checkActivity is an object including the activities that can be done by this method.
+  *@return true if the file is acceptable, false if not.
+  */
+  @Override
+  public boolean checkURLIndexable(String pipelineDescription, String url, IOutputCheckActivity checkActivity)
+    throws ManifoldCFException, ServiceInterruption
+  {
+    return checkActivity.checkURLIndexable(url);
   }
 
   /** Get a pipeline version string, given a pipeline specification object.  The version string is used to

Added: manifoldcf/branches/CONNECTORS-946/framework/agents/src/main/java/org/apache/manifoldcf/agents/transformationconnectorpool/TransformationConnectorPool.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-946/framework/agents/src/main/java/org/apache/manifoldcf/agents/transformationconnectorpool/TransformationConnectorPool.java?rev=1598862&view=auto
==============================================================================
--- manifoldcf/branches/CONNECTORS-946/framework/agents/src/main/java/org/apache/manifoldcf/agents/transformationconnectorpool/TransformationConnectorPool.java (added)
+++ manifoldcf/branches/CONNECTORS-946/framework/agents/src/main/java/org/apache/manifoldcf/agents/transformationconnectorpool/TransformationConnectorPool.java Sat May 31 11:54:51 2014
@@ -0,0 +1,176 @@
+/* $Id$ */
+
+/**
+* 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.manifoldcf.agents.transformationconnectorpool;
+
+import org.apache.manifoldcf.core.interfaces.*;
+import org.apache.manifoldcf.agents.interfaces.*;
+
+import java.util.*;
+import java.io.*;
+
+/** An implementation of ITransformationConnectorPool.
+* Coordination and allocation among cluster members is managed within. 
+* These objects are thread-local, so do not share them among threads.
+*/
+public class TransformationConnectorPool implements ITransformationConnectorPool
+{
+  public static final String _rcsid = "@(#)$Id$";
+
+  /** Local connector pool */
+  protected final static LocalPool localPool = new LocalPool();
+
+  /** Thread context */
+  protected final IThreadContext threadContext;
+  
+  /** Constructor */
+  public TransformationConnectorPool(IThreadContext threadContext)
+    throws ManifoldCFException
+  {
+    this.threadContext = threadContext;
+  }
+  
+  /** Get multiple transformation connectors, all at once.  Do this in a particular order
+  * so that any connector exhaustion will not cause a deadlock.
+  *@param orderingKeys are the keys which determine in what order the connectors are obtained.
+  *@param transformationConnections are the connections to use the build the connector instances.
+  */
+  @Override
+  public ITransformationConnector[] grabMultiple(String[] orderingKeys, ITransformationConnection[] transformationConnections)
+    throws ManifoldCFException
+  {
+    // For now, use the TransformationConnectorFactory method.  This will require us to extract info
+    // from each output connection, however.
+    String[] connectionNames = new String[transformationConnections.length];
+    String[] classNames = new String[transformationConnections.length];
+    ConfigParams[] configInfos = new ConfigParams[transformationConnections.length];
+    int[] maxPoolSizes = new int[transformationConnections.length];
+    
+    for (int i = 0; i < transformationConnections.length; i++)
+    {
+      connectionNames[i] = transformationConnections[i].getName();
+      classNames[i] = transformationConnections[i].getClassName();
+      configInfos[i] = transformationConnections[i].getConfigParams();
+      maxPoolSizes[i] = transformationConnections[i].getMaxConnections();
+    }
+    return localPool.grabMultiple(threadContext,
+      orderingKeys, connectionNames, classNames, configInfos, maxPoolSizes);
+  }
+
+  /** Get a transformation connector.
+  * The connector is specified by a transformation connection object.
+  *@param transformationConnection is the transformation connection to base the connector instance on.
+  */
+  @Override
+  public ITransformationConnector grab(ITransformationConnection transformationConnection)
+    throws ManifoldCFException
+  {
+    return localPool.grab(threadContext, transformationConnection.getName(), transformationConnection.getClassName(),
+      transformationConnection.getConfigParams(), transformationConnection.getMaxConnections());
+  }
+
+  /** Release multiple transformation connectors.
+  *@param connections are the connections describing the instances to release.
+  *@param connectors are the connector instances to release.
+  */
+  @Override
+  public void releaseMultiple(ITransformationConnection[] connections, ITransformationConnector[] connectors)
+    throws ManifoldCFException
+  {
+    String[] connectionNames = new String[connections.length];
+    for (int i = 0; i < connections.length; i++)
+    {
+      connectionNames[i] = connections[i].getName();
+    }
+    localPool.releaseMultiple(threadContext, connectionNames, connectors);
+  }
+
+  /** Release a transformation connector.
+  *@param connection is the connection describing the instance to release.
+  *@param connector is the connector to release.
+  */
+  @Override
+  public void release(ITransformationConnection connection, ITransformationConnector connector)
+    throws ManifoldCFException
+  {
+    localPool.release(threadContext,connection.getName(),connector);
+  }
+
+  /** Idle notification for inactive transformation connector handles.
+  * This method polls all inactive handles.
+  */
+  @Override
+  public void pollAllConnectors()
+    throws ManifoldCFException
+  {
+    localPool.pollAllConnectors(threadContext);
+  }
+
+  /** Flush only those connector handles that are currently unused.
+  */
+  @Override
+  public void flushUnusedConnectors()
+    throws ManifoldCFException
+  {
+    localPool.flushUnusedConnectors(threadContext);
+  }
+
+  /** Clean up all open output connector handles.
+  * This method is called when the connector pool needs to be flushed,
+  * to free resources.
+  */
+  @Override
+  public void closeAllConnectors()
+    throws ManifoldCFException
+  {
+    localPool.closeAllConnectors(threadContext);
+  }
+
+  /** Actual static output connector pool */
+  protected static class LocalPool extends org.apache.manifoldcf.core.connectorpool.ConnectorPool<ITransformationConnector>
+  {
+    public LocalPool()
+    {
+      super("_TRANSFORMATIONCONNECTORPOOL_");
+    }
+    
+    @Override
+    protected boolean isInstalled(IThreadContext tc, String className)
+      throws ManifoldCFException
+    {
+      ITransformationConnectorManager connectorManager = TransformationConnectorManagerFactory.make(tc);
+      return connectorManager.isInstalled(className);
+    }
+
+    @Override
+    protected boolean isConnectionNameValid(IThreadContext tc, String connectionName)
+      throws ManifoldCFException
+    {
+      ITransformationConnectionManager connectionManager = TransformationConnectionManagerFactory.make(tc);
+      return connectionManager.load(connectionName) != null;
+    }
+
+    public ITransformationConnector[] grabMultiple(IThreadContext tc, String[] orderingKeys, String[] connectionNames, String[] classNames, ConfigParams[] configInfos, int[] maxPoolSizes)
+      throws ManifoldCFException
+    {
+      return grabMultiple(tc,ITransformationConnector.class,orderingKeys,connectionNames,classNames,configInfos,maxPoolSizes);
+    }
+
+  }
+  
+}

Propchange: manifoldcf/branches/CONNECTORS-946/framework/agents/src/main/java/org/apache/manifoldcf/agents/transformationconnectorpool/TransformationConnectorPool.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: manifoldcf/branches/CONNECTORS-946/framework/agents/src/main/java/org/apache/manifoldcf/agents/transformationconnectorpool/TransformationConnectorPool.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: manifoldcf/branches/CONNECTORS-946/framework/buildfiles/connector-build.xml
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-946/framework/buildfiles/connector-build.xml?rev=1598862&r1=1598861&r2=1598862&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-946/framework/buildfiles/connector-build.xml (original)
+++ manifoldcf/branches/CONNECTORS-946/framework/buildfiles/connector-build.xml Sat May 31 11:54:51 2014
@@ -807,6 +807,25 @@
     <target name="general-add-output-connector" depends="general-add-output-connector-commented,general-add-output-connector-non-commented,general-add-output-connector-proprietary-commented,general-add-output-connector-proprietary-non-commented">
     </target>
 
+    <target name="general-add-transformation-connector-commented" depends="general-connector-runnable-check" unless="is-runnable">
+        <replace file="${mcf-dist}/connectors.xml" token="&lt;!-- Add your transformation connectors here --&gt;" value="&lt;!-- Add your transformation connectors here --&gt;&#0010;  &lt;!--transformationconnector name=&quot;${connector-label}&quot; class=&quot;${connector-class}&quot;/--&gt;"/>
+    </target>
+
+    <target name="general-add-transformation-connector-non-commented" depends="general-connector-runnable-check" if="is-runnable">
+        <replace file="${mcf-dist}/connectors.xml" token="&lt;!-- Add your transformation connectors here --&gt;" value="&lt;!-- Add your transformation connectors here --&gt;&#0010;  &lt;transformationconnector name=&quot;${connector-label}&quot; class=&quot;${connector-class}&quot;/&gt;"/>
+    </target>
+
+    <target name="general-add-transformation-connector-proprietary-commented" depends="general-connector-proprietary-runnable-check" unless="is-proprietary-runnable">
+        <replace file="${mcf-dist}/connectors-proprietary.xml" token="&lt;!-- Add your transformation connectors here --&gt;" value="&lt;!-- Add your transformation connectors here --&gt;&#0010;  &lt;!--transformationconnector name=&quot;${connector-label}&quot; class=&quot;${connector-class}&quot;/--&gt;"/>
+    </target>
+
+    <target name="general-add-transformation-connector-proprietary-non-commented" depends="general-connector-proprietary-runnable-check" if="is-proprietary-runnable">
+        <replace file="${mcf-dist}/connectors-proprietary.xml" token="&lt;!-- Add your transformation connectors here --&gt;" value="&lt;!-- Add your transformation connectors here --&gt;&#0010;  &lt;transformationconnector name=&quot;${connector-label}&quot; class=&quot;${connector-class}&quot;/&gt;"/>
+    </target>
+
+    <target name="general-add-transformation-connector" depends="general-add-transformation-connector-commented,general-add-transformation-connector-non-commented,general-add-transformation-connector-proprietary-commented,general-add-transformation-connector-proprietary-non-commented">
+    </target>
+
     <target name="general-add-repository-connector-commented" depends="general-connector-runnable-check" unless="is-runnable">
         <replace file="${mcf-dist}/connectors.xml" token="&lt;!-- Add your repository connectors here --&gt;" value="&lt;!-- Add your repository connectors here --&gt;&#0010;  &lt;!--repositoryconnector name=&quot;${connector-label}&quot; class=&quot;${connector-class}&quot;/--&gt;"/>
     </target>

Modified: manifoldcf/branches/CONNECTORS-946/framework/example-common/connectors.xml
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-946/framework/example-common/connectors.xml?rev=1598862&r1=1598861&r2=1598862&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-946/framework/example-common/connectors.xml (original)
+++ manifoldcf/branches/CONNECTORS-946/framework/example-common/connectors.xml Sat May 31 11:54:51 2014
@@ -28,7 +28,9 @@
     <!-- authorizationdomain domain="FB" name="FaceBook"/-->
 
     <!-- Add your output connectors here -->
-    
+
+    <!-- Add your transformation connectors here -->
+
     <!-- Add your mapping connectors here -->
     
     <!-- Add your authority connectors here -->