cern.cmw.rda.examples
Class DeviceServer

java.lang.Object
  extended by cern.cmw.rda.server.DeviceServerBase
      extended by cern.cmw.rda.examples.DeviceServer
All Implemented Interfaces:
Runnable

public class DeviceServer
extends DeviceServerBase
implements Runnable


Field Summary
 
Fields inherited from class cern.cmw.rda.server.DeviceServerBase
STATUS_GREEN, STATUS_RED, STATUS_YELLOW
 
Method Summary
 Data get(IOPoint iop, Data context)
          Delegates the get call to a NoiseGenerator specified by the iop argument.
 Data getState()
          This method gets called when an administration client invokes the getState method of the admin::ServerAdmin interface.
 int getStatus()
          This method gets called when an administration client invokes the getStatus method of the admin::ServerAdmin interface.
static void main(String[] args)
          Creates and starts a DeviceServer.
 void monitorOff(IOPoint iop, ValueChangeListener listener)
          Delegates the monitorOff call to a NoiseGenerator specified by the iop argument.
 void monitorOn(IOPoint iop, ValueChangeListener listener)
          Delegates the monitorOn call to a NoiseGenerator specified by the iop argument.
 void run()
           
 void set(IOPoint iop, Data value, Data context)
          Delegates the set call to a NoiseGenerator specified by the iop argument.
 
Methods inherited from class cern.cmw.rda.server.DeviceServerBase
getCallsLogger, getClassName, getGlobalLogger, getServerName, getSubscriptionsLogger, getVersion, runServer, shutDown
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

get

public Data get(IOPoint iop,
                Data context)
         throws BadParameter,
                IOError
Delegates the get call to a NoiseGenerator specified by the iop argument.

Overrides:
get in class DeviceServerBase
Parameters:
iop - the I/O point identifier
context - the operation context, if specified in the client call, or an empty Data object otherwise.
Throws:
BadParameter - if there is no such device in the server or if the device get method raises this exception
IOError - if the device get method raises an IOError exception
See Also:
NoiseGenerator.get(IOPoint, Data)

set

public void set(IOPoint iop,
                Data value,
                Data context)
         throws BadParameter,
                IOError
Delegates the set call to a NoiseGenerator specified by the iop argument.

Overrides:
set in class DeviceServerBase
Parameters:
iop - the I/O point identifier
value - the value to set
context - the operation context, if specified in the client call, or an empty Data object otherwise.
Throws:
BadParameter - if there is no such device in the server or if the device set method raises this exception
IOError - if the device set method raises an IOError exception
See Also:
NoiseGenerator.set(IOPoint, Data, Data)

monitorOn

public void monitorOn(IOPoint iop,
                      ValueChangeListener listener)
               throws BadParameter
Delegates the monitorOn call to a NoiseGenerator specified by the iop argument.

Overrides:
monitorOn in class DeviceServerBase
Parameters:
iop - the I/O point identifier
listener - the callback object where to deliver subscription results.
Throws:
BadParameter - if there is no such device in the server or if the device monitorOn method raises this exception
See Also:
NoiseGenerator.monitorOn(IOPoint, ValueChangeListener)

monitorOff

public void monitorOff(IOPoint iop,
                       ValueChangeListener listener)
Delegates the monitorOff call to a NoiseGenerator specified by the iop argument.

Overrides:
monitorOff in class DeviceServerBase
See Also:
NoiseGenerator.monitorOff(IOPoint, ValueChangeListener)

getState

public Data getState()
Description copied from class: DeviceServerBase
This method gets called when an administration client invokes the getState method of the admin::ServerAdmin interface. The default implementation of the method in this class returns a Data object which contains state variables of the RDA server. If you want to add some information to the state data, first get the RDA server state by calling the superclass' method, then add to it your state variables. For example:

class MyServer extends DeviceServerBase
{
   ...
   private double delay;
   private long counter;
   public Data getState()
   {
      //
      // Get the RDA server state
      //
      Data state = super.getState();
      //
      // Add MyServer variables to the state data
      //
      state.insert("my.delay", delay);
      state.insert("my.counter", counter);
      return state;
   }
   ...
};

Overrides:
getState in class DeviceServerBase

getStatus

public int getStatus()
Description copied from class: DeviceServerBase
This method gets called when an administration client invokes the getStatus method of the admin::ServerAdmin interface. The default implementation of the method in this class returns getStatus in class DeviceServerBase

run

public void run()
Specified by:
run in interface Runnable

main

public static void main(String[] args)
                 throws Exception
Creates and starts a DeviceServer.

Throws:
Exception


Copyright © 2007 CERN. All Rights Reserved.