-
-
Notifications
You must be signed in to change notification settings - Fork 110
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Boilerplate config changes 2 (#1328)
* added service-life-cycle doc * proposal * different implementation * worky proposal * testing and removal of local config member * unit test fixed and audiofile updated * Rework config generics so T is propagated through ConfigurableService correctly * stop compiler errors * all service templated with config * unit tests catches bug before release ... yesss.. * more fixes * dumb unit test fix * requested updates * removed casts fixed servo ui * fixed unit test --------- Co-authored-by: Branden Butler <[email protected]>
- Loading branch information
1 parent
244d6a7
commit 516f1d5
Showing
165 changed files
with
774 additions
and
706 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# Service Life Cycle | ||
```mermaid | ||
stateDiagram | ||
start: start(name, type) | ||
load: load(name, type) | ||
loadService: loadService(plan, name, type, true, 0) | ||
[*] --> start | ||
start --> load | ||
load --> loadService | ||
loadService --> getDefault | ||
getDefault --> readServiceConfig | ||
readServiceConfig --> loadService | ||
loadService --> createServicesFromPlan | ||
createServicesFromPlan --> createService | ||
createService --> setConfig | ||
setConfig --> apply | ||
apply --> startService | ||
startService --> stopService | ||
stopService --> releaseService | ||
releaseService --> release | ||
release --> [*] | ||
[*] --> create | ||
create --> load | ||
``` | ||
|
||
### start(name, type) | ||
Creates and starts a service with the given name and type | ||
|
||
### load | ||
Starts loading the hierarchy of configuration | ||
FIXME - this should not be the memory plan, but should exist on the filesystem | ||
Default config is used if no config found ~~in memory~~ on filesystem | ||
|
||
### loadService | ||
Recursively loads a service config into a plan | ||
|
||
### createServicesFromPlan(plan, createdServices, name) | ||
Loops through all "loaded" services in the plan and creates them all | ||
|
||
### createService | ||
Instantiates instance of service | ||
|
||
### setConfig | ||
Sets the config of the service | ||
|
||
### apply | ||
Applies the config to the service |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
src/main/java/org/myrobotlab/framework/interfaces/ConfigurableService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package org.myrobotlab.framework.interfaces; | ||
|
||
import org.myrobotlab.service.config.ServiceConfig; | ||
|
||
public interface ConfigurableService<T extends ServiceConfig> { | ||
T getConfig(); | ||
T apply(T c); | ||
} |
Oops, something went wrong.