Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--docs/TCF Service - Streams.html31
-rw-r--r--plugins/org.eclipse.tm.tcf.core/src/org/eclipse/tm/internal/tcf/services/remote/StreamsProxy.java9
-rw-r--r--plugins/org.eclipse.tm.tcf.core/src/org/eclipse/tm/tcf/services/IStreams.java5
-rw-r--r--plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/model/TCFLaunch.java11
-rw-r--r--plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/tests/TestStreams.java2
5 files changed, 46 insertions, 12 deletions
diff --git a/docs/TCF Service - Streams.html b/docs/TCF Service - Streams.html
index 6c7879b8e..3d166f869 100644
--- a/docs/TCF Service - Streams.html
+++ b/docs/TCF Service - Streams.html
@@ -42,6 +42,10 @@
<td>0.2
<td>2009-05-18
<td>Added connect command
+ <tr>
+ <td>0.3
+ <td>2009-08-13
+ <td>Added "context ID" argument in "created" event
</table>
<h2><a name='Overview'>Overview</a></h2>
@@ -213,9 +217,27 @@ R &bull; <i>&lt;token&gt;</i> &bull; <i>&lt;error report&gt;</i> &bull;
Clients can change their subscription with <b>subscribe</b> and <b>unsubscribe</b> commands.</p>
<pre><b><font face="Courier New" size=2 color=#333399>
-E &bull; Streams &bull; created &bull; <i>&lt;string: stream type&gt;</i> &bull; <i>&lt;string: stream ID&gt;</i> &bull;
+E &bull; Streams &bull; created &bull; <i>&lt;string: stream type&gt;</i> &bull; <i>&lt;string: stream ID&gt;</i> &bull; <i>&lt;string: context ID&gt;</i> &bull;
+</font></b></pre>
+<p>
+Sent when a new stream is created.
+"stream type" - source type of the stream.
+"stream ID" - ID of the stream.
+"context ID" - a context ID that is associated with the stream, or null.
+</p>
+<p>
+Exact meaning of the context ID depends on stream type.
+Stream types and context IDs are defined by services that use Streams service to transmit data.
+</p>
+
+<pre><b><font face="Courier New" size=2 color=#333399>
E &bull; Streams &bull; disposed &bull; <i>&lt;string: stream type&gt;</i> &bull; <i>&lt;string: stream ID&gt;</i> &bull;
</font></b></pre>
+<p>
+Sent when a stream is disposed.
+"stream type" - source type of the stream.
+"stream ID" - ID of the stream.
+</p>
<h2><a name='API'>API</a></h2>
@@ -238,11 +260,14 @@ E &bull; Streams &bull; disposed &bull; <i>&lt;string: stream type&gt;</i> &bull
<font color=#7F0055>interface</font> StreamsListener {
<font color=#3F5FBF>/**
- * Called when a new stream is created.
+ * Called when a new stream is created.
* <font color=#7F9FBF>@param</font> stream_type - source type of the stream.
* <font color=#7F9FBF>@param</font> stream_id - ID of the stream.
+ * <font color=#7F9FBF>@param</font> context_id - a context ID that is associated with the stream, or null.
+ * Exact meaning of the context ID depends on stream type.
+ * Stream types and context IDs are defined by services that use Streams service to transmit data.
*/</font>
- <font color=#7F0055>void</font> created(String stream_type, String stream_id);
+ <font color=#7F0055>void</font> created(String stream_type, String stream_id, String context_id);
<font color=#3F5FBF>/**
* Called when a stream is disposed.
diff --git a/plugins/org.eclipse.tm.tcf.core/src/org/eclipse/tm/internal/tcf/services/remote/StreamsProxy.java b/plugins/org.eclipse.tm.tcf.core/src/org/eclipse/tm/internal/tcf/services/remote/StreamsProxy.java
index dd9a7b9ad..50d8e7771 100644
--- a/plugins/org.eclipse.tm.tcf.core/src/org/eclipse/tm/internal/tcf/services/remote/StreamsProxy.java
+++ b/plugins/org.eclipse.tm.tcf.core/src/org/eclipse/tm/internal/tcf/services/remote/StreamsProxy.java
@@ -103,8 +103,13 @@ public class StreamsProxy implements IStreams {
try {
Object[] args = JSON.parseSequence(data);
if (name.equals("created")) {
- assert args.length == 2;
- listener.created((String)args[0], (String)args[1]);
+ if (args.length == 3) {
+ listener.created((String)args[0], (String)args[1], (String)args[2]);
+ }
+ else {
+ assert args.length == 2;
+ listener.created((String)args[0], (String)args[1], null);
+ }
}
else if (name.equals("disposed")) {
assert args.length == 2;
diff --git a/plugins/org.eclipse.tm.tcf.core/src/org/eclipse/tm/tcf/services/IStreams.java b/plugins/org.eclipse.tm.tcf.core/src/org/eclipse/tm/tcf/services/IStreams.java
index 5b58c4217..9867f420b 100644
--- a/plugins/org.eclipse.tm.tcf.core/src/org/eclipse/tm/tcf/services/IStreams.java
+++ b/plugins/org.eclipse.tm.tcf.core/src/org/eclipse/tm/tcf/services/IStreams.java
@@ -44,8 +44,11 @@ public interface IStreams extends IService {
* Called when a new stream is created.
* @param stream_type - source type of the stream.
* @param stream_id - ID of the stream.
+ * @param context_id - a context ID that is associated with the stream, or null.
+ * Exact meaning of the context ID depends on stream type.
+ * Stream types and context IDs are defined by services that use Streams service to transmit data.
*/
- void created(String stream_type, String stream_id);
+ void created(String stream_type, String stream_id, String context_id);
/**
* Called when a stream is disposed.
diff --git a/plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/model/TCFLaunch.java b/plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/model/TCFLaunch.java
index cbc9141fe..8e4d2eb29 100644
--- a/plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/model/TCFLaunch.java
+++ b/plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/model/TCFLaunch.java
@@ -85,16 +85,17 @@ public class TCFLaunch extends Launch {
private final HashMap<String,LinkedList<Runnable>> context_action_queue =
new HashMap<String,LinkedList<Runnable>>();
- private HashSet<String> stream_ids = new HashSet<String>();
+ private HashMap<String,String> stream_ids = new HashMap<String,String>();
private final IStreams.StreamsListener streams_listener = new IStreams.StreamsListener() {
- public void created(String stream_type, String stream_id) {
+ public void created(String stream_type, String stream_id, String context_id) {
+ assert IProcesses.NAME.equals(stream_type);
if (process_start_command == null) {
disconnectStream(stream_id);
}
else {
- stream_ids.add(stream_id);
+ stream_ids.put(stream_id, context_id);
}
}
@@ -400,7 +401,7 @@ public class TCFLaunch extends Launch {
final String inp_id = (String)process.getProperties().get(IProcesses.PROP_STDIN_ID);
final String out_id = (String)process.getProperties().get(IProcesses.PROP_STDOUT_ID);
final String err_id = (String)process.getProperties().get(IProcesses.PROP_STDERR_ID);
- for (final String id : stream_ids.toArray(new String[stream_ids.size()])) {
+ for (final String id : stream_ids.keySet().toArray(new String[stream_ids.size()])) {
if (id.equals(inp_id)) {
process_input_stream_id = id;
}
@@ -528,7 +529,7 @@ public class TCFLaunch extends Launch {
if (channel.getState() == IChannel.STATE_CLOSED) return;
IStreams streams = getService(IStreams.class);
final Set<IToken> cmds = new HashSet<IToken>();
- for (String id : stream_ids) {
+ for (String id : stream_ids.keySet()) {
cmds.add(streams.disconnect(id, new IStreams.DoneDisconnect() {
public void doneDisconnect(IToken token, Exception error) {
cmds.remove(token);
diff --git a/plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/tests/TestStreams.java b/plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/tests/TestStreams.java
index 7cddd7073..19dc9a0cf 100644
--- a/plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/tests/TestStreams.java
+++ b/plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/tests/TestStreams.java
@@ -217,7 +217,7 @@ class TestStreams implements ITCFTest, IStreams.StreamsListener {
/************************** StreamsListener **************************/
- public void created(String stream_type, String stream_id) {
+ public void created(String stream_type, String stream_id, String context_id) {
if (!IDiagnostics.NAME.equals(stream_type)) exit(new Exception("Invalid stream type in Streams.created event"));
if (stream_ids.contains(stream_id)) exit(new Exception("Invalid stream ID in Streams.created event"));
stream_ids.add(stream_id);

Back to the top