Class MockScannableConnector

java.lang.Object
org.eclipse.scanning.example.scannable.MockScannableConnector
All Implemented Interfaces:
AutoCloseable, IScannableDeviceService, IConnection

public class MockScannableConnector extends Object implements IScannableDeviceService, IConnection
  • Field Details

    • broker

      protected String broker
  • Constructor Details

    • MockScannableConnector

      public MockScannableConnector()
    • MockScannableConnector

      public MockScannableConnector(IPublisher<Location> positionPublisher)
  • Method Details

    • connect

      public void connect() throws URISyntaxException
      Throws:
      URISyntaxException
    • register

      public <T> void register(IScannable<T> mockScannable)
      Description copied from interface: IScannableDeviceService
      Used 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:
      register in interface IScannableDeviceService
    • register

      public void register(INameable mockScannable)
    • getScannable

      public <T> IScannable<T> getScannable(String name) throws ScanningException
      Description copied from interface: IScannableDeviceService
      Get a scannable by name.
      Specified by:
      getScannable in interface IScannableDeviceService
      Parameters:
      name - name of scannable to find
      Returns:
      scannable, never null
      Throws:
      ScanningException - if no scannable with the given name could be found
    • getScannableNames

      public List<String> getScannableNames() throws ScanningException
      Description copied from interface: IScannableDeviceService
      Get the names of all scannables known to the connector.
      Specified by:
      getScannableNames in interface IScannableDeviceService
      Returns:
      Throws:
      ScanningException
    • setGlobalPerScanMonitorNames

      public void setGlobalPerScanMonitorNames(String... globalMetadataScannableNames)
    • getGlobalPerScanMonitorNames

      public Set<String> getGlobalPerScanMonitorNames()
      Description copied from interface: IScannableDeviceService
      Returns 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:
      getGlobalPerScanMonitorNames in interface IScannableDeviceService
      Returns:
      global per-scan monitor names
    • setGlobalPerScanMonitorPrerequisiteNames

      public void setGlobalPerScanMonitorPrerequisiteNames(String metadataScannableName, String... prerequisiteMetadataScannableNames)
    • 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: IScannableDeviceService
      Returns 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:
      getRequiredPerScanMonitorNames in interface IScannableDeviceService
      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

      public void disconnect() throws EventException
      Description copied from interface: IConnection
      Call 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 method IConnection.close(), inherited from AutoCloseable calls this method, which means that if an object of a class implementing IConnection is used with a try-with-resources block this method will be called automatically when exiting that block.
      Specified by:
      disconnect in interface IConnection
      Throws:
      EventException - if resource could not be disconnected.
    • isConnected

      public boolean isConnected()
      Description copied from interface: IConnection
      Returns whether this connection is connected. This method returns true until disconnect is called, even if the connection is created lazily.
      Specified by:
      isConnected in interface IConnection
      Returns:
      true if connected, false otherwise
    • getBroker

      public String getBroker()
    • setBroker

      public void setBroker(String broker)
    • isCreateIfNotThere

      public boolean isCreateIfNotThere()
    • setCreateIfNotThere

      public void setCreateIfNotThere(boolean createIfNotThere)