Class ServiceCallbackProxy

Object
com.tailf.dp.annotations.ServiceCallbackProxy
All Implemented Interfaces:
DpServiceCallback

public class ServiceCallbackProxy extends Object implements DpServiceCallback
Callback proxy for Service Callbacks. Implements the DpServiceCallback interface and delegates calls to the registered callback POJO with annotated methods
  • Constructor Details

    • ServiceCallbackProxy

      public ServiceCallbackProxy(Object backupObject, String servicePoint)
      Constructor for Callback proxys. Used internally.
      Parameters:
      backupObject - registered callback POJO
      servicePoint - string describing the servicepoint for this callback
  • Method Details

    • getBackupObject

      public Object getBackupObject()
      Retrieve the callback POJO
      Returns:
      Object registered callback object
    • getServicePoint

      public String getServicePoint()
      Retrieve the callback servicepoint
      Returns:
      servicepoint string
    • addActionMethod

      public void addActionMethod(String name, Method method)
      Add callback action method to proxy
      Parameters:
      name - canonical action name
      method - registered callback method
    • addActionCapability

      public void addActionCapability(ServiceCBType serviceCBType)
      Add action capability from annotated callType used to register capabilities on the server
      Parameters:
      serviceCBType - action type
    • servicepoint

      public String servicepoint()
      Description copied from interface: DpServiceCallback
      The name of the servicepoint
      Specified by:
      servicepoint in interface DpServiceCallback
    • create

      public Properties create(ServiceContext context, NavuNode service, NavuNode root, Properties opaque) throws DpCallbackException
      Description copied from interface: DpServiceCallback
      Create callback method. This method is called when a service instance committed due to a create or update event. This method returns a opaque as a Properties object that can be null. If not null it is stored persistently by Ncs. This object is then delivered as argument to new calls of the create method for this service (fastmap algorithm). This way the user can store and later modify persistent data outside the service model that might be needed.
      Specified by:
      create in interface DpServiceCallback
      Parameters:
      context - - The current ServiceContext object
      service - - The NavuNode references the service node.
      root - - This NavuNode references the ncs root.
      opaque - - Parameter contains a Properties object. This object may be used to transfer additional information between consecutive calls to the create callback. It is always null in the first call. I.e. when the service is first created.
      Returns:
      Properties the returning opaque instance
      Throws:
      DpCallbackException
    • update

      public Properties update(ServiceContext context, NavuNode service, NavuNode root, Properties opaque) throws DpCallbackException
      Throws:
      DpCallbackException
    • delete

      public Properties delete(ServiceContext context, NavuNode root, Properties opaque) throws DpCallbackException
      Throws:
      DpCallbackException
    • preModification

      public Properties preModification(ServiceContext context, ServiceOperationType operation, ConfPath path, Properties opaque) throws DpCallbackException
      Description copied from interface: DpServiceCallback
      Pre modification callback If registered this method will be called before a CREATE, UPDATE or DELETE of the service. This is also called with a service context that is of the original transaction. This implies that changes written into this transaction will stay persistent outside of the fastmap algorithm. I.e. will be left untouched by the fastmap algorithm. This can be useful e.g. for allocations that should be stored and existing also when the service instance is removed.
      Specified by:
      preModification in interface DpServiceCallback
      Parameters:
      context - - The current ServiceContext object
      operation - - Type of operation (CREATE,UPDATE,DELETE)
      path - - ConfPath object referring to the services path
      opaque - - Parameter contains a Properties object. This object may be used to transfer additional information between consecutive calls to the create callback. It is always null in the first call. I.e. when the service is first created.
      Returns:
      Properties - the returning opaque instance
      Throws:
      DpCallbackException
    • postModification

      public Properties postModification(ServiceContext context, ServiceOperationType operation, ConfPath path, Properties opaque) throws DpCallbackException
      Description copied from interface: DpServiceCallback
      Post modification callback If registered this method will be called after a CREATE, UPDATE or DELETE of the service. This is also called with a service context that is of the original transaction. This implies that changes written into this transaction will stay persistent outside of the fastmap algorithm. I.e. will be left untouched by the fastmap algorithm. This can be useful e.g. for allocations that should be stored and existing also when the service instance is removed.
      Specified by:
      postModification in interface DpServiceCallback
      Parameters:
      context - - The current ServiceContext object
      operation - - Type of operation (CREATE,UPDATE,DELETE)
      path - - ConfPath object referring to the services path
      opaque - - Parameter contains a Properties object. This object may be used to transfer additional information between consecutive calls to the create callback. It is always null in the first call. I.e. when the service is first created.
      Returns:
      Properties - the returning opaque instance
      Throws:
      DpCallbackException
    • mask

      public int mask()
      Description copied from interface: DpServiceCallback
      Mask of flags for each method that is supported by this callback:
      Specified by:
      mask in interface DpServiceCallback
    • getServiceCallbackProxys

      public static ServiceCallbackProxy[] getServiceCallbackProxys(Object obj) throws DpCallbackException
      Get array of proxy objects from registered POJO callback. Used internally at callback registration
      Parameters:
      obj - registered Callback POJO
      Returns:
      array of ServCallbackProxy
      Throws:
      DpCallbackException