1212import org .slf4j .LoggerFactory ;
1313
1414import java .io .IOException ;
15+ import java .nio .file .Path ;
1516import java .util .List ;
1617import java .util .Optional ;
1718
@@ -55,13 +56,25 @@ public void invoke() throws IOException, InterruptedException
5556 throw new IllegalArgumentException ("Matching files could not be found" , e );
5657 }
5758
59+
60+ String uploadFormat = configuration .getUploadFormat ();
61+ String customerId = configuration .getCustomerId ();
62+ List <String > uploadOptions = configuration .getUploadOptions ();
63+ log .info ("File format: {}" , uploadFormat );
64+ if (StringUtils .isNotEmpty (customerId ))
65+ {
66+ log .info ("Customer ID: {}" , customerId );
67+ }
68+ log .info ("Upload options: {}" , uploadOptions );
69+
5870 log .info ("Found {} files to upload" , filesToUpload .size ());
5971 for (FileToUpload fileToUpload : filesToUpload )
6072 {
61- long length = fileToUpload .path ().toFile ().length ();
73+ Path path = fileToUpload .path ();
74+ long length = path .toFile ().length ();
6275 if (length == 0 )
6376 {
64- log .warn ("Skipping empty file: {}" , fileToUpload . path () );
77+ log .warn ("Skipping empty file: {}" , path );
6578 continue ;
6679 }
6780
@@ -72,9 +85,10 @@ public void invoke() throws IOException, InterruptedException
7285 boolean hasConfigurationLanguageKey = StringUtils .isNotBlank (configurationLanguageKey );
7386
7487 boolean isLanguageMatching = fileLanguageKey .equals (configurationLanguageKey );
88+ String language = fileToUpload .language ();
7589 if (hasFileLanguageKey && hasConfigurationLanguageKey && !isLanguageMatching )
7690 {
77- log .info ("Skipping '{}' language, file: {}" , fileToUpload . language (), fileToUpload . path () );
91+ log .info ("Skipping '{}' language, file: {}" , language , path );
7892 continue ;
7993 }
8094
@@ -87,27 +101,26 @@ public void invoke() throws IOException, InterruptedException
87101 boolean isMultiLanguageFormat = isMultiLanguageFormat (configuration .getUploadFormat ());
88102 if (!hasFileLanguageKey && !hasConfigurationLanguageKey && !isMultiLanguageFormat )
89103 {
90- log .info ("Language key not present in '--uploadPath' nor '--languageKey' parameter, file: {}" , fileToUpload . path () );
104+ log .info ("Language key not present in '--uploadPath' nor '--languageKey' parameter, file: {}" , path );
91105 }
92106
93- String uploadFormat = configuration .getUploadFormat ();
94- String customerId = configuration .getCustomerId ();
95- List <String > uploadOptions = configuration .getUploadOptions ();
107+
108+ String namespace = fileToUpload .namespace ();
96109 UploadRequest uploadRequest = builder ()
97- .withPath (fileToUpload . path () )
110+ .withPath (path )
98111 .withLanguageKey (requestLanguageKey )
99- .withNamespace (fileToUpload . namespace () )
112+ .withNamespace (namespace )
100113 .withFormat (uploadFormat )
101114 .withCustomerId (customerId )
102115 .withOptions (uploadOptions )
103116 .build ();
104117
105118 if (isDryRun )
106119 {
107- log .info ("[Dry run] Found file to upload, language=[{}], namespace=[{}], file: {}" , fileToUpload . language (), fileToUpload . namespace (), fileToUpload . path () );
120+ log .info ("[Dry run] Found file to upload, language=[{}], namespace=[{}], file: {}" , language , namespace , path );
108121 } else
109122 {
110- log .info ("Uploading {} " , fileToUpload . path () );
123+ log .info ("Uploading language=[{}] namespace=[{}] = {} " , language , namespace , path );
111124 client .uploadFile (uploadRequest );
112125 }
113126 }
0 commit comments