本文整理汇总了Java中org.symphonyoss.client.SymphonyClient类的典型用法代码示例。如果您正苦于以下问题:Java SymphonyClient类的具体用法?Java SymphonyClient怎么用?Java SymphonyClient使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SymphonyClient类属于org.symphonyoss.client包,在下文中一共展示了SymphonyClient类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createChat
import org.symphonyoss.client.SymphonyClient; //导入依赖的package包/类
private Chat createChat(SymphonyClient senderClient, SymphonyClient receiverClient) throws
StreamsException,
UsersClientException {
Chat chat = new Chat();
chat.setLocalUser(senderClient.getLocalUser());
Set<SymUser> remoteUsers = new HashSet<>();
//You need to add both users because you are using the same chat object for both sender and receiver.
remoteUsers.add(receiverClient.getLocalUser());
remoteUsers.add(senderClient.getLocalUser());
chat.setRemoteUsers(remoteUsers);
chat.setStream(senderClient.getStreamsClient().getStream(remoteUsers));
receiverClient.getChatService().addChat(chat);
return chat;
}
示例2: sendMessage
import org.symphonyoss.client.SymphonyClient; //导入依赖的package包/类
public static void sendMessage(SymphonyClient client, Chat chat, String message)
throws MessagesException {
SymMessage messageSubmission = new SymMessage();
messageSubmission.setMessageText(message);
client.getChatService().addChat(chat);
client.getMessageService().sendMessage(chat, messageSubmission);
}
示例3: getSymphonyClient
import org.symphonyoss.client.SymphonyClient; //导入依赖的package包/类
public static SymphonyClient getSymphonyClient(SymphonyClientConfig symphonyClientConfig) throws InitException, AuthenticationException {
SymphonyClient symClient = SymphonyClientFactory.getClient(SymphonyClientFactory.TYPE.BASIC);
String proxy = symphonyClientConfig.get("proxy.url");
if (proxy == null) {
symClient.init(symphonyClientConfig);
return symClient;
} else {
ClientConfig clientConfig = new ClientConfig();
clientConfig.connectorProvider(new ApacheConnectorProvider());
clientConfig.property(ClientProperties.PROXY_URI, proxy);
try {
Client httpClient = CustomHttpClient.getClient(
symphonyClientConfig.get(SymphonyClientConfigID.USER_CERT_FILE),
symphonyClientConfig.get(SymphonyClientConfigID.USER_CERT_PASSWORD),
symphonyClientConfig.get(SymphonyClientConfigID.TRUSTSTORE_FILE),
symphonyClientConfig.get(SymphonyClientConfigID.TRUSTSTORE_PASSWORD),
clientConfig);
symClient.init(httpClient, symphonyClientConfig);
return symClient;
} catch (Exception e) {
e.printStackTrace();
}
}
return symClient;
}
示例4: sendMessage
import org.symphonyoss.client.SymphonyClient; //导入依赖的package包/类
public static void sendMessage(String message, SymMessage.Format type, Long userID, SymphonyClient symClient) {
SymMessage userMessage = new SymMessage();
userMessage.setFormat(type);
userMessage.setMessage(message);
UserIdList list = new UserIdList();
list.add(userID);
try {
symClient.getMessagesClient().sendMessage(symClient.getStreamsClient().getStream(list), userMessage);
} catch (Exception e) {
e.printStackTrace();
}
}
示例5: getChat
import org.symphonyoss.client.SymphonyClient; //导入依赖的package包/类
public static Chat getChat(Long userID, SymphonyClient symClient) {
UserIdList list = new UserIdList();
list.add(userID);
Stream stream = null;
try {
stream = symClient.getStreamsClient().getStream(list);
} catch (Exception e) {
e.printStackTrace();
}
return symClient.getChatService().getChatByStream(stream.getId());
}
示例6: sendMessage
import org.symphonyoss.client.SymphonyClient; //导入依赖的package包/类
public static void sendMessage(String message, SymMessage.Format type, String email, SymphonyClient symClient) {
SymMessage userMessage = new SymMessage();
userMessage.setFormat(type);
userMessage.setMessage(message);
try {
symClient.getMessageService().sendMessage(email, userMessage);
} catch (Exception e) {
e.printStackTrace();
}
}
示例7: setSymphonyClient
import org.symphonyoss.client.SymphonyClient; //导入依赖的package包/类
@Override
public void setSymphonyClient(SymphonyClient symphonyClient) {
this.symClient = symphonyClient;
}
示例8: getSymClient
import org.symphonyoss.client.SymphonyClient; //导入依赖的package包/类
public SymphonyClient getSymClient() {
return symClient;
}
示例9: AiResponder
import org.symphonyoss.client.SymphonyClient; //导入依赖的package包/类
public AiResponder(SymphonyClient symClient) {
this.symClient = symClient;
}
示例10: sendMessage
import org.symphonyoss.client.SymphonyClient; //导入依赖的package包/类
/**
* Sends a message to a user
*
* @param message the message received from the user
* @param userID the id of the user
* @param symClient the org.org.symphonyoss.ai's sym client
*/
public void sendMessage(String message, Long userID, SymphonyClient symClient) {
SymUser symUser = new SymUser();
symUser.setId(userID);
try {
sendMessage(message, symClient.getStreamsClient().getStream(symUser), symClient);
} catch (Exception e) {
logger.error("Error sending message", e);
}
}
示例11: AiCommandListener
import org.symphonyoss.client.SymphonyClient; //导入依赖的package包/类
public AiCommandListener(SymphonyClient symClient) {
this.symClient = symClient;
aiResponder = new AiResponder(symClient);
}
示例12: isCommand
import org.symphonyoss.client.SymphonyClient; //导入依赖的package包/类
/**
* A method that allows other classes to determine if a given message
* matches a command in this command listener
*
* @param message the message
* @param symClient Symphony client
* @return True if the message is a command
*/
@SuppressWarnings("unused")
public static boolean isCommand(SymMessage message, SymphonyClient symClient) {
logger.debug("Received message for response.");
MlMessageParser mlMessageParser;
try {
mlMessageParser = new MlMessageParser(symClient);
mlMessageParser.parseMessage(message.getMessage());
String[] chunks = mlMessageParser.getTextChunks();
return chunks[0].charAt(0) == AiConstants.COMMAND;
} catch (Exception e) {
logger.error("Could not parse message {}", message.getMessage(), e);
}
return false;
}
示例13: getSymClient
import org.symphonyoss.client.SymphonyClient; //导入依赖的package包/类
@SuppressWarnings("unused")
public SymphonyClient getSymClient() {
return symClient;
}
示例14: ConnectionsService
import org.symphonyoss.client.SymphonyClient; //导入依赖的package包/类
public ConnectionsService(SymphonyClient symClient) {
this.symClient = symClient;
connectionsWorker = new ConnectionsWorker(symClient, this);
symClient.getMessageService().addConnectionsEventListener(this);
new Thread(connectionsWorker,"ConnectionsWorker: "+symClient.getName()).start();
}
示例15: ConnectionsWorker
import org.symphonyoss.client.SymphonyClient; //导入依赖的package包/类
public ConnectionsWorker(SymphonyClient symClient, ConnectionsListener connectionsListener) {
this.symClient = symClient;
this.connectionsListener = connectionsListener;
}