manifoldcf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwri...@apache.org
Subject svn commit: r1771641 - in /manifoldcf/branches/CONNECTORS-1344/connectors/slack/connector/src/main: java/org/apache/manifoldcf/crawler/notifications/slack/ native2ascii/org/apache/manifoldcf/crawler/notifications/slack/ resources/org/apache/manifoldcf/...
Date Sun, 27 Nov 2016 20:19:39 GMT
Author: kwright
Date: Sun Nov 27 20:19:38 2016
New Revision: 1771641

URL: http://svn.apache.org/viewvc?rev=1771641&view=rev
Log:
Commit third patch

Modified:
    manifoldcf/branches/CONNECTORS-1344/connectors/slack/connector/src/main/java/org/apache/manifoldcf/crawler/notifications/slack/SlackConfig.java
    manifoldcf/branches/CONNECTORS-1344/connectors/slack/connector/src/main/java/org/apache/manifoldcf/crawler/notifications/slack/SlackConnector.java
    manifoldcf/branches/CONNECTORS-1344/connectors/slack/connector/src/main/java/org/apache/manifoldcf/crawler/notifications/slack/SlackSession.java
    manifoldcf/branches/CONNECTORS-1344/connectors/slack/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/notifications/slack/common_en_US.properties
    manifoldcf/branches/CONNECTORS-1344/connectors/slack/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/notifications/slack/common_es_ES.properties
    manifoldcf/branches/CONNECTORS-1344/connectors/slack/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/notifications/slack/common_ja_JP.properties
    manifoldcf/branches/CONNECTORS-1344/connectors/slack/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/notifications/slack/common_zh_CN.properties
    manifoldcf/branches/CONNECTORS-1344/connectors/slack/connector/src/main/resources/org/apache/manifoldcf/crawler/notifications/slack/ConfigurationHeader.js
    manifoldcf/branches/CONNECTORS-1344/connectors/slack/connector/src/main/resources/org/apache/manifoldcf/crawler/notifications/slack/ConfigurationView.html
    manifoldcf/branches/CONNECTORS-1344/connectors/slack/connector/src/main/resources/org/apache/manifoldcf/crawler/notifications/slack/Configuration_Server.html

