use of fr.inria.spirals.repairnator.serializer.engines.table.GoogleSpreadsheetSerializerEngine in project repairnator by Spirals-Team.
the class LauncherUtils method initSpreadsheetSerializerEngineWithAccessToken.
public static SerializerEngine initSpreadsheetSerializerEngineWithAccessToken(Logger logger) {
RepairnatorConfig config = RepairnatorConfig.getInstance();
if (config.getSpreadsheetId() != null && config.getGoogleAccessToken() != null) {
logger.info("Initialize Google spreadsheet serializer engine.");
GoogleSpreadSheetFactory.setSpreadsheetId(config.getSpreadsheetId());
try {
if (GoogleSpreadSheetFactory.initWithAccessToken(config.getGoogleAccessToken())) {
return new GoogleSpreadsheetSerializerEngine();
} else {
logger.error("Error while initializing Google Spreadsheet, no information will be serialized in spreadsheets.");
}
} catch (IOException | GeneralSecurityException e) {
logger.error("Error while initializing Google Spreadsheet, no information will be serialized in spreadsheets.", e);
}
} else {
logger.info("Google Spreadsheet won't be used for serialization.");
}
return null;
}
use of fr.inria.spirals.repairnator.serializer.engines.table.GoogleSpreadsheetSerializerEngine in project repairnator by Spirals-Team.
the class LauncherUtils method initSpreadsheetSerializerEngineWithFileSecret.
public static SerializerEngine initSpreadsheetSerializerEngineWithFileSecret(Logger logger) {
RepairnatorConfig config = RepairnatorConfig.getInstance();
if (config.getSpreadsheetId() != null && (new File(config.getGoogleSecretPath())).exists()) {
logger.info("Initialize Google spreadsheet serializer engine.");
GoogleSpreadSheetFactory.setSpreadsheetId(config.getSpreadsheetId());
try {
GoogleSpreadSheetFactory.initWithFileSecret(config.getGoogleSecretPath());
return new GoogleSpreadsheetSerializerEngine();
} catch (IOException | GeneralSecurityException e) {
logger.error("Error while initializing Google Spreadsheet, no information will be serialized in spreadsheets.", e);
}
} else {
logger.info("Google Spreadsheet won't be used for serialization.");
}
return null;
}
Aggregations