Interface SelfLinkingBoard
- All Superinterfaces:
AssemblyInstallAware
Board can implement if it doesn't naturally
link via some external process. A board is a logical representation of
some physical device and that device typically gets detected and interfaces
to java via an adapter or some similar process. However, in some cases a
board is really an abstraction for an external system that only deals
with incoming operations, such as a device that only reacts to http requests.
In this case there is no inbound event to KOS to trigger a board link.
In these cases a board can implement SelfLinkingBoard which allows
the board to declare itself linked / unlinked by calling methods in the
interface. This allows the board to still leverage the linking concept
by deciding when to link and unlink. In the example of an external system
that responds to http requests, the board can start pinging the external
system once the assembly the board is part of is installed. When pings
are successful, the board can link and when pings fail, the board can
unlink. This has the result of triggering standard lifecycle events
and troubles, such as BoardNotLinkedTrouble.
This interface extends AssemblyInstallAware which provides
install / uninstall callbacks when the assembly the board is part of
is installed. These indicate when it's safe for the board to start
any activities, including link detection / linking.
- Since:
- 9
- Version:
- 9
-
Method Summary
Modifier and TypeMethodDescriptiondefault voidCall to link the board.default voidCall to unlink the board.Methods inherited from interface com.kosdev.kos.core.service.assembly.AssemblyInstallAware
onAssemblyInstall, onAssemblyUninstall
-
Method Details
-
selfLink
Call to link the board. If this is called before the associated assembly has been installed, it will throw an exception. Calling this while the board is already linked will have no effect.If the board is effectively linked to an external system and that system has a serial number, it should be provided when calling
selfLink(). If there is no concept of a serial number, specify null which will cause the link to use the hashcode of the board path as the serial number.- Parameters:
serialNum- serial number for the board, if null, hashcode of board path will be used- Throws:
NotInstalledException- if the assembly is not installed- Since:
- 9
-
selfUnlink
default void selfUnlink()Call to unlink the board. Calling this while the board is already unlinked will have no effect.- Since:
- 9
-