Modified: manifoldcf/branches/CONNECTORS-1344/connectors/slack/connector/src/main/java/org/apache/manifoldcf/crawler/notifications/slack/SlackConfig.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-1344/connectors/slack/connector/src/main/java/org/apache/manifoldcf/crawler/notifications/slack/SlackConfig.java?rev=1771641&r1=1771640&r2=1771641&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-1344/connectors/slack/connector/src/main/java/org/apache/manifoldcf/crawler/notifications/slack/SlackConfig.java
(original)
+++ manifoldcf/branches/CONNECTORS-1344/connectors/slack/connector/src/main/java/org/apache/manifoldcf/crawler/notifications/slack/SlackConfig.java
Sun Nov 27 20:19:38 2016
@@ -30,6 +30,32 @@ public class SlackConfig {
   public static final String WEBHOOK_URL_PARAM = "webHookUrl";
 
   /**
+   * Proxy Host
+   */
+  public static final String PROXY_HOST_PARAM = "proxyHost";
+
+  /**
+   * Proxy Port
+   */
+
+  public static final String PROXY_PORT_PARAM = "proxyPort";
+
+  /**
+   * Proxy Username
+   */
+  public static final String PROXY_USERNAME_PARAM = "proxyUsername";
+
+  /**
+   * Proxy Password
+   */
+  public static final String PROXY_PASSWORD_PARAM = "proxyPassword";
+
+  /**
+   * Proxy Domain
+   */
+  public static final String PROXY_DOMAIN_PARAM = "proxyDomain";
+
+  /**
   * URL template
   */
   public static final String URL_PARAM = "url";

Modified: manifoldcf/branches/CONNECTORS-1344/connectors/slack/connector/src/main/java/org/apache/manifoldcf/crawler/notifications/slack/SlackConnector.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-1344/connectors/slack/connector/src/main/java/org/apache/manifoldcf/crawler/notifications/slack/SlackConnector.java?rev=1771641&r1=1771640&r2=1771641&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-1344/connectors/slack/connector/src/main/java/org/apache/manifoldcf/crawler/notifications/slack/SlackConnector.java
(original)
+++ manifoldcf/branches/CONNECTORS-1344/connectors/slack/connector/src/main/java/org/apache/manifoldcf/crawler/notifications/slack/SlackConnector.java
Sun Nov 27 20:19:38 2016
@@ -49,6 +49,9 @@ public class SlackConnector extends org.
 
   protected String webHookUrl = null;
 
+  // Parameters for proxy connection
+  protected SlackSession.ProxySettings proxySettings = null;
+
   // Local session handle
   protected SlackSession session = null;
 
@@ -64,6 +67,17 @@ public class SlackConnector extends org.
   public void connect(ConfigParams configParameters) {
     super.connect(configParameters);
     this.webHookUrl = configParameters.getParameter(SlackConfig.WEBHOOK_URL_PARAM);
+
+    String proxyHost = configParameters.getParameter(SlackConfig.PROXY_HOST_PARAM);
+    String proxyPortString = configParameters.getParameter(SlackConfig.PROXY_PORT_PARAM);
+    if(StringUtils.isNotEmpty(proxyHost) && StringUtils.isNotEmpty(proxyPortString))
{
+      String proxyUsername = configParameters.getParameter(SlackConfig.PROXY_USERNAME_PARAM);
+      String proxyPassword = configParameters.getObfuscatedParameter(SlackConfig.PROXY_PASSWORD_PARAM);
+      String proxyDomain = configParameters.getParameter(SlackConfig.PROXY_DOMAIN_PARAM);
+      this.proxySettings = new SlackSession.ProxySettings(proxyHost, proxyPortString, proxyUsername,
proxyPassword, proxyDomain);
+    } else {
+      Logging.connectors.info("Using no proxy settings - no proxyHost and no proxyPort found.");
+    }
   }
 
   /**
@@ -74,6 +88,7 @@ public class SlackConnector extends org.
   public void disconnect()
     throws ManifoldCFException {
     this.webHookUrl = null;
+    this.proxySettings = null;
     finalizeConnection();
     super.disconnect();
   }
@@ -134,7 +149,7 @@ public class SlackConnector extends org.
 
       // Create a session.
       try {
-        ConnectThread connectThread = new ConnectThread(webHookUrl);
+        ConnectThread connectThread = new ConnectThread(webHookUrl, proxySettings);
         connectThread.start();
         session = connectThread.finishUp();
       } catch (InterruptedException e) {
@@ -315,11 +330,34 @@ public class SlackConnector extends org.
   }
 
   private static void fillInServerConfigurationMap(Map<String, Object> paramMap, IPasswordMapperActivity
mapper, ConfigParams parameters) {
-    String webHookUrl = parameters.getParameter(SlackConfig.WEBHOOK_URL_PARAM);
-    if (webHookUrl == null)
-      webHookUrl = StringUtils.EMPTY;
+    String webHookUrl = getEmptyOnNull(parameters, SlackConfig.WEBHOOK_URL_PARAM);
+    String proxyHost = getEmptyOnNull(parameters, SlackConfig.PROXY_HOST_PARAM);
+    String proxyPort = getEmptyOnNull(parameters, SlackConfig.PROXY_PORT_PARAM);
+    String proxyUsername = getEmptyOnNull(parameters, SlackConfig.PROXY_USERNAME_PARAM);
+
+    String proxyPassword = parameters.getObfuscatedParameter(SlackConfig.PROXY_PASSWORD_PARAM);
+    if(proxyPassword == null) {
+      proxyPassword = StringUtils.EMPTY;
+    } else {
+      mapper.mapPasswordToKey(proxyPassword);
+    }
+
+    String proxyDomain = getEmptyOnNull(parameters, SlackConfig.PROXY_DOMAIN_PARAM);
 
     paramMap.put("WEBHOOK_URL", webHookUrl);
+    paramMap.put("PROXY_HOST", proxyHost);
+    paramMap.put("PROXY_PORT", proxyPort);
+    paramMap.put("PROXY_USERNAME", proxyUsername);
+    paramMap.put("PROXY_PASSWORD", proxyPassword);
+    paramMap.put("PROXY_DOMAIN", proxyDomain);
+  }
+
+  private static String getEmptyOnNull(ConfigParams parameters, String key) {
+    String value = parameters.getParameter(key);
+    if (value == null) {
+      value = StringUtils.EMPTY;
+    }
+    return value;
   }
 
   /**
@@ -340,9 +378,43 @@ public class SlackConnector extends org.
   public String processConfigurationPost(IThreadContext threadContext, IPostParameters variableContext,
     ConfigParams parameters) throws ManifoldCFException {
 
-    String webHookUrl = variableContext.getParameter("webHookUrl");
-    if (webHookUrl != null)
+    final String webHookUrl = variableContext.getParameter("webHookUrl");
+    if (webHookUrl != null) {
       parameters.setParameter(SlackConfig.WEBHOOK_URL_PARAM, webHookUrl);
+    }
+
+    final String proxyHost = variableContext.getParameter("proxyHost");
+    if (proxyHost != null) {
+      parameters.setParameter(SlackConfig.PROXY_HOST_PARAM, proxyHost);
+    }
+
+    final String proxyPort = variableContext.getParameter("proxyPort");
+    if (StringUtils.isNotEmpty(proxyPort)) {
+      try {
+        Integer.parseInt(proxyPort);
+      } catch (NumberFormatException e) {
+        Logging.connectors.warn("Proxy port must be a number. Found " + proxyPort);
+        throw new ManifoldCFException("Proxy Port must be a number: " + e.getMessage(), e);
+      }
+      parameters.setParameter(SlackConfig.PROXY_PORT_PARAM, proxyPort);
+    } else if(proxyPort != null){
+      parameters.setParameter(SlackConfig.PROXY_PORT_PARAM, proxyPort);
+    }
+
+    final String proxyUsername = variableContext.getParameter("proxyUsername");
+    if (proxyUsername != null) {
+      parameters.setParameter(SlackConfig.PROXY_USERNAME_PARAM, proxyUsername);
+    }
+
+    final String proxyPassword = variableContext.getParameter("proxyPassword");
+    if (proxyPassword != null) {
+      parameters.setObfuscatedParameter(SlackConfig.PROXY_PASSWORD_PARAM, variableContext.mapKeyToPassword(proxyPassword));
+    }
+
+    final String proxyDomain = variableContext.getParameter("proxyDomain");
+    if (proxyDomain != null) {
+      parameters.setParameter(SlackConfig.PROXY_DOMAIN_PARAM, proxyDomain);
+    }
 
     return null;
   }
@@ -451,7 +523,6 @@ public class SlackConnector extends org.
       }
     }
     // If ANY of the above are non-empty, we create a new dummy record
-    // TODO check if channel check is right
     if (channel.length() > 0) {
       // Add the dummy records
       addRecord(paramMap, SlackConfig.NODE_FINISHED, channel, message);
@@ -613,14 +684,16 @@ public class SlackConnector extends org.
   protected static class ConnectThread extends Thread
   {
     protected final String webHookUrl;
+    protected final SlackSession.ProxySettings proxySettings;
 
     // Local session handle
     protected SlackSession session = null;
     protected Throwable exception = null;
 
-    public ConnectThread(String webHookUrl)
+    public ConnectThread(String webHookUrl, SlackSession.ProxySettings proxySettings)
     {
       this.webHookUrl = webHookUrl;
+      this.proxySettings = proxySettings;
       setDaemon(true);
     }
 
@@ -628,7 +701,7 @@ public class SlackConnector extends org.
     {
       try
       {
-        session = new SlackSession(webHookUrl);
+        session = new SlackSession(webHookUrl, proxySettings);
       }
       catch (Throwable e)
       {
@@ -814,5 +887,4 @@ public class SlackConnector extends org.
       }
     }
   }
-
 }
\ No newline at end of file

Modified: manifoldcf/branches/CONNECTORS-1344/connectors/slack/connector/src/main/java/org/apache/manifoldcf/crawler/notifications/slack/SlackSession.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-1344/connectors/slack/connector/src/main/java/org/apache/manifoldcf/crawler/notifications/slack/SlackSession.java?rev=1771641&r1=1771640&r2=1771641&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-1344/connectors/slack/connector/src/main/java/org/apache/manifoldcf/crawler/notifications/slack/SlackSession.java
(original)
+++ manifoldcf/branches/CONNECTORS-1344/connectors/slack/connector/src/main/java/org/apache/manifoldcf/crawler/notifications/slack/SlackSession.java
Sun Nov 27 20:19:38 2016
@@ -21,19 +21,32 @@ package org.apache.manifoldcf.crawler.no
 import java.io.IOException;
 import java.nio.charset.StandardCharsets;
 
+import javax.net.ssl.SSLSocketFactory;
+
 import org.apache.commons.lang.StringUtils;
 import org.apache.http.HttpEntity;
+import org.apache.http.HttpHost;
 import org.apache.http.HttpStatus;
 import org.apache.http.StatusLine;
+import org.apache.http.auth.AuthScope;
+import org.apache.http.auth.NTCredentials;
+import org.apache.http.client.CredentialsProvider;
 import org.apache.http.client.HttpResponseException;
 import org.apache.http.client.config.RequestConfig;
 import org.apache.http.client.entity.EntityBuilder;
 import org.apache.http.client.methods.CloseableHttpResponse;
 import org.apache.http.client.methods.HttpPost;
+import org.apache.http.conn.ssl.NoopHostnameVerifier;
+import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
 import org.apache.http.entity.ContentType;
+import org.apache.http.impl.client.BasicCredentialsProvider;
 import org.apache.http.impl.client.CloseableHttpClient;
 import org.apache.http.impl.client.HttpClientBuilder;
 import org.apache.http.util.EntityUtils;
+import org.apache.manifoldcf.connectorcommon.common.InterruptibleSocketFactory;
+import org.apache.manifoldcf.connectorcommon.interfaces.KeystoreManagerFactory;
+import org.apache.manifoldcf.core.interfaces.ManifoldCFException;
+import org.apache.manifoldcf.crawler.system.Logging;
 
 import com.fasterxml.jackson.annotation.JsonInclude.Include;
 import com.fasterxml.jackson.databind.ObjectMapper;
@@ -44,12 +57,34 @@ import com.fasterxml.jackson.databind.Ob
 public class SlackSession
 {
 
+  private static String currentHost = null;
+
   private CloseableHttpClient httpClient;
   private ObjectMapper objectMapper;
   private final String webHookUrl;
 
-  /** Create a session */
-  public SlackSession(final String webHookUrl)
+  static
+  {
+    // Find the current host name
+    try
+    {
+      java.net.InetAddress addr = java.net.InetAddress.getLocalHost();
+
+      // Get hostname
+      currentHost = addr.getHostName();
+    }
+    catch (java.net.UnknownHostException e)
+    {
+    }
+  }
+
+  /**
+   * Create a session.
+   * @param webHookUrl - the webHookUrl to use for slack messages.
+   * @param proxySettingsOrNull - the proxy settings or null if not necessary.
+   * @throws ManifoldCFException 
+   */
+  public SlackSession(final String webHookUrl, final ProxySettings proxySettingsOrNull) throws
ManifoldCFException
   {
     this.webHookUrl = webHookUrl;
     this.objectMapper = new ObjectMapper();
@@ -58,17 +93,46 @@ public class SlackSession
     int connectionTimeout = 60000;
     int socketTimeout = 900000;
 
-    RequestConfig requestConfig = RequestConfig.custom()
+    final RequestConfig.Builder requestBuilder = RequestConfig.custom()
         .setSocketTimeout(socketTimeout)
         .setConnectTimeout(connectionTimeout)
-        .setConnectionRequestTimeout(socketTimeout)
-        .build();
+        .setConnectionRequestTimeout(socketTimeout);
+
+    if(proxySettingsOrNull != null) {
+      addProxySettings(requestBuilder, proxySettingsOrNull);
+    }
+
+    // Create a ssl socket factory trusting everything.
+    // Reason: manifoldcf wishes connectors to encapsulate certificate handling
+    //         per connection and not rely on the global keystore.
+    //         A configurable keystore seems overkill for the slack notification use case
+    //         so we trust everything.
+    SSLSocketFactory httpsSocketFactory = KeystoreManagerFactory.getTrustingSecureSocketFactory();
+    SSLConnectionSocketFactory myFactory = new SSLConnectionSocketFactory(new InterruptibleSocketFactory(httpsSocketFactory,connectionTimeout),
+        NoopHostnameVerifier.INSTANCE);
 
     httpClient = HttpClientBuilder.create()
-        .setDefaultRequestConfig(requestConfig)
+        .setDefaultRequestConfig(requestBuilder.build())
+        .setSSLSocketFactory(myFactory)
         .build();
   }
 
+  private void addProxySettings(RequestConfig.Builder requestBuilder, ProxySettings proxySettingsOrNull)
+  {
+    if (proxySettingsOrNull.hasUsername()) {
+      CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
+      credentialsProvider.setCredentials(
+          new AuthScope(proxySettingsOrNull.getHost(), proxySettingsOrNull.getPort()),
+          new NTCredentials(proxySettingsOrNull.getUsername(),
+              (proxySettingsOrNull.getPassword() == null) ? "" : proxySettingsOrNull.getPassword(),
+                  currentHost,
+                  (proxySettingsOrNull.getDomain() == null) ? "" : proxySettingsOrNull.getDomain()));
+    }
+
+    HttpHost proxy = new HttpHost(proxySettingsOrNull.getHost(), proxySettingsOrNull.getPort());
+    requestBuilder.setProxy(proxy);
+  }
+
   public void checkConnection() throws IOException
   {
     HttpPost headRequest = new HttpPost(webHookUrl);
@@ -102,10 +166,10 @@ public class SlackSession
     String json = objectMapper.writeValueAsString(slackMessage);
 
     HttpEntity entity = EntityBuilder.create()
-      .setContentType(ContentType.APPLICATION_JSON)
-      .setContentEncoding(StandardCharsets.UTF_8.name())
-      .setText(json)
-      .build();
+        .setContentType(ContentType.APPLICATION_JSON)
+        .setContentEncoding(StandardCharsets.UTF_8.name())
+        .setText(json)
+        .build();
 
     messagePost.setEntity(entity);
     try (CloseableHttpResponse response = httpClient.execute(messagePost)) {
@@ -119,4 +183,62 @@ public class SlackSession
     httpClient = null;
     objectMapper = null;
   }
+
+  protected static final class ProxySettings {
+    private String host;
+    private int port = -1;
+    private String username;
+    private String password;
+    private String domain;
+
+    public ProxySettings(String host, String portString, String username, String password,
String domain) {
+      this.host = host;
+      if(StringUtils.isNotEmpty(portString)) {
+        try {
+          this.port = Integer.parseInt(portString);
+        } catch (NumberFormatException e) {
+          Logging.connectors.warn("Proxy port must be an number. Found " + portString);
+        }
+      }
+      this.username = username;
+      this.password = password;
+      this.domain = domain;
+    }
+
+    public String getHost() {
+      return host;
+    }
+
+    public int getPort() {
+      return port;
+    }
+
+    public String getUsername() {
+      return username;
+    }
+
+    public boolean hasUsername() {
+      return StringUtils.isNotEmpty(this.username);
+    }
+
+    public String getPassword() {
+      return password;
+    }
+
+    public String getDomain() {
+      return domain;
+    }
+
+    @Override
+    public String toString() {
+      final StringBuilder sb = new StringBuilder("ProxySettings{");
+      sb.append("host='").append(host).append('\'');
+      sb.append(", port=").append(port);
+      sb.append(", username='").append(username).append('\'');
+      sb.append(", password='").append(password).append('\'');
+      sb.append(", domain='").append(domain).append('\'');
+      sb.append('}');
+      return sb.toString();
+    }
+  }
 }
\ No newline at end of file

Modified: manifoldcf/branches/CONNECTORS-1344/connectors/slack/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/notifications/slack/common_en_US.properties
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-1344/connectors/slack/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/notifications/slack/common_en_US.properties?rev=1771641&r1=1771640&r2=1771641&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-1344/connectors/slack/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/notifications/slack/common_en_US.properties
(original)
+++ manifoldcf/branches/CONNECTORS-1344/connectors/slack/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/notifications/slack/common_en_US.properties
Sun Nov 27 20:19:38 2016
@@ -17,8 +17,15 @@ SlackConnector.WebHook=Slack WebHook
 SlackConnector.Message=Message
 
 SlackConnector.EnterAWebHookUrl=Enter a Slack WebHook URL
+SlackConnector.ProxyPortMustBeAnInteger=Proxy port must be an integer
+SlackConnector.ProxyPortMustBeGivenWithHost=Proxy port must be given when proxy host is configured
 
 SlackConnector.WebHookUrlColon=WebHook URL:
+SlackConnector.ProxyHostColon=Proxy Host:
+SlackConnector.ProxyPortColon=Proxy Port:
+SlackConnector.ProxyUsernameColon=Proxy NTLM Username:
+SlackConnector.ProxyPasswordColon=Proxy NTLM Password:
+SlackConnector.ProxyDomainColon=Proxy NTLM Authentication Domain:
 
 SlackConnector.JobFinished=Job finished
 SlackConnector.JobStopErrorAbort=Job stopped due to error abort

Modified: manifoldcf/branches/CONNECTORS-1344/connectors/slack/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/notifications/slack/common_es_ES.properties
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-1344/connectors/slack/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/notifications/slack/common_es_ES.properties?rev=1771641&r1=1771640&r2=1771641&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-1344/connectors/slack/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/notifications/slack/common_es_ES.properties
(original)
+++ manifoldcf/branches/CONNECTORS-1344/connectors/slack/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/notifications/slack/common_es_ES.properties
Sun Nov 27 20:19:38 2016
@@ -17,8 +17,15 @@ SlackConnector.WebHook=Slack WebHook
 SlackConnector.Message=Message
 
 SlackConnector.EnterAWebHookUrl=Enter a Slack WebHook URL
+SlackConnector.ProxyPortMustBeAnInteger=Proxy port must be an integer
+SlackConnector.ProxyPortMustBeGivenWithHost=Proxy port must be given when proxy host is configured
 
 SlackConnector.WebHookUrlColon=WebHook URL:
+SlackConnector.ProxyHostColon=Proxy Host:
+SlackConnector.ProxyPortColon=Proxy Port:
+SlackConnector.ProxyUsernameColon=Proxy NTLM Username:
+SlackConnector.ProxyPasswordColon=Proxy NTLM Password:
+SlackConnector.ProxyDomainColon=Proxy NTLM Authentication Domain:
 
 SlackConnector.JobFinished=Job finished
 SlackConnector.JobStopErrorAbort=Job stopped due to error abort

Modified: manifoldcf/branches/CONNECTORS-1344/connectors/slack/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/notifications/slack/common_ja_JP.properties
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-1344/connectors/slack/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/notifications/slack/common_ja_JP.properties?rev=1771641&r1=1771640&r2=1771641&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-1344/connectors/slack/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/notifications/slack/common_ja_JP.properties
(original)
+++ manifoldcf/branches/CONNECTORS-1344/connectors/slack/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/notifications/slack/common_ja_JP.properties
Sun Nov 27 20:19:38 2016
@@ -17,8 +17,15 @@ SlackConnector.WebHook=Slack WebHook
 SlackConnector.Message=Message
 
 SlackConnector.EnterAWebHookUrl=Enter a Slack WebHook URL
+SlackConnector.ProxyPortMustBeAnInteger=Proxy port must be an integer
+SlackConnector.ProxyPortMustBeGivenWithHost=Proxy port must be given when proxy host is configured
 
 SlackConnector.WebHookUrlColon=WebHook URL:
+SlackConnector.ProxyHostColon=Proxy Host:
+SlackConnector.ProxyPortColon=Proxy Port:
+SlackConnector.ProxyUsernameColon=Proxy NTLM Username:
+SlackConnector.ProxyPasswordColon=Proxy NTLM Password:
+SlackConnector.ProxyDomainColon=Proxy NTLM Authentication Domain:
 
 SlackConnector.JobFinished=Job finished
 SlackConnector.JobStopErrorAbort=Job stopped due to error abort

Modified: manifoldcf/branches/CONNECTORS-1344/connectors/slack/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/notifications/slack/common_zh_CN.properties
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-1344/connectors/slack/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/notifications/slack/common_zh_CN.properties?rev=1771641&r1=1771640&r2=1771641&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-1344/connectors/slack/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/notifications/slack/common_zh_CN.properties
(original)
+++ manifoldcf/branches/CONNECTORS-1344/connectors/slack/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/notifications/slack/common_zh_CN.properties
Sun Nov 27 20:19:38 2016
@@ -17,8 +17,15 @@ SlackConnector.WebHook=Slack WebHook
 SlackConnector.Message=Message
 
 SlackConnector.EnterAWebHookUrl=Enter a Slack WebHook URL
+SlackConnector.ProxyPortMustBeAnInteger=Proxy port must be an integer
+SlackConnector.ProxyPortMustBeGivenWithHost=Proxy port must be given when proxy host is configured
 
 SlackConnector.WebHookUrlColon=WebHook URL:
+SlackConnector.ProxyHostColon=Proxy Host:
+SlackConnector.ProxyPortColon=Proxy Port:
+SlackConnector.ProxyUsernameColon=Proxy NTLM Username:
+SlackConnector.ProxyPasswordColon=Proxy NTLM Password:
+SlackConnector.ProxyDomainColon=Proxy NTLM Authentication Domain:
 
 SlackConnector.JobFinished=Job finished
 SlackConnector.JobStopErrorAbort=Job stopped due to error abort

Modified: manifoldcf/branches/CONNECTORS-1344/connectors/slack/connector/src/main/resources/org/apache/manifoldcf/crawler/notifications/slack/ConfigurationHeader.js
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-1344/connectors/slack/connector/src/main/resources/org/apache/manifoldcf/crawler/notifications/slack/ConfigurationHeader.js?rev=1771641&r1=1771640&r2=1771641&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-1344/connectors/slack/connector/src/main/resources/org/apache/manifoldcf/crawler/notifications/slack/ConfigurationHeader.js
(original)
+++ manifoldcf/branches/CONNECTORS-1344/connectors/slack/connector/src/main/resources/org/apache/manifoldcf/crawler/notifications/slack/ConfigurationHeader.js
Sun Nov 27 20:19:38 2016
@@ -16,7 +16,16 @@
 -->
 
 <script type="text/javascript">
-<!--
+function checkConfig()
+{
+  if (editconnection.proxyPort.value != "" && !isInteger(editconnection.proxyPort.value))
+  {
+    alert("$Encoder.bodyJavascriptEscape($ResourceBundle.getString('SlackConnector.ProxyPortMustBeAnInteger'))");
+    editconnection.proxyPort.focus();
+    return false;
+  }
+  return true;
+}
 
 function checkConfigForSave()
 {
@@ -27,6 +36,20 @@ function checkConfigForSave()
     editconnection.webHookUrl.focus();
     return false;
   }
+  if (editconnection.proxyHost.value != "" && editconnection.proxyPort.value == "")
+  {
+    alert("$Encoder.bodyJavascriptEscape($ResourceBundle.getString('SlackConnector.ProxyPortMustBeGivenWithHost'))");
+    SelectTab("$Encoder.bodyJavascriptEscape($ResourceBundle.getString('SlackConnector.WebHook'))");
+    editconnection.proxyPort.focus();
+    return false;
+  }
+  if (editconnection.proxyPort.value != "" && !isInteger(editconnection.proxyPort.value))
+  {
+    alert("$Encoder.bodyJavascriptEscape($ResourceBundle.getString('SlackConnector.ProxyPortMustBeAnInteger'))");
+    SelectTab("$Encoder.bodyJavascriptEscape($ResourceBundle.getString('SlackConnector.WebHook'))");
+    editconnection.proxyPort.focus();
+    return false;
+  }
   return true;
 }
 

