|
From: <mba...@us...> - 2007-01-31 22:28:13
|
Revision: 1900
http://svn.sourceforge.net/rubyeclipse/?rev=1900&view=rev
Author: mbarchfe
Date: 2007-01-31 14:28:12 -0800 (Wed, 31 Jan 2007)
Log Message:
-----------
Added better abstraction for debugger access since we need two socket connections for rubydebug
Added Paths:
-----------
trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/commands/
trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/commands/AbstractCommand.java
Added: trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/commands/AbstractCommand.java
===================================================================
--- trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/commands/AbstractCommand.java (rev 0)
+++ trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/commands/AbstractCommand.java 2007-01-31 22:28:12 UTC (rev 1900)
@@ -0,0 +1,44 @@
+package org.rubypeople.rdt.internal.debug.core.commands;
+
+import java.io.IOException;
+
+import org.rubypeople.rdt.internal.debug.core.DebuggerNotFoundException;
+import org.rubypeople.rdt.internal.debug.core.parsing.AbstractReadStrategy;
+import org.rubypeople.rdt.internal.debug.core.parsing.XmlStreamReader;
+
+public abstract class AbstractCommand {
+ private String command ;
+ private boolean isControl ;
+ private XmlStreamReader resultReader;
+
+ protected AbstractCommand(String command, boolean isControl) {
+ this.command = command;
+ this.isControl = isControl;
+ }
+
+ public void execute(AbstractDebuggerConnection debuggerConnection) throws DebuggerNotFoundException, IOException {
+ AbstractReadStrategy readStrategy = debuggerConnection.sendCommand(this) ;
+ resultReader = createResultReader(readStrategy) ;
+ }
+
+ protected abstract XmlStreamReader createResultReader(AbstractReadStrategy readStrategy) ;
+
+ public XmlStreamReader getResultReader() {
+ if (!isExecuted()) {
+ throw new IllegalStateException("getResultReader must only be called after the command was executed.") ;
+ }
+ return resultReader;
+ }
+
+ public String getCommand() {
+ return command;
+ }
+
+ public boolean isControl() {
+ return isControl;
+ }
+
+ public boolean isExecuted() {
+ return resultReader != null ;
+ }
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|