Commit 787e1e0f authored by Martti Käärik's avatar Martti Käärik
Browse files

TRI - added source/target component parameter to interaction functions.

parent 814c2d13
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -131,7 +131,7 @@ public class HttpSystemAdapter implements SystemAdapter {
	}

	@Override
	public void send(Data message, Connection connection) {
	public void send(Data message, Connection connection, NamedElement source) {
		HttpRequestData httpData = getRequestData(message);

		HttpRequest.Builder requestBuilder = HttpRequest.newBuilder();
@@ -196,7 +196,7 @@ public class HttpSystemAdapter implements SystemAdapter {
	}

	@Override
	public Data receive(Data expected, Connection connection) throws InterruptedException, AssertionError {
	public Data receive(Data expected, Connection connection, NamedElement target) throws InterruptedException, AssertionError {
		HttpResponseData expectedHttpData = expected != null ? getResponseData(expected) : null;

		synchronized (unhandledResponses) {
@@ -256,17 +256,17 @@ public class HttpSystemAdapter implements SystemAdapter {

	@Override
	public Data call(Procedure operation, Argument[] arguments, Data expectedReturn, Data expectedException,
			Connection connection) {
			Connection connection, NamedElement source) {
		throw new UnsupportedOperationException("Procedure-based communication is not supported by this adapter.");
	}

	@Override
	public Data[] receiveCall(Procedure operation, Data[] expectedArguments, Connection connection) {
	public Data[] receiveCall(Procedure operation, Data[] expectedArguments, Connection connection, NamedElement target) {
		throw new UnsupportedOperationException("Procedure-based communication is not supported by this adapter.");
	}

	@Override
	public void replyCall(Procedure operation, Data returnValue, Data exception, Connection connection) {
	public void replyCall(Procedure operation, Data returnValue, Data exception, Connection connection, NamedElement source) {
		throw new UnsupportedOperationException("Procedure-based communication is not supported by this adapter.");
	}

+10 −6
Original line number Diff line number Diff line
@@ -28,8 +28,9 @@ public interface SystemAdapter {
	 * 
	 * @param message    The data to be sent.
	 * @param connection The connection on which the message is to be sent.
	 * @param source     The component that sends the message.
	 */
	void send(Data message, Connection connection);
	void send(Data message, Connection connection, NamedElement source);

	/**
	 * Blocks until incoming data is available and tries to decode the first
@@ -48,13 +49,14 @@ public interface SystemAdapter {
	 *                   match against. If null then returns any data that is
	 *                   available after decoding.
	 * @param connection The connection on which the message is to be received.
	 * @param target     The component that receives the message.
	 * @return The data in expected format or null if most recent data didn't match
	 *         the expected one.
	 * @throws InterruptedException If the waiting thread is interrupted.
	 * @throws AssertionError       If the received data didn't match the expected
	 *                              data.
	 */
	Data receive(Data expected, Connection connection) throws InterruptedException, AssertionError;
	Data receive(Data expected, Connection connection, NamedElement target) throws InterruptedException, AssertionError;

	/**
	 * Calls a remote procedure and blocks until reply is received or exception is
@@ -76,18 +78,19 @@ public interface SystemAdapter {
	 *                          and value to match against.
	 * @param connection        The connection on which the procedure is to be
	 *                          called.
	 * @param source            The component that calls the procedure.
	 * @return The reply or exception in expected format.
	 * @throws InterruptedException If the waiting thread is interrupted.
	 * @throws AssertionError       If the received reply or exception didn't match
	 *                              the expected data.
	 */
	Data call(Procedure operation, Argument[] arguments, Data expectedReturn, Data expectedException,
			Connection connection) throws InterruptedException, AssertionError;
			Connection connection, NamedElement source) throws InterruptedException, AssertionError;

	/**
	 * @see #receive(Data, Connection)
	 * @see #receive(Data, Connection, NamedElement)
	 */
	Data[] receiveCall(Procedure operation, Data[] expectedArguments, Connection connection)
	Data[] receiveCall(Procedure operation, Data[] expectedArguments, Connection connection, NamedElement target)
			throws InterruptedException, AssertionError;

	/**
@@ -98,8 +101,9 @@ public interface SystemAdapter {
	 * @param reply      The reply to be sent.
	 * @param exception  The exception to be raised.
	 * @param connection The connection on which the response is to be sent.
	 * @param source     The component that sends the reply.
	 */
	void replyCall(Procedure operation, Data reply, Data exception, Connection connection);
	void replyCall(Procedure operation, Data reply, Data exception, Connection connection, NamedElement source);

	/**
	 * XXX do we need this?