private static final String STR_INSTALL_DEV_ADDRESS_CMD = "-install_dev_add";
private static final String STR_INSTALL_ZB_ADDRESS_CMD = "-install_zb_add";
private static final String STR_INSTALL_HOST_CMD = "-install_host";
+ private static final String STR_DELETE_COMMUNICATION_CMD = "-delete_comm";
private static final String STR_DELETE_ENTITY_CMD = "-delete_ent";
private static final String STR_DELETE_ADDRESS_CMD = "-delete_add";
private static final String STR_DELETE_DEV_ADD_CMD = "-delete_dev_add";
}
}
+
+ /**
+ * A method to delete relation/communication information from database
+ *
+ * @param strEntIDSource String for entity ID source
+ * @param strEntIDDest String for entity ID destination
+ * @return void
+ */
+ public void deleteComm(String strEntIDSource, String strEntIDDest) {
+
+ // Delete from table IoTMain
+ tbl.setTableName(STR_COMM_TABLE_NAME);
+ String strWhere = "ID_SOURCE='" + strEntIDSource + "' AND ID_DESTINATION='" + strEntIDDest + "';";
+ tbl.deleteEntry(strWhere);
+ System.out.println("IoTInstaller: Removing relation/communication from table " + STR_COMM_TABLE_NAME);
+ }
/**
* A method to extract device/entity addresses information
System.out.println("IoTInstaller: 6) Install zigbee device address, e.g. java iotinstaller.IoTInstaller -install_zb_add <filename>");
System.out.println("IoTInstaller: 7) Install host, e.g. java iotinstaller.IoTInstaller -install_host <filename>");
System.out.println("IoTInstaller: 8) Delete entity, e.g. java iotinstaller.IoTInstaller -delete_ent <ent_id> <ent_type> <ent_name>");
- System.out.println("IoTInstaller: 9) Delete address, e.g. java iotinstaller.IoTInstaller -delete_add <ent_id> <ent_type>");
- System.out.println("IoTInstaller: 10) Delete device address, e.g. java iotinstaller.IoTInstaller -delete_dev_add <ent_id> <ent_type>");
- System.out.println("IoTInstaller: 11) Delete zigbee device address, e.g. java iotinstaller.IoTInstaller -delete_zb_add <ent_id> <ent_type>");
- System.out.println("IoTInstaller: 12) Delete host, e.g. java iotinstaller.IoTInstaller -delete_host <host_address>");
+ System.out.println("IoTInstaller: 9) Delete comm pattern, e.g. java iotinstaller.IoTInstaller -delete_comm <ent_id_source> <ent_id_dest>");
+ System.out.println("IoTInstaller: 10) Delete address, e.g. java iotinstaller.IoTInstaller -delete_add <ent_id> <ent_type>");
+ System.out.println("IoTInstaller: 11) Delete device address, e.g. java iotinstaller.IoTInstaller -delete_dev_add <ent_id> <ent_type>");
+ System.out.println("IoTInstaller: 12) Delete zigbee device address, e.g. java iotinstaller.IoTInstaller -delete_zb_add <ent_id> <ent_type>");
+ System.out.println("IoTInstaller: 13) Delete host, e.g. java iotinstaller.IoTInstaller -delete_host <host_address>");
System.out.println("IoTInstaller: Type 'java iotinstaller.IoTInstaller -help' to display this help.");
System.out.println();
}
helpTxt = helpTxt + "IoTInstaller: 6) Install zigbee device address, e.g. java iotinstaller.IoTInstaller -install_zb_add <filename>\n";
helpTxt = helpTxt + "IoTInstaller: 7) Install host, e.g. java iotinstaller.IoTInstaller -install_host <filename>\n";
helpTxt = helpTxt + "IoTInstaller: 8) Delete entity, e.g. java iotinstaller.IoTInstaller -delete_ent <ent_id> <ent_type> <ent_name>\n";
- helpTxt = helpTxt + "IoTInstaller: 9) Delete address, e.g. java iotinstaller.IoTInstaller -delete_add <ent_id>\n";
- helpTxt = helpTxt + "IoTInstaller: 10) Delete device address, e.g. java iotinstaller.IoTInstaller -delete_dev_add <ent_id>\n";
- helpTxt = helpTxt + "IoTInstaller: 11) Delete zigbee device address, e.g. java iotinstaller.IoTInstaller -delete_zb_add <ent_id>\n";
- helpTxt = helpTxt + "IoTInstaller: 12) Delete host, e.g. java iotinstaller.IoTInstaller -delete_host <host_address>\n";
+ helpTxt = helpTxt + "IoTInstaller: 9) Delete comm pattern, e.g. java iotinstaller.IoTInstaller -delete_comm <ent_id_source> <ent_id_dest>\n";
+ helpTxt = helpTxt + "IoTInstaller: 10) Delete address, e.g. java iotinstaller.IoTInstaller -delete_add <ent_id>\n";
+ helpTxt = helpTxt + "IoTInstaller: 11) Delete device address, e.g. java iotinstaller.IoTInstaller -delete_dev_add <ent_id>\n";
+ helpTxt = helpTxt + "IoTInstaller: 12) Delete zigbee device address, e.g. java iotinstaller.IoTInstaller -delete_zb_add <ent_id>\n";
+ helpTxt = helpTxt + "IoTInstaller: 13) Delete host, e.g. java iotinstaller.IoTInstaller -delete_host <host_address>\n";
helpTxt = helpTxt + "IoTInstaller: Type 'java iotinstaller.IoTInstaller -help' to display this help.\n";
helpTxt = helpTxt + "\n";
} else if (args[0].equals(STR_DELETE_ENTITY_CMD)) {
iotinst.deleteEntity(args[1], args[2], args[3]);
+ } else if (args[0].equals(STR_DELETE_COMMUNICATION_CMD)) {
+ iotinst.deleteComm(args[1], args[2]);
+
} else if (args[0].equals(STR_DELETE_ADDRESS_CMD)) {
iotinst.deleteAddress(STR_ADDRESS_TABLE_NAME, args[1], args[2]);