// Parse configuration file
// Assumption here is that .config file is written with the correct syntax (need typechecking)
- //File file = new File(strCfgFileName);
- //Scanner scanFile = new Scanner(new FileReader(file));
- //System.out.println("IoTInstaller: Extracting information from config file: " + strCfgFileName);
-
// Initialize String for ID and TYPE
String strID = "";
String strType = "";
*/
public void extractTableAndInstall(String strCfgFileName) {
// TO DO: WE PROBABLY NEED TO IMPROVE THE FILE PARSING BUT FOR NOW KEEP IT MINIMUM
-
try {
// Parse configuration file
strFields[iFieldCnt++] = scanFile.next();
}
-
// Create a new installer object
tbl.setTableName(STR_COMM_TABLE_NAME);
tbl.insertEntry(strFields);
// Insert new address entry
tbl.insertEntry(strFieldsAddress);
-
System.out.println("IoTInstaller: Installing a new device/entity address into the system");
}
File file = new File(strCfgFileName);
FileInputStream fis = new FileInputStream(file);
System.out.println("IoTInstaller: Extracting information from config file: " + strCfgFileName);
-
installDeviceAddressCore(fis);
} catch (FileNotFoundException ex) {
// Insert new address entry
tbl.insertEntry(strFieldsAddress);
-
System.out.println("IoTInstaller: Installing a new device/entity address into the system");
} catch (FileNotFoundException ex) {
// Insert new address entry
tbl.insertEntry(strFieldsAddress);
-
System.out.println("IoTInstaller: Installing a new device/entity address into the system");
} catch (FileNotFoundException ex) {
// Create a new installer object
tbl.setTableName(STR_HOST_TABLE_NAME);
tbl.insertEntry(strFields);
-
System.out.println("IoTInstaller: Installing a new host into the system");
} catch (FileNotFoundException ex) {
tbl.setTableName(STR_HOST_TABLE_NAME);
String strWhere = "HOSTADDRESS='" + strHostAddress + "';";
tbl.deleteEntry(strWhere);
-
System.out.println("IoTInstaller: Deleting a host from the system");
}
String strWhere = "ID='" + strEntID + "';";
tbl.deleteEntry(strWhere);
System.out.println("IoTInstaller: Removing entity from table " + STR_MAIN_TABLE_NAME);
-
// Delete from table with type name, e.g. Camera
tbl.setTableName(strEntType);
strWhere = "ID='" + strEntID + "';";
tbl.setTableName(strEntAddType + strEntID);
tbl.dropTable();
System.out.println("IoTInstaller: Dropping class constructor table...");
-
System.out.println("IoTInstaller: Deleting an entry from the system...");
}