org.openqa.selenium.server
Class CommandQueue

java.lang.Object
  extended by org.openqa.selenium.server.CommandQueue

public class CommandQueue
extends java.lang.Object

Schedules and coordinates commands to be run.

Version:
$Revision: 734 $
Author:
Paul Hammant, Jennifer Bevan

Constructor Summary
CommandQueue(java.lang.String newSessionId, java.lang.String newUniqueId, int opDelay, RemoteControlConfiguration configuration)
           
CommandQueue(java.lang.String newSessionId, java.lang.String newUniqueId, RemoteControlConfiguration configuration)
           
 
Method Summary
 void addJsWindowNameVar(java.lang.String jsWindowNameVar)
           
 void declareClosed()
           
 java.lang.String doCommand(java.lang.String command, java.lang.String field, java.lang.String value)
          Sends the specified command (to be retrieved by the next call to handle command result), and returns the result of that command.
protected  void doCommandWithoutWaitingForAResponse(java.lang.String command, java.lang.String field, java.lang.String value)
           
 void endOfLife()
          clear the contents of the threads, and unblocks polling threads
 BrowserResponseSequencer getBrowserResponseSequencer()
           
 FrameAddress getFrameAddress()
           
protected static java.lang.String getIdentification(java.lang.String caller, java.lang.String queueId)
           
protected  RemoteCommand getNextCommand()
          Get, and remove from the command holder, the next command to run
 int getQueueDelay()
           
protected  java.lang.String getResult()
          Get, and remove from the command holder, the next command to run
static int getSpeed()
           
 RemoteCommand handleCommandResult(java.lang.String commandResult)
           Accepts a command reply, and retrieves the next command to run.
protected  void handleCommandResultWithoutWaitingForACommand(java.lang.String commandResult)
           
 boolean isClosed()
           
 boolean isResultExpected()
          Get whether this command queue expects a result instead of just "OK".
 boolean isWindowPointedToByJsVariable(java.lang.String jsVariableName)
           
protected  RemoteCommand peekAtCommand()
           
protected  java.lang.String peekAtResult()
           
protected  boolean putCommand(RemoteCommand cmd)
           
protected  boolean putResult(java.lang.String result)
           
 void setFrameAddress(FrameAddress frameAddress)
           
 void setQueueDelay(int i)
           
protected  void setResultExpected(boolean resultExpected)
           
static void setSpeed(int i)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CommandQueue

public CommandQueue(java.lang.String newSessionId,
                    java.lang.String newUniqueId,
                    RemoteControlConfiguration configuration)

CommandQueue

public CommandQueue(java.lang.String newSessionId,
                    java.lang.String newUniqueId,
                    int opDelay,
                    RemoteControlConfiguration configuration)
Method Detail

doCommand

public java.lang.String doCommand(java.lang.String command,
                                  java.lang.String field,
                                  java.lang.String value)
Sends the specified command (to be retrieved by the next call to handle command result), and returns the result of that command.

Parameters:
command - - the remote command verb
field - - the first remote argument (meaning depends on the verb)
value - - the second remote argument
Returns:
- the command result, defined by the remote JavaScript. "getX" style commands may return data from the browser; other "doX" style commands may just return "OK" or an error message.

doCommandWithoutWaitingForAResponse

protected void doCommandWithoutWaitingForAResponse(java.lang.String command,
                                                   java.lang.String field,
                                                   java.lang.String value)
                                            throws WindowClosedException
Throws:
WindowClosedException

getResult

protected java.lang.String getResult()
Get, and remove from the command holder, the next command to run


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

handleCommandResult

public RemoteCommand handleCommandResult(java.lang.String commandResult)

Accepts a command reply, and retrieves the next command to run.

Parameters:
commandResult - - the reply from the previous command, or null
Returns:
- the next command to run

handleCommandResultWithoutWaitingForACommand

protected void handleCommandResultWithoutWaitingForACommand(java.lang.String commandResult)

getNextCommand

protected RemoteCommand getNextCommand()
Get, and remove from the command holder, the next command to run


getIdentification

protected static java.lang.String getIdentification(java.lang.String caller,
                                                    java.lang.String queueId)

endOfLife

public void endOfLife()
clear the contents of the threads, and unblocks polling threads


getFrameAddress

public FrameAddress getFrameAddress()

setFrameAddress

public void setFrameAddress(FrameAddress frameAddress)

isResultExpected

public boolean isResultExpected()
Get whether this command queue expects a result instead of just "OK".

Returns:
Returns whether this command will expect a command result.

setQueueDelay

public void setQueueDelay(int i)

getQueueDelay

public int getQueueDelay()

setSpeed

public static void setSpeed(int i)

getSpeed

public static int getSpeed()

isWindowPointedToByJsVariable

public boolean isWindowPointedToByJsVariable(java.lang.String jsVariableName)

addJsWindowNameVar

public void addJsWindowNameVar(java.lang.String jsWindowNameVar)

declareClosed

public void declareClosed()

isClosed

public boolean isClosed()

getBrowserResponseSequencer

public BrowserResponseSequencer getBrowserResponseSequencer()

setResultExpected

protected void setResultExpected(boolean resultExpected)

peekAtResult

protected java.lang.String peekAtResult()

peekAtCommand

protected RemoteCommand peekAtCommand()

putResult

protected boolean putResult(java.lang.String result)

putCommand

protected boolean putCommand(RemoteCommand cmd)


Copyright © 2011. All Rights Reserved.