+ * It will send a message to a call.home.user and listen/create new Chat + * sessions. + *
+ *
+ *
+ * REQUIRED VM Arguments or System Properties: + *
+ * -Dtruststore.file= -Dtruststore.password=password
+ * -Dsessionauth.url=https://(hostname)/sessionauth
+ * -Dkeyauth.url=https://(hostname)/keyauth
+ * -Duser.call.home=frank.tarsillo@markit.com -Duser.cert.password=password
+ * -Duser.cert.file=bot.user2.p12 -Duser.email=bot.user2@domain.com
+ * -Dpod.url=https://(pod host)/pod -Dagent.url=https://(agent server
+ * host)/agent -Dreceiver.email=bot.user2@markit.com or bot user email
+ *
+ * @author Dov Katz
+ */
+// NOSONAR
+public class SignalsExample {
+
+ private final Logger logger = LoggerFactory.getLogger(SignalsExample.class);
+ private SymphonyClient symClient;
+
+ public SignalsExample() {
+
+ init();
+
+ }
+
+ public static void main(String[] args) {
+
+ new SignalsExample();
+
+ }
+
+ public void init() {
+ logger.info("Signal Client example starting...");
+
+ try {
+
+ // Create an initialized client
+ symClient = SymphonyClientFactory.getClient(TYPE.V4);
+ symClient.init(new SymphonyClientConfig(true));
+ logger.info("My bot email is {}", symClient.getLocalUser().getEmailAddress());
+ logger.info("My bot' name is {}", symClient.getLocalUser().getDisplayName());
+
+ // List Signals
+ List
id. Basically non-deterministic, so YMMV.
+ */
public String get(SymphonyClientConfigID id) {
- String value = config.getProperty(id.getPropName());
+ String value = rawGet(id);
if (value == null)
value = System.getProperty(id.getPropName());
diff --git a/symphony-client/src/main/java/org/symphonyoss/client/SymphonyClientConfigBuilder.java b/symphony-client/src/main/java/org/symphonyoss/client/SymphonyClientConfigBuilder.java
index 3c9d6902..4b0ac96e 100644
--- a/symphony-client/src/main/java/org/symphonyoss/client/SymphonyClientConfigBuilder.java
+++ b/symphony-client/src/main/java/org/symphonyoss/client/SymphonyClientConfigBuilder.java
@@ -81,6 +81,7 @@ public static interface UserCredsStep
public static interface BuildStep
{
BuildStep withReceiverEmail(String receiverEmail);
+ BuildStep withGetAllUsersTimeout(String getAllUsersTimeout);
BuildStep withServices(boolean enabled);
BuildStep withJMXHealthcheck(boolean enabled);
SymphonyClientConfig build();
@@ -105,6 +106,7 @@ private static class Steps
private String userCertFilename = null;
private char[] userCertPassword = null;
private String receiverEmail = null;
+ private String getAllUsersTimeout = null;
private boolean servicesEnabled = true;
private boolean jmxHealthCheckEnabled = true;
@@ -160,6 +162,13 @@ public BuildStep withReceiverEmail(String receiverEmail)
return (this);
}
+ @Override
+ public BuildStep withGetAllUsersTimeout(String getAllUsersTimeout)
+ {
+ this.getAllUsersTimeout = getAllUsersTimeout;
+ return (this);
+ }
+
@Override
public BuildStep withServices(boolean enabled)
{
@@ -179,16 +188,18 @@ public SymphonyClientConfig build()
{
SymphonyClientConfig result = new SymphonyClientConfig();
- result.set(SymphonyClientConfigID.SESSIONAUTH_URL, this.sessionAuthUrl);
- result.set(SymphonyClientConfigID.KEYAUTH_URL, this.keyAuthUrl);
- result.set(SymphonyClientConfigID.POD_URL, this.podUrl);
- result.set(SymphonyClientConfigID.AGENT_URL, this.agentUrl);
- result.set(SymphonyClientConfigID.TRUSTSTORE_FILE, this.trustStoreFilename);
- result.set(SymphonyClientConfigID.TRUSTSTORE_PASSWORD, new String(this.trustStorePassword)); // SECURITY HOLE DUE TO STRING INTERNING
- result.set(SymphonyClientConfigID.USER_EMAIL, this.userEmail);
- result.set(SymphonyClientConfigID.USER_CERT_FILE, this.userCertFilename);
- result.set(SymphonyClientConfigID.USER_CERT_PASSWORD, new String(this.userCertPassword)); // SECURITY HOLE DUE TO STRING INTERNING
- result.set(SymphonyClientConfigID.RECEIVER_EMAIL, this.receiverEmail);
+ if (this.sessionAuthUrl != null) result.set(SymphonyClientConfigID.SESSIONAUTH_URL, this.sessionAuthUrl);
+ if (this.keyAuthUrl != null) result.set(SymphonyClientConfigID.KEYAUTH_URL, this.keyAuthUrl);
+ if (this.podUrl != null) result.set(SymphonyClientConfigID.POD_URL, this.podUrl);
+ if (this.agentUrl != null) result.set(SymphonyClientConfigID.AGENT_URL, this.agentUrl);
+ if (this.trustStoreFilename != null) result.set(SymphonyClientConfigID.TRUSTSTORE_FILE, this.trustStoreFilename);
+ if (this.trustStorePassword != null) result.set(SymphonyClientConfigID.TRUSTSTORE_PASSWORD, new String(this.trustStorePassword)); // SECURITY HOLE DUE TO STRING INTERNING
+ if (this.userEmail != null) result.set(SymphonyClientConfigID.USER_EMAIL, this.userEmail);
+ if (this.userCertFilename != null) result.set(SymphonyClientConfigID.USER_CERT_FILE, this.userCertFilename);
+ if (this.userCertPassword != null) result.set(SymphonyClientConfigID.USER_CERT_PASSWORD, new String(this.userCertPassword)); // SECURITY HOLE DUE TO STRING INTERNING
+ if (this.receiverEmail != null) result.set(SymphonyClientConfigID.RECEIVER_EMAIL, this.receiverEmail);
+ if (this.getAllUsersTimeout != null) result.set(SymphonyClientConfigID.GET_ALL_USERS_TIMEOUT, this.getAllUsersTimeout);
+
result.set(SymphonyClientConfigID.DISABLE_SERVICES, String.valueOf(!this.servicesEnabled));
result.set(SymphonyClientConfigID.HEALTHCHECK_JMX_ENABLED, String.valueOf(this.jmxHealthCheckEnabled));
diff --git a/symphony-client/src/main/java/org/symphonyoss/client/SymphonyClientConfigID.java b/symphony-client/src/main/java/org/symphonyoss/client/SymphonyClientConfigID.java
index 66de9add..c52b7b9c 100644
--- a/symphony-client/src/main/java/org/symphonyoss/client/SymphonyClientConfigID.java
+++ b/symphony-client/src/main/java/org/symphonyoss/client/SymphonyClientConfigID.java
@@ -28,6 +28,7 @@ public enum SymphonyClientConfigID {
USER_CERT_PASSWORD("javax.net.ssl.keyStorePassword"),
USER_EMAIL,
RECEIVER_EMAIL(false),
+ GET_ALL_USERS_TIMEOUT(false),
DISABLE_SERVICES(false),
HEALTHCHECK_JMX_ENABLED(false);
diff --git a/symphony-client/src/main/java/org/symphonyoss/client/exceptions/SignalsException.java b/symphony-client/src/main/java/org/symphonyoss/client/exceptions/SignalsException.java
new file mode 100644
index 00000000..7948e18d
--- /dev/null
+++ b/symphony-client/src/main/java/org/symphonyoss/client/exceptions/SignalsException.java
@@ -0,0 +1,43 @@
+/*
+ *
+ *
+ * Copyright 2018 The Symphony Software Foundation
+ *
+ * Licensed to The Symphony Software Foundation (SSF) 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.symphonyoss.client.exceptions;
+
+/**
+ * @author dovkatz on 03/13/2018
+ */
+public class SignalsException extends SymException {
+ @SuppressWarnings("unused")
+ public SignalsException(String message) {
+ super(message);
+ }
+
+ @SuppressWarnings("unused")
+ public SignalsException(Throwable cause) {
+ super(cause);
+ }
+
+ public SignalsException(String message, Throwable cause) {
+ super(message, cause);
+ }
+}
diff --git a/symphony-client/src/main/java/org/symphonyoss/client/impl/AuthRefreshTask.java b/symphony-client/src/main/java/org/symphonyoss/client/impl/AuthRefreshTask.java
index 32f2f3b8..ef8bb914 100644
--- a/symphony-client/src/main/java/org/symphonyoss/client/impl/AuthRefreshTask.java
+++ b/symphony-client/src/main/java/org/symphonyoss/client/impl/AuthRefreshTask.java
@@ -66,9 +66,16 @@ public SymAuth runTask() {
AuthenticationClient authClient;
+
//Init the Symphony authorization client, which requires both the key and session URL's. In most cases,
- //the same fqdn but different URLs.
- if (symClient.getSymAuth() != null && symClient.getSymAuth().getHttpClient() != null) {
+ //the same fqdn but different URLs. Also take into account if there are different HTTP clients being used between POD and key manager.
+ if (symClient.getSymAuth() != null && symClient.getSymAuth().getHttpClientForKeyToken() != null && symClient.getSymAuth().getHttpClientForSessionToken() != null) {
+
+ //Take the stored http client configuration with the pre-loaded keystores.
+ authClient = new AuthenticationClient(symClient.getSymAuth().getSessionUrl(), symClient.getSymAuth().getKeyUrl(), symClient.getSymAuth().getHttpClientForSessionToken(), symClient.getSymAuth().getHttpClientForKeyToken());
+
+
+ } else if (symClient.getSymAuth() != null && symClient.getSymAuth().getHttpClient() != null) {
//Take the stored http client configuration with the pre-loaded keystores.
authClient = new AuthenticationClient(symClient.getSymAuth().getSessionUrl(), symClient.getSymAuth().getKeyUrl(), symClient.getSymAuth().getHttpClient());
@@ -92,14 +99,14 @@ public SymAuth runTask() {
//Create a SymAuth which holds both key and session tokens. This will call the external service.
- symAuth = authClient.authenticate();
+ symAuth = authClient.authenticate();
symClient.getSymAuth().setKeyToken(symAuth.getKeyToken());
symClient.getSymAuth().setSessionToken(symAuth.getSessionToken());
logger.info("Successfully refreshed SymAuth tokens...");
- } catch (NetworkException e) {
+ } catch (NetworkException | RuntimeException e) {
logger.error("Unable to refresh SymAuth keys...", e);
}
diff --git a/symphony-client/src/main/java/org/symphonyoss/client/impl/SymphonyBasicClient.java b/symphony-client/src/main/java/org/symphonyoss/client/impl/SymphonyBasicClient.java
index ca052c9b..9ed2077a 100644
--- a/symphony-client/src/main/java/org/symphonyoss/client/impl/SymphonyBasicClient.java
+++ b/symphony-client/src/main/java/org/symphonyoss/client/impl/SymphonyBasicClient.java
@@ -42,7 +42,7 @@
import org.symphonyoss.symphony.clients.jmx.ClientCheck;
import org.symphonyoss.symphony.clients.model.ApiVersion;
import org.symphonyoss.symphony.clients.model.SymUser;
-import org.symphonyoss.symphony.pod.invoker.JSON;
+
import javax.management.*;
import javax.ws.rs.client.Client;
@@ -78,6 +78,7 @@ public class SymphonyBasicClient implements SymphonyClient {
private UsersClient usersClient;
private StreamsClient streamsClient;
private PresenceClient presenceClient;
+ private SignalsClient signalsClient;
private RoomMembershipClient roomMembershipClient;
private AttachmentsClient attachmentsClient;
private ConnectionsClient connectionsClient;
@@ -285,6 +286,7 @@ public void init(SymAuth symAuth, SymphonyClientConfig config) throws InitExcept
dataFeedClient = DataFeedFactory.getClient(this);
messagesClient = MessagesFactory.getClient(this);
presenceClient = PresenceFactory.getClient(this);
+ signalsClient = SignalsFactory.getClient(this);
streamsClient = StreamsFactory.getClient(this);
usersClient = UsersFactory.getClient(this);
shareClient = ShareFactory.getClient(this);
@@ -461,6 +463,10 @@ public ShareClient getShareClient() {
return shareClient;
}
+ @Override
+ public SignalsClient getSignalsClient() {
+ return signalsClient;
+ }
/**
* Provides the default http client if one is set.
*
diff --git a/symphony-client/src/main/java/org/symphonyoss/client/model/SymAuth.java b/symphony-client/src/main/java/org/symphonyoss/client/model/SymAuth.java
index 01175c1c..b5d67198 100644
--- a/symphony-client/src/main/java/org/symphonyoss/client/model/SymAuth.java
+++ b/symphony-client/src/main/java/org/symphonyoss/client/model/SymAuth.java
@@ -44,6 +44,8 @@ public class SymAuth {
private String serverTruststorePassword;
private String clientKeystorePassword;
private Client httpClient;
+ private Client httpClientForSessionToken;
+ private Client httpClientForKeyToken;
public String getServerTruststore() {
@@ -130,6 +132,22 @@ public void setKeyUrl(String keyUrl) {
this.keyUrl = keyUrl;
}
+ public Client getHttpClientForSessionToken() {
+ return httpClientForSessionToken;
+ }
+
+ public void setHttpClientForSessionToken(Client httpClientForSessionToken) {
+ this.httpClientForSessionToken = httpClientForSessionToken;
+ }
+
+ public Client getHttpClientForKeyToken() {
+ return httpClientForKeyToken;
+ }
+
+ public void setHttpClientForKeyToken(Client httpClientForKeyToken) {
+ this.httpClientForKeyToken = httpClientForKeyToken;
+ }
+
public static SymAuth fromOboAuth(OboAuthResponse oboAuthResponse) {
if(oboAuthResponse==null)
diff --git a/symphony-client/src/main/java/org/symphonyoss/client/util/MlMessageParser.java b/symphony-client/src/main/java/org/symphonyoss/client/util/MlMessageParser.java
index 4e2ecd65..4f80756e 100644
--- a/symphony-client/src/main/java/org/symphonyoss/client/util/MlMessageParser.java
+++ b/symphony-client/src/main/java/org/symphonyoss/client/util/MlMessageParser.java
@@ -296,7 +296,9 @@ private void updateMentionUidToEmail(SymphonyClient symClient, List