Author: schuch
Date: Sat Oct 21 15:03:06 2017
New Revision: 1812830
URL: http://svn.apache.org/viewvc?rev=1812830&view=rev
Log:
Improved the Rocket.Chat notification connector
- simplified errorhandling
- added support for alias, avatar and emoji
- a default channel can now be specified
Modified:
manifoldcf/branches/CONNECTORS-1468/connectors/rocketchat/connector/src/main/java/org/apache/manifoldcf/crawler/notifications/rocketchat/RocketChatConfig.java
manifoldcf/branches/CONNECTORS-1468/connectors/rocketchat/connector/src/main/java/org/apache/manifoldcf/crawler/notifications/rocketchat/RocketChatConnector.java
manifoldcf/branches/CONNECTORS-1468/connectors/rocketchat/connector/src/main/java/org/apache/manifoldcf/crawler/notifications/rocketchat/RocketChatMessage.java
manifoldcf/branches/CONNECTORS-1468/connectors/rocketchat/connector/src/main/java/org/apache/manifoldcf/crawler/notifications/rocketchat/RocketChatSession.java
manifoldcf/branches/CONNECTORS-1468/connectors/rocketchat/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/notifications/rocketchat/common_en_US.properties
manifoldcf/branches/CONNECTORS-1468/connectors/rocketchat/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/notifications/rocketchat/common_es_ES.properties
manifoldcf/branches/CONNECTORS-1468/connectors/rocketchat/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/notifications/rocketchat/common_ja_JP.properties
manifoldcf/branches/CONNECTORS-1468/connectors/rocketchat/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/notifications/rocketchat/common_zh_CN.properties
manifoldcf/branches/CONNECTORS-1468/connectors/rocketchat/connector/src/main/resources/org/apache/manifoldcf/crawler/notifications/rocketchat/SpecificationView.html
manifoldcf/branches/CONNECTORS-1468/connectors/rocketchat/connector/src/main/resources/org/apache/manifoldcf/crawler/notifications/rocketchat/Specification_Message.html
Modified:
manifoldcf/branches/CONNECTORS-1468/connectors/rocketchat/connector/src/main/java/org/apache/manifoldcf/crawler/notifications/rocketchat/RocketChatConfig.java
URL:
http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-1468/connectors/rocketchat/connector/src/main/java/org/apache/manifoldcf/crawler/notifications/rocketchat/RocketChatConfig.java?rev=1812830&r1=1812829&r2=1812830&view=diff
==============================================================================
---
manifoldcf/branches/CONNECTORS-1468/connectors/rocketchat/connector/src/main/java/org/apache/manifoldcf/crawler/notifications/rocketchat/RocketChatConfig.java
(original)
+++
manifoldcf/branches/CONNECTORS-1468/connectors/rocketchat/connector/src/main/java/org/apache/manifoldcf/crawler/notifications/rocketchat/RocketChatConfig.java
Sat Oct 21 15:03:06 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/branches/CONNECTORS-1468/connectors/rocketchat/connector/src/main/java/org/apache/manifoldcf/crawler/notifications/rocketchat/RocketChatConnector.java
URL:
http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-1468/connectors/rocketchat/connector/src/main/java/org/apache/manifoldcf/crawler/notifications/rocketchat/RocketChatConnector.java?rev=1812830&r1=1812829&r2=1812830&view=diff
==============================================================================
---
manifoldcf/branches/CONNECTORS-1468/connectors/rocketchat/connector/src/main/java/org/apache/manifoldcf/crawler/notifications/rocketchat/RocketChatConnector.java
(original)
+++
manifoldcf/branches/CONNECTORS-1468/connectors/rocketchat/connector/src/main/java/org/apache/manifoldcf/crawler/notifications/rocketchat/RocketChatConnector.java
Sat Oct 21 15:03:06 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<String> tabsArray)
- throws ManifoldCFException, IOException {
+ Locale locale, ConfigParams parameters, List<String> tabsArray)
+ throws ManifoldCFException, IOException {
tabsArray.add(Messages.getString(locale, "RocketChatConnector.RestAPI"));
// Map the parameters
Map<String, Object> paramMap = new HashMap<String, Object>();
@@ -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<String, Object> paramMap = new HashMap<String, Object>();
// 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 <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.
- */
+ * 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 {
+ Locale locale, ConfigParams parameters) throws ManifoldCFException,
IOException {
Map<String, Object> paramMap = new HashMap<String, Object>();
// 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<String> tabsArray)
- throws ManifoldCFException, IOException {
+ int connectionSequenceNumber, List<String> tabsArray)
+ throws ManifoldCFException, IOException {
Map<String, Object> paramMap = new HashMap<String, Object>();
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
- * <html>, <body>, and <form> 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
+ * <html>, <body>, and <form> 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<String, Object> paramMap = new HashMap<String, Object>();
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<String, Object> 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<String,Object> 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 <html> and <body> 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 <html> and <body> 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<String, Object> paramMap = new HashMap<String, Object>();
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/branches/CONNECTORS-1468/connectors/rocketchat/connector/src/main/java/org/apache/manifoldcf/crawler/notifications/rocketchat/RocketChatMessage.java
URL:
http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-1468/connectors/rocketchat/connector/src/main/java/org/apache/manifoldcf/crawler/notifications/rocketchat/RocketChatMessage.java?rev=1812830&r1=1812829&r2=1812830&view=diff
==============================================================================
---
manifoldcf/branches/CONNECTORS-1468/connectors/rocketchat/connector/src/main/java/org/apache/manifoldcf/crawler/notifications/rocketchat/RocketChatMessage.java
(original)
+++
manifoldcf/branches/CONNECTORS-1468/connectors/rocketchat/connector/src/main/java/org/apache/manifoldcf/crawler/notifications/rocketchat/RocketChatMessage.java
Sat Oct 21 15:03:06 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/branches/CONNECTORS-1468/connectors/rocketchat/connector/src/main/java/org/apache/manifoldcf/crawler/notifications/rocketchat/RocketChatSession.java
URL:
http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-1468/connectors/rocketchat/connector/src/main/java/org/apache/manifoldcf/crawler/notifications/rocketchat/RocketChatSession.java?rev=1812830&r1=1812829&r2=1812830&view=diff
==============================================================================
---
manifoldcf/branches/CONNECTORS-1468/connectors/rocketchat/connector/src/main/java/org/apache/manifoldcf/crawler/notifications/rocketchat/RocketChatSession.java
(original)
+++
manifoldcf/branches/CONNECTORS-1468/connectors/rocketchat/connector/src/main/java/org/apache/manifoldcf/crawler/notifications/rocketchat/RocketChatSession.java
Sat Oct 21 15:03:06 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/branches/CONNECTORS-1468/connectors/rocketchat/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/notifications/rocketchat/common_en_US.properties
URL:
http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-1468/connectors/rocketchat/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/notifications/rocketchat/common_en_US.properties?rev=1812830&r1=1812829&r2=1812830&view=diff
==============================================================================
---
manifoldcf/branches/CONNECTORS-1468/connectors/rocketchat/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/notifications/rocketchat/common_en_US.properties
(original)
+++
manifoldcf/branches/CONNECTORS-1468/connectors/rocketchat/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/notifications/rocketchat/common_en_US.properties
Sat Oct 21 15:03:06 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/branches/CONNECTORS-1468/connectors/rocketchat/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/notifications/rocketchat/common_es_ES.properties
URL:
http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-1468/connectors/rocketchat/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/notifications/rocketchat/common_es_ES.properties?rev=1812830&r1=1812829&r2=1812830&view=diff
==============================================================================
---
manifoldcf/branches/CONNECTORS-1468/connectors/rocketchat/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/notifications/rocketchat/common_es_ES.properties
(original)
+++
manifoldcf/branches/CONNECTORS-1468/connectors/rocketchat/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/notifications/rocketchat/common_es_ES.properties
Sat Oct 21 15:03:06 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/branches/CONNECTORS-1468/connectors/rocketchat/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/notifications/rocketchat/common_ja_JP.properties
URL:
http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-1468/connectors/rocketchat/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/notifications/rocketchat/common_ja_JP.properties?rev=1812830&r1=1812829&r2=1812830&view=diff
==============================================================================
---
manifoldcf/branches/CONNECTORS-1468/connectors/rocketchat/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/notifications/rocketchat/common_ja_JP.properties
(original)
+++
manifoldcf/branches/CONNECTORS-1468/connectors/rocketchat/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/notifications/rocketchat/common_ja_JP.properties
Sat Oct 21 15:03:06 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/branches/CONNECTORS-1468/connectors/rocketchat/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/notifications/rocketchat/common_zh_CN.properties
URL:
http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-1468/connectors/rocketchat/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/notifications/rocketchat/common_zh_CN.properties?rev=1812830&r1=1812829&r2=1812830&view=diff
==============================================================================
---
manifoldcf/branches/CONNECTORS-1468/connectors/rocketchat/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/notifications/rocketchat/common_zh_CN.properties
(original)
+++
manifoldcf/branches/CONNECTORS-1468/connectors/rocketchat/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/notifications/rocketchat/common_zh_CN.properties
Sat Oct 21 15:03:06 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/branches/CONNECTORS-1468/connectors/rocketchat/connector/src/main/resources/org/apache/manifoldcf/crawler/notifications/rocketchat/SpecificationView.html
URL:
http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-1468/connectors/rocketchat/connector/src/main/resources/org/apache/manifoldcf/crawler/notifications/rocketchat/SpecificationView.html?rev=1812830&r1=1812829&r2=1812830&view=diff
==============================================================================
---
manifoldcf/branches/CONNECTORS-1468/connectors/rocketchat/connector/src/main/resources/org/apache/manifoldcf/crawler/notifications/rocketchat/SpecificationView.html
(original)
+++
manifoldcf/branches/CONNECTORS-1468/connectors/rocketchat/connector/src/main/resources/org/apache/manifoldcf/crawler/notifications/rocketchat/SpecificationView.html
Sat Oct 21 15:03:06 2017
@@ -17,6 +17,38 @@ limitations under the License.
<table class="displaytable">
+ <tr><td class="message"
colspan="2"><nobr>$Encoder.bodyEscape($ResourceBundle.getString('RocketChatConnector.Globals'))</nobr></td></tr>
+ <tr>
+ <td
class="description"><nobr>$Encoder.bodyEscape($ResourceBundle.getString('RocketChatConnector.DefaultChannelColon'))</nobr></td>
+ <td class="value">
+ <nobr>$Encoder.bodyEscape($default_channel)</nobr>
+ </td>
+ </tr>
+ <tr>
+ <td
class="description"><nobr>$Encoder.bodyEscape($ResourceBundle.getString('RocketChatConnector.AliasColon'))</nobr></td>
+ <td class="value">
+ <nobr>$Encoder.bodyEscape($alias)</nobr>
+ </td>
+ </tr>
+ <tr>
+ <td
class="description"><nobr>$Encoder.bodyEscape($ResourceBundle.getString('RocketChatConnector.EmojiColon'))</nobr></td>
+ <td class="value">
+ <nobr>$Encoder.bodyEscape($emoji)</nobr>
+ </td>
+ </tr>
+ <tr>
+ <td
class="description"><nobr>$Encoder.bodyEscape($ResourceBundle.getString('RocketChatConnector.AvatarColon'))</nobr></td>
+ <td class="value">
+ <nobr>$Encoder.bodyEscape($avatar)</nobr>
+ </td>
+ </tr>
+
+</table>
+
+<hr/>
+
+<table class="displaytable">
+
<tr><td class="message"
colspan="2"><nobr>$Encoder.bodyEscape($ResourceBundle.getString('RocketChatConnector.JobFinished'))</nobr></td></tr>
<tr>
<td
class="description"><nobr>$Encoder.bodyEscape($ResourceBundle.getString('RocketChatConnector.ChannelColon'))</nobr></td>
@@ -25,7 +57,7 @@ limitations under the License.
</td>
</tr>
<tr>
- <td
class="description"><nobr>$Encoder.bodyEscape($ResourceBundle.getString('RocketChatConnector_MessageColon'))</nobr></td>
+ <td
class="description"><nobr>$Encoder.bodyEscape($ResourceBundle.getString('RocketChatConnector.MessageColon'))</nobr></td>
<td class="value">
$Encoder.bodyEscape($finished_MESSAGE)
</td>
@@ -39,7 +71,7 @@ limitations under the License.
</td>
</tr>
<tr>
- <td
class="description"><nobr>$Encoder.bodyEscape($ResourceBundle.getString('RocketChatConnector_MessageColon'))</nobr></td>
+ <td
class="description"><nobr>$Encoder.bodyEscape($ResourceBundle.getString('RocketChatConnector.MessageColon'))</nobr></td>
<td class="value">
$Encoder.bodyEscape($erroraborted_MESSAGE)
</td>
@@ -53,7 +85,7 @@ limitations under the License.
</td>
</tr>
<tr>
- <td
class="description"><nobr>$Encoder.bodyEscape($ResourceBundle.getString('RocketChatConnector_MessageColon'))</nobr></td>
+ <td
class="description"><nobr>$Encoder.bodyEscape($ResourceBundle.getString('RocketChatConnector.MessageColon'))</nobr></td>
<td class="value">
$Encoder.bodyEscape($manualaborted_MESSAGE)
</td>
@@ -67,7 +99,7 @@ limitations under the License.
</td>
</tr>
<tr>
- <td
class="description"><nobr>$Encoder.bodyEscape($ResourceBundle.getString('RocketChatConnector_MessageColon'))</nobr></td>
+ <td
class="description"><nobr>$Encoder.bodyEscape($ResourceBundle.getString('RocketChatConnector.MessageColon'))</nobr></td>
<td class="value">
$Encoder.bodyEscape($manualpaused_MESSAGE)
</td>
@@ -81,7 +113,7 @@ limitations under the License.
</td>
</tr>
<tr>
- <td
class="description"><nobr>$Encoder.bodyEscape($ResourceBundle.getString('RocketChatConnector_MessageColon'))</nobr></td>
+ <td
class="description"><nobr>$Encoder.bodyEscape($ResourceBundle.getString('RocketChatConnector.MessageColon'))</nobr></td>
<td class="value">
$Encoder.bodyEscape($schedulepaused_MESSAGE)
</td>
@@ -95,7 +127,7 @@ limitations under the License.
</td>
</tr>
<tr>
- <td
class="description"><nobr>$Encoder.bodyEscape($ResourceBundle.getString('RocketChatConnector_MessageColon'))</nobr></td>
+ <td
class="description"><nobr>$Encoder.bodyEscape($ResourceBundle.getString('RocketChatConnector.MessageColon'))</nobr></td>
<td class="value">
$Encoder.bodyEscape($restarted_MESSAGE)
</td>
Modified:
manifoldcf/branches/CONNECTORS-1468/connectors/rocketchat/connector/src/main/resources/org/apache/manifoldcf/crawler/notifications/rocketchat/Specification_Message.html
URL:
http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-1468/connectors/rocketchat/connector/src/main/resources/org/apache/manifoldcf/crawler/notifications/rocketchat/Specification_Message.html?rev=1812830&r1=1812829&r2=1812830&view=diff
==============================================================================
---
manifoldcf/branches/CONNECTORS-1468/connectors/rocketchat/connector/src/main/resources/org/apache/manifoldcf/crawler/notifications/rocketchat/Specification_Message.html
(original)
+++
manifoldcf/branches/CONNECTORS-1468/connectors/rocketchat/connector/src/main/resources/org/apache/manifoldcf/crawler/notifications/rocketchat/Specification_Message.html
Sat Oct 21 15:03:06 2017
@@ -19,6 +19,45 @@ limitations under the License.
<table class="displaytable">
+ <tr><td class="message"
colspan="2"><nobr>$Encoder.bodyEscape($ResourceBundle.getString('RocketChatConnector.Globals'))</nobr></td></tr>
+ <tr>
+ <td class="description">
+
<nobr>$Encoder.bodyEscape($ResourceBundle.getString('RocketChatConnector.DefaultChannelColon'))</nobr>
+ </td>
+ <td class="value">
+ <input type="text" name="default_channel" size="32"
value="$Encoder.attributeEscape($default_channel)"/>
+ </td>
+ </tr>
+ <tr>
+ <td class="description">
+
<nobr>$Encoder.bodyEscape($ResourceBundle.getString('RocketChatConnector.AliasColon'))</nobr>
+ </td>
+ <td class="value">
+ <input type="text" name="alias" size="32"
value="$Encoder.attributeEscape($alias)"/>
+ </td>
+ </tr>
+ <tr>
+ <td class="description">
+
<nobr>$Encoder.bodyEscape($ResourceBundle.getString('RocketChatConnector.EmojiColon'))</nobr>
+ </td>
+ <td class="value">
+ <input type="text" name="emoji" size="32"
value="$Encoder.attributeEscape($emoji)"/>
+ </td>
+ </tr>
+ <tr>
+ <td class="description">
+
<nobr>$Encoder.bodyEscape($ResourceBundle.getString('RocketChatConnector.AvatarColon'))</nobr>
+ </td>
+ <td class="value">
+ <input type="text" name="avatar" size="32"
value="$Encoder.attributeEscape($avatar)"/>
+ </td>
+ </tr>
+</table>
+
+<hr/>
+
+<table class="displaytable">
+
<tr><td class="message"
colspan="2"><nobr>$Encoder.bodyEscape($ResourceBundle.getString('RocketChatConnector.JobFinished'))</nobr></td></tr>
<tr>
<td class="description">
@@ -30,7 +69,7 @@ limitations under the License.
</tr>
<tr>
<td class="description">
-
<nobr>$Encoder.bodyEscape($ResourceBundle.getString('RocketChatConnector_MessageColon'))</nobr>
+
<nobr>$Encoder.bodyEscape($ResourceBundle.getString('RocketChatConnector.MessageColon'))</nobr>
</td>
<td class="value">
<textarea name="s${SeqNum}_finished_message" rows="10"
cols="50">$Encoder.bodyEscape($finished_MESSAGE)</textarea>
@@ -48,7 +87,7 @@ limitations under the License.
</tr>
<tr>
<td class="description">
-
<nobr>$Encoder.bodyEscape($ResourceBundle.getString('RocketChatConnector_MessageColon'))</nobr>
+
<nobr>$Encoder.bodyEscape($ResourceBundle.getString('RocketChatConnector.MessageColon'))</nobr>
</td>
<td class="value">
<textarea name="s${SeqNum}_erroraborted_message" rows="10"
cols="50">$Encoder.bodyEscape($erroraborted_MESSAGE)</textarea>
@@ -66,7 +105,7 @@ limitations under the License.
</tr>
<tr>
<td class="description">
-
<nobr>$Encoder.bodyEscape($ResourceBundle.getString('RocketChatConnector_MessageColon'))</nobr>
+
<nobr>$Encoder.bodyEscape($ResourceBundle.getString('RocketChatConnector.MessageColon'))</nobr>
</td>
<td class="value">
<textarea name="s${SeqNum}_manualaborted_message" rows="10"
cols="50">$Encoder.bodyEscape($manualaborted_MESSAGE)</textarea>
@@ -84,7 +123,7 @@ limitations under the License.
</tr>
<tr>
<td class="description">
-
<nobr>$Encoder.bodyEscape($ResourceBundle.getString('RocketChatConnector_MessageColon'))</nobr>
+
<nobr>$Encoder.bodyEscape($ResourceBundle.getString('RocketChatConnector.MessageColon'))</nobr>
</td>
<td class="value">
<textarea name="s${SeqNum}_manualpaused_message" rows="10"
cols="50">$Encoder.bodyEscape($manualpaused_MESSAGE)</textarea>
@@ -102,7 +141,7 @@ limitations under the License.
</tr>
<tr>
<td class="description">
-
<nobr>$Encoder.bodyEscape($ResourceBundle.getString('RocketChatConnector_MessageColon'))</nobr>
+
<nobr>$Encoder.bodyEscape($ResourceBundle.getString('RocketChatConnector.MessageColon'))</nobr>
</td>
<td class="value">
<textarea name="s${SeqNum}_schedulepaused_message" rows="10"
cols="50">$Encoder.bodyEscape($schedulepaused_MESSAGE)</textarea>
@@ -120,7 +159,7 @@ limitations under the License.
</tr>
<tr>
<td class="description">
-
<nobr>$Encoder.bodyEscape($ResourceBundle.getString('RocketChatConnector_MessageColon'))</nobr>
+
<nobr>$Encoder.bodyEscape($ResourceBundle.getString('RocketChatConnector.MessageColon'))</nobr>
</td>
<td class="value">
<textarea name="s${SeqNum}_restarted_message" rows="10"
cols="50">$Encoder.bodyEscape($restarted_MESSAGE)</textarea>
@@ -131,6 +170,11 @@ limitations under the License.
#else
+<input type="hidden" name="default_channel"
value="$Encoder.attributeEscape($default_channel)"/>
+<input type="hidden" name="alias" value="$Encoder.attributeEscape($alias)"/>
+<input type="hidden" name="emoji" value="$Encoder.attributeEscape($emoji)"/>
+<input type="hidden" name="avatar" value="$Encoder.attributeEscape($avatar)"/>
+
<input type="hidden" name="s${SeqNum}_finished_channel"
value="$Encoder.attributeEscape($finished_CHANNEL)"/>
<input type="hidden" name="s${SeqNum}_finished_message"
value="$Encoder.attributeEscape($finished_MESSAGE)"/>