cern.cmw.rda.client
Class ReplyAdapter

java.lang.Object
  extended by cern.cmw.rda.client.ReplyAdapter
All Implemented Interfaces:
ReplyHandler
Direct Known Subclasses:
SimpleReplyHandler, Subscription

public abstract class ReplyAdapter
extends Object
implements ReplyHandler

An abstract class for receiving replies to asynchronous calls or subscription reports. This class exists as convenience for creating objects that implement the ReplyHandler interface. If you implement the ReplyHandler interface, you have to define all of the methods in it. This class provides simple default implementations for them all, so you can only define methods for the kinds of replies you care about. It also defines a new method to which all calls to the overloaded handleException methods are forwarded by default. Use (override) this method if you can use the same exception handling procedure for all kinds of exceptions, or for some of them.

Example:


     //
     // Print a message for all kinds of exceptions except for IOError which needs
     // a special treatment.
     //
     class ErrorListener extends ReplyAdapter
     {
        void handleException(Request request, IOError exception)
        {
           //
           // handle IOError in a special way
           //
        }

        void handleError(Request request, CmwException exception)
        {
           DeviceHandle dh = request.getDeviceHandle();
           System.out.println("==> call to "
                              + dh.getDeviceName() +"/"
                              + request.getPropertyName() +"/"
                              + request.getCycleSelector() +" failed");
           System.out.println("    "+ exception);
        }
     }
  

See Also:
ReplyHandler

Constructor Summary
ReplyAdapter()
           
 
Method Summary
 void cancelled(SubscriptionRequest request)
          Invoked when a data subscription is cancelled by a monitorOff call.
 void disconnected(SubscriptionRequest request)
          Invoked when a subscription is suspended because of a lost connection to a remote device; for example, because the device server is down.
 void done(SetRequest request)
          Invoked when a set call completes successfully.
 void handleError(Request request, CmwException exception)
          This method is called by default implementations of the handleException methods.
 void handleException(Request request, BadParameter exception)
          Invoked on receipt of a reply containing the specified exception.
 void handleException(Request request, InternalException exception)
          Invoked on receipt of a reply containing the specified exception.
 void handleException(Request request, IOError exception)
          Invoked on receipt of a reply containing the specified exception.
 void handleException(Request request, LostUpdates exception)
          Invoked on reception of a reply containing information about lost updates.
 void handleException(Request request, NoConnection exception)
          Invoked if the connection to the device server has been lost while waiting for the reply.
 void handleException(Request request, NoPermission exception)
          Invoked on reception of a reply containing the RBAC-related exception.
 void handleException(Request request, TimeOut exception)
          Invoked if no reply to the request has been received within a certain time limit.
 void handleReply(Request request, Data value)
          Invoked when a property value is delivered as a result of a successful get or monitorOn call.
 void reconnected(SubscriptionRequest request)
          Invoked when a suspended subscription has been resumed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReplyAdapter

public ReplyAdapter()
Method Detail

handleReply

public void handleReply(Request request,
                        Data value)
Invoked when a property value is delivered as a result of a successful get or monitorOn call. The value Data may change after the call returns: make a copy of the Data object if you need to store it in your application.

Implementation: empty.

Specified by:
handleReply in interface ReplyHandler

done

public void done(SetRequest request)
Invoked when a set call completes successfully.

Implementation: empty.

Specified by:
done in interface ReplyHandler

disconnected

public void disconnected(SubscriptionRequest request)
Invoked when a subscription is suspended because of a lost connection to a remote device; for example, because the device server is down. Note that this is not a fatal error: connection will be automatically reestablished when the server is up again.

Implementation: empty.

Specified by:
disconnected in interface ReplyHandler
See Also:
ReplyHandler.reconnected(cern.cmw.rda.client.SubscriptionRequest)

reconnected

public void reconnected(SubscriptionRequest request)
Invoked when a suspended subscription has been resumed.

Implementation: empty.

Specified by:
reconnected in interface ReplyHandler
See Also:
ReplyHandler.disconnected(cern.cmw.rda.client.SubscriptionRequest)

cancelled

public void cancelled(SubscriptionRequest request)
Invoked when a data subscription is cancelled by a monitorOff call.

Implementation: empty.

Specified by:
cancelled in interface ReplyHandler

handleException

public void handleException(Request request,
                            BadParameter exception)
Invoked on receipt of a reply containing the specified exception.

Implementation: calls handleError(cern.cmw.rda.client.Request, cern.cmw.CmwException) with the specified parameters.

Specified by:
handleException in interface ReplyHandler

handleException

public void handleException(Request request,
                            TimeOut exception)
Invoked if no reply to the request has been received within a certain time limit.

Implementation: calls handleError(cern.cmw.rda.client.Request, cern.cmw.CmwException) with the specified parameters.

Specified by:
handleException in interface ReplyHandler

handleException

public void handleException(Request request,
                            NoConnection exception)
Invoked if the connection to the device server has been lost while waiting for the reply.

Implementation: calls handleError(cern.cmw.rda.client.Request, cern.cmw.CmwException) with the specified parameters.

Specified by:
handleException in interface ReplyHandler

handleException

public void handleException(Request request,
                            IOError exception)
Invoked on receipt of a reply containing the specified exception.

Implementation: calls handleError(cern.cmw.rda.client.Request, cern.cmw.CmwException) with the specified parameters.

Specified by:
handleException in interface ReplyHandler

handleException

public void handleException(Request request,
                            InternalException exception)
Invoked on receipt of a reply containing the specified exception.

Implementation: calls ReplyAdapter##handleError with the specified parameters.

Specified by:
handleException in interface ReplyHandler

handleException

public void handleException(Request request,
                            NoPermission exception)
Invoked on reception of a reply containing the RBAC-related exception.

Implementation: calls ReplyAdapter##handleError with the specified parameters.

Specified by:
handleException in interface ReplyHandler

handleException

public void handleException(Request request,
                            LostUpdates exception)
Invoked on reception of a reply containing information about lost updates.

Implementation: calls ReplyAdapter##handleError with the specified parameters.

Specified by:
handleException in interface ReplyHandler

handleError

public void handleError(Request request,
                        CmwException exception)
This method is called by default implementations of the handleException methods.

Implementation: empty



Copyright © 2007 CERN. All Rights Reserved.