this.jsonFactory = new JacksonFactory();
}
@Override
public Drive makeClient(String clientId, String clientSecret, Collection<String> scopes, String applicationName, String refreshToken, String accessToken) {
Credential credential;
try {
credential = authorize(clientId, clientSecret, scopes);
if (refreshToken != null && !"".equals(refreshToken)) {
credential.setRefreshToken(refreshToken);
}
if (accessToken != null && !"".equals(accessToken)) {
credential.setAccessToken(accessToken);
}
return new Drive.Builder(transport, jsonFactory, credential).setApplicationName(applicationName).build();
} catch (Exception e) {
LOG.error("Could not create Google Drive client.", e);
}