[ 
https://issues.apache.org/jira/browse/BROOKLYN-14?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14051202#comment-14051202
 ] 

ASF GitHub Bot commented on BROOKLYN-14:
----------------------------------------

Github user ahgittin commented on a diff in the pull request:

    https://github.com/apache/incubator-brooklyn/pull/35#discussion_r14502877
  
    --- Diff: 
core/src/main/java/brooklyn/entity/rebind/BasicEntityRebindSupport.java ---
    @@ -98,6 +96,32 @@ public void reconstruct(RebindContext rebindContext, 
EntityMemento memento) {
             ((AbstractEntity)entity).rebind();
         }
         
    +    @Override
    +    public void addPolicies(RebindContext rebindContext, EntityMemento 
memento) {
    +        for (String policyId : memento.getPolicies()) {
    +            AbstractPolicy policy = (AbstractPolicy) 
rebindContext.getPolicy(policyId);
    +            if (policy != null) {
    +                entity.addPolicy(policy);
    +            } else {
    +                LOG.warn("Policy not found; discarding policy {} of entity 
{}({})",
    +                        new Object[] {policyId, memento.getType(), 
memento.getId()});
    +            }
    +        }
    +    }
    +    
    +    @Override
    +    public void addEnrichers(RebindContext rebindContext, EntityMemento 
memento) {
    +        for (String enricherId : memento.getEnrichers()) {
    +            AbstractEnricher enricher = (AbstractEnricher) 
rebindContext.getEnricher(enricherId);
    +            if (enricher != null) {
    +                entity.addEnricher(enricher);
    --- End diff --
    
    as with `addPolicies`, after #34 need to 
`rebindContext.getExceptionHandler().onAddEnricherFailed(entity, enricher, e);`


> Persist+rebind policies and enrichers
> -------------------------------------
>
>                 Key: BROOKLYN-14
>                 URL: https://issues.apache.org/jira/browse/BROOKLYN-14
>             Project: Brooklyn
>          Issue Type: New Feature
>            Reporter: Aled Sage
>             Fix For: 0.7.0
>
>
> Currently in Brooklyn, rebinding policies+enrichers is supported but is off 
> by default - see BrooklynFeatureEnablement [1]. This is because not all 
> policies/enrichers/entities have been reviewed to ensure they will work with 
> policies being persisted and added on Brooklyn restart (or on brooklyn 
> standby node taking over).
> I propose that we change this to persist policies+enrichers. However, we can 
> also improve the RebindExceptionHandler [2] to allow behaviour on policy 
> rebind to set - defaulting to continue on errors.
> I also want to add a PersistenceExceptionHandler to be called when there are 
> errors persisting entities/policies.
> [1] 
> https://github.com/apache/incubator-brooklyn/blob/master/core/src/main/java/brooklyn/internal/BrooklynFeatureEnablement.java
> [2] 
> https://github.com/apache/incubator-brooklyn/blob/master/api/src/main/java/brooklyn/entity/rebind/RebindExceptionHandler.java



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to