@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; } }
@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(); } }
@Override public boolean isRelevant(IntentEvent event) { if (event.subject() instanceof VirtualNetworkIntent) { return true; } return false; }