Package org.eclipse.scanning.sequencer
Class RunnableDeviceServiceImpl
java.lang.Object
org.eclipse.scanning.sequencer.RunnableDeviceServiceImpl
- All Implemented Interfaces:
IRunnableDeviceService,IPositionerService,IScanService
public final class RunnableDeviceServiceImpl
extends Object
implements IRunnableDeviceService, IScanService
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic StringThe default Malcolm Hostname can be injected by spring. -
Constructor Summary
ConstructorsConstructorDescriptionMain constructor used in the running server by OSGi (only)RunnableDeviceServiceImpl(IScannableDeviceService scannableDeviceService) Deprecated, for removal: This API element is subject to removal in a future version. -
Method Summary
Modifier and TypeMethodDescriptionvoid_register(String name, IRunnableDevice<?> device) Deprecated, for removal: This API element is subject to removal in a future version.voidaddScanParticipant(Object device) Used to register a scan participant.static voidapplyNameIfInModel(INameable nameable, Object model) Search a model for a name with reflection.static <M> voidconfigureAndFireAnnotations(IConfigurable<M> configurable, M model) Configure a RunnableDevice using a compatible model, fire thePreConfigureandPostConfigureannotations at the appropriate times.final IPositionercreatePositioner(String name) This method sets the value of the scannables named to this position.final IPositionercreatePositioner(INameable parent) This method sets the value of the scannables named to this position.createScanDevice(ScanModel model) Create and configure a new device that represents a scan.createScanDevice(ScanModel model, boolean configure) Create and configure a new device that represents a scan.createScanDevice(ScanModel model, IPublisher<ScanBean> eventPublisher) Create and configure a new device that represents a scan, the scan will publish events to the supplied publisher.createScanDevice(ScanModel model, IPublisher<ScanBean> eventPublisher, boolean configure) Create and configure a new device that represents a scan, the scan will publish events to the supplied publisher.<T> IRunnableDevice<T> This is a convenience method for getting the currently active scanner.Deprecated, for removal: This API element is subject to removal in a future version.Get the information for all the runnable devices currently created.getDeviceInformation(String name) Get the information for the named runnable device.Get the information for all the runnable devices currently created with a specific role.Get the information for all the runnable devices currently created.<T> IRunnableDevice<T> getRunnableDevice(String name) Get a runnable device by name.<T> IRunnableDevice<T> getRunnableDevice(String name, IPublisher<ScanBean> publisher) Get a runnable device by name.A collection of the current named runnable devices which may be retrieved and configured.The list of objects to be run as participants with the scan.<T> voidregister(IRunnableDevice<T> device) Used to register a device.voidremoveScanParticipant(Object device) Used to remove a scan participant.static voidsetDeviceConnectorService(IScannableDeviceService connectorService) Deprecated, for removal: This API element is subject to removal in a future version.voidstart(org.osgi.framework.BundleContext context) voidstop()
-
Field Details
-
defaultMalcolmHostname
The default Malcolm Hostname can be injected by spring. Otherwise this machine will be used for the malcolm host for instance 'beamline'-control.
-
-
Constructor Details
-
RunnableDeviceServiceImpl
public RunnableDeviceServiceImpl()Main constructor used in the running server by OSGi (only) -
RunnableDeviceServiceImpl
@Deprecated(since="GDA 9.34", forRemoval=true) public RunnableDeviceServiceImpl(IScannableDeviceService scannableDeviceService) Deprecated, for removal: This API element is subject to removal in a future version.
-
-
Method Details
-
register
Description copied from interface:IRunnableDeviceServiceUsed to register a device. This is required so that spring may create detectors and call the register method by telling the detector to register itself.- Specified by:
registerin interfaceIRunnableDeviceService- Parameters:
device-
-
createPositioner
Description copied from interface:IPositionerServiceThis method sets the value of the scannables named to this position. It takes into account the levels of the scannbles. It is blocking until all the scannables have reached the desired location.- Specified by:
createPositionerin interfaceIPositionerService- Parameters:
parent- the parent device- Returns:
- the positioner
- Throws:
ScanningException
-
createPositioner
Description copied from interface:IPositionerServiceThis method sets the value of the scannables named to this position. It takes into account the levels of the scannbles. It is blocking until all the scannables have reached the desired location.- Specified by:
createPositionerin interfaceIPositionerService- Parameters:
name- the name of the positioner- Returns:
- the positioner
- Throws:
ScanningException
-
getRunnableDevice
Description copied from interface:IRunnableDeviceServiceGet a runnable device by name. If the device was created by spring it may need configuring before use. If the device was added to the service after a createRunnableDevice(...) call, it will already be configured.- Specified by:
getRunnableDevicein interfaceIRunnableDeviceService- Parameters:
name-- Returns:
- named runnable device
- Throws:
ScanningException
-
getRunnableDevice
public <T> IRunnableDevice<T> getRunnableDevice(String name, IPublisher<ScanBean> publisher) throws ScanningException Description copied from interface:IRunnableDeviceServiceGet a runnable device by name. If the device was created by spring it may need configuring before use. If the device was added to the service after a createRunnableDevice(...) call, it will already be configured.- Specified by:
getRunnableDevicein interfaceIRunnableDeviceService- Parameters:
name-publisher- used for a particular run of the device. This must be set with care as only one publisher may be active on a device at a time.- Returns:
- named runnable device
- Throws:
ScanningException
-
getDeviceConnectorService
@Deprecated(since="GDA 9.33", forRemoval=true) public IScannableDeviceService getDeviceConnectorService()Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:IRunnableDeviceServiceGet the service being used to connect this service to the underlying hardware devices.- Specified by:
getDeviceConnectorServicein interfaceIRunnableDeviceService- Returns:
- connection service
-
setDeviceConnectorService
@Deprecated(since="GDA 9.33", forRemoval=true) public static void setDeviceConnectorService(IScannableDeviceService connectorService) Deprecated, for removal: This API element is subject to removal in a future version. -
start
public void start(org.osgi.framework.BundleContext context) -
stop
public void stop() -
_register
@Deprecated(since="GDA 9.34", forRemoval=true) public void _register(String name, IRunnableDevice<?> device) Deprecated, for removal: This API element is subject to removal in a future version.useregister(IRunnableDevice)insteadUsed for testing only- Parameters:
device-
-
getRunnableDeviceNames
Description copied from interface:IRunnableDeviceServiceA collection of the current named runnable devices which may be retrieved and configured.- Specified by:
getRunnableDeviceNamesin interfaceIRunnableDeviceService- Returns:
- devices
- Throws:
ScanningException
-
getDeviceInformation
Description copied from interface:IRunnableDeviceServiceGet the information for all the runnable devices currently created. Will not get device information that is potentially held on the device if the device is not alive.- Specified by:
getDeviceInformationin interfaceIRunnableDeviceService- Returns:
- information for all the runnable devices currently created
- Throws:
ScanningException
-
getDeviceInformationIncludingNonAlive
public Collection<DeviceInformation<?>> getDeviceInformationIncludingNonAlive() throws ScanningExceptionDescription copied from interface:IRunnableDeviceServiceGet the information for all the runnable devices currently created. Will attempt to get device information that is potentially held on the device even if the device is not alive.- Specified by:
getDeviceInformationIncludingNonAlivein interfaceIRunnableDeviceService- Returns:
- information for all the runnable devices currently created
- Throws:
ScanningException
-
getDeviceInformation
public Collection<DeviceInformation<?>> getDeviceInformation(DeviceRole role) throws ScanningException Description copied from interface:IRunnableDeviceServiceGet the information for all the runnable devices currently created with a specific role. Will not get device information that is potentially held on the device if the device is not alive.- Specified by:
getDeviceInformationin interfaceIRunnableDeviceService- Returns:
- device info
- Throws:
ScanningException
-
getDeviceInformation
Description copied from interface:IRunnableDeviceServiceGet the information for the named runnable device.- Specified by:
getDeviceInformationin interfaceIRunnableDeviceService- Returns:
- information for the named device
- Throws:
ScanningException
-
addScanParticipant
Description copied from interface:IScanServiceUsed to register a scan participant. Once registered any scan created will use the participant.- Specified by:
addScanParticipantin interfaceIScanService- Parameters:
device-
-
removeScanParticipant
Description copied from interface:IScanServiceUsed to remove a scan participant. Once registered any scan created will use the participant it must be removed to stop this.- Specified by:
removeScanParticipantin interfaceIScanService- Parameters:
device-
-
getScanParticipants
Description copied from interface:IScanServiceThe list of objects to be run as participants with the scan.- Specified by:
getScanParticipantsin interfaceIScanService- Returns:
-
getActiveScanner
Description copied from interface:IRunnableDeviceServiceThis is a convenience method for getting the currently active scanner. It is useful if the scan is paused and it is required to seek the scan to a new location from Jython. The returned scanner will be null unless a scan is currently running, therefore it is of limited usage normally. *- Specified by:
getActiveScannerin interfaceIRunnableDeviceService- Returns:
- current actively scanning device.
-
createScanDevice
Description copied from interface:IScanServiceCreate and configure a new device that represents a scan.- Specified by:
createScanDevicein interfaceIScanService- Parameters:
model- The model providing the configuration for the scan- Returns:
- A new
IScanDevice - Throws:
ScanningException
-
createScanDevice
Description copied from interface:IScanServiceCreate and configure a new device that represents a scan. Configure it if requested. TODO: Use Builder pattern rather than a flag?- Specified by:
createScanDevicein interfaceIScanService- Parameters:
model- The model providing the configuration for the scanconfigure- Should the new device be automatically configured?- Returns:
- A new
IScanDevice - Throws:
ScanningException
-
createScanDevice
public IScanDevice createScanDevice(ScanModel model, IPublisher<ScanBean> eventPublisher) throws ScanningException Description copied from interface:IScanServiceCreate and configure a new device that represents a scan, the scan will publish events to the supplied publisher. TODO: Use Builder pattern rather than a flag?- Specified by:
createScanDevicein interfaceIScanService- Parameters:
model- The model providing the configuration for the scaneventPublisher- A publisher that the scan will use to produce events.- Returns:
- A new
IScanDevice - Throws:
ScanningException
-
createScanDevice
public IScanDevice createScanDevice(ScanModel model, IPublisher<ScanBean> eventPublisher, boolean configure) throws ScanningException Description copied from interface:IScanServiceCreate and configure a new device that represents a scan, the scan will publish events to the supplied publisher. Configure the device if requested. TODO: Use Builder pattern rather than a flag?- Specified by:
createScanDevicein interfaceIScanService- Parameters:
model- The model providing the configuration for the scaneventPublisher- A publisher that the scan will use to produce events.configure- Should the new device be automatically configured?- Returns:
- A new
IScanDevice - Throws:
ScanningException
-
configureAndFireAnnotations
public static <M> void configureAndFireAnnotations(IConfigurable<M> configurable, M model) throws ScanningException Configure a RunnableDevice using a compatible model, fire thePreConfigureandPostConfigureannotations at the appropriate times. TODO: This should be encapsulated inside the devices themselves.- Type Parameters:
M- The type of the model, must be compatible with the device.- Parameters:
configurable- A device implementing the IConfigurable interface.model- The model providing the configuration- Throws:
ScanningException
-
applyNameIfInModel
Search a model for a name with reflection. If found, transfer it to an INameable.- Parameters:
nameable- The nameable to possibly namemodel- The model possibly providing the name
-
register(IRunnableDevice)instead