Class AssemblyAdapter
- All Implemented Interfaces:
Device,Scannable,IScannableGroup,IScannableGroupNamed,Configurable,Findable,gda.observable.IObservable,Assembly,CoordinatesMove,IndexMove,IndexPositioner
- Direct Known Subclasses:
PlateLoaderAdapter
-
Field Summary
Fields inherited from interface gda.device.Scannable
ATTR_NEXUS_CATEGORY, ATTR_NX_CLASS, DEFAULT_INPUT_NAME, VALUE_UNAVAILABLE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription__call__()voidaddActionRule(Scannable scannable, ActionRule rule, Device... devices) voidaddDefinedCoordinates(String name, int index, Coordinates coordinates) voidaddGroupMember(Scannable scannable) voidaddGroupMember(Scannable groupMember, boolean toConfigure) voidaddGroupMemberByName(String groupMemberName) voidaddIObserver(gda.observable.IObserver observer) voidasynchronousMoveTo(Object position) Trigger a move/operation and return immediately.voidasynchronousMoveToCoordinates(Coordinates coordinates) Trigger a move/operation and return immediately.voidasynchronousMoveToDefined(String coordinatesName) Trigger a move/operation to a pre-defined and indexed position and return immediately.voidasynchronousMoveToIndex(int index) voidHook to be used by Scan and pos commands to inform the Scannable that an exception, such as a DeviceExcpetion, has occurred.voidvoidCalled by both the pos and scan commands at the start of each subsequent level move only on Scannables that will be moved as part that level's movement.voidCalled by both the pos and scan commands at the start of each subsequent level move on all Scannables that are part that level's movement.voidCalled on every Scannable at the end of every data point, for scans which are broken down into individual points (i.e.voidCalled on every Scannable at every data point, for scans which are broken down into individual points (i.e.voidCalled for every Scannable at the end of a group of nested scans (or a single scan if that is the case).voidCalled for every Scannable at the end of every scanvoidCalled for every Scannable at the start of every scanvoidCalled for every Scannable at the start of a group of nested scans (or a single scan if that is the case)booleanprotected AssemblybooleancheckMovementValid(Coordinates start, Coordinates target) checkPositionValid(Object position) Tests if the given object is meaningful to this Scannable and so could be used by one of the move commands.voidvoidclose()Close and unconfigure the device.voidPerform operations that must be done after Spring initialisation i.e.voiddeleteIObserver(gda.observable.IObserver observer) voidgetAdapter(Class<? extends Assembly> adapter) getAttribute(String attributeName) Get the value of the specified attributeReturns the current predefined coordinates holder.Returns an array of the names of registered defined coordinatesString[]Additional names for extra values that returned by getPosition().getGroupMemberByName(String name) String[]String[]Deprecated.String[]gets a array of InputNames used by moveTo of this scannable.intgetLevel()get the operation level of this scannable.getName()Get the object name.String[]Returns an array of strings which are the format strings to use when pretty printing parts of the outputReturns the current position of the Scannable.intbooleanbooleanTests if the scannable is at (or if appropriate, close to) the value positionToTest.booleanTests if the coordinates are at (or if appropriate, close to) the values in coordinatesToTest.booleanisAtIndex(int indexToTest) booleanisBusy()Check if the Scannable is moving/operating.booleanIndicates whether this object should be configured at startup.booleanChecks to see if the object is already configured.booleanbooleanTests if the underlying positioner is expected to only allow movements to the indexed positions.voidTrigger a move/operation and block until completion.voidmoveToCoordinates(Coordinates coordinates) Trigger a move/operation and block until completion.voidmoveToDefined(String coordinatesName) Trigger a move/operation and block until completion.voidmoveToIndex(int index) voidRe-initialisation of values and states.voidremoveGroupMemberByIndex(int index) voidremoveGroupMemberByScannable(Scannable scannable) voidremoveGroupMemberName(String name) setAssembly(Assembly assembly) voidsetAttribute(String attributeName, Object value) Set any attribute the implementing classes may providevoidsetDefinedCoordinates(List<Coordinates> coords) voidsetExtraNames(String[] names) Sets the array of names returned by getExtraNames of this scannable.final voidsetGroupMembers(List<Scannable> scannables) voidsetGroupMembersNames(List<String> scannableNames) final voidsetGroupMembersNamesWithArray(String[] scannableNames) final voidsetGroupMembersNamesWithArray(String[] scannableNames, boolean toConfigure) voidsetGroupMembersNamesWithList(List<String> scannableNames, boolean toConfigure) voidsetGroupMembersWithArray(Scannable[] scannables) voidsetGroupMembersWithList(List<Scannable> groupMembers, boolean toConfigure) voidsetInputNames(String[] names) sets the array of names returned by getInputNames method of this scannable.voidsetLevel(int level) Used for ordering the operations of Scannables during scansvoidSet or change the name of the object (as defined in XML).voidsetOutputFormat(String[] names) Sets the array of strings describing how best to format the positions from this scannablevoidsetProtectionLevel(int newLevel) Sets the permission level for this object.voidstop()Stop the current move/operation.Returns a string representation of the Scannable and its current position/value/statustoString()updateCoordinates(Coordinates coord) voidReturns when operation carried out by moveTo has completedMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface gda.device.scannable.scannablegroup.IScannableGroup
getUnitsMethods inherited from interface gda.device.Scannable
getScanMetadataAttribute, getScanMetadataAttributeNames, getScanMetadataAttributes, setScanMetadataAttribute, setScanMetadataAttributes
-
Constructor Details
-
AssemblyAdapter
public AssemblyAdapter()
-
-
Method Details
-
__call__
- Throws:
DeviceException
-
__call__
- Throws:
DeviceException
-
addActionRule
public void addActionRule(Scannable scannable, ActionRule rule, Device... devices) throws DeviceException - Specified by:
addActionRulein interfaceAssembly- Throws:
DeviceException
-
addDefinedCoordinates
public void addDefinedCoordinates(String name, int index, Coordinates coordinates) throws DeviceException - Specified by:
addDefinedCoordinatesin interfaceIndexPositioner- Throws:
DeviceException
-
addGroupMemberByName
- Specified by:
addGroupMemberByNamein interfaceIScannableGroupNamed- Throws:
FactoryException
-
addIObserver
public void addIObserver(gda.observable.IObserver observer) - Specified by:
addIObserverin interfacegda.observable.IObservable
-
asynchronousMoveTo
Description copied from interface:ScannableTrigger a move/operation and return immediately. Implementations of this method should be non-blocking to allow concurrent motion; the isBusy method will be used to determine when the move has completed.- Specified by:
asynchronousMoveToin interfaceScannable- Parameters:
position- Position to move to should have an element for each input field.- Throws:
DeviceException
-
asynchronousMoveToCoordinates
Description copied from interface:CoordinatesMoveTrigger a move/operation and return immediately. Implementations of this method should be non-blocking to allow concurrent motion; the isBusy method will be used to determine when the move has completed.- Specified by:
asynchronousMoveToCoordinatesin interfaceCoordinatesMove- Parameters:
coordinates- Coordinates to move to- Throws:
DeviceException
-
asynchronousMoveToDefined
Description copied from interface:IndexMoveTrigger a move/operation to a pre-defined and indexed position and return immediately. Implementations of this method should be non-blocking to allow concurrent motion;- Specified by:
asynchronousMoveToDefinedin interfaceIndexMove- Parameters:
coordinatesName- Coordinates to move to- Throws:
DeviceException
-
asynchronousMoveToIndex
- Specified by:
asynchronousMoveToIndexin interfaceIndexMove- Throws:
DeviceException
-
atCommandFailure
Description copied from interface:ScannableHook to be used by Scan and pos commands to inform the Scannable that an exception, such as a DeviceExcpetion, has occurred. However not called when the command is aborted using an InterruptionException. If a Scan is aborted then onlyScannable.stop()will be called by the Scan or pos command.Useful for telling Scannables which hold state during a scan for example, to reset themselves. Used for example by CoordinatedMotionScannables. This hook should be used not in the same way as the stop hook.
- Specified by:
atCommandFailurein interfaceScannable- Throws:
DeviceException
-
atLevelEnd
- Specified by:
atLevelEndin interfaceScannable- Throws:
DeviceException
-
atLevelMoveStart
Description copied from interface:ScannableCalled by both the pos and scan commands at the start of each subsequent level move only on Scannables that will be moved as part that level's movement.For example "pos a 1 b 2 c 3", will, if a and b have the same level and c a higher level will result in:
This hook is used by CoordinatedMotionScannables.a.atLevelMoveStart() invalid input: '<'---- b.atLevelMoveStart() invalid input: '<'---- a.asynchronousMoveTo() b.asynchronousMoveTo() a.waitWhileBusy() b.waitWhileBusy() c.atLevelMoveStart() invalid input: '<'---- c.asynchronousMoveTo() c.waitWhileBusy()
- Specified by:
atLevelMoveStartin interfaceScannable- Throws:
DeviceException
-
atLevelStart
Description copied from interface:ScannableCalled by both the pos and scan commands at the start of each subsequent level move on all Scannables that are part that level's movement.This provides a useful mechanism for e.g. creating a Scannable that opens a shutter after motors have moved but before a detector is exposed.
- Specified by:
atLevelStartin interfaceScannable- Throws:
DeviceException
-
atPointEnd
Description copied from interface:ScannableCalled on every Scannable at the end of every data point, for scans which are broken down into individual points (i.e. non-continous scans)- Specified by:
atPointEndin interfaceScannable- Throws:
DeviceException
-
atPointStart
Description copied from interface:ScannableCalled on every Scannable at every data point, for scans which are broken down into individual points (i.e. non-continuous scans)- Specified by:
atPointStartin interfaceScannable- Throws:
DeviceException
-
atScanEnd
Description copied from interface:ScannableCalled for every Scannable at the end of a group of nested scans (or a single scan if that is the case).Note that this is only called if the Scan finishes normally, or has been requested to finish early. This will not be called if the scan finishes due to an exception of any kind. See
Scannable.atCommandFailure()- Specified by:
atScanEndin interfaceScannable- Throws:
DeviceException
-
atScanLineEnd
Description copied from interface:ScannableCalled for every Scannable at the end of every scan- Specified by:
atScanLineEndin interfaceScannable- Throws:
DeviceException
-
atScanLineStart
Description copied from interface:ScannableCalled for every Scannable at the start of every scan- Specified by:
atScanLineStartin interfaceScannable- Throws:
DeviceException
-
atScanStart
Description copied from interface:ScannableCalled for every Scannable at the start of a group of nested scans (or a single scan if that is the case)- Specified by:
atScanStartin interfaceScannable- Throws:
DeviceException
-
checkAssemblies
public boolean checkAssemblies()- Specified by:
checkAssembliesin interfaceAssembly
-
checkAssembly
- Throws:
IllegalStateException
-
checkMovementValid
- Specified by:
checkMovementValidin interfaceCoordinatesMove
-
checkPositionValid
Description copied from interface:ScannableTests if the given object is meaningful to this Scannable and so could be used by one of the move commands. May check limits and other things too. This is the method called by scans on all points before the scan is run.- Specified by:
checkPositionValidin interfaceScannable- Parameters:
position-- Returns:
- null if position is valid, or returns a description if not.
- Throws:
DeviceException
-
clearConfiguration
- Specified by:
clearConfigurationin interfaceAssembly- Throws:
DeviceExceptionFactoryException
-
close
Description copied from interface:DeviceClose and unconfigure the device.- Specified by:
closein interfaceDevice- Throws:
DeviceException
-
configure
Description copied from interface:ConfigurablePerform operations that must be done after Spring initialisation i.e. anything that goes beyond setting member variables.- Specified by:
configurein interfaceConfigurable- Throws:
FactoryException- if there is an error in configuration e.g. required variable not set or cannot connect to device
-
deleteIObserver
public void deleteIObserver(gda.observable.IObserver observer) - Specified by:
deleteIObserverin interfacegda.observable.IObservable
-
deleteIObservers
public void deleteIObservers()- Specified by:
deleteIObserversin interfacegda.observable.IObservable
-
getAdapter
- Specified by:
getAdapterin interfaceAssembly- Throws:
DeviceException
-
getAllDevices
- Specified by:
getAllDevicesin interfaceAssembly- Throws:
DeviceException
-
getAttribute
Description copied from interface:DeviceGet the value of the specified attribute- Specified by:
getAttributein interfaceDevice- Parameters:
attributeName- is the name of the attribute- Returns:
- the value of the attribute as an Object type
- Throws:
DeviceException- if an attribute cannot be retrieved
-
getCurrentCoordinates
Description copied from interface:CoordinatesMoveReturns the current predefined coordinates holder.- Specified by:
getCurrentCoordinatesin interfaceCoordinatesMove- Returns:
- Current Coordinate object with a position element for each scannable dimension.
- Throws:
DeviceException
-
getDefinedCoordinates
- Specified by:
getDefinedCoordinatesin interfaceCoordinatesMove
-
getDefinedCoordinatesNames
Description copied from interface:IndexMoveReturns an array of the names of registered defined coordinates- Specified by:
getDefinedCoordinatesNamesin interfaceIndexMove- Returns:
- an array of defined coordinates names
-
getDevice
- Specified by:
getDevicein interfaceAssembly- Throws:
DeviceException
-
getExtraNames
Description copied from interface:ScannableAdditional names for extra values that returned by getPosition().- Specified by:
getExtraNamesin interfaceScannable- Returns:
- array of names of the extra elements if the array returned by getPosition is larger than the array required by moveTo
-
getGroupMemberNames
- Specified by:
getGroupMemberNamesin interfaceIScannableGroup- Returns:
- the names of the members of this group
-
getGroupMembersNamesAsArray
Deprecated.- Specified by:
getGroupMembersNamesAsArrayin interfaceIScannableGroupNamed
-
getInputNames
Description copied from interface:Scannablegets a array of InputNames used by moveTo of this scannable.- Specified by:
getInputNamesin interfaceScannable- Returns:
- array of the names of the elements of the object returned by getPosition
-
getLevel
public int getLevel()Description copied from interface:Scannableget the operation level of this scannable. -
getName
Description copied from interface:FindableGet the object name. Used by Castor to check if the object name has been set before calling theFindable.setName(String)method. -
getOutputFormat
Description copied from interface:ScannableReturns an array of strings which are the format strings to use when pretty printing parts of the output- Specified by:
getOutputFormatin interfaceScannable- Returns:
- string array
-
getPosition
Description copied from interface:ScannableReturns the current position of the Scannable. Called by ConcurentScan at the end of the point.- Specified by:
getPositionin interfaceScannable- Returns:
- Current position with an element for each input and extra field. null if their are no fields.
- Throws:
DeviceException
-
getProtectionLevel
public int getProtectionLevel()- Specified by:
getProtectionLevelin interfaceDevice- Returns:
- int - the permission level for this object.
-
getSubAssemblies
- Specified by:
getSubAssembliesin interfaceAssembly- Throws:
DeviceException
-
hasAssembly
public boolean hasAssembly() -
isAt
Description copied from interface:ScannableTests if the scannable is at (or if appropriate, close to) the value positionToTest.- Specified by:
isAtin interfaceScannable- Parameters:
positionToTest- The position to compare the scannable's position to.- Returns:
- true if scannable is at positionToTest
- Throws:
DeviceException
-
isAt
Description copied from interface:IndexMoveTests if the coordinates are at (or if appropriate, close to) the values in coordinatesToTest.- Specified by:
isAtin interfaceIndexMove- Parameters:
coordinatesToTest- The position to compare the positioner's position to.- Returns:
- true if coordinates is at coordinatesToTest
- Throws:
DeviceException
-
isAtIndex
- Specified by:
isAtIndexin interfaceIndexMove- Throws:
DeviceException
-
isBusy
Description copied from interface:ScannableCheck if the Scannable is moving/operating.- Specified by:
isBusyin interfaceScannable- Returns:
- true - if operation carried out by moveTo has not completed yet
- Throws:
DeviceException
-
isConfigureAtStartup
public boolean isConfigureAtStartup()Description copied from interface:ConfigurableIndicates whether this object should be configured at startup.Moved from ConditionallyConfigurable which has been deleted
- Specified by:
isConfigureAtStartupin interfaceConfigurable
-
isConfigured
public boolean isConfigured()Description copied from interface:ConfigurableChecks to see if the object is already configured.- Specified by:
isConfiguredin interfaceConfigurable- Returns:
- return
trueif configuredfalseotherwise
-
isEnabled
public boolean isEnabled() -
isLockedToIndexPositions
public boolean isLockedToIndexPositions()Description copied from interface:IndexPositionerTests if the underlying positioner is expected to only allow movements to the indexed positions.- Specified by:
isLockedToIndexPositionsin interfaceIndexPositioner- Returns:
- true if implementer is locked to indexed positions only
-
moveTo
Description copied from interface:ScannableTrigger a move/operation and block until completion.- Specified by:
moveToin interfaceScannable- Parameters:
position-- Throws:
DeviceException
-
moveToCoordinates
Description copied from interface:CoordinatesMoveTrigger a move/operation and block until completion.- Specified by:
moveToCoordinatesin interfaceCoordinatesMove- Throws:
DeviceException
-
moveToDefined
Description copied from interface:IndexMoveTrigger a move/operation and block until completion.- Specified by:
moveToDefinedin interfaceIndexMove- Parameters:
coordinatesName- Coordinates to move to- Throws:
DeviceException
-
moveToIndex
- Specified by:
moveToIndexin interfaceIndexMove- Throws:
DeviceException
-
reconfigure
Description copied from interface:ConfigurableRe-initialisation of values and states.Moved from Reconfigurable which has been deleted
- Specified by:
reconfigurein interfaceConfigurable- Throws:
FactoryException
-
setAssembly
-
setAttribute
Description copied from interface:DeviceSet any attribute the implementing classes may provide- Specified by:
setAttributein interfaceDevice- Parameters:
attributeName- is the name of the attributevalue- is the value of the attribute- Throws:
DeviceException- if an attribute cannot be set
-
setDefinedCoordinates
- Specified by:
setDefinedCoordinatesin interfaceIndexPositioner- Throws:
DeviceException
-
setExtraNames
Description copied from interface:ScannableSets the array of names returned by getExtraNames of this scannable.- Specified by:
setExtraNamesin interfaceScannable- Parameters:
names-
-
setInputNames
Description copied from interface:Scannablesets the array of names returned by getInputNames method of this scannable.- Specified by:
setInputNamesin interfaceScannable- Parameters:
names-
-
setLevel
public void setLevel(int level) Description copied from interface:ScannableUsed for ordering the operations of Scannables during scans -
setName
Description copied from interface:FindableSet or change the name of the object (as defined in XML). -
setOutputFormat
Description copied from interface:ScannableSets the array of strings describing how best to format the positions from this scannable- Specified by:
setOutputFormatin interfaceScannable- Parameters:
names-
-
setProtectionLevel
public void setProtectionLevel(int newLevel) Description copied from interface:DeviceSets the permission level for this object. If this is not set then a default value will be applied.- Specified by:
setProtectionLevelin interfaceDevice- Parameters:
newLevel-
-
stop
Description copied from interface:ScannableStop the current move/operation.- Specified by:
stopin interfaceScannable- Throws:
DeviceException
-
toFormattedString
Description copied from interface:ScannableReturns a string representation of the Scannable and its current position/value/statusTypically should return:
name : position
or for detectors, name : status
If the position/status cannot be determined, the function should return
Scannable.VALUE_UNAVAILABLEin its place.- Specified by:
toFormattedStringin interfaceScannable- Returns:
- string as defined above
-
updateCoordinates
- Specified by:
updateCoordinatesin interfaceIndexPositioner- Throws:
DeviceException
-
waitWhileBusy
Description copied from interface:ScannableReturns when operation carried out by moveTo has completed- Specified by:
waitWhileBusyin interfaceScannable- Throws:
DeviceExceptionInterruptedException
-
getGroupMembersNames
- Specified by:
getGroupMembersNamesin interfaceIScannableGroupNamed
-
setGroupMembersNames
- Specified by:
setGroupMembersNamesin interfaceIScannableGroupNamed- Throws:
FactoryException
-
setGroupMembersNamesWithList
public void setGroupMembersNamesWithList(List<String> scannableNames, boolean toConfigure) throws FactoryException - Specified by:
setGroupMembersNamesWithListin interfaceIScannableGroupNamed- Throws:
FactoryException
-
setGroupMembersNamesWithArray
- Specified by:
setGroupMembersNamesWithArrayin interfaceIScannableGroupNamed- Throws:
FactoryException
-
setGroupMembersNamesWithArray
public final void setGroupMembersNamesWithArray(String[] scannableNames, boolean toConfigure) throws FactoryException - Specified by:
setGroupMembersNamesWithArrayin interfaceIScannableGroupNamed- Throws:
FactoryException
-
removeGroupMemberName
- Specified by:
removeGroupMemberNamein interfaceIScannableGroupNamed- Throws:
DeviceException
-
setGroupMembers
- Specified by:
setGroupMembersin interfaceIScannableGroup- Throws:
FactoryException
-
setGroupMembersWithArray
- Specified by:
setGroupMembersWithArrayin interfaceIScannableGroup- Throws:
FactoryException
-
removeGroupMemberByScannable
- Specified by:
removeGroupMemberByScannablein interfaceIScannableGroup- Throws:
FactoryException
-
removeGroupMemberByIndex
- Specified by:
removeGroupMemberByIndexin interfaceIScannableGroup- Throws:
FactoryException
-
addGroupMember
- Specified by:
addGroupMemberin interfaceIScannableGroup- Throws:
FactoryException
-
addGroupMember
- Specified by:
addGroupMemberin interfaceIScannableGroup- Throws:
FactoryException
-
setGroupMembersWithList
public void setGroupMembersWithList(List<Scannable> groupMembers, boolean toConfigure) throws FactoryException - Specified by:
setGroupMembersWithListin interfaceIScannableGroup- Throws:
FactoryException
-
toString
-
getGroupMemberByName
- Specified by:
getGroupMemberByNamein interfaceIScannableGroupNamed- Throws:
DeviceException
-
getGroupMembersAsArray
- Specified by:
getGroupMembersAsArrayin interfaceIScannableGroup- Throws:
DeviceException
-
getGroupMembers
- Specified by:
getGroupMembersin interfaceIScannableGroup- Throws:
DeviceException
-