コード例 #1
0
 ActivationConditionHandler release() {
   if (activationCondition != null) {
     eventBus.unregister(this);
     nexusActiveCondition.release();
     activationCondition.release();
     activationCondition = null;
   }
   return this;
 }
コード例 #2
0
 ActivationConditionHandler bind() {
   if (activationCondition == null) {
     nexusActiveCondition = conditions.nexus().active();
     try {
       activationCondition = reference.capability().activationCondition();
       if (activationCondition instanceof CapabilityContextAware) {
         ((CapabilityContextAware) activationCondition).setContext(reference.context());
       }
     } catch (Exception e) {
       activationCondition = new UnsatisfiedCondition("Failed to determine activation condition");
       getLogger()
           .error(
               "Could not get activation condition from capability {} ({}). Considering it as non activatable",
               new Object[] {reference.capability(), reference.context().id(), e});
     }
     if (activationCondition == null) {
       activationCondition = new SatisfiedCondition("Capability has no activation condition");
     }
     nexusActiveCondition.bind();
     activationCondition.bind();
     eventBus.register(this);
   }
   return this;
 }
 @Override
 public String explainUnsatisfied() {
   return condition.explainSatisfied();
 }
コード例 #4
0
 boolean isConditionSatisfied() {
   return activationCondition != null && activationCondition.isSatisfied();
 }
コード例 #5
0
 public String explainWhyNotSatisfied() {
   return isConditionSatisfied() ? null : activationCondition.explainUnsatisfied();
 }