blob: 3afef7d35dacf54d969a03275864f035d2e99ab1 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
/*******************************************************************************
* Copyright (c) 2004, 2007 Boeing.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
package org.eclipse.osee.ote.service.core;
import java.util.Properties;
import org.eclipse.osee.framework.messaging.EndpointSend;
import org.eclipse.osee.framework.messaging.ExceptionHandler;
import org.eclipse.osee.framework.messaging.Message;
import org.eclipse.osee.framework.messaging.id.ProtocolId;
import org.eclipse.osee.framework.messaging.id.StringName;
import org.eclipse.osee.framework.messaging.id.StringNamespace;
import org.eclipse.osee.framework.messaging.id.StringProtocolId;
import org.eclipse.osee.ote.core.environment.interfaces.ITestEnvironment;
import org.eclipse.osee.ote.service.IOteClientService;
/**
* @author Andrew M. Finkbeiner
*/
public class OteClientEndpointSend implements EndpointSend {
public static ProtocolId OTE_CLIENT_SEND_PROTOCOL = new StringProtocolId(new StringNamespace(
"org.eclipse.osee.ote.service.core"), new StringName("OteClientEndpointSend"));
private IOteClientService clientService;
@Override
public void send(Message message, ExceptionHandler exceptionHandler) {
if (clientService == null) {
exceptionHandler.handleException(new Exception(String.format(
"Unable to send message [%s], no client service is available.", message.toString())));
} else {
ITestEnvironment env = clientService.getConnectedEnvironment();
if (env == null) {
exceptionHandler.handleException(new Exception(String.format(
"Unable to send message [%s], there is not a connected environment.", message.toString())));
} else {
try {
env.sendMessage(message);
} catch (Throwable th) {
exceptionHandler.handleException(new Exception(String.format("Unable to send message [%s]",
message.toString()), th));
}
}
}
}
@Override
public void start(Properties properties) {
}
public void setTestClientService(IOteClientService testClientServiceImpl) {
this.clientService = testClientServiceImpl;
}
}
|