@Override public RayoNode removeNode(String rayoNode) throws DatastoreException { log.debug("Removing node: [%s]", rayoNode); RayoNode node = getNode(rayoNode); if (node == null) { log.error("Node not found: [%s]", rayoNode); throw new RayoNodeNotFoundException(); } RowDeletor deletor = Pelops.createRowDeletor(schemaName); deletor.deleteRow("ips", node.getIpAddress(), ConsistencyLevel.ONE); Mutator mutator = Pelops.createMutator(schemaName); for (String platform : node.getPlatforms()) { mutator.deleteColumn("nodes", platform, rayoNode); } try { mutator.execute(ConsistencyLevel.ONE); log.debug("Node [%s] deleted successfully", rayoNode); } catch (Exception e) { log.error(e.getMessage(), e); throw new DatastoreException("Could not remove node"); } return node; }
@Override public void removeVerbFromMixer(String verbId, String mixerName) throws DatastoreException { log.debug("Removing verb [%s] from mixer [%s]", verbId, mixerName); Mutator mutator = Pelops.createMutator(schemaName); mutator.deleteColumn("verbs", mixerName, verbId); try { mutator.execute(ConsistencyLevel.ONE); log.debug("Verb [%s] removed successfully from mixer [%s]", verbId, mixerName); } catch (Exception e) { log.error(e.getMessage(), e); throw new DatastoreException("Could not remove verb from mixer"); } }
@Override public void removeFilter(String jid, String id) throws DatastoreException { log.debug("Unfiltering id [%s] for app [%s]", id, jid); Mutator mutator = Pelops.createMutator(schemaName); mutator.deleteColumn("filters", id, jid); try { mutator.execute(ConsistencyLevel.ONE); log.debug("Id [%s] has been removed from the filters of application [%s]", id, jid); } catch (Exception e) { log.error(e.getMessage(), e); throw new DatastoreException("Could not remove filter"); } }
@Override public GatewayClient removeClient(String jid) throws DatastoreException { log.debug("Removing client with jid: [%s]", jid); GatewayClient client = getClient(jid); if (client != null) { Mutator mutator = Pelops.createMutator(schemaName); String bareJid = JIDUtils.getBareJid(jid); String resource = JIDUtils.getResource(jid); mutator.deleteColumn("clients", bareJid, resource); mutator.execute(ConsistencyLevel.ONE); List<String> resources = getClientResources(bareJid); if (resources.size() == 0) { RowDeletor deletor = Pelops.createRowDeletor(schemaName); deletor.deleteRow("clients", bareJid, ConsistencyLevel.ONE); } log.debug("Client with jid: [%s] removed successfully", jid); } return client; }