Search in sources :

Example 1 with GoogleSpreadsheetSerializerEngine

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;
}
Also used : RepairnatorConfig(fr.inria.spirals.repairnator.config.RepairnatorConfig) GeneralSecurityException(java.security.GeneralSecurityException) GoogleSpreadsheetSerializerEngine(fr.inria.spirals.repairnator.serializer.engines.table.GoogleSpreadsheetSerializerEngine) IOException(java.io.IOException)

Example 2 with GoogleSpreadsheetSerializerEngine

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;
}
Also used : RepairnatorConfig(fr.inria.spirals.repairnator.config.RepairnatorConfig) GeneralSecurityException(java.security.GeneralSecurityException) GoogleSpreadsheetSerializerEngine(fr.inria.spirals.repairnator.serializer.engines.table.GoogleSpreadsheetSerializerEngine) IOException(java.io.IOException) File(java.io.File)

Aggregations

RepairnatorConfig (fr.inria.spirals.repairnator.config.RepairnatorConfig)2 GoogleSpreadsheetSerializerEngine (fr.inria.spirals.repairnator.serializer.engines.table.GoogleSpreadsheetSerializerEngine)2 IOException (java.io.IOException)2 GeneralSecurityException (java.security.GeneralSecurityException)2 File (java.io.File)1