Search in sources :

Example 1 with ManageGoogleAccessToken

use of fr.inria.spirals.repairnator.serializer.gspreadsheet.ManageGoogleAccessToken in project repairnator by Spirals-Team.

the class Launcher method initSerializerEngines.

private void initSerializerEngines() {
    this.engines = new ArrayList<>();
    SerializerEngine spreadsheetSerializerEngine = LauncherUtils.initSpreadsheetSerializerEngineWithFileSecret(LOGGER);
    if (spreadsheetSerializerEngine != null) {
        this.engines.add(spreadsheetSerializerEngine);
        try {
            ManageGoogleAccessToken manageGoogleAccessToken = ManageGoogleAccessToken.getInstance();
            Credential credential = manageGoogleAccessToken.getCredential();
            if (credential != null) {
                this.config.setGoogleAccessToken(credential.getAccessToken());
            }
        } catch (IOException | GeneralSecurityException e) {
            LOGGER.error("Error while initializing Google Spreadsheet, no information will be serialized in spreadsheets from the pipeline.", e);
        }
    }
    List<SerializerEngine> fileSerializerEngines = LauncherUtils.initFileSerializerEngines(LOGGER);
    this.engines.addAll(fileSerializerEngines);
    SerializerEngine mongoDBSerializerEngine = LauncherUtils.initMongoDBSerializerEngine(LOGGER);
    if (mongoDBSerializerEngine != null) {
        this.engines.add(mongoDBSerializerEngine);
    }
}
Also used : Credential(com.google.api.client.auth.oauth2.Credential) GeneralSecurityException(java.security.GeneralSecurityException) SerializerEngine(fr.inria.spirals.repairnator.serializer.engines.SerializerEngine) IOException(java.io.IOException) ManageGoogleAccessToken(fr.inria.spirals.repairnator.serializer.gspreadsheet.ManageGoogleAccessToken)

Aggregations

Credential (com.google.api.client.auth.oauth2.Credential)1 SerializerEngine (fr.inria.spirals.repairnator.serializer.engines.SerializerEngine)1 ManageGoogleAccessToken (fr.inria.spirals.repairnator.serializer.gspreadsheet.ManageGoogleAccessToken)1 IOException (java.io.IOException)1 GeneralSecurityException (java.security.GeneralSecurityException)1