-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for managing enrichers within the catalog #638
Conversation
@tbouron see brooklyn-server/policy/src/main/resources/catalog.bom - I think we'd need to list the enrichers in a .bom file, otherwise we won't list them when running in karaf (because we won't classpath-scan for annotated enrichers across all bundles, I believe). |
53faeec
to
12bd108
Compare
@aledsage Tried to add enricher definitions in the Am I doing something wrong? |
e07c0e1
to
ba561e9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. A couple of micro observations.
@@ -116,6 +120,8 @@ public static CatalogItemSummary catalogItemSummary(BrooklynRestResourceUtils b, | |||
return catalogEntitySummary(b, item, ub); | |||
case POLICY: | |||
return catalogPolicySummary(b, item, ub); | |||
case ENRICHER: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indentation
@@ -55,7 +56,7 @@ | |||
* (or until another process manually sets {@link Attributes#SERVICE_STATE_ACTUAL} to {@value Lifecycle#ON_FIRE}, | |||
* which this enricher will not clear until all problems have gone away) | |||
*/ | |||
//@Catalog(name="Service Failure Detector", description="HA policy for deteting failure of a service") | |||
@Catalog(name="Service Failure Detector", description="Emits a new sensor if the current entity has an issue") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"has an issue" seems too general, would simply if the current entity fails
be better?
|
||
//Would ideally re-use the PolicySpecResolver | ||
//but it is CAMP specific and there is no easy way to get hold of it. | ||
Object policies = checkNotNull(plan.getCustomAttributes().get(BasicBrooklynCatalog.ENRICHERS_KEY), "enricher config"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
variable name is still policies
static EnricherSpec<?> createEnricherSpec(String yamlPlan, BrooklynClassLoadingContext loader, Set<String> encounteredCatalogTypes) { | ||
DeploymentPlan plan = makePlanFromYaml(loader.getManagementContext(), yamlPlan); | ||
|
||
//Would ideally re-use the PolicySpecResolver |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PolicySpecResolver
in the comment isn't right
ba561e9
to
3320a51
Compare
Thanks for the review @geomacy! I addressed your comments and rebased on the latest master |
Thanks @tbouron, that's great, merging now. |
Actually can you squash the commits? |
…scanned and YAML parsed, same as entities or policies)
3320a51
to
02305e7
Compare
@geomacy done! |
Thanks, merging now |
Add support for managing enrichers within the catalog This allows enrichers to be registered within the Brooklyn catalog, same as entities or policies. It allows enrichers' registration via: - `@Catalog` annotation on the java class - YAML with an `itemType: enricher` This also adds 3 endpoints to the `/v1/catalog` REST API: - `GET /v1/catalog/enrichers` returns the list of all registered enrichers - `GET /v1/catalog/enrichers/<enricherId>/<version>` returns the detail of a specific enricher - `DELETE /v1/catalog/enrichers/<enricherId>/<version>` details a specific enricher _PS: If the PR is too big, I can split up to multiples PRs. Hopefully the commit's messages are pretty clear_
This allows enrichers to be registered within the Brooklyn catalog, same as entities or policies. It allows enrichers' registration via:
@Catalog
annotation on the java classitemType: enricher
This also adds 3 endpoints to the
/v1/catalog
REST API:GET /v1/catalog/enrichers
returns the list of all registered enrichersGET /v1/catalog/enrichers/<enricherId>/<version>
returns the detail of a specific enricherDELETE /v1/catalog/enrichers/<enricherId>/<version>
details a specific enricherPS: If the PR is too big, I can split up to multiples PRs. Hopefully the commit's messages are pretty clear