Class NexusDeviceService
java.lang.Object
org.eclipse.dawnsci.nexus.device.impl.NexusDeviceService
- All Implemented Interfaces:
INexusDeviceService
Implementation of
INexusDeviceService.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<N extends NXobject>
INexusDevice<N> decorateNexusDevice(INexusDevice<N> nexusDevice) Returns the decorated nexus device for the given nexus device if one is registered, otherwise returns the given nexus device as is.<N extends NXobject>
INexusDeviceDecorator<N> getDecorator(String name) Returns the decorator for the given name, if one is registered.<N extends NXobject>
INexusDevice<N> getNexusDevice(String name) Gets theINexusDevicewith the given name.<N extends NXobject,T>
INexusDevice<N> getNexusDevice(T device, NexusScanInfo.ScanRole scanRole) Gets theINexusDevicefor the given object, if possible, otherwisenull.booleanhasDecorator(String name) Returns whether aINexusDeviceDecoratoris registered with the given name.booleanhasNexusDevice(String name) Returns whether a nexus device is registered with the given name.<N extends NXobject>
voidregister(INexusDevice<N> nexusDevice) Registers the given nexus device with this service.<N extends NXobject>
voidunregister(INexusDevice<N> nexusDevice) Unregisters the given nexus device from this service.
-
Constructor Details
-
NexusDeviceService
public NexusDeviceService()
-
-
Method Details
-
register
Description copied from interface:INexusDeviceServiceRegisters the given nexus device with this service.- Specified by:
registerin interfaceINexusDeviceService- Type Parameters:
N- subclass ofNXobjectcreated by this device- Parameters:
nexusDevice- the nexus device to register
-
unregister
Description copied from interface:INexusDeviceServiceUnregisters the given nexus device from this service.- Specified by:
unregisterin interfaceINexusDeviceService- Type Parameters:
N- subclass ofNXobjectcreated by this device- Parameters:
nexusDevice- the nexus device to unregister
-
hasNexusDevice
Description copied from interface:INexusDeviceServiceReturns whether a nexus device is registered with the given name.- Specified by:
hasNexusDevicein interfaceINexusDeviceService- Parameters:
name- name- Returns:
trueif a nexus device with the given name is registered,falseotherwise
-
getNexusDevice
Description copied from interface:INexusDeviceServiceGets theINexusDevicewith the given name.- Specified by:
getNexusDevicein interfaceINexusDeviceService- Type Parameters:
N- subclass ofNXobjectcreated by this device- Parameters:
name- name- Returns:
- the nexus device with the given name
- Throws:
NexusException- if there is no nexus device with the given name
-
hasDecorator
Description copied from interface:INexusDeviceServiceReturns whether aINexusDeviceDecoratoris registered with the given name.- Specified by:
hasDecoratorin interfaceINexusDeviceService- Parameters:
name- name- Returns:
trueif a decorator is registered with the given name,falseotherwise
-
getDecorator
public <N extends NXobject> INexusDeviceDecorator<N> getDecorator(String name) throws NexusException Description copied from interface:INexusDeviceServiceReturns the decorator for the given name, if one is registered. This can be used to query or update the decorators properties. It should not be used to decorate a nexus device as the methodINexusDeviceService.decorateNexusDevice(INexusDevice)is provided for that purpose.- Specified by:
getDecoratorin interfaceINexusDeviceService- Type Parameters:
N- subclass ofNXobjectcreated by the returned decorator- Returns:
- the decorator for the given name
- Throws:
NexusException- if no such decorator exists
-
decorateNexusDevice
Description copied from interface:INexusDeviceServiceReturns the decorated nexus device for the given nexus device if one is registered, otherwise returns the given nexus device as is. The decorator should be an instance ofINexusDeviceDecorator. It will be looked up by name and itsINexusDeviceDecorator.setDecorated(INexusDevice)called with the given nexus device.- Specified by:
decorateNexusDevicein interfaceINexusDeviceService- Type Parameters:
N- subclass ofNXobjectcreated by the given device, and the decorator (if applicable)- Parameters:
nexusDevice- the nexus device to decorate, if a decorator is registered- Returns:
- the decorated nexus device
-
getNexusDevice
public <N extends NXobject,T> INexusDevice<N> getNexusDevice(T device, NexusScanInfo.ScanRole scanRole) throws NexusException Description copied from interface:INexusDeviceServiceGets theINexusDevicefor the given object, if possible, otherwisenull.- Specified by:
getNexusDevicein interfaceINexusDeviceService- Type Parameters:
N- subclass ofNXobjectcreated by this device- Parameters:
device- the device to get theINexusDeviceforscanRole- the role the device is taking part in the scan- Returns:
- the nexus device with the given name, or
nullif no nexus device can be created - Throws:
NexusException
-