|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcern.cmw.rda.server.DeviceServerBase
public abstract class DeviceServerBase
An abstract class that provides the RDA connectivity for device servers implemented as its derived classes. Device server developers must at least provide implementations for the four basic device access methods: get(), set(), monitorOn(), monitorOff(). These methods are called whenever a corresponding method is called on an associated DeviceHandle in a remote client.
The device access calls can throw the following two exceptions:
Field Summary | |
---|---|
static int |
STATUS_GREEN
Everything is fine. |
static int |
STATUS_RED
A serious problem with the server. |
static int |
STATUS_YELLOW
Something went wrong, but the server is still operational. |
Constructor Summary | |
---|---|
DeviceServerBase(String serverName)
Constructs a device server with the specified name. |
Method Summary | |
---|---|
Data |
get(IOPoint iop,
Data context)
Returns the value at the specified I/O point. |
static Logger |
getCallsLogger()
Returns the logger that is used by RDA to trace device calls. |
String |
getClassName(String deviceName)
|
static Logger |
getGlobalLogger()
Returns the logger that is used by RDA to trace general activities in the server (initialization, fatal errors, shutdown, ...). |
static String |
getServerName()
Returns the Corba name of the server (or null if server has not yet been instantiated) |
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 Logger |
getSubscriptionsLogger()
Returns the logger that is used by RDA to trace subscription reports. |
int |
getVersion(String component)
Gets the version number of a specified software component. |
void |
monitorOff(IOPoint iop,
ValueChangeListener listener)
Cancels the subscription identified by the I/O point and listener. |
void |
monitorOn(IOPoint iop,
ValueChangeListener listener)
Starts a subscription to value at the specified I/O point. |
void |
runServer()
Makes the server available for clients. |
void |
set(IOPoint iop,
Data value,
Data context)
Changes the value at the specified I/O point. |
void |
shutDown()
Deactivates the server. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int STATUS_GREEN
public static final int STATUS_YELLOW
public static final int STATUS_RED
Constructor Detail |
---|
public DeviceServerBase(String serverName) throws InternalException
runServer
method of the class.
serverName
- the name under which the new server will be registered
with the naming service when activated by the #runServer call.
InternalException
Method Detail |
---|
public Data get(IOPoint iop, Data context) throws BadParameter, IOError
iop
- the I/O point identifiercontext
- the operation context, if specified in the client call, or an empty Data
object otherwise.
BadParameter
IOError
public void set(IOPoint iop, Data value, Data context) throws BadParameter, IOError
iop
- the I/O point identifiervalue
- the value to setcontext
- the operation context, if specified in the client call, or an empty Data
object otherwise.
BadParameter
IOError
public void monitorOn(IOPoint iop, ValueChangeListener listener) throws BadParameter, IOError
iop
- the I/O point identifierlistener
- the callback object where to deliver subscription results.
BadParameter
IOError
public void monitorOff(IOPoint iop, ValueChangeListener listener)
public void runServer() throws InternalException
Each device server must call this method when it is ready to accept client
requests. The method registers the server with the naming service and
enters event loop to receive incoming requests. The method only returns if
shutDown
is called on the server.
InternalException
- thrown if the call fails due to some internal error.public void shutDown()
runServer()
to return.
public String getClassName(String deviceName) throws BadParameter
BadParameter
public int getVersion(String component) throws BadParameter
component
- The component name.
BadParameter
- If the component is unknown.public int getStatus()
getStatus
method of
the admin::ServerAdmin interface.
The default implementation of the method in this class returns
public Data getState()
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;
}
...
};
public static String getServerName()
public static Logger getGlobalLogger()
public static Logger getCallsLogger()
public static Logger getSubscriptionsLogger()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |