Advertisement
effedetto

Untitled

Jul 17th, 2019
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.56 KB | None | 0 0
  1. /**
  2. * Create BucketS3 channelTag.json.
  3. * Log the error if json cannot be created to the S3 location
  4. *
  5. * @param awsClient S3 bucket builder
  6. * @param channelTag The channel name in tag-version (eg.I1,C5,R4)
  7. * @param content NowNextResponse the now&next content of the channel
  8. * @param tID current transaction ID
  9. * @log error on saving fail, nothing otherwise
  10. * @see AmazonS3
  11. * @see NowNextResponse
  12. */
  13. private void saveNowNextChannelFile(AmazonS3 awsClient, String channelTag, NowNextResponse content, String tID){
  14. String S3jsonName = StringFormatter.format(StringFormatter.PLACEHOLDER_DIGITS, NOW_NEXT_BUCKET_CHANNEL_KEY, channelTag);
  15. NowNextResult nowNextResult = new NowNextResult("NowNextTask", true, tID, content);
  16.  
  17. //TODO to change
  18. try {
  19. if(!S3Manager.uploadFile( awsClient, configuration.getAwsS3Env(), configuration.getAwsS3BucketNameShare(), S3jsonName, JSONHelper.stringify(nowNextResult), configuration.getCacheControl() ))
  20. log.error("Error during updating json on S3 bucket.");
  21.  
  22. if (configuration.isNowNextDuplicationEnabled()) {
  23. S3jsonName = StringUtils.substring(S3jsonName, S3jsonName.indexOf('/') + 1);
  24. if(!S3Manager.uploadFile( awsClient, configuration.getAwsS3Env(), configuration.getAwsS3BucketNameShare(), S3jsonName, JSONHelper.stringify(nowNextResult), configuration.getCacheControl() ))
  25. log.error("Error during updating json on S3 bucket.");
  26. }
  27.  
  28. }catch(IOException e) {
  29. log.error("Error during building json from SchedulerNowNextResult.", e);
  30. }
  31.  
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement