示例#1
0
    @Override
    public void event(IntentEvent event) {

      // Ignore intent events that are not relevant.
      if (!isRelevant(event)) {
        return;
      }

      VirtualNetworkIntent intent = (VirtualNetworkIntent) event.subject();

      switch (event.type()) {
        case INSTALL_REQ:
          store.addOrUpdateIntent(intent, IntentState.INSTALL_REQ);
          break;
        case INSTALLED:
          store.addOrUpdateIntent(intent, IntentState.INSTALLED);
          break;
        case WITHDRAW_REQ:
          store.addOrUpdateIntent(intent, IntentState.WITHDRAW_REQ);
          break;
        case WITHDRAWN:
          store.addOrUpdateIntent(intent, IntentState.WITHDRAWN);
          break;
        case FAILED:
          store.addOrUpdateIntent(intent, IntentState.FAILED);
          break;
        case CORRUPT:
          store.addOrUpdateIntent(intent, IntentState.CORRUPT);
          break;
        case PURGED:
          store.removeIntent(intent.key());
        default:
          break;
      }
    }
示例#2
0
 @Override
 public void event(IntentEvent event) {
   if (Objects.equals(event.subject().key(), key)
       && (event.type() == IntentEvent.Type.WITHDRAWN
           || event.type() == IntentEvent.Type.FAILED)) {
     latch.countDown();
   }
 }
示例#3
0
 @Override
 public boolean isRelevant(IntentEvent event) {
   if (event.subject() instanceof VirtualNetworkIntent) {
     return true;
   }
   return false;
 }