Class DeviceRequest

java.lang.Object
org.eclipse.scanning.api.event.IdBean
org.eclipse.scanning.api.event.scan.DeviceRequest
All Implemented Interfaces:
Serializable

public class DeviceRequest extends IdBean
Object used to query which devices are available from a given broker. The solstice server for instance asks the IRunnableDeviceService what is available and returns a list of devices and their configuration. Servlet may also be used to configure a given device and return the result, set its value get its value. It can be used for Scannables and Detectors.
 Usage:
 1. Set nothing, post returns list of DeviceInformation for all runnable devices.
 2. Set the device name, post returns the runnable device with this name.               IRunnableDeviceService.getRunnableDevice()
 3. Set name and device type, post returns the device with this name.
 4. Set name and model, named device is retrieved and configured.
 5. Set the device model and the configure boolean, get a new device created.  IRunnableDeviceService.createRunnableDevice()
 6. Set the device action and the device name to call specific methods.

 
TODO The data in this class has become a little overloaded. We could have one class for scannables and one for runnable devices (detectors) to simplify things. The reason that this refactor has not been done is that it is not clear if we want Solstice to be delivering client-side services this way in the future. The hand coding of post and response which this message is part of has advantages and disadvantages. Current the design meets the requirement of server without an endpoint (multiple servers) and allows any technology like python/stomp to interact with it. However the Java client design then becomes a little inelegant because the services have these remote versions implemented.
See Also:
  • Constructor Details

    • DeviceRequest

      public DeviceRequest()
    • DeviceRequest

      public DeviceRequest(DeviceType type)
    • DeviceRequest

      public DeviceRequest(String name)
      For IRunnableDeviceService.getRunnableDevice()
      Parameters:
      name -
    • DeviceRequest

      public DeviceRequest(String name, DeviceAction action)
      For IRunnableDeviceService.getRunnableDevice()
      Parameters:
      name -
    • DeviceRequest

      public DeviceRequest(String name, DeviceAction action, Object model)
    • DeviceRequest

      public DeviceRequest(Object model, boolean conf)
      For IRunnableDeviceService.createRunnableDevice()
      Parameters:
      name -
    • DeviceRequest

      public DeviceRequest(String name, Object model)
      For IRunnableDeviceService.getRunnableDevice(...) then device.configure(...)
      Parameters:
      name -
    • DeviceRequest

      public DeviceRequest(String name, DeviceType type)
      For IRunnableDeviceService.getRunnableDevice(...) then device.configure(...)
      Parameters:
      name -
    • DeviceRequest

      public DeviceRequest(String name, DeviceType type, DeviceAction action, boolean activated)
    • DeviceRequest

      public DeviceRequest(String name, DeviceType type, DeviceAction action, Object deviceValue)
  • Method Details

    • merge

      public <A extends IdBean> void merge(A with)
      Description copied from class: IdBean
      Subclasses should override this method calling super.merge(...) If they forget
      Overrides:
      merge in class IdBean
      Parameters:
      with -
    • getDevices

      public Collection<DeviceInformation<?>> getDevices()
    • setDevices

      public void setDevices(Collection<DeviceInformation<?>> devices)
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class IdBean
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class IdBean
    • addDeviceInformation

      public void addDeviceInformation(DeviceInformation<?> info)
    • getDeviceName

      public String getDeviceName()
    • setDeviceName

      public void setDeviceName(String dn)
    • getDeviceModel

      public Object getDeviceModel()
    • setDeviceModel

      public void setDeviceModel(Object dm)
    • isEmpty

      public boolean isEmpty()
    • getDeviceInformation

      public DeviceInformation<?> getDeviceInformation()
    • size

      public int size()
    • getDeviceType

      public DeviceType getDeviceType()
    • setDeviceType

      public void setDeviceType(DeviceType deviceType)
    • isGetDatasets

      public boolean isGetDatasets()
    • setGetDatasets

      public void setGetDatasets(boolean getDatasets)
    • isConfigure

      public boolean isConfigure()
    • setConfigure

      public void setConfigure(boolean configure)
    • getDeviceAction

      public DeviceAction getDeviceAction()
    • setDeviceAction

      public void setDeviceAction(DeviceAction deviceAction)
    • getPosition

      public IPosition getPosition()
    • setPosition

      public void setPosition(IPosition position)
    • getErrorMessage

      public String getErrorMessage()
    • setErrorMessage

      public void setErrorMessage(String errorMessage)
    • getDeviceValue

      public Object getDeviceValue()
    • setDeviceValue

      public void setDeviceValue(Object deviceValue)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getErrorFieldNames

      public String[] getErrorFieldNames()
    • setErrorFieldNames

      public void setErrorFieldNames(String[] errorFieldNames)
    • isIncludeNonAlive

      public boolean isIncludeNonAlive()
    • setIncludeNonAlive

      public void setIncludeNonAlive(boolean includeNonAlive)
    • getDatasets

      public MalcolmTable getDatasets()
    • setDatasets

      public void setDatasets(MalcolmTable datasets)
    • checkException

      public void checkException() throws ValidationException, EventException
      Checks if this request contains an error message and throws an exception if it does, does nothing otherwise
      Throws:
      ModelValidationException - if the model failed validation
      EventException - if the request failed for any other reason
      ValidationException