Class DeviceRequest
java.lang.Object
org.eclipse.scanning.api.event.IdBean
org.eclipse.scanning.api.event.scan.DeviceRequest
- All Implemented Interfaces:
Serializable
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 Summary
ConstructorsConstructorDescriptionDeviceRequest(Object model, boolean conf) For IRunnableDeviceService.createRunnableDevice()DeviceRequest(String name) For IRunnableDeviceService.getRunnableDevice()DeviceRequest(String name, Object model) For IRunnableDeviceService.getRunnableDevice(...) then device.configure(...)DeviceRequest(String name, DeviceType type) For IRunnableDeviceService.getRunnableDevice(...) then device.configure(...)DeviceRequest(String name, DeviceType type, DeviceAction action, boolean activated) DeviceRequest(String name, DeviceType type, DeviceAction action, Object deviceValue) DeviceRequest(String name, DeviceAction action) For IRunnableDeviceService.getRunnableDevice()DeviceRequest(String name, DeviceAction action, Object model) DeviceRequest(DeviceType type) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddDeviceInformation(DeviceInformation<?> info) voidChecks if this request contains an error message and throws an exception if it does, does nothing otherwisebooleanString[]inthashCode()booleanbooleanisEmpty()booleanboolean<A extends IdBean>
voidmerge(A with) Subclasses should override this method calling super.merge(...) If they forgetvoidsetConfigure(boolean configure) voidsetDatasets(MalcolmTable datasets) voidsetDeviceAction(DeviceAction deviceAction) voidsetDeviceModel(Object dm) voidsetDeviceName(String dn) voidsetDevices(Collection<DeviceInformation<?>> devices) voidsetDeviceType(DeviceType deviceType) voidsetDeviceValue(Object deviceValue) voidsetErrorFieldNames(String[] errorFieldNames) voidsetErrorMessage(String errorMessage) voidsetGetDatasets(boolean getDatasets) voidsetIncludeNonAlive(boolean includeNonAlive) voidsetPosition(IPosition position) intsize()toString()Methods inherited from class org.eclipse.scanning.api.event.IdBean
getUniqueId, setUniqueId
-
Constructor Details
-
DeviceRequest
public DeviceRequest() -
DeviceRequest
-
DeviceRequest
For IRunnableDeviceService.getRunnableDevice()- Parameters:
name-
-
DeviceRequest
For IRunnableDeviceService.getRunnableDevice()- Parameters:
name-
-
DeviceRequest
-
DeviceRequest
For IRunnableDeviceService.createRunnableDevice()- Parameters:
name-
-
DeviceRequest
For IRunnableDeviceService.getRunnableDevice(...) then device.configure(...)- Parameters:
name-
-
DeviceRequest
For IRunnableDeviceService.getRunnableDevice(...) then device.configure(...)- Parameters:
name-
-
DeviceRequest
-
DeviceRequest
-
-
Method Details
-
merge
Description copied from class:IdBeanSubclasses should override this method calling super.merge(...) If they forget -
getDevices
-
setDevices
-
hashCode
public int hashCode() -
equals
-
addDeviceInformation
-
getDeviceName
-
setDeviceName
-
getDeviceModel
-
setDeviceModel
-
isEmpty
public boolean isEmpty() -
getDeviceInformation
-
size
public int size() -
getDeviceType
-
setDeviceType
-
isGetDatasets
public boolean isGetDatasets() -
setGetDatasets
public void setGetDatasets(boolean getDatasets) -
isConfigure
public boolean isConfigure() -
setConfigure
public void setConfigure(boolean configure) -
getDeviceAction
-
setDeviceAction
-
getPosition
-
setPosition
-
getErrorMessage
-
setErrorMessage
-
getDeviceValue
-
setDeviceValue
-
toString
-
getErrorFieldNames
-
setErrorFieldNames
-
isIncludeNonAlive
public boolean isIncludeNonAlive() -
setIncludeNonAlive
public void setIncludeNonAlive(boolean includeNonAlive) -
getDatasets
-
setDatasets
-
checkException
Checks if this request contains an error message and throws an exception if it does, does nothing otherwise- Throws:
ModelValidationException- if the model failed validationEventException- if the request failed for any other reasonValidationException
-