[CONTROLLER-365] Enhancements to the toaster md-sal exampl Created: 22/Apr/14 Updated: 18/Jan/18 Resolved: 14/May/14 |
|
| Status: | Resolved |
| Project: | controller |
| Component/s: | mdsal |
| Affects Version/s: | Helium |
| Fix Version/s: | None |
| Type: | Improvement | ||
| Reporter: | Tom Pantelis | Assignee: | Tom Pantelis |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Operating System: Linux |
||
| Description |
|
While documenting the toaster example on wiki, Devin Avery and I would like to propose some enhancements to the example, specifically the toaster consumer part. Currently, the ToasterConsumer is a hand-coded interface providing a createToast method and the implementation merely passes through to ToasterService.makeToast. We were a little confused initially as to the intent of having another interface to make toast that essentially is a wrapper for the ToasterService. We surmise that the purpose of the ToasterConsumer is to demonstrate how to programmatically access the ToasterService. This is fine however essentially re-defining the same interface isn't very compelling and may be a little confusing. We'd like to propose changing the ToasterConsumer to a KitchenService interface with the ability to make breakfast: boolean makeBreakfast( EggsType eggs, Class<? extends ToastType> toast, int toastDoneness ); This defines a higher-level service for making a full breakfast, including toast and eggs. This nicely demonstrates “service chaining”, a consumer of one or more services being a provider of another service. This example would only actually implement and call into the 'toast' service but one can see that it could be extended to also implement and call into an 'eggs' service and also add 'coffee' service etc. In addition, we'd like to propose replacing the 'toastDone' notification with ³toasterOutOfStock² and 'toasterRestocked' notifications. The KitchenService would listen for these notifications and set/clear an internal 'toasterOutOfStock' flag. In the makeBreakfast method, if toasterOutOfStock is true, fail the call, ie return false. In the toaster provider:
|
| Comments |
| Comment by Tom Pantelis [ 25/Apr/14 ] |
|
Added gerrit: |
| Comment by Vratko Polak [ 18/Jan/18 ] |
|
> replacing the 'toastDone' notification Does anybody remember why it was a good idea to remove the toastDone notification? I mean, toasterOutOfStock and toasterRestocked does not tell anything about whether my toast is done already. The notification removal causes ODL toaster to be incompatible with netconf central toaster, see https://jira.opendaylight.org/browse/CONTROLLER-1808
|