com.opera.core.systems.scope.stp
Class StpConnection

java.lang.Object
  extended by com.opera.core.systems.scope.stp.StpConnection
All Implemented Interfaces:
SocketListener

public class StpConnection
extends Object
implements SocketListener


Nested Class Summary
static class StpConnection.State
           
 
Constructor Summary
StpConnection(SocketChannel socket, IConnectionHandler handler, EventHandler eventHandler, SocketMonitor monitor)
          Initializes variables in object scope, sets 'count known' to false to read byte count (STP/0).
 
Method Summary
 boolean canRead(SelectableChannel channel)
           
 boolean canWrite(SelectableChannel channel)
           
 void close()
          Switches the wait state and wakes up the selector to process.
 boolean isConnected()
           
 void parseServiceList(String message)
          Processes an incoming message and passes it to event handler if needed, the following events are to our interest: Runtime-Started: ecmascript runtime starts in Opera (that we can inject to) Runtime-Stopped: ecmascript runtime stops (not used, buggy) Message: fired from console log event Updated-Window: a window is updated OR created (opener-id=0) Active-Window: window focus changed Window-Closed: self explanatory If message matches none it is added to the response queue (probably response to command).
 void send(UmsProtos.Command command)
          Queues up an STP/1 message sent from another thread and wakes up selector to register it to the key.
 void sendEnableStp1()
           
 void sendQuit()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StpConnection

public StpConnection(SocketChannel socket,
                     IConnectionHandler handler,
                     EventHandler eventHandler,
                     SocketMonitor monitor)
              throws IOException
Initializes variables in object scope, sets 'count known' to false to read byte count (STP/0).

Throws:
IOException
Method Detail

isConnected

public boolean isConnected()

send

public void send(UmsProtos.Command command)
Queues up an STP/1 message sent from another thread and wakes up selector to register it to the key.

Parameters:
command - to add to the request queue

sendEnableStp1

public void sendEnableStp1()

sendQuit

public void sendQuit()

canRead

public boolean canRead(SelectableChannel channel)
                throws IOException
Specified by:
canRead in interface SocketListener
Returns:
true if more reading is expected.
Throws:
IOException

canWrite

public boolean canWrite(SelectableChannel channel)
                 throws IOException
Specified by:
canWrite in interface SocketListener
Returns:
true if more writing is needed.
Throws:
IOException

close

public void close()
Switches the wait state and wakes up the selector to process.


parseServiceList

public void parseServiceList(String message)
Processes an incoming message and passes it to event handler if needed, the following events are to our interest: Runtime-Started: ecmascript runtime starts in Opera (that we can inject to) Runtime-Stopped: ecmascript runtime stops (not used, buggy) Message: fired from console log event Updated-Window: a window is updated OR created (opener-id=0) Active-Window: window focus changed Window-Closed: self explanatory If message matches none it is added to the response queue (probably response to command).



Copyright © 2012. All Rights Reserved.