Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 150217 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/tptp/platform/execution/datacollection/BaseAgent.java (+33 lines)
Lines 135-140 Link Here
135
    private native int sendData0(int targetInstanceId, char[] buffer, int bufferLength);
135
    private native int sendData0(int targetInstanceId, char[] buffer, int bufferLength);
136
    
136
    
137
    /**
137
    /**
138
     * Native function for sending data 
139
     */
140
    private native int sendData1(int targetInstanceId, byte[] buffer, int offset, int length);
141
    
142
     /**
138
     * Native function for sending a command to the Agent Controller
143
     * Native function for sending a command to the Agent Controller
139
     */
144
     */
140
    private native int sendCommand0(String command) throws InactiveAgentException;
145
    private native int sendCommand0(String command) throws InactiveAgentException;
Lines 312-317 Link Here
312
		if(response == -1){throw new AgentControllerUnavailableException(Constants.TPTP_PLATFORM_EXEC_MSG43);}
317
		if(response == -1){throw new AgentControllerUnavailableException(Constants.TPTP_PLATFORM_EXEC_MSG43);}
313
		return response;
318
		return response;
314
	}
319
	}
320
321
	/**
322
	* @see IBaseAgent#sendData(int, byte[])
323
	*/
324
	public int sendData(int targetInstanceId, byte[] buffer) throws AgentControllerUnavailableException {
325
		return sendData (targetInstanceId, buffer, 0, buffer.length);
326
	}
327
328
	/**
329
	 * @see IBaseAgent#sendData(int, byte[], int, int)
330
	 */
331
	public int sendData(int targetInstanceId, byte[] buffer,  int offset, int length) throws AgentControllerUnavailableException {
332
		if (buffer == null) return 0;
333
		if (offset > length)
334
			throw new IllegalArgumentException("Offset should not exceed array length");
335
336
		int response = this.sendData1(targetInstanceId, buffer, offset, length);
337
		if(response == -1){throw new AgentControllerUnavailableException(Constants.TPTP_PLATFORM_EXEC_MSG43);}
338
		return response;
339
	}
340
315
	/**
341
	/**
316
	 * @see IBaseAgent#receiveData(int, char[], int)
342
	 * @see IBaseAgent#receiveData(int, char[], int)
317
	 */
343
	 */
Lines 325-330 Link Here
325
		return 0;
351
		return 0;
326
	}
352
	}
327
	
353
	
354
 	/**
355
 	 * @see IBaseAgent#receiveData(int, char[], int)
356
 	 */
357
	public int receiveData(int sourceId, byte[] buffer, int bufferLength) throws AgentControllerUnavailableException {
358
		System.out.println(String.valueOf(bufferLength) + " bytes recvd. on the data channel");
359
		return 0;
360
	}
328
361
329
	/**
362
	/**
330
	 * @see IAgent#getName()
363
	 * @see IAgent#getName()
(-)src/org/eclipse/tptp/platform/execution/datacollection/IBaseAgent.java (+33 lines)
Lines 82-87 Link Here
82
	//public int sendData(int targetInstanceId, char[] buffer, int bufferLength) throws DataChannelConnectionException, NotConnectedException;
82
	//public int sendData(int targetInstanceId, char[] buffer, int bufferLength) throws DataChannelConnectionException, NotConnectedException;
83
	public int sendData(int targetInstanceId, char[] buffer) throws DataChannelConnectionException, AgentControllerUnavailableException;
83
	public int sendData(int targetInstanceId, char[] buffer) throws DataChannelConnectionException, AgentControllerUnavailableException;
84
	/**
84
	/**
85
 	 * send the given data buffer to the given destination
86
 	 * This method is used by the Remote Agent 
87
	 * on the AgentController to send the data to the Client
88
	 * @param targetInstanceId - send data to the target connection id
89
	 * @param buffer - data to be sent
90
	 * @throws DataChannelConnectionException
91
	 * @return 0 successful; non-zero error
92
	 */
93
	public int sendData(int targetInstanceId, byte[] buffer) throws AgentControllerUnavailableException;
94
	
95
	/**
96
	 * send the given data buffer to the given destination
97
	 * This method is used by the Remote Agent 
98
	 * on the AgentController to send the data to the Client
99
	 * @param targetInstanceId - send data to the target connection id
100
	 * @param buffer - data to be sent
101
	 * @param offset - start offset in the data
102
	 * @param length - number of bytes to send
103
	 * @throws DataChannelConnectionException
104
	 * @return 0 successful; non-zero error
105
	 */
106
	public int sendData(int targetInstanceId, byte[] buffer, int offset, int length) throws AgentControllerUnavailableException;
107
	
108
	/**
85
	 * ReceiveData from the Client 
109
	 * ReceiveData from the Client 
86
	 * @param sourceId 
110
	 * @param sourceId 
87
	 * @param buffer
111
	 * @param buffer
Lines 90-95 Link Here
90
	 */
114
	 */
91
	public int receiveData(int sourceId, String buffer, int bufferLength) throws DataChannelConnectionException, AgentControllerUnavailableException;
115
	public int receiveData(int sourceId, String buffer, int bufferLength) throws DataChannelConnectionException, AgentControllerUnavailableException;
92
	
116
	
117
 	/**
118
	 * ReceiveData from the Client 
119
	 * @param sourceId 
120
	 * @param buffer
121
	 * @param bufferLength
122
	 * @throws DataChannelConnectionException, NotConnectedException
123
	 */
124
	public int receiveData(int sourceId, byte[] buffer, int bufferLength) throws DataChannelConnectionException, AgentControllerUnavailableException;
125
	
93
	/**
126
	/**
94
	 * This method is invoked by the Agent Controller if there are no referencing clients
127
	 * This method is invoked by the Agent Controller if there are no referencing clients
95
	 */
128
	 */

Return to bug 150217