Modified: manifoldcf/branches/CONNECTORS-1344/connectors/slack/connector/src/main/resources/org/apache/manifoldcf/crawler/notifications/slack/ConfigurationView.html
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-1344/connectors/slack/connector/src/main/resources/org/apache/manifoldcf/crawler/notifications/slack/ConfigurationView.html?rev=1771641&r1=1771640&r2=1771641&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-1344/connectors/slack/connector/src/main/resources/org/apache/manifoldcf/crawler/notifications/slack/ConfigurationView.html
(original)
+++ manifoldcf/branches/CONNECTORS-1344/connectors/slack/connector/src/main/resources/org/apache/manifoldcf/crawler/notifications/slack/ConfigurationView.html
Sun Nov 27 20:19:38 2016
@@ -25,6 +25,46 @@ limitations under the License.
       <nobr>$Encoder.bodyEscape($WEBHOOK_URL)</nobr>
     </td>
   </tr>
-
+  <tr>
+    <td class="description">
+      <nobr>$Encoder.bodyEscape($ResourceBundle.getString('SlackConnector.ProxyHostColon'))</nobr>
+    </td>
+    <td class="value">
+      <nobr>$Encoder.bodyEscape($PROXY_HOST)</nobr>
+    </td>
+  </tr>
+  <tr>
+    <td class="description">
+      <nobr>$Encoder.bodyEscape($ResourceBundle.getString('SlackConnector.ProxyPortColon'))</nobr>
+    </td>
+    <td class="value">
+      <nobr>$Encoder.bodyEscape($PROXY_PORT)</nobr>
+    </td>
+  </tr>
+  <tr>
+    <td class="description">
+      <nobr>$Encoder.bodyEscape($ResourceBundle.getString('SlackConnector.ProxyUsernameColon'))</nobr>
+    </td>
+    <td class="value">
+      <nobr>$Encoder.bodyEscape($PROXY_USERNAME)</nobr>
+    </td>
+  </tr>
+  <tr>
+    <td class="description">
+      <nobr>$Encoder.bodyEscape($ResourceBundle.getString('SlackConnector.ProxyPasswordColon'))</nobr>
+    </td>
+    <td class="value">
+      #if($PROXY_PASSWORD && !$PROXY_PASSWORD.empty)
+      <nobr>********</nobr>
+      #end
+    </td>
+  </tr>
+  <tr>
+    <td class="description">
+      <nobr>$Encoder.bodyEscape($ResourceBundle.getString('SlackConnector.ProxyDomainColon'))</nobr>
+    </td>
+    <td class="value">
+      <nobr>$Encoder.bodyEscape($PROXY_DOMAIN)</nobr>
+    </td>
 </table>
 

