Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id CE750200D28 for ; Mon, 23 Oct 2017 21:28:01 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id CCE511609E0; Mon, 23 Oct 2017 19:28:01 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id A92CB1609DF for ; Mon, 23 Oct 2017 21:27:59 +0200 (CEST) Received: (qmail 70603 invoked by uid 500); 23 Oct 2017 19:27:58 -0000 Mailing-List: contact commits-help@manifoldcf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@manifoldcf.apache.org Delivered-To: mailing list commits@manifoldcf.apache.org Received: (qmail 70594 invoked by uid 99); 23 Oct 2017 19:27:58 -0000 Received: from Unknown (HELO svn01-us-west.apache.org) (209.188.14.144) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 23 Oct 2017 19:27:58 +0000 Received: from svn01-us-west.apache.org (localhost [127.0.0.1]) by svn01-us-west.apache.org (ASF Mail Server at svn01-us-west.apache.org) with ESMTP id 142653A009D for ; Mon, 23 Oct 2017 19:27:56 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1813066 - in /manifoldcf/trunk: ./ connectors/ connectors/rocketchat/ connectors/rocketchat/connector/src/main/java/org/apache/manifoldcf/crawler/notifications/rocketchat/ connectors/rocketchat/connector/src/main/native2ascii/org/apache/ma... Date: Mon, 23 Oct 2017 19:27:54 -0000 To: commits@manifoldcf.apache.org From: schuch@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20171023192757.142653A009D@svn01-us-west.apache.org> archived-at: Mon, 23 Oct 2017 19:28:02 -0000 Author: schuch Date: Mon Oct 23 19:27:53 2017 New Revision: 1813066 URL: http://svn.apache.org/viewvc?rev=1813066&view=rev Log: Merged CONNECTORS-1468 (Rockat.Chat Notification Connector) Added: manifoldcf/trunk/connectors/rocketchat/ - copied from r1812793, manifoldcf/branches/CONNECTORS-1468/connectors/rocketchat/ manifoldcf/trunk/site/src/documentation/resources/images/en_US/rocketchat-configure-restapi.PNG - copied unchanged from r1812903, manifoldcf/branches/CONNECTORS-1468/site/src/documentation/resources/images/en_US/rocketchat-configure-restapi.PNG manifoldcf/trunk/site/src/documentation/resources/images/en_US/rocketchat-job-notifications.PNG - copied unchanged from r1812903, manifoldcf/branches/CONNECTORS-1468/site/src/documentation/resources/images/en_US/rocketchat-job-notifications.PNG Modified: manifoldcf/trunk/ (props changed) manifoldcf/trunk/CHANGES.txt manifoldcf/trunk/connectors/pom.xml manifoldcf/trunk/connectors/rocketchat/connector/src/main/java/org/apache/manifoldcf/crawler/notifications/rocketchat/RocketChatConfig.java manifoldcf/trunk/connectors/rocketchat/connector/src/main/java/org/apache/manifoldcf/crawler/notifications/rocketchat/RocketChatConnector.java manifoldcf/trunk/connectors/rocketchat/connector/src/main/java/org/apache/manifoldcf/crawler/notifications/rocketchat/RocketChatCredentials.java manifoldcf/trunk/connectors/rocketchat/connector/src/main/java/org/apache/manifoldcf/crawler/notifications/rocketchat/RocketChatMessage.java manifoldcf/trunk/connectors/rocketchat/connector/src/main/java/org/apache/manifoldcf/crawler/notifications/rocketchat/RocketChatSession.java manifoldcf/trunk/connectors/rocketchat/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/notifications/rocketchat/common_en_US.properties manifoldcf/trunk/connectors/rocketchat/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/notifications/rocketchat/common_es_ES.properties manifoldcf/trunk/connectors/rocketchat/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/notifications/rocketchat/common_ja_JP.properties manifoldcf/trunk/connectors/rocketchat/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/notifications/rocketchat/common_zh_CN.properties manifoldcf/trunk/connectors/rocketchat/connector/src/main/resources/org/apache/manifoldcf/crawler/notifications/rocketchat/SpecificationView.html manifoldcf/trunk/connectors/rocketchat/connector/src/main/resources/org/apache/manifoldcf/crawler/notifications/rocketchat/Specification_Message.html manifoldcf/trunk/site/src/documentation/content/xdocs/en_US/end-user-documentation.xml manifoldcf/trunk/site/src/documentation/content/xdocs/en_US/included-connectors.xml Propchange: manifoldcf/trunk/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Mon Oct 23 19:27:53 2017 @@ -78,6 +78,7 @@ /manifoldcf/branches/CONNECTORS-1418:1792801-1793156 /manifoldcf/branches/CONNECTORS-1424:1794708-1794716 /manifoldcf/branches/CONNECTORS-1425:1794719-1794944 +/manifoldcf/branches/CONNECTORS-1468:1812793,1812830,1812903,1812905,1812909 /manifoldcf/branches/CONNECTORS-470:1349741-1360750,1360808 /manifoldcf/branches/CONNECTORS-474:1349741-1353803 /manifoldcf/branches/CONNECTORS-488:1363249-1364203 Modified: manifoldcf/trunk/CHANGES.txt URL: http://svn.apache.org/viewvc/manifoldcf/trunk/CHANGES.txt?rev=1813066&r1=1813065&r2=1813066&view=diff ============================================================================== --- manifoldcf/trunk/CHANGES.txt (original) +++ manifoldcf/trunk/CHANGES.txt Mon Oct 23 19:27:53 2017 @@ -7,6 +7,9 @@ CONNECTORS-1469: The slack notification integrated into the maven build. (Markus Schuch) +CONNECTORS-1468: Adds Rocket.Chat Notification Connector +(Markus Schuch) + CONNECTORS-1459: Allow the Tika service to override the mime type in the metadata. (Julien Massiera) Modified: manifoldcf/trunk/connectors/pom.xml URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/pom.xml?rev=1813066&r1=1813065&r2=1813066&view=diff ============================================================================== --- manifoldcf/trunk/connectors/pom.xml (original) +++ manifoldcf/trunk/connectors/pom.xml Mon Oct 23 19:27:53 2017 @@ -73,6 +73,7 @@ nuxeo contentlimiter slack + rocketchat Modified: manifoldcf/trunk/connectors/rocketchat/connector/src/main/java/org/apache/manifoldcf/crawler/notifications/rocketchat/RocketChatConfig.java URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/rocketchat/connector/src/main/java/org/apache/manifoldcf/crawler/notifications/rocketchat/RocketChatConfig.java?rev=1813066&r1=1812793&r2=1813066&view=diff ============================================================================== --- manifoldcf/trunk/connectors/rocketchat/connector/src/main/java/org/apache/manifoldcf/crawler/notifications/rocketchat/RocketChatConfig.java (original) +++ manifoldcf/trunk/connectors/rocketchat/connector/src/main/java/org/apache/manifoldcf/crawler/notifications/rocketchat/RocketChatConfig.java Mon Oct 23 19:27:53 2017 @@ -78,9 +78,14 @@ public class RocketChatConfig { public static final String NODE_SCHEDULEPAUSED = "schedulepaused"; public static final String NODE_RESTARTED = "restarted"; + public static final String NODE_GLOBALS = "globals"; public static final String NODE_CHANNEL = "channel"; public static final String NODE_MESSAGE = "message"; - + public static final String NODE_DEFAULT_CHANNEL = "default_channel"; + public static final String NODE_ALIAS = "alias"; + public static final String NODE_EMOJI = "emoji"; + public static final String NODE_AVATAR = "avatar"; + public static final String ATTRIBUTE_NAME = "name"; public static final String ATTRIBUTE_VALUE = "value"; Modified: manifoldcf/trunk/connectors/rocketchat/connector/src/main/java/org/apache/manifoldcf/crawler/notifications/rocketchat/RocketChatConnector.java URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/rocketchat/connector/src/main/java/org/apache/manifoldcf/crawler/notifications/rocketchat/RocketChatConnector.java?rev=1813066&r1=1812793&r2=1813066&view=diff ============================================================================== --- manifoldcf/trunk/connectors/rocketchat/connector/src/main/java/org/apache/manifoldcf/crawler/notifications/rocketchat/RocketChatConnector.java (original) +++ manifoldcf/trunk/connectors/rocketchat/connector/src/main/java/org/apache/manifoldcf/crawler/notifications/rocketchat/RocketChatConnector.java Mon Oct 23 19:27:53 2017 @@ -1,21 +1,21 @@ /* $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. -*/ + * 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.crawler.notifications.rocketchat; import java.io.IOException; @@ -37,7 +37,7 @@ import org.apache.manifoldcf.core.interf import org.apache.manifoldcf.crawler.system.Logging; /** -*/ + */ public class RocketChatConnector extends org.apache.manifoldcf.crawler.notifications.BaseNotificationConnector { protected final static long SESSION_EXPIRATION_MILLISECONDS = 300000L; @@ -60,11 +60,11 @@ public class RocketChatConnector extends //////////////////////////////////Start of Basic Connector Methods///////////////////////// /** - * Connect. - * - * @param configParameters is the set of configuration parameters, which - * in this case describe the root directory. - */ + * Connect. + * + * @param configParameters is the set of configuration parameters, which + * in this case describe the root directory. + */ @Override public void connect(ConfigParams configParameters) { super.connect(configParameters); @@ -85,12 +85,12 @@ public class RocketChatConnector extends } /** - * Close the connection. Call this before discarding this instance of the - * repository connector. - */ + * Close the connection. Call this before discarding this instance of the + * repository connector. + */ @Override public void disconnect() - throws ManifoldCFException { + throws ManifoldCFException { this.serverUrl = null; this.user = null; this.password = null; @@ -100,9 +100,9 @@ public class RocketChatConnector extends } /** - * This method is periodically called for all connectors that are connected but not - * in active use. - */ + * This method is periodically called for all connectors that are connected but not + * in active use. + */ @Override public void poll() throws ManifoldCFException { if (session != null) @@ -113,10 +113,10 @@ public class RocketChatConnector extends } /** - * Test the connection. Returns a string describing the connection integrity. - * - * @return the connection's status as a displayable string. - */ + * 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 { @@ -146,7 +146,7 @@ public class RocketChatConnector extends } protected void getSession() - throws ManifoldCFException, ServiceInterruption { + throws ManifoldCFException, ServiceInterruption { if (session == null) { // Check that all the required parameters are there. @@ -191,77 +191,97 @@ public class RocketChatConnector extends //////////////////////////////Start of Notification Connector Method/////////////////////////////////// /** Notify of job stop due to error abort. - *@param spec is the notification specification. - */ + *@param spec is the notification specification. + */ @Override public void notifyOfJobStopErrorAbort(final Specification spec) - throws ManifoldCFException, ServiceInterruption { + throws ManifoldCFException, ServiceInterruption { sendRocketChatMessage(spec, RocketChatConfig.NODE_ERRORABORTED); } /** Notify of job stop due to manual abort. - *@param spec is the notification specification. - */ + *@param spec is the notification specification. + */ @Override public void notifyOfJobStopManualAbort(final Specification spec) - throws ManifoldCFException, ServiceInterruption { + throws ManifoldCFException, ServiceInterruption { sendRocketChatMessage(spec, RocketChatConfig.NODE_MANUALABORTED); } /** Notify of job stop due to manual pause. - *@param spec is the notification specification. - */ + *@param spec is the notification specification. + */ @Override public void notifyOfJobStopManualPause(final Specification spec) - throws ManifoldCFException, ServiceInterruption { + throws ManifoldCFException, ServiceInterruption { sendRocketChatMessage(spec, RocketChatConfig.NODE_MANUALPAUSED); } /** Notify of job stop due to schedule pause. - *@param spec is the notification specification. - */ + *@param spec is the notification specification. + */ @Override public void notifyOfJobStopSchedulePause(final Specification spec) - throws ManifoldCFException, ServiceInterruption { + throws ManifoldCFException, ServiceInterruption { sendRocketChatMessage(spec, RocketChatConfig.NODE_SCHEDULEPAUSED); } /** Notify of job stop due to restart. - *@param spec is the notification specification. - */ + *@param spec is the notification specification. + */ @Override public void notifyOfJobStopRestart(final Specification spec) - throws ManifoldCFException, ServiceInterruption { + throws ManifoldCFException, ServiceInterruption { sendRocketChatMessage(spec, RocketChatConfig.NODE_RESTARTED); } /** Notify of job end. - *@param spec is the notification specification. - */ + *@param spec is the notification specification. + */ @Override public void notifyOfJobEnd(final Specification spec) - throws ManifoldCFException, ServiceInterruption { + throws ManifoldCFException, ServiceInterruption { sendRocketChatMessage(spec, RocketChatConfig.NODE_FINISHED); } protected void sendRocketChatMessage(final Specification spec, final String nodeType) - throws ManifoldCFException, ServiceInterruption + throws ManifoldCFException, ServiceInterruption { + + String defaultChannel = null; + String alias = null; + String emoji = null; + String avatar = null; + String channel = ""; String message = ""; - for (int i = 0; i < spec.getChildCount(); i++) { - SpecificationNode sn = spec.getChild(i); - if (sn.getType().equals(RocketChatConfig.NODE_CHANNEL)) - channel = sn.getAttributeValue(RocketChatConfig.ATTRIBUTE_VALUE); - else if (sn.getType().equals(RocketChatConfig.NODE_MESSAGE)) - message = sn.getAttributeValue(RocketChatConfig.ATTRIBUTE_VALUE); - } // Look for node of the specified type if (nodeType != null) { for (int i = 0; i < spec.getChildCount(); i++) { SpecificationNode childNode = spec.getChild(i); - if (childNode.getType().equals(nodeType)) + + // Global settings + if (childNode.getType().equals(RocketChatConfig.NODE_GLOBALS)) { + for (int j = 0; j < childNode.getChildCount(); j++) { + SpecificationNode sn = childNode.getChild(j); + if (sn.getType().equals(RocketChatConfig.NODE_DEFAULT_CHANNEL)) { + defaultChannel = sn.getAttributeValue(RocketChatConfig.ATTRIBUTE_VALUE); + } + else if (sn.getType().equals(RocketChatConfig.NODE_ALIAS)) { + alias = sn.getAttributeValue(RocketChatConfig.ATTRIBUTE_VALUE); + } + else if (sn.getType().equals(RocketChatConfig.NODE_EMOJI)) { + emoji = sn.getAttributeValue(RocketChatConfig.ATTRIBUTE_VALUE); + } + else if (sn.getType().equals(RocketChatConfig.NODE_AVATAR)) { + avatar = sn.getAttributeValue(RocketChatConfig.ATTRIBUTE_VALUE); + } + } + } + + // notification type specific settings + else if (childNode.getType().equals(nodeType)) { for (int j = 0; j < childNode.getChildCount(); j++) { SpecificationNode sn = childNode.getChild(j); @@ -278,10 +298,25 @@ public class RocketChatConnector extends return; } + if (StringUtils.isBlank(channel)) { + if (StringUtils.isBlank(defaultChannel)) { + return; + } else { + channel = defaultChannel; + } + } + // Construct and send a rocketchat message getSession(); - SendThread st = new SendThread(session, channel, message); + RocketChatMessage chatMessage = new RocketChatMessage(); + chatMessage.setChannel(channel); + chatMessage.setText(message); + chatMessage.setAlias(alias); + chatMessage.setEmoji(emoji); + chatMessage.setAvatar(avatar); + + SendThread st = new SendThread(session, chatMessage); st.start(); try { st.finishUp(); @@ -299,22 +334,22 @@ public class RocketChatConnector extends ///////////////////////////////////////Start of Configuration UI///////////////////////////////////// /** - * 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. - * The connector does not need to be connected for this method to be called. - * - * @param threadContext is the local thread context. - * @param out is the output to which any HTML should be sent. - * @param locale is the desired locale. - * @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. - */ + * 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. + * The connector does not need to be connected for this method to be called. + * + * @param threadContext is the local thread context. + * @param out is the output to which any HTML should be sent. + * @param locale is the desired locale. + * @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 tabsArray) - throws ManifoldCFException, IOException { + Locale locale, ConfigParams parameters, List tabsArray) + throws ManifoldCFException, IOException { tabsArray.add(Messages.getString(locale, "RocketChatConnector.RestAPI")); // Map the parameters Map paramMap = new HashMap(); @@ -328,8 +363,8 @@ public class RocketChatConnector extends @Override public void outputConfigurationBody(IThreadContext threadContext, IHTTPOutput out, - Locale locale, ConfigParams parameters, String tabName) - throws ManifoldCFException, IOException { + Locale locale, ConfigParams parameters, String tabName) + throws ManifoldCFException, IOException { // Output the Server tab Map paramMap = new HashMap(); // Set the tab name @@ -348,7 +383,7 @@ public class RocketChatConnector extends } else { password = mapper.mapPasswordToKey(password); } - + String proxyHost = getEmptyOnNull(parameters, RocketChatConfig.PROXY_HOST_PARAM); String proxyPort = getEmptyOnNull(parameters, RocketChatConfig.PROXY_PORT_PARAM); String proxyUsername = getEmptyOnNull(parameters, RocketChatConfig.PROXY_USERNAME_PARAM); @@ -381,22 +416,22 @@ public class RocketChatConnector extends } /** - * 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 always "editconnection". - * The connector does not need to be connected for this method to be called. - * - * @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). - */ + * 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 always "editconnection". + * The connector does not need to be connected for this method to be called. + * + * @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 { + ConfigParams parameters) throws ManifoldCFException { final String serverUrl = variableContext.getParameter("serverUrl"); if (serverUrl != null) { @@ -407,12 +442,12 @@ public class RocketChatConnector extends if (user != null) { parameters.setParameter(RocketChatConfig.USER_PARAM, user); } - + final String password = variableContext.getParameter("password"); if (password != null) { parameters.setObfuscatedParameter(RocketChatConfig.PASSWORD_PARAM, variableContext.mapKeyToPassword(password)); } - + final String proxyHost = variableContext.getParameter("proxyHost"); if (proxyHost != null) { parameters.setParameter(RocketChatConfig.PROXY_HOST_PARAM, proxyHost); @@ -450,20 +485,20 @@ public class RocketChatConnector extends } /** - * 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 and - * 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. - */ + * 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 and + * 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 { + Locale locale, ConfigParams parameters) throws ManifoldCFException, IOException { Map paramMap = new HashMap(); // Fill in map from each tab @@ -479,20 +514,20 @@ public class RocketChatConnector extends /////////////////////////////////Start of Specification UI////////////////////////////////////////////////// /** Output the specification header section. - * This method is called in the head section of a job page which has selected a repository connection of the - * current type. Its purpose is to add the required tabs to the list, and to output any javascript methods - * that might be needed by the job editing HTML. - * The connector will be connected before this method can be called. - *@param out is the output to which any HTML should be sent. - *@param locale is the locale the output is preferred to be in. - *@param ds is the current document specification for this job. - *@param connectionSequenceNumber is the unique number of this connection within the job. - *@param tabsArray is an array of tab names. Add to this array any tab names that are specific to the connector. - */ + * This method is called in the head section of a job page which has selected a repository connection of the + * current type. Its purpose is to add the required tabs to the list, and to output any javascript methods + * that might be needed by the job editing HTML. + * The connector will be connected before this method can be called. + *@param out is the output to which any HTML should be sent. + *@param locale is the locale the output is preferred to be in. + *@param ds is the current document specification for this job. + *@param connectionSequenceNumber is the unique number of this connection within the job. + *@param tabsArray is an array of tab names. Add to this array any tab names that are specific to the connector. + */ @Override public void outputSpecificationHeader(IHTTPOutput out, Locale locale, Specification ds, - int connectionSequenceNumber, List tabsArray) - throws ManifoldCFException, IOException { + int connectionSequenceNumber, List tabsArray) + throws ManifoldCFException, IOException { Map paramMap = new HashMap(); paramMap.put("SeqNum", Integer.toString(connectionSequenceNumber)); // Add the tabs @@ -501,32 +536,32 @@ public class RocketChatConnector extends } /** Output the specification body section. - * This method is called in the body section of a job page which has selected a repository connection of the - * current type. Its purpose is to present the required form elements for editing. - * The coder can presume that the HTML that is output from this configuration will be within appropriate - * , , and
tags. The name of the form is always "editjob". - * The connector will be connected before this method can be called. - *@param out is the output to which any HTML should be sent. - *@param locale is the locale the output is preferred to be in. - *@param ds is the current document specification for this job. - *@param connectionSequenceNumber is the unique number of this connection within the job. - *@param actualSequenceNumber is the connection within the job that has currently been selected. - *@param tabName is the current tab name. (actualSequenceNumber, tabName) form a unique tuple within - * the job. - */ + * This method is called in the body section of a job page which has selected a repository connection of the + * current type. Its purpose is to present the required form elements for editing. + * The coder can presume that the HTML that is output from this configuration will be within appropriate + * , , and tags. The name of the form is always "editjob". + * The connector will be connected before this method can be called. + *@param out is the output to which any HTML should be sent. + *@param locale is the locale the output is preferred to be in. + *@param ds is the current document specification for this job. + *@param connectionSequenceNumber is the unique number of this connection within the job. + *@param actualSequenceNumber is the connection within the job that has currently been selected. + *@param tabName is the current tab name. (actualSequenceNumber, tabName) form a unique tuple within + * the job. + */ @Override public void outputSpecificationBody(IHTTPOutput out, Locale locale, Specification ds, - int connectionSequenceNumber, int actualSequenceNumber, String tabName) - throws ManifoldCFException, IOException { + int connectionSequenceNumber, int actualSequenceNumber, String tabName) + throws ManifoldCFException, IOException { outputMessageTab(out, locale, ds, tabName, connectionSequenceNumber, actualSequenceNumber); } /** -* Take care of "Message" tab. -*/ + * Take care of "Message" tab. + */ protected void outputMessageTab(IHTTPOutput out, Locale locale, - Specification ds, String tabName, int connectionSequenceNumber, int actualSequenceNumber) - throws ManifoldCFException, IOException { + Specification ds, String tabName, int connectionSequenceNumber, int actualSequenceNumber) + throws ManifoldCFException, IOException { Map paramMap = new HashMap(); paramMap.put("TabName", tabName); paramMap.put("SeqNum", Integer.toString(connectionSequenceNumber)); @@ -536,66 +571,71 @@ public class RocketChatConnector extends } /** - * Fill in Velocity context for Metadata tab. - */ + * Fill in Velocity context for Metadata tab. + */ protected static void fillInMessageTab(Map paramMap, - Specification ds) { + Specification ds) { - // Preload default values, for backwards compatibility - String channel = ""; - String message = ""; + // Initialize all records with blanks + addRecord(paramMap, RocketChatConfig.NODE_FINISHED, "", ""); + addRecord(paramMap, RocketChatConfig.NODE_ERRORABORTED, "", ""); + addRecord(paramMap, RocketChatConfig.NODE_MANUALABORTED, "", ""); + addRecord(paramMap, RocketChatConfig.NODE_MANUALPAUSED, "", ""); + addRecord(paramMap, RocketChatConfig.NODE_SCHEDULEPAUSED, "", ""); + addRecord(paramMap, RocketChatConfig.NODE_RESTARTED, "" ,""); + + String channel; + String message; + // Loop through nodes and pick them out that way for (int i = 0; i < ds.getChildCount(); i++) { - SpecificationNode sn = ds.getChild(i); - if (sn.getType().equals(RocketChatConfig.NODE_CHANNEL)) { - channel = sn.getAttributeValue(RocketChatConfig.ATTRIBUTE_VALUE); - } else if (sn.getType().equals(RocketChatConfig.NODE_MESSAGE)) { - message = sn.getAttributeValue(RocketChatConfig.ATTRIBUTE_VALUE); - } - } - // If ANY of the above are non-empty, we create a new dummy record - if (channel.length() > 0) { - // Add the dummy records - addRecord(paramMap, RocketChatConfig.NODE_FINISHED, channel, message); - addRecord(paramMap, RocketChatConfig.NODE_ERRORABORTED, channel, message); - addRecord(paramMap, RocketChatConfig.NODE_MANUALABORTED, channel, message); - addRecord(paramMap, RocketChatConfig.NODE_MANUALPAUSED, channel, message); - addRecord(paramMap, RocketChatConfig.NODE_SCHEDULEPAUSED, channel, message); - addRecord(paramMap, RocketChatConfig.NODE_RESTARTED, channel, message); - - } - else - { - // Initialize all records with blanks - addRecord(paramMap, RocketChatConfig.NODE_FINISHED, "", ""); - addRecord(paramMap, RocketChatConfig.NODE_ERRORABORTED, "", ""); - addRecord(paramMap, RocketChatConfig.NODE_MANUALABORTED, "", ""); - addRecord(paramMap, RocketChatConfig.NODE_MANUALPAUSED, "", ""); - addRecord(paramMap, RocketChatConfig.NODE_SCHEDULEPAUSED, "", ""); - addRecord(paramMap, RocketChatConfig.NODE_RESTARTED, "" ,""); - - // Loop through nodes and pick them out that way - for (int i = 0; i < ds.getChildCount(); i++) { - SpecificationNode childNode = ds.getChild(i); - if (childNode.getType().equals(RocketChatConfig.NODE_FINISHED) || + SpecificationNode childNode = ds.getChild(i); + if (childNode.getType().equals(RocketChatConfig.NODE_FINISHED) || childNode.getType().equals(RocketChatConfig.NODE_ERRORABORTED) || childNode.getType().equals(RocketChatConfig.NODE_MANUALABORTED) || childNode.getType().equals(RocketChatConfig.NODE_MANUALPAUSED) || childNode.getType().equals(RocketChatConfig.NODE_SCHEDULEPAUSED) || childNode.getType().equals(RocketChatConfig.NODE_RESTARTED)) { - channel = ""; - message = ""; - for (int j = 0; j < childNode.getChildCount(); j++) { - SpecificationNode sn = childNode.getChild(j); - if (sn.getType().equals(RocketChatConfig.NODE_CHANNEL)) { - channel = sn.getAttributeValue(RocketChatConfig.ATTRIBUTE_VALUE); - } else if (sn.getType().equals(RocketChatConfig.NODE_MESSAGE)) { - message = sn.getAttributeValue(RocketChatConfig.ATTRIBUTE_VALUE); - } + channel = ""; + message = ""; + for (int j = 0; j < childNode.getChildCount(); j++) { + SpecificationNode sn = childNode.getChild(j); + if (sn.getType().equals(RocketChatConfig.NODE_CHANNEL)) { + channel = sn.getAttributeValue(RocketChatConfig.ATTRIBUTE_VALUE); + } else if (sn.getType().equals(RocketChatConfig.NODE_MESSAGE)) { + message = sn.getAttributeValue(RocketChatConfig.ATTRIBUTE_VALUE); } - addRecord(paramMap, childNode.getType(), channel, message); } + addRecord(paramMap, childNode.getType(), channel, message); } } + + // Global Settings + + // Initialize globals with blanks + paramMap.put(RocketChatConfig.NODE_DEFAULT_CHANNEL, ""); + paramMap.put(RocketChatConfig.NODE_ALIAS, ""); + paramMap.put(RocketChatConfig.NODE_EMOJI, ""); + paramMap.put(RocketChatConfig.NODE_AVATAR, ""); + + for (int i = 0; i < ds.getChildCount(); i++) { + SpecificationNode childNode = ds.getChild(i); + if (childNode.getType().equals(RocketChatConfig.NODE_GLOBALS)) { + for (int j = 0; j < childNode.getChildCount(); j++) { + SpecificationNode sn = childNode.getChild(j); + if (sn.getType().equals(RocketChatConfig.NODE_DEFAULT_CHANNEL)) { + paramMap.put(RocketChatConfig.NODE_DEFAULT_CHANNEL, sn.getAttributeValue(RocketChatConfig.ATTRIBUTE_VALUE)); + } else if (sn.getType().equals(RocketChatConfig.NODE_ALIAS)) { + paramMap.put(RocketChatConfig.NODE_ALIAS, sn.getAttributeValue(RocketChatConfig.ATTRIBUTE_VALUE)); + } else if (sn.getType().equals(RocketChatConfig.NODE_EMOJI)) { + paramMap.put(RocketChatConfig.NODE_EMOJI, sn.getAttributeValue(RocketChatConfig.ATTRIBUTE_VALUE)); + } else if (sn.getType().equals(RocketChatConfig.NODE_AVATAR)) { + paramMap.put(RocketChatConfig.NODE_AVATAR, sn.getAttributeValue(RocketChatConfig.ATTRIBUTE_VALUE)); + } + } + } + + } + } protected static void addRecord(Map paramMap, String nodeType, String channel, String message) { @@ -604,35 +644,31 @@ public class RocketChatConnector extends } /** Process a specification post. - * This method is called at the start of job's edit or view 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 - * document specification accordingly. The name of the posted form is always "editjob". - * The connector will be connected before this method can be called. - *@param variableContext contains the post data, including binary file-upload information. - *@param locale is the locale the output is preferred to be in. - *@param ds is the current document specification for this job. - *@param connectionSequenceNumber is the unique number of this connection within the job. - *@return null if all is well, or a string error message if there is an error that should prevent saving of - * the job (and cause a redirection to an error page). - */ + * This method is called at the start of job's edit or view 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 + * document specification accordingly. The name of the posted form is always "editjob". + * The connector will be connected before this method can be called. + *@param variableContext contains the post data, including binary file-upload information. + *@param locale is the locale the output is preferred to be in. + *@param ds is the current document specification for this job. + *@param connectionSequenceNumber is the unique number of this connection within the job. + *@return null if all is well, or a string error message if there is an error that should prevent saving of + * the job (and cause a redirection to an error page). + */ @Override public String processSpecificationPost(IPostParameters variableContext, Locale locale, Specification ds, - int connectionSequenceNumber) - throws ManifoldCFException { + int connectionSequenceNumber) + throws ManifoldCFException { return processMessageTab(variableContext, ds, connectionSequenceNumber); } protected String processMessageTab(IPostParameters variableContext, Specification ds, - int connectionSequenceNumber) - throws ManifoldCFException { + int connectionSequenceNumber) + throws ManifoldCFException { String seqPrefix = "s"+connectionSequenceNumber+"_"; - // Remove legacy nodes always - removeNodes(ds, RocketChatConfig.NODE_CHANNEL); - removeNodes(ds, RocketChatConfig.NODE_MESSAGE); - // Gather all different kinds. gatherRecord(ds, seqPrefix, variableContext, RocketChatConfig.NODE_FINISHED); gatherRecord(ds, seqPrefix, variableContext, RocketChatConfig.NODE_ERRORABORTED); @@ -641,6 +677,27 @@ public class RocketChatConnector extends gatherRecord(ds, seqPrefix, variableContext, RocketChatConfig.NODE_SCHEDULEPAUSED); gatherRecord(ds, seqPrefix, variableContext, RocketChatConfig.NODE_RESTARTED); + // Gather global settings + SpecificationNode sn = new SpecificationNode(RocketChatConfig.NODE_GLOBALS); + + String defaultChannel = variableContext.getParameter(RocketChatConfig.NODE_DEFAULT_CHANNEL); + if (defaultChannel != null) { + addNodeValue(sn, RocketChatConfig.NODE_DEFAULT_CHANNEL, defaultChannel); + } + String alias = variableContext.getParameter(RocketChatConfig.NODE_ALIAS); + if (alias != null) { + addNodeValue(sn, RocketChatConfig.NODE_ALIAS, alias); + } + String emoji = variableContext.getParameter(RocketChatConfig.NODE_EMOJI); + if (emoji != null) { + addNodeValue(sn, RocketChatConfig.NODE_EMOJI, emoji); + } + String avatar = variableContext.getParameter(RocketChatConfig.NODE_AVATAR); + if (avatar != null) { + addNodeValue(sn, RocketChatConfig.NODE_AVATAR, avatar); + } + ds.addChild(ds.getChildCount(), sn); + return null; } @@ -661,19 +718,19 @@ public class RocketChatConnector extends } /** View specification. - * This method is called in the body section of a job's view page. Its purpose is to present the document - * specification information to the user. The coder can presume that the HTML that is output from - * this configuration will be within appropriate and tags. - * The connector will be connected before this method can be called. - *@param out is the output to which any HTML should be sent. - *@param locale is the locale the output is preferred to be in. - *@param ds is the current document specification for this job. - *@param connectionSequenceNumber is the unique number of this connection within the job. - */ + * This method is called in the body section of a job's view page. Its purpose is to present the document + * specification information to the user. The coder can presume that the HTML that is output from + * this configuration will be within appropriate and tags. + * The connector will be connected before this method can be called. + *@param out is the output to which any HTML should be sent. + *@param locale is the locale the output is preferred to be in. + *@param ds is the current document specification for this job. + *@param connectionSequenceNumber is the unique number of this connection within the job. + */ @Override public void viewSpecification(IHTTPOutput out, Locale locale, Specification ds, - int connectionSequenceNumber) - throws ManifoldCFException, IOException { + int connectionSequenceNumber) + throws ManifoldCFException, IOException { Map paramMap = new HashMap(); paramMap.put("SeqNum", Integer.toString(connectionSequenceNumber)); fillInMessageTab(paramMap, ds); @@ -703,14 +760,14 @@ public class RocketChatConnector extends /** Handle Messaging exceptions in a consistent global manner */ protected static void handleIOException(IOException e, String context) - throws ManifoldCFException, ServiceInterruption + throws ManifoldCFException, ServiceInterruption { Logging.connectors.error("RocketChat: Error "+context+": "+e.getMessage(),e); throw new ManifoldCFException("Error "+context+": "+e.getMessage(),e); } /** Class to set up connection. - */ + */ protected static class ConnectThread extends Thread { protected final String serverUrl; @@ -744,7 +801,7 @@ public class RocketChatConnector extends } public RocketChatSession finishUp() - throws IOException, InterruptedException + throws IOException, InterruptedException { try { @@ -769,7 +826,7 @@ public class RocketChatConnector extends } /** Class to close the session. - */ + */ protected static class CloseSessionThread extends Thread { protected final RocketChatSession session; @@ -795,7 +852,7 @@ public class RocketChatConnector extends } public void finishUp() - throws IOException, InterruptedException + throws IOException, InterruptedException { try { @@ -819,7 +876,7 @@ public class RocketChatConnector extends } /** Class to check the connection. - */ + */ protected static class CheckConnectionThread extends Thread { protected final RocketChatSession session; @@ -845,7 +902,7 @@ public class RocketChatConnector extends } public void finishUp() - throws IOException, InterruptedException + throws IOException, InterruptedException { try { @@ -869,19 +926,17 @@ public class RocketChatConnector extends } /** Class to send Rocket.Chat messages. - */ + */ protected static class SendThread extends Thread { protected final RocketChatSession session; - protected final String channel; - protected final String message; + protected final RocketChatMessage message; protected Throwable exception = null; - public SendThread(RocketChatSession session, String channel, String message) + public SendThread(RocketChatSession session, RocketChatMessage message) { this.session = session; - this.channel = channel; this.message = message; setDaemon(true); } @@ -890,7 +945,7 @@ public class RocketChatConnector extends { try { - session.send(channel, message); + session.send(message); } catch (Throwable e) { @@ -899,7 +954,7 @@ public class RocketChatConnector extends } public void finishUp() - throws IOException, InterruptedException + throws IOException, InterruptedException { try { Modified: manifoldcf/trunk/connectors/rocketchat/connector/src/main/java/org/apache/manifoldcf/crawler/notifications/rocketchat/RocketChatCredentials.java URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/rocketchat/connector/src/main/java/org/apache/manifoldcf/crawler/notifications/rocketchat/RocketChatCredentials.java?rev=1813066&r1=1812793&r2=1813066&view=diff ============================================================================== --- manifoldcf/trunk/connectors/rocketchat/connector/src/main/java/org/apache/manifoldcf/crawler/notifications/rocketchat/RocketChatCredentials.java (original) +++ manifoldcf/trunk/connectors/rocketchat/connector/src/main/java/org/apache/manifoldcf/crawler/notifications/rocketchat/RocketChatCredentials.java Mon Oct 23 19:27:53 2017 @@ -1,3 +1,21 @@ +/* $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.crawler.notifications.rocketchat; public class RocketChatCredentials { Modified: manifoldcf/trunk/connectors/rocketchat/connector/src/main/java/org/apache/manifoldcf/crawler/notifications/rocketchat/RocketChatMessage.java URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/rocketchat/connector/src/main/java/org/apache/manifoldcf/crawler/notifications/rocketchat/RocketChatMessage.java?rev=1813066&r1=1812793&r2=1813066&view=diff ============================================================================== --- manifoldcf/trunk/connectors/rocketchat/connector/src/main/java/org/apache/manifoldcf/crawler/notifications/rocketchat/RocketChatMessage.java (original) +++ manifoldcf/trunk/connectors/rocketchat/connector/src/main/java/org/apache/manifoldcf/crawler/notifications/rocketchat/RocketChatMessage.java Mon Oct 23 19:27:53 2017 @@ -26,6 +26,10 @@ public class RocketChatMessage { private String alias; + private String emoji; + + private String avatar; + public String getChannel() { return channel; } @@ -50,4 +54,20 @@ public class RocketChatMessage { this.alias = alias; } + public String getEmoji() { + return emoji; + } + + public void setEmoji(String emoji) { + this.emoji = emoji; + } + + public String getAvatar() { + return avatar; + } + + public void setAvatar(String avatar) { + this.avatar = avatar; + } + } Modified: manifoldcf/trunk/connectors/rocketchat/connector/src/main/java/org/apache/manifoldcf/crawler/notifications/rocketchat/RocketChatSession.java URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/rocketchat/connector/src/main/java/org/apache/manifoldcf/crawler/notifications/rocketchat/RocketChatSession.java?rev=1813066&r1=1812793&r2=1813066&view=diff ============================================================================== --- manifoldcf/trunk/connectors/rocketchat/connector/src/main/java/org/apache/manifoldcf/crawler/notifications/rocketchat/RocketChatSession.java (original) +++ manifoldcf/trunk/connectors/rocketchat/connector/src/main/java/org/apache/manifoldcf/crawler/notifications/rocketchat/RocketChatSession.java Mon Oct 23 19:27:53 2017 @@ -19,7 +19,6 @@ package org.apache.manifoldcf.crawler.notifications.rocketchat; import java.io.IOException; -import java.text.MessageFormat; import javax.net.ssl.SSLSocketFactory; @@ -145,34 +144,6 @@ public class RocketChatSession public void checkConnection() throws IOException { - // test connection - HttpGet infoGet = new HttpGet(serverUrl + "/api/v1/info"); - int statusCode; - Boolean success = null; - String error = ""; - try (CloseableHttpResponse response = httpClient.execute(infoGet)) { - statusCode = response.getStatusLine().getStatusCode(); - JsonNode jsonResponse = objectMapper.readTree(response.getEntity().getContent()); - JsonNode successNode = jsonResponse.get("success"); - JsonNode errorNode = jsonResponse.get("error"); - if (successNode != null) { - success = successNode.asBoolean(); - } else if (errorNode != null) { - error = errorNode.asText(); - } - - // the API responds with { "success" : true } - boolean isExpectedStatus = statusCode == HttpStatus.SC_OK; - boolean isConnectionOk = isExpectedStatus && success != null && success; - if (!isConnectionOk) { - String messageTemplate = "connection failed: status {0}, message: {1}"; - String statusInfo = isExpectedStatus ? "ok" : statusCode + " is unexpected"; - String details = success != null ? "success " + success : error; - String message = MessageFormat.format(messageTemplate, statusInfo, details); - throw new ClientProtocolException(message); - } - } - // test login Header[] authHeader = null; try { @@ -182,10 +153,9 @@ public class RocketChatSession logout(authHeader); } } - } - public void send(String channel, String message) throws IOException + public void send(RocketChatMessage message) throws IOException { Header[] authHeader = null; try { @@ -194,14 +164,7 @@ public class RocketChatSession HttpPost messagePost = new HttpPost(serverUrl + "/api/v1/chat.postMessage"); messagePost.setHeaders(authHeader); - RocketChatMessage rocketChatMessage = new RocketChatMessage(); - if (StringUtils.isNotBlank(channel)) { - rocketChatMessage.setChannel(channel); - } - rocketChatMessage.setText(message); - rocketChatMessage.setAlias("Apache ManifoldCF"); - - String json = objectMapper.writeValueAsString(rocketChatMessage); + String json = objectMapper.writeValueAsString(message); HttpEntity entity = EntityBuilder.create() .setContentType(ContentType.APPLICATION_JSON) @@ -215,7 +178,7 @@ public class RocketChatSession EntityUtils.consume(response.getEntity()); } else { Logging.connectors.error("Sending Rocket.Chat message failed with statusline " + response.getStatusLine()); - Logging.connectors.debug(" Response was: " + EntityUtils.toString(response.getEntity())); + Logging.connectors.error(" Response was: " + EntityUtils.toString(response.getEntity())); } } } finally { @@ -244,7 +207,6 @@ public class RocketChatSession JsonNode jsonResponse = objectMapper.readTree(response.getEntity().getContent()); JsonNode dataNode = jsonResponse.get("data"); - JsonNode errorNode = jsonResponse.get("error"); if (dataNode != null) { String authToken = dataNode.get("authToken").asText(); String userId = dataNode.get("userId").asText(); @@ -254,19 +216,15 @@ public class RocketChatSession new BasicHeader("X-User-Id", userId) }; } else { - String message; - if (errorNode != null) { - message = errorNode.asText(); - } else { - message = "login response did not contain authentication data"; - } - throw new ClientProtocolException(message); + Logging.connectors.error("The login returned OK, but the response did not contain any authentication data."); + Logging.connectors.error(" Response was: " + objectMapper.writeValueAsString(jsonResponse)); + throw new ClientProtocolException("login response did not contain any authentication data"); } } else { Logging.connectors.error("Login to Rocket.Chat failed with statusline " + response.getStatusLine()); - Logging.connectors.debug(" Response was: " + EntityUtils.toString(response.getEntity())); + Logging.connectors.error(" Response was: " + EntityUtils.toString(response.getEntity())); throw new HttpResponseException(statusCode, response.getStatusLine().getReasonPhrase()); } } @@ -279,7 +237,7 @@ public class RocketChatSession int statusCode = response.getStatusLine().getStatusCode(); if (statusCode != HttpStatus.SC_OK) { Logging.connectors.error("Logout from Rocket.Chat failed with statusline " + response.getStatusLine()); - Logging.connectors.debug(" Response was: " + EntityUtils.toString(response.getEntity())); + Logging.connectors.error(" Response was: " + EntityUtils.toString(response.getEntity())); } } } Modified: manifoldcf/trunk/connectors/rocketchat/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/notifications/rocketchat/common_en_US.properties URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/rocketchat/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/notifications/rocketchat/common_en_US.properties?rev=1813066&r1=1812793&r2=1813066&view=diff ============================================================================== --- manifoldcf/trunk/connectors/rocketchat/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/notifications/rocketchat/common_en_US.properties (original) +++ manifoldcf/trunk/connectors/rocketchat/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/notifications/rocketchat/common_en_US.properties Mon Oct 23 19:27:53 2017 @@ -14,7 +14,7 @@ # limitations under the License. RocketChatConnector.RestAPI=Rocket.Chat REST API -RocketChatConnector.Message=Message +RocketChatConnector.Message=Rocket.Chat Notifications RocketChatConnector.EnterAServerUrl=Enter a Rocket.Chat server URL RocketChatConnector.EnterAUser=Enter a user (username or email) @@ -31,6 +31,8 @@ RocketChatConnector.ProxyUsernameColon=P RocketChatConnector.ProxyPasswordColon=Proxy NTLM Password: RocketChatConnector.ProxyDomainColon=Proxy NTLM Authentication Domain: +RocketChatConnector.Globals=Global Rocket.Chat Settings + RocketChatConnector.JobFinished=Job finished RocketChatConnector.JobStopErrorAbort=Job stopped due to error abort RocketChatConnector.JobStopManualAbort=Job stopped due to manual abort @@ -39,4 +41,8 @@ RocketChatConnector.JobStopSchedulePause RocketChatConnector.JobStopRestart=Job stopped due to job restart RocketChatConnector.ChannelColon=Channel: -RocketChatConnector_MessageColon=Message: +RocketChatConnector.MessageColon=Message: +RocketChatConnector.DefaultChannelColon=Default Channel: +RocketChatConnector.AliasColon=Alias: +RocketChatConnector.EmojiColon=Emoji: +RocketChatConnector.AvatarColon=Avatar: Modified: manifoldcf/trunk/connectors/rocketchat/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/notifications/rocketchat/common_es_ES.properties URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/rocketchat/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/notifications/rocketchat/common_es_ES.properties?rev=1813066&r1=1812793&r2=1813066&view=diff ============================================================================== --- manifoldcf/trunk/connectors/rocketchat/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/notifications/rocketchat/common_es_ES.properties (original) +++ manifoldcf/trunk/connectors/rocketchat/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/notifications/rocketchat/common_es_ES.properties Mon Oct 23 19:27:53 2017 @@ -14,7 +14,7 @@ # limitations under the License. RocketChatConnector.RestAPI=Rocket.Chat REST API -RocketChatConnector.Message=Message +RocketChatConnector.Message=Rocket.Chat Notifications RocketChatConnector.EnterAServerUrl=Enter a Rocket.Chat server URL RocketChatConnector.EnterAUser=Enter a user (username or email) @@ -31,6 +31,8 @@ RocketChatConnector.ProxyUsernameColon=P RocketChatConnector.ProxyPasswordColon=Proxy NTLM Password: RocketChatConnector.ProxyDomainColon=Proxy NTLM Authentication Domain: +RocketChatConnector.Globals=Global Rocket.Chat Settings + RocketChatConnector.JobFinished=Job finished RocketChatConnector.JobStopErrorAbort=Job stopped due to error abort RocketChatConnector.JobStopManualAbort=Job stopped due to manual abort @@ -39,4 +41,8 @@ RocketChatConnector.JobStopSchedulePause RocketChatConnector.JobStopRestart=Job stopped due to job restart RocketChatConnector.ChannelColon=Channel: -RocketChatConnector_MessageColon=Message: +RocketChatConnector.MessageColon=Message: +RocketChatConnector.DefaultChannelColon=Default Channel: +RocketChatConnector.AliasColon=Alias: +RocketChatConnector.EmojiColon=Emoji: +RocketChatConnector.AvatarColon=Avatar: Modified: manifoldcf/trunk/connectors/rocketchat/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/notifications/rocketchat/common_ja_JP.properties URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/rocketchat/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/notifications/rocketchat/common_ja_JP.properties?rev=1813066&r1=1812793&r2=1813066&view=diff ============================================================================== --- manifoldcf/trunk/connectors/rocketchat/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/notifications/rocketchat/common_ja_JP.properties (original) +++ manifoldcf/trunk/connectors/rocketchat/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/notifications/rocketchat/common_ja_JP.properties Mon Oct 23 19:27:53 2017 @@ -14,7 +14,7 @@ # limitations under the License. RocketChatConnector.RestAPI=Rocket.Chat REST API -RocketChatConnector.Message=Message +RocketChatConnector.Message=Rocket.Chat Notifications RocketChatConnector.EnterAServerUrl=Enter a Rocket.Chat server URL RocketChatConnector.EnterAUser=Enter a user (username or email) @@ -31,6 +31,8 @@ RocketChatConnector.ProxyUsernameColon=P RocketChatConnector.ProxyPasswordColon=Proxy NTLM Password: RocketChatConnector.ProxyDomainColon=Proxy NTLM Authentication Domain: +RocketChatConnector.Globals=Global Rocket.Chat Settings + RocketChatConnector.JobFinished=Job finished RocketChatConnector.JobStopErrorAbort=Job stopped due to error abort RocketChatConnector.JobStopManualAbort=Job stopped due to manual abort @@ -39,4 +41,8 @@ RocketChatConnector.JobStopSchedulePause RocketChatConnector.JobStopRestart=Job stopped due to job restart RocketChatConnector.ChannelColon=Channel: -RocketChatConnector_MessageColon=Message: +RocketChatConnector.MessageColon=Message: +RocketChatConnector.DefaultChannelColon=Default Channel: +RocketChatConnector.AliasColon=Alias: +RocketChatConnector.EmojiColon=Emoji: +RocketChatConnector.AvatarColon=Avatar: Modified: manifoldcf/trunk/connectors/rocketchat/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/notifications/rocketchat/common_zh_CN.properties URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/rocketchat/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/notifications/rocketchat/common_zh_CN.properties?rev=1813066&r1=1812793&r2=1813066&view=diff ============================================================================== --- manifoldcf/trunk/connectors/rocketchat/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/notifications/rocketchat/common_zh_CN.properties (original) +++ manifoldcf/trunk/connectors/rocketchat/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/notifications/rocketchat/common_zh_CN.properties Mon Oct 23 19:27:53 2017 @@ -14,7 +14,7 @@ # limitations under the License. RocketChatConnector.RestAPI=Rocket.Chat REST API -RocketChatConnector.Message=Message +RocketChatConnector.Message=Rocket.Chat Notifications RocketChatConnector.EnterAServerUrl=Enter a Rocket.Chat server URL RocketChatConnector.EnterAUser=Enter a user (username or email) @@ -31,6 +31,8 @@ RocketChatConnector.ProxyUsernameColon=P RocketChatConnector.ProxyPasswordColon=Proxy NTLM Password: RocketChatConnector.ProxyDomainColon=Proxy NTLM Authentication Domain: +RocketChatConnector.Globals=Global Rocket.Chat Settings + RocketChatConnector.JobFinished=Job finished RocketChatConnector.JobStopErrorAbort=Job stopped due to error abort RocketChatConnector.JobStopManualAbort=Job stopped due to manual abort @@ -39,4 +41,8 @@ RocketChatConnector.JobStopSchedulePause RocketChatConnector.JobStopRestart=Job stopped due to job restart RocketChatConnector.ChannelColon=Channel: -RocketChatConnector_MessageColon=Message: +RocketChatConnector.MessageColon=Message: +RocketChatConnector.DefaultChannelColon=Default Channel: +RocketChatConnector.AliasColon=Alias: +RocketChatConnector.EmojiColon=Emoji: +RocketChatConnector.AvatarColon=Avatar: Modified: manifoldcf/trunk/connectors/rocketchat/connector/src/main/resources/org/apache/manifoldcf/crawler/notifications/rocketchat/SpecificationView.html URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/rocketchat/connector/src/main/resources/org/apache/manifoldcf/crawler/notifications/rocketchat/SpecificationView.html?rev=1813066&r1=1812793&r2=1813066&view=diff ============================================================================== --- manifoldcf/trunk/connectors/rocketchat/connector/src/main/resources/org/apache/manifoldcf/crawler/notifications/rocketchat/SpecificationView.html (original) +++ manifoldcf/trunk/connectors/rocketchat/connector/src/main/resources/org/apache/manifoldcf/crawler/notifications/rocketchat/SpecificationView.html Mon Oct 23 19:27:53 2017 @@ -17,6 +17,38 @@ limitations under the License. + + + + + + + + + + + + + + + + + + +
$Encoder.bodyEscape($ResourceBundle.getString('RocketChatConnector.Globals'))
$Encoder.bodyEscape($ResourceBundle.getString('RocketChatConnector.DefaultChannelColon')) + $Encoder.bodyEscape($default_channel) +
$Encoder.bodyEscape($ResourceBundle.getString('RocketChatConnector.AliasColon')) + $Encoder.bodyEscape($alias) +
$Encoder.bodyEscape($ResourceBundle.getString('RocketChatConnector.EmojiColon')) + $Encoder.bodyEscape($emoji) +
$Encoder.bodyEscape($ResourceBundle.getString('RocketChatConnector.AvatarColon')) + $Encoder.bodyEscape($avatar) +
+ +
+ + + @@ -25,7 +57,7 @@ limitations under the License. - + @@ -39,7 +71,7 @@ limitations under the License. - + @@ -53,7 +85,7 @@ limitations under the License. - + @@ -67,7 +99,7 @@ limitations under the License. - + @@ -81,7 +113,7 @@ limitations under the License. - + @@ -95,7 +127,7 @@ limitations under the License. - + Modified: manifoldcf/trunk/connectors/rocketchat/connector/src/main/resources/org/apache/manifoldcf/crawler/notifications/rocketchat/Specification_Message.html URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/rocketchat/connector/src/main/resources/org/apache/manifoldcf/crawler/notifications/rocketchat/Specification_Message.html?rev=1813066&r1=1812793&r2=1813066&view=diff ============================================================================== --- manifoldcf/trunk/connectors/rocketchat/connector/src/main/resources/org/apache/manifoldcf/crawler/notifications/rocketchat/Specification_Message.html (original) +++ manifoldcf/trunk/connectors/rocketchat/connector/src/main/resources/org/apache/manifoldcf/crawler/notifications/rocketchat/Specification_Message.html Mon Oct 23 19:27:53 2017 @@ -19,6 +19,45 @@ limitations under the License.
$Encoder.bodyEscape($ResourceBundle.getString('RocketChatConnector.JobFinished'))
$Encoder.bodyEscape($ResourceBundle.getString('RocketChatConnector.ChannelColon'))
$Encoder.bodyEscape($ResourceBundle.getString('RocketChatConnector_MessageColon'))$Encoder.bodyEscape($ResourceBundle.getString('RocketChatConnector.MessageColon')) $Encoder.bodyEscape($finished_MESSAGE)
$Encoder.bodyEscape($ResourceBundle.getString('RocketChatConnector_MessageColon'))$Encoder.bodyEscape($ResourceBundle.getString('RocketChatConnector.MessageColon')) $Encoder.bodyEscape($erroraborted_MESSAGE)
$Encoder.bodyEscape($ResourceBundle.getString('RocketChatConnector_MessageColon'))$Encoder.bodyEscape($ResourceBundle.getString('RocketChatConnector.MessageColon')) $Encoder.bodyEscape($manualaborted_MESSAGE)
$Encoder.bodyEscape($ResourceBundle.getString('RocketChatConnector_MessageColon'))$Encoder.bodyEscape($ResourceBundle.getString('RocketChatConnector.MessageColon')) $Encoder.bodyEscape($manualpaused_MESSAGE)
$Encoder.bodyEscape($ResourceBundle.getString('RocketChatConnector_MessageColon'))$Encoder.bodyEscape($ResourceBundle.getString('RocketChatConnector.MessageColon')) $Encoder.bodyEscape($schedulepaused_MESSAGE)
$Encoder.bodyEscape($ResourceBundle.getString('RocketChatConnector_MessageColon'))$Encoder.bodyEscape($ResourceBundle.getString('RocketChatConnector.MessageColon')) $Encoder.bodyEscape($restarted_MESSAGE)
+ + + + + + + + + + + + + + + + + +
$Encoder.bodyEscape($ResourceBundle.getString('RocketChatConnector.Globals'))
+ $Encoder.bodyEscape($ResourceBundle.getString('RocketChatConnector.DefaultChannelColon')) + + +
+ $Encoder.bodyEscape($ResourceBundle.getString('RocketChatConnector.AliasColon')) + + +
+ $Encoder.bodyEscape($ResourceBundle.getString('RocketChatConnector.EmojiColon')) + + +
+ $Encoder.bodyEscape($ResourceBundle.getString('RocketChatConnector.AvatarColon')) + + +
+ +
+ + + - @@ -88,6 +87,13 @@
$Encoder.bodyEscape($ResourceBundle.getString('RocketChatConnector.JobFinished'))
@@ -30,7 +69,7 @@ limitations under the License.
- $Encoder.bodyEscape($ResourceBundle.getString('RocketChatConnector_MessageColon')) + $Encoder.bodyEscape($ResourceBundle.getString('RocketChatConnector.MessageColon')) @@ -48,7 +87,7 @@ limitations under the License.
- $Encoder.bodyEscape($ResourceBundle.getString('RocketChatConnector_MessageColon')) + $Encoder.bodyEscape($ResourceBundle.getString('RocketChatConnector.MessageColon')) @@ -66,7 +105,7 @@ limitations under the License.
- $Encoder.bodyEscape($ResourceBundle.getString('RocketChatConnector_MessageColon')) + $Encoder.bodyEscape($ResourceBundle.getString('RocketChatConnector.MessageColon')) @@ -84,7 +123,7 @@ limitations under the License.
- $Encoder.bodyEscape($ResourceBundle.getString('RocketChatConnector_MessageColon')) + $Encoder.bodyEscape($ResourceBundle.getString('RocketChatConnector.MessageColon')) @@ -102,7 +141,7 @@ limitations under the License.
- $Encoder.bodyEscape($ResourceBundle.getString('RocketChatConnector_MessageColon')) + $Encoder.bodyEscape($ResourceBundle.getString('RocketChatConnector.MessageColon')) @@ -120,7 +159,7 @@ limitations under the License.
- $Encoder.bodyEscape($ResourceBundle.getString('RocketChatConnector_MessageColon')) + $Encoder.bodyEscape($ResourceBundle.getString('RocketChatConnector.MessageColon')) @@ -131,6 +170,11 @@ limitations under the License. #else + + + + + Modified: manifoldcf/trunk/site/src/documentation/content/xdocs/en_US/end-user-documentation.xml URL: http://svn.apache.org/viewvc/manifoldcf/trunk/site/src/documentation/content/xdocs/en_US/end-user-documentation.xml?rev=1813066&r1=1813065&r2=1813066&view=diff ============================================================================== --- manifoldcf/trunk/site/src/documentation/content/xdocs/en_US/end-user-documentation.xml (original) +++ manifoldcf/trunk/site/src/documentation/content/xdocs/en_US/end-user-documentation.xml Mon Oct 23 19:27:53 2017 @@ -3116,6 +3116,26 @@ curl -XGET http://localhost:9200/index/_ If no channel is defined, the message is sent to the default channel of the Slack Incoming WebHook.

The "Message" supports Markdown formatting. Refer to the Slack Custom Integrations documentation for more information.

+ +
+ Rocket.Chat Notifications +

The Rocket.Chat notification connection allows you to send job notifications to a Rocket.Chat channel. The connection type uses the Rocket.Chat REST API to post messages.

+

A Rocket.Chat notification connection has only one special tab on the notification connection editing screen: the "Rocket.Chat REST API" tab. The tab looks like this:

+

+
+

+

Enter the server URL of your Rocket.Chat instance and the user credentials here. The user field takes either the username or the email address of your Rocket.Chat user. Fill out the proxy fields if you need + to connect to your Rocket.Chat through an http proxy.

+

When you configure a job to use a notification connection of the Rocket.Chat notification type, an additional tab "Rocket.Chat Notifications" is presented.

+

The tab looks like this:

+

+
+

+

This tab allows you to set the notification messages for the different job statuses. The tab begins with a section for global settings, followed by multiple sections for each + notification type. The default channel defines the channel, to which the messages are posted. You can customize the appearance of the posted message with the alias, emoji and avatar fields.

+

The "Channel" field in the second section allows you to override the default channel for the corresponding notification type. If no channel is defined, the message is sent to the specified default channel.

+

The "Message" field holds the actual message that will be posted to Rocket.Chat. The field supports Markdown for formatting the message. Refer to the Rocket.Chat documentation for detailed information.

+
Modified: manifoldcf/trunk/site/src/documentation/content/xdocs/en_US/included-connectors.xml URL: http://svn.apache.org/viewvc/manifoldcf/trunk/site/src/documentation/content/xdocs/en_US/included-connectors.xml?rev=1813066&r1=1813065&r2=1813066&view=diff ============================================================================== --- manifoldcf/trunk/site/src/documentation/content/xdocs/en_US/included-connectors.xml (original) +++ manifoldcf/trunk/site/src/documentation/content/xdocs/en_US/included-connectors.xml Mon Oct 23 19:27:53 2017 @@ -54,7 +54,6 @@
Meridio (Autonomy) Pure Java Win N/A Tested with Meridio 4.1, 5.0
RSS Pure Java N/A N/A Atom, RSS 2.0, others
SharePoint (MSFT)Pure Java Win N/A Tested with SharePoint 2003 (2.0), 2007 (3.0), 2010 (4.0), 2013 (5.0)
SlackPure Java N/A N/A Tested with Slack API November 2016
Web Pure Java N/A N/A HTML Version 1.0, 1.1, 2.0, Atom, RSS 2.0, others
Windows SharesPure Java Win, Samba, NetApp, other NAS systems N/AN/A
Wiki Pure Java N/A N/A Wiki version 1.8 and above
OpenNLP ExtractorPure JavaVariousVariousVarious
Tika Content ExtractorPure JavaVariousVariousVarious
+ + + + + + +
Notification Connector interoperability table
EmailPure JavaVariousJavamail 1.4N/A
Rocket.ChatPure Java N/A N/A Tested with Rocket.Chat 0.58.1
SlackPure Java N/A N/A Tested with Slack API November 2016