Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'development/org.eclipse.wst.jsdt.debug.chrome/src/org/eclipse/wst/jsdt/debug/internal/chrome/transport/PacketImpl.java')
-rw-r--r--development/org.eclipse.wst.jsdt.debug.chrome/src/org/eclipse/wst/jsdt/debug/internal/chrome/transport/PacketImpl.java27
1 files changed, 23 insertions, 4 deletions
diff --git a/development/org.eclipse.wst.jsdt.debug.chrome/src/org/eclipse/wst/jsdt/debug/internal/chrome/transport/PacketImpl.java b/development/org.eclipse.wst.jsdt.debug.chrome/src/org/eclipse/wst/jsdt/debug/internal/chrome/transport/PacketImpl.java
index 4853963..eb47938 100644
--- a/development/org.eclipse.wst.jsdt.debug.chrome/src/org/eclipse/wst/jsdt/debug/internal/chrome/transport/PacketImpl.java
+++ b/development/org.eclipse.wst.jsdt.debug.chrome/src/org/eclipse/wst/jsdt/debug/internal/chrome/transport/PacketImpl.java
@@ -27,18 +27,24 @@ public class PacketImpl implements Packet {
*/
public static boolean TRACE = false;
- private String type = null;
+ private final String type;
+ private final String tool;
/**
* Constructor
*
- * @param type
+ * @param type the type of the packet
+ * @param tool the tools service expected to handle the packet
*/
- public PacketImpl(String type) {
+ public PacketImpl(String type, String tool) {
if(type == null) {
throw new IllegalArgumentException(Messages.packet_type_cannot_be_null);
}
+ if(tool == null) {
+ throw new IllegalArgumentException(Messages.packet_tools_service_name_cannot_be_null);
+ }
this.type = type;
+ this.tool = tool;
}
/**
@@ -54,6 +60,10 @@ public class PacketImpl implements Packet {
if(type == null) {
throw new IllegalArgumentException(Messages.no_packet_type_in_json);
}
+ tool = (String) json.get(Attributes.TOOL);
+ if(tool == null) {
+ throw new IllegalArgumentException(Messages.no_tool_found_in_packet_json);
+ }
}
/**
@@ -64,6 +74,15 @@ public class PacketImpl implements Packet {
TRACE = tracing;
}
+ /**
+ * Returns the name of the tools service expected to handle this packet
+ *
+ * @return the tools service name
+ */
+ public String tool() {
+ return tool;
+ }
+
/* (non-Javadoc)
* @see org.eclipse.wst.jsdt.debug.transport.packet.Packet#getType()
*/
@@ -76,7 +95,7 @@ public class PacketImpl implements Packet {
*/
public Map toJSON() {
Map json = new HashMap();
- json.put(Attributes.TYPE, type);
+ //json.put(Attributes.TYPE, type);
return json;
}

Back to the top