Modified: manifoldcf/branches/CONNECTORS-1344/connectors/slack/connector/src/main/resources/org/apache/manifoldcf/crawler/notifications/slack/Configuration_Server.html
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-1344/connectors/slack/connector/src/main/resources/org/apache/manifoldcf/crawler/notifications/slack/Configuration_Server.html?rev=1771641&r1=1771640&r2=1771641&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-1344/connectors/slack/connector/src/main/resources/org/apache/manifoldcf/crawler/notifications/slack/Configuration_Server.html
(original)
+++ manifoldcf/branches/CONNECTORS-1344/connectors/slack/connector/src/main/resources/org/apache/manifoldcf/crawler/notifications/slack/Configuration_Server.html
Sun Nov 27 20:19:38 2016
@@ -27,10 +27,55 @@ limitations under the License.
       <input id="webHookUrl" name="webHookUrl" type="text" size="80" value="$Encoder.attributeEscape($WEBHOOK_URL)"/>
     </td>
   </tr>
+  <tr>
+    <td class="description">
+      <nobr>$Encoder.bodyEscape($ResourceBundle.getString('SlackConnector.ProxyHostColon'))</nobr>
+    </td>
+    <td class="value">
+      <input id="proxyHost" name="proxyHost" type="text" size="32" value="$Encoder.attributeEscape($PROXY_HOST)"/>
+    </td>
+  </tr>
+  <tr>
+    <td class="description">
+      <nobr>$Encoder.bodyEscape($ResourceBundle.getString('SlackConnector.ProxyPortColon'))</nobr>
+    </td>
+    <td class="value">
+      <input id="proxyPort" name="proxyPort" type="text" size="5" value="$Encoder.attributeEscape($PROXY_PORT)"/>
+    </td>
+  </tr>
+  <tr>
+    <td class="description">
+      <nobr>$Encoder.bodyEscape($ResourceBundle.getString('SlackConnector.ProxyUsernameColon'))</nobr>
+    </td>
+    <td class="value">
+      <input id="proxyUsername" name="proxyUsername" type="text" size="32" value="$Encoder.attributeEscape($PROXY_USERNAME)"/>
+    </td>
+  </tr>
+  <tr>
+    <td class="description">
+      <nobr>$Encoder.bodyEscape($ResourceBundle.getString('SlackConnector.ProxyPasswordColon'))</nobr>
+    </td>
+    <td class="value">
+      <input id="proxyPassword" name="proxyPassword" type="password" size="32" value="$Encoder.attributeEscape($PROXY_PASSWORD)"/>
+    </td>
+  </tr>
+  <tr>
+    <td class="description">
+      <nobr>$Encoder.bodyEscape($ResourceBundle.getString('SlackConnector.ProxyDomainColon'))</nobr>
+    </td>
+    <td class="value">
+      <input id="proxyDomain" name="proxyDomain" type="text" size="32" value="$Encoder.attributeEscape($PROXY_DOMAIN)"/>
+    </td>
+  </tr>
 </table>
 
 #else
 
 <input type="hidden" name="webHookUrl" value="$Encoder.attributeEscape($WEBHOOK_URL)"/>
+<input type="hidden" name="proxyHost" value="$Encoder.attributeEscape($PROXY_HOST)"/>
+<input type="hidden" name="proxyPort" value="$Encoder.attributeEscape($PROXY_PORT)"/>
+<input type="hidden" name="proxyUsername" value="$Encoder.attributeEscape($PROXY_USERNAME)"/>
+<input type="hidden" name="proxyPassword" value="$Encoder.attributeEscape($PROXY_PASSWORD)"/>
+<input type="hidden" name="proxyDomain" value="$Encoder.attributeEscape($PROXY_DOMAIN)"/>
 
 #end
\ No newline at end of file



Mime
View raw message