org.indi.server
Class ClientHandler

java.lang.Object
  extended by org.indi.reactor.SimpleEventHandler
      extended by org.indi.reactor.OutputQueue
          extended by org.indi.server.ClientHandler
All Implemented Interfaces:
java.io.Closeable, java.lang.Runnable, java.nio.channels.Channel, java.nio.channels.WritableByteChannel, org.indi.reactor.EventHandler

public class ClientHandler
extends org.indi.reactor.OutputQueue
implements java.lang.Runnable

A class to handle a connection to a single client

Author:
Dirk Hünniger

Field Summary
 
Fields inherited from class org.indi.reactor.OutputQueue
active, dead, queue
 
Fields inherited from class org.indi.reactor.SimpleEventHandler
channel, reactor, registeredOperations
 
Constructor Summary
ClientHandler(org.indi.reactor.Reactor r, java.nio.channels.SelectableChannel ch)
          class constructor
 
Method Summary
 boolean getVectorEnabled(org.indi.objects.Vector vec)
          Checks whether a given indivector should be send to the client with respect to the blobenable configuration for the client.
 void onEnableBlob(org.indi.clientmessages.EnableBlob eb)
          called when an enable blob message ist received from the client
 void onGetProperties(org.indi.clientmessages.GetProperties o)
          called when a get properties message is received from the client
 void onRead()
           
 void run()
          start method parsing thread (run asynchornously)
 void send(org.indi.objects.Object object, org.indi.objects.TransferType type, java.lang.String message)
          send a particular indiobject to the client
 void setQueue(java.util.Queue<java.lang.Object> queue)
          set the queue to send parsed messages from the parsing thread to the device drivers
 
Methods inherited from class org.indi.reactor.OutputQueue
close, isOpen, onClose, onWrite, write
 
Methods inherited from class org.indi.reactor.SimpleEventHandler
channel, onAccept, onConnect, register
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClientHandler

public ClientHandler(org.indi.reactor.Reactor r,
                     java.nio.channels.SelectableChannel ch)
              throws java.io.IOException,
                     javax.xml.parsers.ParserConfigurationException,
                     org.xml.sax.SAXException
class constructor

Parameters:
r - the reactor to register with
ch - the channel to communicate with the client
Throws:
java.io.IOException
javax.xml.parsers.ParserConfigurationException
org.xml.sax.SAXException
Method Detail

setQueue

public void setQueue(java.util.Queue<java.lang.Object> queue)
set the queue to send parsed messages from the parsing thread to the device drivers

Parameters:
queue -

run

public void run()
start method parsing thread (run asynchornously)

Specified by:
run in interface java.lang.Runnable

onRead

public void onRead()
            throws java.io.IOException
Specified by:
onRead in interface org.indi.reactor.EventHandler
Overrides:
onRead in class org.indi.reactor.SimpleEventHandler
Throws:
java.io.IOException

onGetProperties

public void onGetProperties(org.indi.clientmessages.GetProperties o)
called when a get properties message is received from the client

Parameters:
o -

onEnableBlob

public void onEnableBlob(org.indi.clientmessages.EnableBlob eb)
called when an enable blob message ist received from the client

Parameters:
eb - the blobenable object describing the request of the client

getVectorEnabled

public boolean getVectorEnabled(org.indi.objects.Vector vec)
Checks whether a given indivector should be send to the client with respect to the blobenable configuration for the client.

Parameters:
vec - the indivector to be checked
Returns:
true if the given indivector should be send to the client

send

public void send(org.indi.objects.Object object,
                 org.indi.objects.TransferType type,
                 java.lang.String message)
send a particular indiobject to the client

Parameters:
object - the object to be send
type - the way the obejct should be send
message - the message to be sent along wiht the object


Copyright © 2008. All Rights Reserved.