Class MockScannableConnector
java.lang.Object
org.eclipse.scanning.example.scannable.MockScannableConnector
- All Implemented Interfaces:
AutoCloseable,IScannableDeviceService,IConnection
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidconnect()voidCall to disconnect any resources which we no longer need.Returns the set of global per-scan monitors that should be added to all scans.getRequiredPerScanMonitorNames(String scannableName) Deprecated, for removal: This API element is subject to removal in a future version.<T> IScannable<T> getScannable(String name) Get a scannable by name.Get the names of all scannables known to the connector.booleanReturns whether this connection is connected.booleanvoid<T> voidregister(IScannable<T> mockScannable) Used to register a device.voidvoidsetCreateIfNotThere(boolean createIfNotThere) voidsetGlobalPerScanMonitorNames(String... globalMetadataScannableNames) voidsetGlobalPerScanMonitorPrerequisiteNames(String metadataScannableName, String... prerequisiteMetadataScannableNames) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.eclipse.scanning.api.event.core.IConnection
closeMethods inherited from interface org.eclipse.scanning.api.device.IScannableDeviceService
getScannables, getScannables, handleDeviceError
-
Field Details
-
broker
-
-
Constructor Details
-
MockScannableConnector
public MockScannableConnector() -
MockScannableConnector
-
-
Method Details
-
connect
- Throws:
URISyntaxException
-
register
Description copied from interface:IScannableDeviceServiceUsed 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 interfaceIScannableDeviceService
-
register
-
getScannable
Description copied from interface:IScannableDeviceServiceGet a scannable by name.- Specified by:
getScannablein interfaceIScannableDeviceService- Parameters:
name- name of scannable to find- Returns:
- scannable, never
null - Throws:
ScanningException- if no scannable with the given name could be found
-
getScannableNames
Description copied from interface:IScannableDeviceServiceGet the names of all scannables known to the connector.- Specified by:
getScannableNamesin interfaceIScannableDeviceService- Returns:
- Throws:
ScanningException
-
setGlobalPerScanMonitorNames
-
getGlobalPerScanMonitorNames
Description copied from interface:IScannableDeviceServiceReturns the set of global per-scan monitors that should be added to all scans. This is used to support legacy (GDA8) spring configurations. Should not be called by client code.- Specified by:
getGlobalPerScanMonitorNamesin interfaceIScannableDeviceService- Returns:
- global per-scan monitor names
-
setGlobalPerScanMonitorPrerequisiteNames
-
getRequiredPerScanMonitorNames
@Deprecated(since="GDA 9.3", forRemoval=true) public Set<String> getRequiredPerScanMonitorNames(String scannableName) Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:IScannableDeviceServiceReturns the set of the names required per-scan monitors for the given scannable name. This is used to support legacy (GDA8) spring configurations. Should not be called by client code.- Specified by:
getRequiredPerScanMonitorNamesin interfaceIScannableDeviceService- Parameters:
scannableName- scannable to get required per-scan monitor names for- Returns:
- names of required per-scan monitors for the scannable with the given name
-
disconnect
Description copied from interface:IConnectionCall to disconnect any resources which we no longer need. The resource may have timed out so it might not be connected, in that case it silently returns. Note, that the methodIConnection.close(), inherited fromAutoCloseablecalls this method, which means that if an object of a class implementingIConnectionis used with a try-with-resources block this method will be called automatically when exiting that block.- Specified by:
disconnectin interfaceIConnection- Throws:
EventException- if resource could not be disconnected.
-
isConnected
public boolean isConnected()Description copied from interface:IConnectionReturns whether this connection is connected. This method returnstrueuntil disconnect is called, even if the connection is created lazily.- Specified by:
isConnectedin interfaceIConnection- Returns:
trueif connected,falseotherwise
-
getBroker
-
setBroker
-
isCreateIfNotThere
public boolean isCreateIfNotThere() -
setCreateIfNotThere
public void setCreateIfNotThere(boolean createIfNotThere)
-