Author: kwright
Date: Tue Aug 7 15:07:07 2018
New Revision: 1837604
URL: http://svn.apache.org/viewvc?rev=1837604&view=rev
Log:
Apply patch for mongodb output connector
Added:
manifoldcf/branches/CONNECTORS-1490/connectors/mongodb/
manifoldcf/branches/CONNECTORS-1490/connectors/mongodb/build.xml
manifoldcf/branches/CONNECTORS-1490/connectors/mongodb/pom.xml
manifoldcf/branches/CONNECTORS-1490/connectors/mongodb/src/
manifoldcf/branches/CONNECTORS-1490/connectors/mongodb/src/main/
manifoldcf/branches/CONNECTORS-1490/connectors/mongodb/src/main/java/
manifoldcf/branches/CONNECTORS-1490/connectors/mongodb/src/main/java/org/
manifoldcf/branches/CONNECTORS-1490/connectors/mongodb/src/main/java/org/apache/
manifoldcf/branches/CONNECTORS-1490/connectors/mongodb/src/main/java/org/apache/manifoldcf/
manifoldcf/branches/CONNECTORS-1490/connectors/mongodb/src/main/java/org/apache/manifoldcf/agents/
manifoldcf/branches/CONNECTORS-1490/connectors/mongodb/src/main/java/org/apache/manifoldcf/agents/output/
manifoldcf/branches/CONNECTORS-1490/connectors/mongodb/src/main/java/org/apache/manifoldcf/agents/output/mongodboutput/
manifoldcf/branches/CONNECTORS-1490/connectors/mongodb/src/main/java/org/apache/manifoldcf/agents/output/mongodboutput/Messages.java
manifoldcf/branches/CONNECTORS-1490/connectors/mongodb/src/main/java/org/apache/manifoldcf/agents/output/mongodboutput/MongodbOutputConfig.java
manifoldcf/branches/CONNECTORS-1490/connectors/mongodb/src/main/java/org/apache/manifoldcf/agents/output/mongodboutput/MongodbOutputConnector.java
manifoldcf/branches/CONNECTORS-1490/connectors/mongodb/src/main/native2ascii/
manifoldcf/branches/CONNECTORS-1490/connectors/mongodb/src/main/native2ascii/org/
manifoldcf/branches/CONNECTORS-1490/connectors/mongodb/src/main/native2ascii/org/apache/
manifoldcf/branches/CONNECTORS-1490/connectors/mongodb/src/main/native2ascii/org/apache/manifoldcf/
manifoldcf/branches/CONNECTORS-1490/connectors/mongodb/src/main/native2ascii/org/apache/manifoldcf/agents/
manifoldcf/branches/CONNECTORS-1490/connectors/mongodb/src/main/native2ascii/org/apache/manifoldcf/agents/output/
manifoldcf/branches/CONNECTORS-1490/connectors/mongodb/src/main/native2ascii/org/apache/manifoldcf/agents/output/mongodboutput/
manifoldcf/branches/CONNECTORS-1490/connectors/mongodb/src/main/native2ascii/org/apache/manifoldcf/agents/output/mongodboutput/common_en_US.properties
manifoldcf/branches/CONNECTORS-1490/connectors/mongodb/src/main/resources/
manifoldcf/branches/CONNECTORS-1490/connectors/mongodb/src/main/resources/org/
manifoldcf/branches/CONNECTORS-1490/connectors/mongodb/src/main/resources/org/apache/
manifoldcf/branches/CONNECTORS-1490/connectors/mongodb/src/main/resources/org/apache/manifoldcf/
manifoldcf/branches/CONNECTORS-1490/connectors/mongodb/src/main/resources/org/apache/manifoldcf/agents/
manifoldcf/branches/CONNECTORS-1490/connectors/mongodb/src/main/resources/org/apache/manifoldcf/agents/output/
manifoldcf/branches/CONNECTORS-1490/connectors/mongodb/src/main/resources/org/apache/manifoldcf/agents/output/mongodboutput/
manifoldcf/branches/CONNECTORS-1490/connectors/mongodb/src/main/resources/org/apache/manifoldcf/agents/output/mongodboutput/editConfiguration.js
manifoldcf/branches/CONNECTORS-1490/connectors/mongodb/src/main/resources/org/apache/manifoldcf/agents/output/mongodboutput/editConfiguration_Parameters.html
manifoldcf/branches/CONNECTORS-1490/connectors/mongodb/src/main/resources/org/apache/manifoldcf/agents/output/mongodboutput/viewConfiguration.html
manifoldcf/branches/CONNECTORS-1490/connectors/mongodb/src/test/
manifoldcf/branches/CONNECTORS-1490/connectors/mongodb/src/test/java/
manifoldcf/branches/CONNECTORS-1490/connectors/mongodb/src/test/java/org/
manifoldcf/branches/CONNECTORS-1490/connectors/mongodb/src/test/java/org/apache/
manifoldcf/branches/CONNECTORS-1490/connectors/mongodb/src/test/java/org/apache/manifoldcf/
manifoldcf/branches/CONNECTORS-1490/connectors/mongodb/src/test/java/org/apache/manifoldcf/agents/
manifoldcf/branches/CONNECTORS-1490/connectors/mongodb/src/test/java/org/apache/manifoldcf/agents/output/
manifoldcf/branches/CONNECTORS-1490/connectors/mongodb/src/test/java/org/apache/manifoldcf/agents/output/mongodboutput/
manifoldcf/branches/CONNECTORS-1490/connectors/mongodb/src/test/java/org/apache/manifoldcf/agents/output/mongodboutput/tests/
manifoldcf/branches/CONNECTORS-1490/connectors/mongodb/src/test/java/org/apache/manifoldcf/agents/output/mongodboutput/tests/APISanityHSQLDBIT.java
manifoldcf/branches/CONNECTORS-1490/connectors/mongodb/src/test/java/org/apache/manifoldcf/agents/output/mongodboutput/tests/BaseHSQLDB.java
manifoldcf/branches/CONNECTORS-1490/connectors/mongodb/src/test/java/org/apache/manifoldcf/agents/output/mongodboutput/tests/BaseITHSQLDB.java
manifoldcf/branches/CONNECTORS-1490/connectors/mongodb/src/test/java/org/apache/manifoldcf/agents/output/mongodboutput/tests/BaseITSanityTestUtils.java
manifoldcf/branches/CONNECTORS-1490/connectors/mongodb/src/test/java/org/apache/manifoldcf/agents/output/mongodboutput/tests/BasePostgresql.java
manifoldcf/branches/CONNECTORS-1490/connectors/mongodb/src/test/java/org/apache/manifoldcf/agents/output/mongodboutput/tests/BaseUIHSQLDB.java
manifoldcf/branches/CONNECTORS-1490/connectors/mongodb/src/test/java/org/apache/manifoldcf/agents/output/mongodboutput/tests/NavigationHSQLDBUI.java
manifoldcf/branches/CONNECTORS-1490/connectors/mongodb/src/test/java/org/apache/manifoldcf/agents/output/mongodboutput/tests/SanityHSQLDBTest.java
manifoldcf/branches/CONNECTORS-1490/connectors/mongodb/src/test/java/org/apache/manifoldcf/agents/output/mongodboutput/tests/SanityPostgresqlTest.java
manifoldcf/branches/CONNECTORS-1490/site/src/documentation/resources/images/en_US/mongodb-output-connection-configuration.PNG
(with props)
Modified:
manifoldcf/branches/CONNECTORS-1490/connectors/pom.xml
manifoldcf/branches/CONNECTORS-1490/site/src/documentation/content/xdocs/en_US/end-user-documentation.xml
manifoldcf/branches/CONNECTORS-1490/site/src/documentation/content/xdocs/en_US/included-connectors.xml
Added: manifoldcf/branches/CONNECTORS-1490/connectors/mongodb/build.xml
URL:
http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-1490/connectors/mongodb/build.xml?rev=1837604&view=auto
==============================================================================
--- manifoldcf/branches/CONNECTORS-1490/connectors/mongodb/build.xml (added)
+++ manifoldcf/branches/CONNECTORS-1490/connectors/mongodb/build.xml Tue Aug 7
15:07:07 2018
@@ -0,0 +1,97 @@
+<!--
+ 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="mongodb" 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>
+ <condition property="is-on-Windows">
+ <os family="windows" />
+ </condition>
+ <condition property="is-on-Unix">
+ <os family="unix" />
+ </condition>
+
+ <import file="${mcf-dist}/connector-build.xml"/>
+
+ <target name="download-cleanup">
+ <delete>
+ <fileset dir="test-materials" excludes="README*.txt"/>
+ </delete>
+ </target>
+
+ <path id="connector-classpath">
+ <path refid="mcf-connector-build.connector-classpath"/>
+ <fileset dir="../../lib">
+ <include name="mongo-java-driver*.jar"/>
+ </fileset>
+ </path>
+
+ <target name="lib" depends="mcf-connector-build.lib,precompile-check"
if="canBuild">
+ <mkdir dir="dist/lib"/>
+ <copy todir="dist/lib">
+ <fileset dir="../../lib">
+ <include name="mongo-java-driver*.jar"/>
+ </fileset>
+ </copy>
+ </target>
+
+ <target name="deliver-connector"
depends="mcf-connector-build.deliver-connector">
+ <antcall target="general-add-output-connector">
+ <param name="connector-label" value="MongoDB"/>
+ <param name="connector-class"
+
value="org.apache.manifoldcf.agents.output.mongodboutput.MongodbOutputConnector"/>
+ </antcall>
+ </target>
+
+ <target name="run-IT-HSQLDB" depends="run-maven-IT-on-unix,
run-maven-IT-on-windows"/>
+
+ <target name="run-maven-IT-on-windows" if="is-on-Windows">
+ <exec dir="." executable="cmd" resultproperty="result">
+ <arg line="/c mvn verify" />
+ </exec>
+ <fail>
+ <condition>
+ <not>
+ <equals arg1="${result}" arg2="0" />
+ </not>
+ </condition>
+ </fail>
+ </target>
+
+ <target name="run-maven-IT-on-unix" if="is-on-Unix">
+ <exec dir="." executable="sh" resultproperty="result">
+ <arg line="-c 'mvn verify'" />
+ </exec>
+ <fail>
+ <condition>
+ <not>
+ <equals arg1="${result}" arg2="0" />
+ </not>
+ </condition>
+ </fail>
+ </target>
+
+</project>
Added: manifoldcf/branches/CONNECTORS-1490/connectors/mongodb/pom.xml
URL:
http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-1490/connectors/mongodb/pom.xml?rev=1837604&view=auto
==============================================================================
--- manifoldcf/branches/CONNECTORS-1490/connectors/mongodb/pom.xml (added)
+++ manifoldcf/branches/CONNECTORS-1490/connectors/mongodb/pom.xml Tue Aug 7
15:07:07 2018
@@ -0,0 +1,423 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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>2.11-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>
+ <mongo.java.driver.version>2.11.3</mongo.java.driver.version>
+ <docker.maven.plugin.version>0.26.0</docker.maven.plugin.version>
+ <mongodb.port>27017</mongodb.port>
+ <mongodb.username>dummyuser</mongodb.username>
+ <mongodb.password>dummysecrect</mongodb.password>
+ </properties>
+
+ <developers>
+ <developer>
+ <name>Irindu Nugawela</name>
+ </developer>
+ <developer>
+ <name>Piergiorgio Lucidi</name>
+ <organization>Sourcesense</organization>
+ <organizationUrl>http://www.sourcesense.com</organizationUrl>
+ <url>http://www.open4dev.com</url>
+ </developer>
+ </developers>
+
+ <artifactId>mcf-mongodb-connector</artifactId>
+ <name>ManifoldCF - Connectors - Mongodb</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>mcf-core</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>mcf-connector-common</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-pull-agent</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>mcf-ui-core</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.mongodb</groupId>
+ <artifactId>mongo-java-driver</artifactId>
+ <version>${mongo.java.driver.version}</version>
+ </dependency>
+
+ <!-- Test dependencies -->
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>${junit.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>io.fabric8</groupId>
+ <artifactId>docker-maven-plugin</artifactId>
+ <version>${docker.maven.plugin.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>org.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>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>
+
+ <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>
+ <forkCount>1</forkCount>
+ <reuseForks>false</reuseForks>
+ <workingDirectory>target/test-output</workingDirectory>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-failsafe-plugin</artifactId>
+ <version>2.18.1</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>
+ <forkCount>1</forkCount>
+ <reuseForks>false</reuseForks>
+ <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>
+
+ <plugin>
+ <groupId>io.fabric8</groupId>
+ <artifactId>docker-maven-plugin</artifactId>
+ <version>0.26.0</version>
+ <configuration>
+ <showLogs>true</showLogs>
+
+ <images>
+ <image>
+ <!--<name>mongo:3.4.6</name>-->
+ <name>mongo:2.6.9</name>
+ <alias>mongo</alias>
+ <run>
+ <ports>
+ <port>${mongodb.port}:27017</port>
+ </ports>
+ <env>
+
<MONGO_INITDB_ROOT_USERNAME>${mongodb.username}</MONGO_INITDB_ROOT_USERNAME>
+
<MONGO_INITDB_ROOT_PASSWORD>${mongodb.password}</MONGO_INITDB_ROOT_PASSWORD>
+ </env>
+ <wait>
+ <log>waiting for connections on port</log>
+ <url>http://localhost:${mongodb.port}</url>
+ <time>60000</time>
+ </wait>
+ </run>
+ </image>
+ </images>
+ </configuration>
+
+ <executions>
+ <execution>
+ <id>prepare-containers</id>
+ <phase>pre-integration-test</phase>
+ <goals>
+ <goal>start</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>remove-containers</id>
+ <phase>post-integration-test</phase>
+ <goals>
+ <goal>stop</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ </plugins>
+
+ </build>
+
+</project>
\ No newline at end of file
Added:
manifoldcf/branches/CONNECTORS-1490/connectors/mongodb/src/main/java/org/apache/manifoldcf/agents/output/mongodboutput/Messages.java
URL:
http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-1490/connectors/mongodb/src/main/java/org/apache/manifoldcf/agents/output/mongodboutput/Messages.java?rev=1837604&view=auto
==============================================================================
---
manifoldcf/branches/CONNECTORS-1490/connectors/mongodb/src/main/java/org/apache/manifoldcf/agents/output/mongodboutput/Messages.java
(added)
+++
manifoldcf/branches/CONNECTORS-1490/connectors/mongodb/src/main/java/org/apache/manifoldcf/agents/output/mongodboutput/Messages.java
Tue Aug 7 15:07:07 2018
@@ -0,0 +1,120 @@
+/**
+ * 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.output.mongodboutput;
+
+import org.apache.manifoldcf.core.interfaces.IHTTPOutput;
+import org.apache.manifoldcf.core.interfaces.ManifoldCFException;
+
+import java.util.Locale;
+import java.util.Map;
+
+public class Messages extends org.apache.manifoldcf.ui.i18n.Messages {
+ public static final String DEFAULT_BUNDLE_NAME =
"org.apache.manifoldcf.agents.output.mongodboutput.common";
+ public static final String DEFAULT_PATH_NAME =
"org.apache.manifoldcf.crawler.connectors.mongodboutput";
+
+ /**
+ * Constructor - do no instantiate
+ */
+ protected Messages() {
+ }
+
+ public static String getString(Locale locale, String messageKey) {
+ return getString(DEFAULT_BUNDLE_NAME, locale, messageKey, null);
+ }
+
+ public static String getAttributeString(Locale locale, String messageKey) {
+ return getAttributeString(DEFAULT_BUNDLE_NAME, locale, messageKey,
null);
+ }
+
+ public static String getBodyString(Locale locale, String messageKey) {
+ return getBodyString(DEFAULT_BUNDLE_NAME, locale, messageKey, null);
+ }
+
+ public static String getAttributeJavascriptString(Locale locale, String
messageKey) {
+ return getAttributeJavascriptString(DEFAULT_BUNDLE_NAME, locale,
messageKey, null);
+ }
+
+ public static String getBodyJavascriptString(Locale locale, String
messageKey) {
+ return getBodyJavascriptString(DEFAULT_BUNDLE_NAME, locale,
messageKey, null);
+ }
+
+ public static String getString(Locale locale, String messageKey, Object[]
args) {
+ return getString(DEFAULT_BUNDLE_NAME, locale, messageKey, args);
+ }
+
+ public static String getAttributeString(Locale locale, String messageKey,
Object[] args) {
+ return getAttributeString(DEFAULT_BUNDLE_NAME, locale, messageKey,
args);
+ }
+
+ public static String getBodyString(Locale locale, String messageKey,
Object[] args) {
+ return getBodyString(DEFAULT_BUNDLE_NAME, locale, messageKey, args);
+ }
+
+ public static String getAttributeJavascriptString(Locale locale, String
messageKey, Object[] args) {
+ return getAttributeJavascriptString(DEFAULT_BUNDLE_NAME, locale,
messageKey, args);
+ }
+
+ public static String getBodyJavascriptString(Locale locale, String
messageKey, Object[] args) {
+ return getBodyJavascriptString(DEFAULT_BUNDLE_NAME, locale,
messageKey, args);
+ }
+
+ // More general methods which allow bundlenames and class loaders to be
specified.
+
+ public static String getString(String bundleName, Locale locale, String
messageKey, Object[] args) {
+ return getString(Messages.class, bundleName, locale, messageKey, args);
+ }
+
+ public static String getAttributeString(String bundleName, Locale locale,
String messageKey, Object[] args) {
+ return getAttributeString(Messages.class, bundleName, locale,
messageKey, args);
+ }
+
+ public static String getBodyString(String bundleName, Locale locale,
String messageKey, Object[] args) {
+ return getBodyString(Messages.class, bundleName, locale, messageKey,
args);
+ }
+
+ public static String getAttributeJavascriptString(String bundleName,
Locale locale, String messageKey, Object[] args) {
+ return getAttributeJavascriptString(Messages.class, bundleName,
locale, messageKey, args);
+ }
+
+ public static String getBodyJavascriptString(String bundleName, Locale
locale, String messageKey, Object[] args) {
+ return getBodyJavascriptString(Messages.class, bundleName, locale,
messageKey, args);
+ }
+
+ // Resource output
+
+ public static void outputResource(IHTTPOutput output, Locale locale,
String resourceKey,
+ Map<String, String>
substitutionParameters, boolean mapToUpperCase)
+ throws ManifoldCFException {
+ outputResource(output, Messages.class, DEFAULT_PATH_NAME, locale,
resourceKey,
+ substitutionParameters, mapToUpperCase);
+ }
+
+ public static void outputResourceWithVelocity(IHTTPOutput output, Locale
locale, String resourceKey,
+ Map<String, String>
substitutionParameters, boolean mapToUpperCase)
+ throws ManifoldCFException {
+ outputResourceWithVelocity(output, Messages.class,
DEFAULT_BUNDLE_NAME, DEFAULT_PATH_NAME, locale, resourceKey,
+ substitutionParameters, mapToUpperCase);
+ }
+
+ public static void outputResourceWithVelocity(IHTTPOutput output, Locale
locale, String resourceKey,
+ Map<String, Object>
contextObjects)
+ throws ManifoldCFException {
+ outputResourceWithVelocity(output, Messages.class,
DEFAULT_BUNDLE_NAME, DEFAULT_PATH_NAME, locale, resourceKey,
+ contextObjects);
+ }
+
+}
Added:
manifoldcf/branches/CONNECTORS-1490/connectors/mongodb/src/main/java/org/apache/manifoldcf/agents/output/mongodboutput/MongodbOutputConfig.java
URL:
http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-1490/connectors/mongodb/src/main/java/org/apache/manifoldcf/agents/output/mongodboutput/MongodbOutputConfig.java?rev=1837604&view=auto
==============================================================================
---
manifoldcf/branches/CONNECTORS-1490/connectors/mongodb/src/main/java/org/apache/manifoldcf/agents/output/mongodboutput/MongodbOutputConfig.java
(added)
+++
manifoldcf/branches/CONNECTORS-1490/connectors/mongodb/src/main/java/org/apache/manifoldcf/agents/output/mongodboutput/MongodbOutputConfig.java
Tue Aug 7 15:07:07 2018
@@ -0,0 +1,48 @@
+/**
+ * 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.output.mongodboutput;
+
+/**
+ * Parameters data for the Mongodb output connector.
+ */
+public class MongodbOutputConfig {
+
+ /** Username */
+ public static final String USERNAME_PARAM = "username";
+
+ /** Password */
+ public static final String PASSWORD_PARAM = "password";
+
+ /** Server name */
+ public static final String HOST_PARAM = "host";
+
+ /** Port */
+ public static final String PORT_PARAM = "port";
+
+ /** Database */
+ public static final String DATABASE_PARAM = "database";
+
+ /** Collection */
+ public static final String COLLECTION_PARAM = "collection";
+
+ //default values
+ public static final String HOST_DEFAULT_VALUE = "localhost";
+ public static final String PORT_DEFAULT_VALUE = "27017";
+ public static final String DATABASE_DEFAULT_VALUE = "database";
+ public static final String COLLECTION_DEFAULT_VALUE = "collection";
+
+}
\ No newline at end of file
Added:
manifoldcf/branches/CONNECTORS-1490/connectors/mongodb/src/main/java/org/apache/manifoldcf/agents/output/mongodboutput/MongodbOutputConnector.java
URL:
http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-1490/connectors/mongodb/src/main/java/org/apache/manifoldcf/agents/output/mongodboutput/MongodbOutputConnector.java?rev=1837604&view=auto
==============================================================================
---
manifoldcf/branches/CONNECTORS-1490/connectors/mongodb/src/main/java/org/apache/manifoldcf/agents/output/mongodboutput/MongodbOutputConnector.java
(added)
+++
manifoldcf/branches/CONNECTORS-1490/connectors/mongodb/src/main/java/org/apache/manifoldcf/agents/output/mongodboutput/MongodbOutputConnector.java
Tue Aug 7 15:07:07 2018
@@ -0,0 +1,878 @@
+/**
+ * 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.output.mongodboutput;
+
+import com.mongodb.BasicDBObject;
+import com.mongodb.DB;
+import com.mongodb.DBCursor;
+import com.mongodb.DBCollection;
+import com.mongodb.MongoClient;
+import com.mongodb.DBTCPConnector;
+import com.mongodb.DBPort;
+import com.mongodb.DBPortPool;
+import com.mongodb.WriteConcern;
+import com.mongodb.WriteResult;
+import com.mongodb.MongoException;
+import org.bson.types.Binary;
+
+import org.apache.commons.io.IOUtils;
+import org.apache.commons.lang.StringUtils;
+import org.apache.manifoldcf.agents.interfaces.IOutputAddActivity;
+import org.apache.manifoldcf.agents.interfaces.IOutputRemoveActivity;
+import org.apache.manifoldcf.agents.interfaces.RepositoryDocument;
+import org.apache.manifoldcf.agents.interfaces.ServiceInterruption;
+import org.apache.manifoldcf.agents.output.BaseOutputConnector;
+import org.apache.manifoldcf.core.interfaces.IThreadContext;
+import org.apache.manifoldcf.core.interfaces.IHTTPOutput;
+import org.apache.manifoldcf.core.interfaces.IPasswordMapperActivity;
+import org.apache.manifoldcf.core.interfaces.IPostParameters;
+import org.apache.manifoldcf.core.interfaces.ConfigParams;
+import org.apache.manifoldcf.core.interfaces.VersionContext;
+import org.apache.manifoldcf.core.interfaces.ManifoldCFException;
+import org.apache.manifoldcf.crawler.system.Logging;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InterruptedIOException;
+import java.net.ConnectException;
+import java.net.UnknownHostException;
+import java.rmi.RemoteException;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Locale;
+import java.util.Date;
+import java.util.Iterator;
+
+/**
+ * This is the "output connector" for MongoDB.
+ *
+ * @author Irindu Nugawela
+ */
+
+public class MongodbOutputConnector extends BaseOutputConnector {
+
+ // Tab name properties
+
+ private static final String MONGODB_TAB_PARAMETERS =
"MongodbConnector.Parameters";
+
+ // Template names
+
+ /**
+ * Forward to the javascript to check the configuration parameters
+ */
+ private static final String EDIT_CONFIG_HEADER_FORWARD =
"editConfiguration.js";
+ /**
+ * Server tab template
+ */
+ private static final String EDIT_CONFIG_FORWARD_SERVER =
"editConfiguration_Parameters.html";
+ /**
+ * Forward to the HTML template to view the configuration parameters
+ */
+ private static final String VIEW_CONFIG_FORWARD = "viewConfiguration.html";
+
+ /**
+ * Save activity
+ */
+ protected final static String ACTIVITY_INJECTION = "Injection";
+ /**
+ * Delete activity
+ */
+ protected final static String ACTIVITY_DELETE = "Delete";
+
+ /**
+ * Document accepted
+ */
+ private final static int DOCUMENT_STATUS_ACCEPTED = 0;
+
+ private static final String DOCUMENT_STATUS_ACCEPTED_DESC = "Injection OK
- ";
+
+ private static final String DOCUMENT_STATUS_REJECTED_DESC = "Injection KO
- ";
+
+ /**
+ * Document permanently rejected
+ */
+ private final static int DOCUMENT_STATUS_REJECTED = 1;
+
+ /**
+ * Document remove accepted
+ */
+ private final static String DOCUMENT_DELETION_STATUS_ACCEPTED = "Remove
request accepted";
+
+ /**
+ * Document remove permanently rejected
+ */
+ private final static String DOCUMENT_DELETION_STATUS_REJECTED = "Remove
request rejected";
+
+ /** Location of host where MongoDB server is hosted*/
+ protected String host = null;
+
+ /** port number associated with MongoDB server process */
+ protected String port = null;
+
+ /** Name of the target database */
+ protected String database = null;
+
+ /** Name of the target collection that belongs to the database specified
above */
+ protected String collection = null;
+
+ /** username and password associated with the target database */
+ protected String username = null;
+ protected String password = null;
+
+ /**
+ * Session expiration time in milliseconds.
+ */
+ protected static final long timeToRelease = 300000L;
+
+ /**
+ * Last session fetch time.
+ */
+ protected long lastSessionFetch = -1L;
+
+ /**
+ * MongoDB client instance used to make the connection to the MongoDB
server
+ */
+ private MongoClient client = null;
+
+ /**
+ * MongoDB database handle instance
+ */
+ private DB mongoDatabase = null;
+
+
+ /**
+ * Constructor
+ */
+ public MongodbOutputConnector() {
+ super();
+ }
+
+
+ /**
+ * Return the list of activities that this connector supports (i.e. writes
+ * into the log).
+ *
+ * @return the list.
+ */
+ @Override
+ public String[] getActivitiesList() {
+ return new String[]{ACTIVITY_INJECTION, ACTIVITY_DELETE};
+ }
+
+ /**
+ * This method is periodically called for all connectors that are connected
+ * but not in active use.
+ */
+ @Override
+ public void poll() throws ManifoldCFException {
+ if (lastSessionFetch == -1L)
+ return;
+
+ long currentTime = System.currentTimeMillis();
+ if (currentTime >= lastSessionFetch + timeToRelease) {
+ DestroySessionThread t = new DestroySessionThread();
+ try {
+ t.start();
+ t.join();
+ Throwable thr = t.getException();
+ if (thr != null) {
+ if (thr instanceof RemoteException)
+ throw (RemoteException) thr;
+ else
+ throw (Error) thr;
+ }
+ client = null;
+ lastSessionFetch = -1L;
+ } catch (InterruptedException e) {
+ t.interrupt();
+ throw new ManifoldCFException("Interrupted: " +
e.getMessage(), e, ManifoldCFException.INTERRUPTED);
+ } catch (RemoteException e) {
+ Throwable e2 = e.getCause();
+ if (e2 instanceof InterruptedException || e2 instanceof
InterruptedIOException)
+ throw new ManifoldCFException(e2.getMessage(), e2,
ManifoldCFException.INTERRUPTED);
+ client = null;
+ lastSessionFetch = -1L;
+ // Treat this as a transient problem
+ Logging.connectors.warn("MongoDB: Transient remote exception
closing session: " + e.getMessage(), e);
+ }
+
+ }
+ }
+
+ /**
+ * This method is called to assess whether to count this connector instance
+ * should actually be counted as being connected.
+ *
+ * @return true if the connector instance is actually connected.
+ */
+ @Override
+ public boolean isConnected() {
+ if (client == null) {
+ return false;
+ }
+ DBTCPConnector currentTCPConnection = client.getConnector();
+ return currentTCPConnection.isOpen();
+ }
+
+ /**
+ * Read the content of a resource, replace the variable ${PARAMNAME} with
the
+ * value and copy it to the out.
+ *
+ * @param resName
+ * @param out
+ * @throws ManifoldCFException
+ */
+ private static void outputResource(String resName, IHTTPOutput out, Locale
locale, Map<String, String> paramMap)
+ throws ManifoldCFException {
+ Messages.outputResourceWithVelocity(out, locale, resName, paramMap,
true);
+ }
+
+ /**
+ * Fill in a Server tab configuration parameter map for calling a Velocity
+ * template.
+ *
+ * @param newMap is the map to fill in
+ * @param parameters is the current set of configuration parameters
+ */
+ private static void fillInServerConfigurationMap(Map<String, String>
newMap, IPasswordMapperActivity mapper,
+ ConfigParams parameters) {
+ String username =
parameters.getParameter(MongodbOutputConfig.USERNAME_PARAM);
+ String password =
parameters.getParameter(MongodbOutputConfig.PASSWORD_PARAM);
+ String host = parameters.getParameter(MongodbOutputConfig.HOST_PARAM);
+ String port = parameters.getParameter(MongodbOutputConfig.PORT_PARAM);
+ String database =
parameters.getParameter(MongodbOutputConfig.DATABASE_PARAM);
+ String collection =
parameters.getParameter(MongodbOutputConfig.COLLECTION_PARAM);
+
+ if (username == null)
+ username = StringUtils.EMPTY;
+ if (password == null)
+ password = StringUtils.EMPTY;
+ else
+ password = mapper.mapPasswordToKey(password);
+ if (host == null)
+ host = MongodbOutputConfig.HOST_DEFAULT_VALUE;
+ if (port == null)
+ port = MongodbOutputConfig.PORT_DEFAULT_VALUE;
+ if (database == null)
+ database = MongodbOutputConfig.DATABASE_DEFAULT_VALUE;
+ if (collection == null)
+ collection = MongodbOutputConfig.COLLECTION_DEFAULT_VALUE;
+
+ newMap.put(MongodbOutputConfig.USERNAME_PARAM, username);
+ newMap.put(MongodbOutputConfig.PASSWORD_PARAM, password);
+ newMap.put(MongodbOutputConfig.HOST_PARAM, host);
+ newMap.put(MongodbOutputConfig.PORT_PARAM, port);
+ newMap.put(MongodbOutputConfig.DATABASE_PARAM, database);
+ newMap.put(MongodbOutputConfig.COLLECTION_PARAM, collection);
+ }
+
+ /**
+ * View configuration. This method is called in the body section of the
+ * connector's view configuration page. Its purpose is to present the
+ * connection information to the user. The coder can presume that the HTML
+ * that is output from this configuration will be within appropriate
+ * <html> and <body> tags.
+ *
+ * @param threadContext is the local thread context.
+ * @param out is the output to which any HTML should be sent.
+ * @param parameters are the configuration parameters, as they
currently exist, for
+ * this connection being configured.
+ */
+ @Override
+ public void viewConfiguration(IThreadContext threadContext, IHTTPOutput
out, Locale locale, ConfigParams parameters)
+ throws ManifoldCFException, IOException {
+ Map<String, String> paramMap = new HashMap<String, String>();
+
+ // Fill in map from each tab
+ fillInServerConfigurationMap(paramMap, out, parameters);
+
+ outputResource(VIEW_CONFIG_FORWARD, out, locale, paramMap);
+ }
+
+ /**
+ * Output the configuration header section. This method is called in the
head
+ * section of the connector's configuration page. Its purpose is to add the
+ * required tabs to the list, and to output any javascript methods that
might
+ * be needed by the configuration editing HTML.
+ *
+ * @param threadContext is the local thread context.
+ * @param out is the output to which any HTML should be sent.
+ * @param parameters are the configuration parameters, as they
currently exist, for
+ * this connection being configured.
+ * @param tabsArray is an array of tab names. Add to this array any
tab names that are
+ * specific to the connector.
+ */
+ @Override
+ public void outputConfigurationHeader(IThreadContext threadContext,
IHTTPOutput out, Locale locale,
+ ConfigParams parameters,
List<String> tabsArray) throws ManifoldCFException, IOException {
+ // Add the Server tab
+ tabsArray.add(Messages.getString(locale, MONGODB_TAB_PARAMETERS));
+ // Map the parameters
+ Map<String, String> paramMap = new HashMap<String, String>();
+
+ // Fill in the parameters from each tab
+ fillInServerConfigurationMap(paramMap, out, parameters);
+
+ // Output the Javascript - only one Velocity template for all tabs
+ outputResource(EDIT_CONFIG_HEADER_FORWARD, out, locale, paramMap);
+ }
+
+ @Override
+ public void outputConfigurationBody(IThreadContext threadContext,
IHTTPOutput out, Locale locale,
+ ConfigParams parameters, String
tabName) throws ManifoldCFException, IOException {
+
+ // Call the Velocity templates for each tab
+
+ // Server tab
+ Map<String, String> paramMap = new HashMap<String, String>();
+ // Set the tab name
+ paramMap.put("TabName", tabName);
+ // Fill in the parameters
+ fillInServerConfigurationMap(paramMap, out, parameters);
+ outputResource(EDIT_CONFIG_FORWARD_SERVER, out, locale, paramMap);
+
+ }
+
+ /**
+ * Process a configuration post. This method is called at the start of the
+ * connector's configuration page, whenever there is a possibility that
form
+ * data for a connection has been posted. Its purpose is to gather form
+ * information and modify the configuration parameters accordingly. The
name
+ * of the posted form is "editconnection".
+ *
+ * @param threadContext is the local thread context.
+ * @param variableContext is the set of variables available from the post,
including binary
+ * file post information.
+ * @param parameters are the configuration parameters, as they
currently exist, for
+ * this connection being configured.
+ * @return null if all is well, or a string error message if there is an
error
+ * that should prevent saving of the connection (and cause a
+ * redirection to an error page).
+ */
+ @Override
+ public String processConfigurationPost(IThreadContext threadContext,
IPostParameters variableContext,
+ ConfigParams parameters) throws
ManifoldCFException {
+
+
+ String username =
variableContext.getParameter(MongodbOutputConfig.USERNAME_PARAM);
+ if (username != null)
+ parameters.setParameter(MongodbOutputConfig.USERNAME_PARAM,
username);
+
+ String password =
variableContext.getParameter(MongodbOutputConfig.PASSWORD_PARAM);
+ if (password != null)
+ parameters.setParameter(MongodbOutputConfig.PASSWORD_PARAM,
variableContext.mapKeyToPassword(password));
+
+ String host =
variableContext.getParameter(MongodbOutputConfig.HOST_PARAM);
+ if (host != null)
+ parameters.setParameter(MongodbOutputConfig.HOST_PARAM, host);
+
+ String port =
variableContext.getParameter(MongodbOutputConfig.PORT_PARAM);
+ if (port != null && !StringUtils.isEmpty(port)) {
+ try {
+ Integer.parseInt(port);
+ parameters.setParameter(MongodbOutputConfig.PORT_PARAM, port);
+ } catch (NumberFormatException e) {
+ return "Invalid Port Number";
+ }
+ }
+
+ String database =
variableContext.getParameter(MongodbOutputConfig.DATABASE_PARAM);
+ if (database != null)
+ parameters.setParameter(MongodbOutputConfig.DATABASE_PARAM,
database);
+
+ String collection =
variableContext.getParameter(MongodbOutputConfig.COLLECTION_PARAM);
+ if (collection != null)
+ parameters.setParameter(MongodbOutputConfig.COLLECTION_PARAM,
collection);
+
+
+ return null;
+ }
+
+ /**
+ * Close the connection. Call this before discarding the connection.
+ */
+ @Override
+ public void disconnect() throws ManifoldCFException {
+ if (client != null) {
+ DestroySessionThread t = new DestroySessionThread();
+ try {
+ t.start();
+ t.join();
+ Throwable thr = t.getException();
+ if (thr != null) {
+ if (thr instanceof RemoteException)
+ throw (RemoteException) thr;
+ else
+ throw (Error) thr;
+ }
+ client = null;
+ mongoDatabase = null;
+ lastSessionFetch = -1L;
+ } catch (InterruptedException e) {
+ t.interrupt();
+ throw new ManifoldCFException("Interrupted: " +
e.getMessage(), e, ManifoldCFException.INTERRUPTED);
+ } catch (RemoteException e) {
+ Throwable e2 = e.getCause();
+ if (e2 instanceof InterruptedException || e2 instanceof
InterruptedIOException)
+ throw new ManifoldCFException(e2.getMessage(), e2,
ManifoldCFException.INTERRUPTED);
+ client = null;
+ mongoDatabase = null;
+ lastSessionFetch = -1L;
+ // Treat this as a transient problem
+ Logging.connectors.warn("MongoDB: Transient remote exception
closing session: " + e.getMessage(), e);
+ }
+
+ }
+
+ username = null;
+ password = null;
+ host = null;
+ port = null;
+ database = null;
+ collection = null;
+
+ }
+
+ /**
+ * This method creates a new MongoDB Session for a MongoDB repository,
+ *
+ * @param configParams is the set of configuration parameters, which in
this case
+ * describe the target, basic auth configuration, etc.
+ */
+ @Override
+ public void connect(ConfigParams configParams) {
+ super.connect(configParams);
+ username = params.getParameter(MongodbOutputConfig.USERNAME_PARAM);
+ password = params.getParameter(MongodbOutputConfig.PASSWORD_PARAM);
+ host = params.getParameter(MongodbOutputConfig.HOST_PARAM);
+ port = params.getParameter(MongodbOutputConfig.PORT_PARAM);
+ database = params.getParameter(MongodbOutputConfig.DATABASE_PARAM);
+ collection = params.getParameter(MongodbOutputConfig.COLLECTION_PARAM);
+ }
+
+ /**
+ * Test the connection. Returns a string describing the connection
integrity.
+ *
+ * @return the connection's status as a displayable string.
+ */
+ @Override
+ public String check() throws ManifoldCFException {
+ try {
+ checkConnection();
+ return super.check();
+ } catch (ServiceInterruption e) {
+ return "Connection temporarily failed: " + e.getMessage();
+ } catch (ManifoldCFException e) {
+ return "Connection failed: " + e.getMessage();
+ }
+ }
+
+ /**
+ * Set up a session
+ */
+ protected void getSession() throws ManifoldCFException,
ServiceInterruption {
+
+ // Check for parameter validity
+
+ if (StringUtils.isEmpty(database))
+ throw new ManifoldCFException("Parameter " +
MongodbOutputConfig.DATABASE_PARAM + " required but not set");
+
+ if (StringUtils.isEmpty(collection))
+ throw new ManifoldCFException("Parameter " +
MongodbOutputConfig.COLLECTION_PARAM + " required but not set");
+
+
+ long currentTime;
+ GetSessionThread t = new GetSessionThread();
+ try {
+ t.start();
+ t.join();
+ Throwable thr = t.getException();
+ if (thr != null) {
+ if (thr instanceof ManifoldCFException)
+ throw new ManifoldCFException("MongoDB: Error during
getting a new session: " + thr.getMessage(), thr);
+ else if (thr instanceof RemoteException)
+ throw (RemoteException) thr;
+ else if (thr instanceof MongoException)
+ throw new ManifoldCFException("MongoDB: Error during
getting a new session: " + thr.getMessage(), thr);
+ else if (thr instanceof java.net.ConnectException)
+ throw new ManifoldCFException("MongoDB: Error Connecting
to MongoDB is mongod running? : " + thr.getMessage(), thr);
+ else
+ throw (Error) thr;
+ }
+ } catch (InterruptedException e) {
+ t.interrupt();
+ throw new ManifoldCFException("Interrupted: " + e.getMessage(), e,
ManifoldCFException.INTERRUPTED);
+ } catch (RemoteException e) {
+ Throwable e2 = e.getCause();
+ if (e2 instanceof InterruptedException || e2 instanceof
InterruptedIOException)
+ throw new ManifoldCFException(e2.getMessage(), e2,
ManifoldCFException.INTERRUPTED);
+ // Treat this as a transient problem
+ Logging.connectors.warn("MongoDB: Transient remote exception
creating session: " + e.getMessage(), e);
+ currentTime = System.currentTimeMillis();
+ throw new ServiceInterruption(e.getMessage(), currentTime +
60000L);
+ }
+
+ lastSessionFetch = System.currentTimeMillis();
+ }
+
+ /**
+ * Release the session, if it's time.
+ */
+ protected void releaseCheck() throws ManifoldCFException {
+ if (lastSessionFetch == -1L)
+ return;
+
+ long currentTime = System.currentTimeMillis();
+ if (currentTime >= lastSessionFetch + timeToRelease) {
+ DestroySessionThread t = new DestroySessionThread();
+ try {
+ t.start();
+ t.join();
+ Throwable thr = t.getException();
+ if (thr != null) {
+ if (thr instanceof RemoteException)
+ throw (RemoteException) thr;
+ else
+ throw (Error) thr;
+ }
+ client = null;
+ lastSessionFetch = -1L;
+ } catch (InterruptedException e) {
+ t.interrupt();
+ throw new ManifoldCFException("Interrupted: " +
e.getMessage(), e, ManifoldCFException.INTERRUPTED);
+ } catch (RemoteException e) {
+ Throwable e2 = e.getCause();
+ if (e2 instanceof InterruptedException || e2 instanceof
InterruptedIOException)
+ throw new ManifoldCFException(e2.getMessage(), e2,
ManifoldCFException.INTERRUPTED);
+ client = null;
+ lastSessionFetch = -1L;
+ // Treat this as a transient problem
+ Logging.connectors.warn("MongoDB: Transient remote exception
closing session: " + e.getMessage(), e);
+ }
+
+ }
+ }
+
+ protected void checkConnection() throws ManifoldCFException,
ServiceInterruption {
+ while (true) {
+ boolean noSession = (client == null);
+ getSession();
+ long currentTime;
+ CheckConnectionThread t = new CheckConnectionThread();
+ try {
+ t.start();
+ t.join();
+ Throwable thr = t.getException();
+ if (thr != null) {
+ if (thr instanceof RemoteException)
+ throw (RemoteException) thr;
+ else if (thr instanceof ConnectException)
+ throw new ManifoldCFException("MongoDB: Error during
checking connection: is Mongod running?" + thr.getMessage(), thr);
+ else if (thr instanceof MongoException)
+ throw new ManifoldCFException("MongoDB: Error during
checking connection: " + thr.getMessage(), thr);
+ else if (thr instanceof ManifoldCFException)
+ throw new ManifoldCFException(thr.getMessage(), thr);
+ else
+ throw (Error) thr;
+ }
+ return;
+ } catch (InterruptedException e) {
+ t.interrupt();
+ throw new ManifoldCFException("Interrupted: " +
e.getMessage(), e, ManifoldCFException.INTERRUPTED);
+ } catch (RemoteException e) {
+ Throwable e2 = e.getCause();
+ if (e2 instanceof InterruptedException || e2 instanceof
InterruptedIOException)
+ throw new ManifoldCFException(e2.getMessage(), e2,
ManifoldCFException.INTERRUPTED);
+ if (noSession) {
+ currentTime = System.currentTimeMillis();
+ throw new ServiceInterruption("Transient error connecting
to filenet service: " + e.getMessage(),
+ currentTime + 60000L);
+ }
+ client = null;
+ lastSessionFetch = -1L;
+ continue;
+ }
+ }
+ }
+
+ protected class GetSessionThread extends Thread {
+ protected Throwable exception = null;
+
+ public GetSessionThread() {
+ super();
+ setDaemon(true);
+ }
+
+ public void run() {
+ try {
+ // Create a session
+ if (client == null) {
+ if (StringUtils.isEmpty(host) &&
StringUtils.isEmpty(port)) {
+ try {
+ client = new MongoClient();
+ mongoDatabase = client.getDB(database);
+ } catch (UnknownHostException ex) {
+ throw new ManifoldCFException("MongoDB: Default
host is not found. Is mongod process running?" + ex.getMessage(), ex);
+ }
+ } else if (!StringUtils.isEmpty(host) &&
StringUtils.isEmpty(port)) {
+ try {
+ client = new MongoClient(host);
+ mongoDatabase = client.getDB(database);
+ } catch (UnknownHostException ex) {
+ throw new ManifoldCFException("MongoDB: Given host
information is not valid or mongod process doesn't run" + ex.getMessage(), ex);
+ }
+ } else if (!StringUtils.isEmpty(host) &&
!StringUtils.isEmpty(port)) {
+ try {
+ int integerPort = Integer.parseInt(port);
+ client = new MongoClient(host, integerPort);
+ mongoDatabase = client.getDB(database);
+ } catch (UnknownHostException ex) {
+ throw new ManifoldCFException("MongoDB: Given
information is not valid or mongod process doesn't run" + ex.getMessage(), ex);
+ } catch (NumberFormatException ex) {
+ throw new ManifoldCFException("MongoDB: Given port
is not a valid number. " + ex.getMessage(), ex);
+ }
+ } else if (StringUtils.isEmpty(host) &&
!StringUtils.isEmpty(port)) {
+ try {
+ int integerPort = Integer.parseInt(port);
+ client = new MongoClient("localhost", integerPort);
+ mongoDatabase = client.getDB(database);
+ } catch (UnknownHostException e) {
+ Logging.connectors.warn("MongoDB: Given
information is not valid or mongod process doesn't run" + e.getMessage(), e);
+ throw new ManifoldCFException("MongoDB: Given
information is not valid or mongod process doesn't run" + e.getMessage(), e);
+ } catch (NumberFormatException e) {
+ Logging.connectors.warn("MongoDB: Given port is
not valid number. " + e.getMessage(), e);
+ throw new ManifoldCFException("MongoDB: Given port
is not valid number. " + e.getMessage(), e);
+ }
+ }
+ if (!StringUtils.isEmpty(username) &&
!StringUtils.isEmpty(password)) {
+ boolean auth = mongoDatabase.authenticate(username,
password.toCharArray());
+ if (!auth) {
+ Logging.connectors.warn("MongoDB:Authentication
Error! Given database username and password doesn't match for the database
given.");
+ throw new ManifoldCFException("MongoDB: Given
database username and password doesn't match for the database given.");
+ } else {
+ if (Logging.connectors.isDebugEnabled()) {
+ Logging.connectors.debug("MongoDB: Username =
'" + username + "'");
+ Logging.connectors.debug("MongoDB: Password
exists");
+ }
+ }
+ }
+ }
+
+ } catch (Throwable e) {
+ this.exception = e;
+ }
+ }
+
+ public Throwable getException() {
+ return exception;
+ }
+ }
+
+ protected class CheckConnectionThread extends Thread {
+ protected Throwable exception = null;
+
+ public CheckConnectionThread() {
+ super();
+ setDaemon(true);
+ }
+
+ public void run() {
+ try {
+ if (client != null) {
+ DBTCPConnector dbtcpConnector = client.getConnector();
+ DBPortPool dbPortPool =
dbtcpConnector.getDBPortPool(client.getAddress());
+ DBPort dbPort = dbPortPool.get();
+ dbPort.ensureOpen();
+ client = null;
+ }
+
+ } catch (Throwable e) {
+ Logging.connectors.warn("MongoDB: Error checking repository: "
+ e.getMessage(), e);
+ this.exception = e;
+ }
+ }
+
+ public Throwable getException() {
+ return exception;
+ }
+
+ }
+
+ protected class DestroySessionThread extends Thread {
+ protected Throwable exception = null;
+
+ public DestroySessionThread() {
+ super();
+ setDaemon(true);
+ }
+
+ public void run() {
+ try {
+ client = null;
+ mongoDatabase = null;
+ } catch (Throwable e) {
+ this.exception = e;
+ }
+ }
+
+ public Throwable getException() {
+ return exception;
+ }
+
+ }
+
+ @Override
+ public int addOrReplaceDocumentWithException(String documentURI,
VersionContext pipelineDescription,
+ RepositoryDocument document,
String authorityNameString, IOutputAddActivity activities)
+ throws ManifoldCFException, ServiceInterruption, IOException {
+
+ getSession();
+
+ //to get an exception if write fails
+ client.setWriteConcern(WriteConcern.SAFE);
+
+ long startTime = System.currentTimeMillis();
+ String resultDescription = StringUtils.EMPTY;
+
+ // Standard document fields
+ String fileName = document.getFileName();
+ Long binaryLength = document.getBinaryLength();
+ String mimeType = document.getMimeType();
+ Date creationDate = document.getCreatedDate();
+ Date lastModificationDate = document.getModifiedDate();
+ Date indexingDate = document.getIndexingDate();
+
+ // check if the repository connector includes the content path
+ String primaryPath = StringUtils.EMPTY;
+ List<String> sourcePath = document.getSourcePath();
+ if (sourcePath != null && !sourcePath.isEmpty()) {
+ primaryPath = sourcePath.get(0);
+ }
+
+ // Content Stream
+ InputStream inputStream = document.getBinaryStream();
+
+ try {
+
+ byte[] bytes = IOUtils.toByteArray(inputStream);
+ Binary content = new Binary(bytes);
+
+ DBCollection mongoCollection =
mongoDatabase.getCollection(collection);
+
+ BasicDBObject newDocument = new BasicDBObject();
+ newDocument.append("fileName", fileName)
+ .append("creationDate", creationDate)
+ .append("lastModificationDate", lastModificationDate)
+ .append("indexingDate", indexingDate)
+ .append("binaryLength", binaryLength)
+ .append("documentURI", documentURI)
+ .append("mimeType", mimeType)
+ .append("content", content)
+ .append("primaryPath", primaryPath);
+
+ // Rest of the fields
+ Iterator<String> i = document.getFields();
+ while (i.hasNext()) {
+ String fieldName = i.next();
+ Date[] dateFieldValues = document.getFieldAsDates(fieldName);
+ if (dateFieldValues != null) {
+ newDocument.append(fieldName, dateFieldValues);
+ } else {
+ String[] fieldValues =
document.getFieldAsStrings(fieldName);
+ newDocument.append(fieldName, fieldValues);
+ }
+ }
+
+ BasicDBObject searchQuery = new
BasicDBObject().append("documentURI", documentURI);
+ DBCursor cursor = mongoCollection.find(searchQuery);
+ Long numberOfDocumentsBeforeInsert = mongoCollection.count();
+ WriteResult result;
+ if (cursor.count() > 0) {
+ result = mongoCollection.update(searchQuery, newDocument);
+ } else {
+ result = mongoCollection.insert(newDocument);
+ }
+ //result.getLastError().get("err") == null
+ //To get the number of documents indexed i.e. tne number of
documents inserted or updated
+ Long numberOfDocumentsAfterInsert = mongoCollection.count();
+ Long numberOfDocumentsInserted = numberOfDocumentsAfterInsert -
numberOfDocumentsBeforeInsert;
+ Long numberOfDocumentsIndexed = (numberOfDocumentsInserted != 0) ?
numberOfDocumentsInserted : result.getN();
+ Logging.connectors.info("Number of documents indexed : " +
numberOfDocumentsIndexed);
+
+ //check if a document is inserted or updated
(numberOfDocumentsInserted > 0) || (result.getN() > 0)
+ if (numberOfDocumentsIndexed > 0) {
+ resultDescription = DOCUMENT_STATUS_ACCEPTED_DESC;
+ return DOCUMENT_STATUS_ACCEPTED;
+ } else {
+ resultDescription = DOCUMENT_STATUS_REJECTED_DESC;
+ return DOCUMENT_STATUS_REJECTED;
+ }
+
+ } catch (MongoException e) {
+ resultDescription = DOCUMENT_STATUS_REJECTED_DESC;
+ Logging.connectors.info("MongoDB: Error inserting or updating : "
+ e.getMessage());
+ throw new ManifoldCFException(e.getMessage(), e);
+ } catch (IOException e) {
+ resultDescription = DOCUMENT_STATUS_REJECTED_DESC;
+ Logging.connectors.info("Error converting the input stream to byte
array : " + e.getMessage());
+ throw new ManifoldCFException(e.getMessage(), e);
+ } catch (Exception e) {
+ resultDescription = DOCUMENT_STATUS_REJECTED_DESC;
+ Logging.connectors.info("Error encoding content : " +
e.getMessage());
+ throw new ManifoldCFException(e.getMessage(), e);
+ } finally {
+ if (inputStream != null) {
+ inputStream.close();
+ }
+
+ activities.recordActivity(startTime, ACTIVITY_INJECTION,
document.getBinaryLength(), documentURI, resultDescription,
+ resultDescription);
+ }
+ }
+
+ @Override
+ public void removeDocument(String documentURI, String outputDescription,
IOutputRemoveActivity activities)
+ throws ManifoldCFException, ServiceInterruption {
+ getSession();
+ long startTime = System.currentTimeMillis();
+ String resultDescription = StringUtils.EMPTY;
+
+ try {
+
+ DBCollection mongoCollection =
mongoDatabase.getCollection(collection);
+
+ BasicDBObject query = new BasicDBObject();
+ query.append("documentURI", documentURI);
+
+ WriteResult result = mongoCollection.remove(query);
+ Logging.connectors.info("Number of documents deleted : " +
result.getN());
+
+ if (result.getN() > 0) {
+ resultDescription = DOCUMENT_DELETION_STATUS_ACCEPTED;
+ } else {
+ resultDescription = DOCUMENT_DELETION_STATUS_REJECTED;
+ }
+
+ } catch (Exception e) {
+ resultDescription = DOCUMENT_DELETION_STATUS_REJECTED;
+ throw new ManifoldCFException(e.getMessage(), e);
+ } finally {
+ activities.recordActivity(startTime, ACTIVITY_DELETE, null,
documentURI, null, resultDescription);
+ }
+ }
+}
Added:
manifoldcf/branches/CONNECTORS-1490/connectors/mongodb/src/main/native2ascii/org/apache/manifoldcf/agents/output/mongodboutput/common_en_US.properties
URL:
http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-1490/connectors/mongodb/src/main/native2ascii/org/apache/manifoldcf/agents/output/mongodboutput/common_en_US.properties?rev=1837604&view=auto
==============================================================================
---
manifoldcf/branches/CONNECTORS-1490/connectors/mongodb/src/main/native2ascii/org/apache/manifoldcf/agents/output/mongodboutput/common_en_US.properties
(added)
+++
manifoldcf/branches/CONNECTORS-1490/connectors/mongodb/src/main/native2ascii/org/apache/manifoldcf/agents/output/mongodboutput/common_en_US.properties
Tue Aug 7 15:07:07 2018
@@ -0,0 +1,33 @@
+# 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.
+
+MongodbConnector.Parameters=Parameters
+
+MongodbConnector.hostNameColon=Hostname:
+MongodbConnector.PortNumberColon=Port Number:
+MongodbConnector.UserNameColon=Username:
+MongodbConnector.PasswordColon=Password:
+MongodbConnector.DatabaseColon=Database:
+MongodbConnector.CollectionColon=Collection:
+
+MongodbConnector.PleaseSupplyValidMongodbHostname=Please supply a valid
Mongodb Hostname
+MongodbConnector.PleaseSupplyValidPortNumber=Please supply a valid Port Number
+MongodbConnector.PleaseSupplyValidUserName=Please supply a valid Username
+MongodbConnector.PleaseSupplyValidDatabase=Please supply a valid Database
+MongodbConnector.PleaseSupplyValidPassword=Please supply a valid Password
+MongodbConnector.PleaseSupplyValidCollection=Please supply a valid Collection
+
+MongodbConnector.Mongodb=Mongodb
+
Added:
manifoldcf/branches/CONNECTORS-1490/connectors/mongodb/src/main/resources/org/apache/manifoldcf/agents/output/mongodboutput/editConfiguration.js
URL:
http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-1490/connectors/mongodb/src/main/resources/org/apache/manifoldcf/agents/output/mongodboutput/editConfiguration.js?rev=1837604&view=auto
==============================================================================
---
manifoldcf/branches/CONNECTORS-1490/connectors/mongodb/src/main/resources/org/apache/manifoldcf/agents/output/mongodboutput/editConfiguration.js
(added)
+++
manifoldcf/branches/CONNECTORS-1490/connectors/mongodb/src/main/resources/org/apache/manifoldcf/agents/output/mongodboutput/editConfiguration.js
Tue Aug 7 15:07:07 2018
@@ -0,0 +1,79 @@
+<!--
+ 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.
+-->
+
+<script type="text/javascript">
+
+ <!--
+ function checkConfig() {
+ return true;
+ }
+
+function checkConfigForSave() {
+ // if (editconnection.host) {
+ // if (editconnection.host.value == "") {
+ //
SelectTab("$Encoder.javascriptBodyEscape($ResourceBundle.getString('MongodbConnector.Parameters'))");
+ //
alert("$Encoder.bodyJavascriptEscape($ResourceBundle.getString('MongodbConnector.PleaseSupplyValidMongodbHostname'))");
+ // editconnection.host.focus();
+ // return false;
+ // }
+ // }
+ if(editconnection.host && editconnection.host.value.indexOf('/')!=-1) {
+
alert("$Encoder.bodyJavascriptEscape($ResourceBundle.getString('MongodbConnector.PleaseSupplyValidMongodbHostname'))");
+
SelectTab("$Encoder.bodyJavascriptEscape($ResourceBundle.getString('MongodbConnector.Parameters'))");
+ editconnection.host.focus();
+ return false;
+ }
+ // if (editconnection.port) {
+ // if (editconnection.port.value == "") {
+ //
alert("$Encoder.bodyJavascriptEscape($ResourceBundle.getString('MongodbConnector.PleaseSupplyValidPortNumber'))");
+ //
SelectTab("$Encoder.javascriptBodyEscape($ResourceBundle.getString('MongodbConnector.Parameters'))");
+ // editconnection.port.focus();
+ // return false;
+ // }
+ // }
+ // if (editconnection.username) {
+ // if (editconnection.username.value == "") {
+ //
alert("$Encoder.bodyJavascriptEscape($ResourceBundle.getString('MongodbConnector.PleaseSupplyValidUserName'))");
+ // editconnection.username.focus();
+ // return false;
+ // }
+ // }
+ // if (editconnection.password) {
+ // if (editconnection.password.value == "") {
+ //
alert("$Encoder.bodyJavascriptEscape($ResourceBundle.getString('MongodbConnector.PleaseSupplyValidPassword'))");
+ // editconnection.password.focus();
+ // return false;
+ // }
+ // }
+ if (editconnection.database) {
+ if (editconnection.database.value == "") {
+
alert("$Encoder.bodyJavascriptEscape($ResourceBundle.getString('MongodbConnector.PleaseSupplyValidDatabase'))");
+ editconnection.database.focus();
+ return false;
+ }
+ }
+ if (editconnection.collection) {
+ if (editconnection.collection.value == "") {
+
alert("$Encoder.bodyJavascriptEscape($ResourceBundle.getString('MongodbConnector.PleaseSupplyValidCollection'))");
+ editconnection.collection.focus();
+ return false;
+ }
+ }
+ return true;
+}
+//-->
+</script>
Added:
manifoldcf/branches/CONNECTORS-1490/connectors/mongodb/src/main/resources/org/apache/manifoldcf/agents/output/mongodboutput/editConfiguration_Parameters.html
URL:
http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-1490/connectors/mongodb/src/main/resources/org/apache/manifoldcf/agents/output/mongodboutput/editConfiguration_Parameters.html?rev=1837604&view=auto
==============================================================================
---
manifoldcf/branches/CONNECTORS-1490/connectors/mongodb/src/main/resources/org/apache/manifoldcf/agents/output/mongodboutput/editConfiguration_Parameters.html
(added)
+++
manifoldcf/branches/CONNECTORS-1490/connectors/mongodb/src/main/resources/org/apache/manifoldcf/agents/output/mongodboutput/editConfiguration_Parameters.html
Tue Aug 7 15:07:07 2018
@@ -0,0 +1,69 @@
+<!--
+ 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.
+-->
+
+#if($TABNAME == $ResourceBundle.getString('MongodbConnector.Parameters'))
+
+<table class="displaytable">
+ <tr>
+ <td class="description">
+
<nobr>$Encoder.bodyEscape($ResourceBundle.getString('MongodbConnector.hostNameColon'))</nobr>
+ </td>
+ <td class="value"><input name="host" type="text"
+ value="$Encoder.attributeEscape($HOST)"
size="40" />
+ </td>
+ </tr>
+ <tr>
+ <td
class="description"><nobr>$Encoder.bodyEscape($ResourceBundle.getString('MongodbConnector.PortNumberColon'))</nobr></td>
+ <td class="value"><input name="port" type="text"
value="$Encoder.attributeEscape($PORT)"
+ size="24" /></td>
+ </tr>
+ <tr>
+ <td
class="description"><nobr>$Encoder.bodyEscape($ResourceBundle.getString('MongodbConnector.UserNameColon'))</nobr></td>
+ <td class="value"><input name="username" type="text"
value="$Encoder.attributeEscape($USERNAME)"
+ size="24" /></td>
+ </tr>
+ <tr>
+ <td
class="description"><nobr>$Encoder.bodyEscape($ResourceBundle.getString('MongodbConnector.PasswordColon'))</nobr></td>
+ <td class="value"><input name="password" type="password"
value="$Encoder.attributeEscape($PASSWORD)"
+ size="24" /></td>
+ </tr>
+ <tr>
+ <td
class="description"><nobr>$Encoder.bodyEscape($ResourceBundle.getString('MongodbConnector.DatabaseColon'))</nobr></td>
+ <td class="value"><input name="database" type="text"
value="$Encoder.attributeEscape($DATABASE)"
+ size="24" /></td>
+ </tr>
+ <tr>
+ <td
class="description"><nobr>$Encoder.bodyEscape($ResourceBundle.getString('MongodbConnector.CollectionColon'))</nobr></td>
+ <td class="value"><input name="collection" type="text"
value="$Encoder.attributeEscape($COLLECTION)"
+ size="24" /></td>
+ </tr>
+
+
+</table>
+
+#else
+
+<input type="hidden" name="host" value="$Encoder.attributeEscape($HOST)" />
+<input type="hidden" name="port" value="$Encoder.attributeEscape($PORT)" />
+<input type="hidden" name="username"
value="$Encoder.attributeEscape($USERNAME)" />
+<input type="hidden" name="password"
value="$Encoder.attributeEscape($PASSWORD)" />
+<input type="hidden" name="database"
value="$Encoder.attributeEscape($DATABASE)" />
+<input type="hidden" name="collection"
value="$Encoder.attributeEscape($COLLECTION)" />
+
+#end
+
+