4949import org .apache .nifi .expression .ExpressionLanguageScope ;
5050import org .apache .nifi .flowfile .FlowFile ;
5151import org .apache .nifi .flowfile .attributes .CoreAttributes ;
52+ import org .apache .nifi .migration .PropertyConfiguration ;
5253import org .apache .nifi .processor .ProcessContext ;
5354import org .apache .nifi .processor .ProcessSession ;
5455import org .apache .nifi .processor .ProcessorInitializationContext ;
9798public class GetHDFSFileInfo extends AbstractHadoopProcessor {
9899 public static final String APPLICATION_JSON = "application/json" ;
99100 public static final PropertyDescriptor FULL_PATH = new PropertyDescriptor .Builder ()
100- .displayName ("Full path" )
101- .name ("gethdfsfileinfo-full-path" )
101+ .name ("Full Path" )
102102 .description ("A directory to start listing from, or a file's full path." )
103103 .required (true )
104104 .expressionLanguageSupported (ExpressionLanguageScope .FLOWFILE_ATTRIBUTES )
@@ -107,8 +107,7 @@ public class GetHDFSFileInfo extends AbstractHadoopProcessor {
107107 .build ();
108108
109109 public static final PropertyDescriptor RECURSE_SUBDIRS = new PropertyDescriptor .Builder ()
110- .displayName ("Recurse Subdirectories" )
111- .name ("gethdfsfileinfo-recurse-subdirs" )
110+ .name ("Recurse Subdirectories" )
112111 .description ("Indicates whether to list files from subdirectories of the HDFS directory" )
113112 .required (true )
114113 .allowableValues ("true" , "false" )
@@ -117,35 +116,31 @@ public class GetHDFSFileInfo extends AbstractHadoopProcessor {
117116 .build ();
118117
119118 public static final PropertyDescriptor DIR_FILTER = new PropertyDescriptor .Builder ()
120- .displayName ("Directory Filter" )
121- .name ("gethdfsfileinfo-dir-filter" )
119+ .name ("Directory Filter" )
122120 .description ("Regex. Only directories whose names match the given regular expression will be picked up. If not provided, any filter would be apply (performance considerations)." )
123121 .expressionLanguageSupported (ExpressionLanguageScope .FLOWFILE_ATTRIBUTES )
124122 .required (false )
125123 .addValidator (StandardValidators .createRegexValidator (0 , Integer .MAX_VALUE , true ))
126124 .build ();
127125
128126 public static final PropertyDescriptor FILE_FILTER = new PropertyDescriptor .Builder ()
129- .displayName ("File Filter" )
130- .name ("gethdfsfileinfo-file-filter" )
127+ .name ("File Filter" )
131128 .description ("Regex. Only files whose names match the given regular expression will be picked up. If not provided, any filter would be apply (performance considerations)." )
132129 .expressionLanguageSupported (ExpressionLanguageScope .FLOWFILE_ATTRIBUTES )
133130 .required (false )
134131 .addValidator (StandardValidators .createRegexValidator (0 , Integer .MAX_VALUE , true ))
135132 .build ();
136133
137134 public static final PropertyDescriptor FILE_EXCLUDE_FILTER = new PropertyDescriptor .Builder ()
138- .displayName ("Exclude Files" )
139- .name ("gethdfsfileinfo-file-exclude-filter" )
135+ .name ("Exclude Files" )
140136 .description ("Regex. Files whose names match the given regular expression will not be picked up. If not provided, any filter won't be apply (performance considerations)." )
141137 .expressionLanguageSupported (ExpressionLanguageScope .FLOWFILE_ATTRIBUTES )
142138 .required (false )
143139 .addValidator (StandardValidators .createRegexValidator (0 , Integer .MAX_VALUE , true ))
144140 .build ();
145141
146142 public static final PropertyDescriptor IGNORE_DOTTED_DIRS = new PropertyDescriptor .Builder ()
147- .displayName ("Ignore Dotted Directories" )
148- .name ("gethdfsfileinfo-ignore-dotted-dirs" )
143+ .name ("Ignore Dotted Directories" )
149144 .description ("If true, directories whose names begin with a dot (\" .\" ) will be ignored" )
150145 .required (true )
151146 .addValidator (StandardValidators .BOOLEAN_VALIDATOR )
@@ -154,8 +149,7 @@ public class GetHDFSFileInfo extends AbstractHadoopProcessor {
154149 .build ();
155150
156151 public static final PropertyDescriptor IGNORE_DOTTED_FILES = new PropertyDescriptor .Builder ()
157- .displayName ("Ignore Dotted Files" )
158- .name ("gethdfsfileinfo-ignore-dotted-files" )
152+ .name ("Ignore Dotted Files" )
159153 .description ("If true, files whose names begin with a dot (\" .\" ) will be ignored" )
160154 .required (true )
161155 .addValidator (StandardValidators .BOOLEAN_VALIDATOR )
@@ -174,8 +168,7 @@ public class GetHDFSFileInfo extends AbstractHadoopProcessor {
174168 "Don't group results. Generate flowfile per each HDFS object." );
175169
176170 public static final PropertyDescriptor GROUPING = new PropertyDescriptor .Builder ()
177- .displayName ("Group Results" )
178- .name ("gethdfsfileinfo-group" )
171+ .name ("Group Results" )
179172 .description ("Groups HDFS objects" )
180173 .required (true )
181174 .addValidator (StandardValidators .NON_EMPTY_VALIDATOR )
@@ -184,8 +177,7 @@ public class GetHDFSFileInfo extends AbstractHadoopProcessor {
184177 .build ();
185178
186179 public static final PropertyDescriptor BATCH_SIZE = new PropertyDescriptor .Builder ()
187- .displayName ("Batch Size" )
188- .name ("gethdfsfileinfo-batch-size" )
180+ .name ("Batch Size" )
189181 .description ("Number of records to put into an output flowfile when 'Destination' is set to 'Content'"
190182 + " and 'Group Results' is set to 'None'" )
191183 .required (false )
@@ -201,8 +193,7 @@ public class GetHDFSFileInfo extends AbstractHadoopProcessor {
201193 "Details of given HDFS object will be stored in a content in JSON format" );
202194
203195 public static final PropertyDescriptor DESTINATION = new PropertyDescriptor .Builder ()
204- .displayName ("Destination" )
205- .name ("gethdfsfileinfo-destination" )
196+ .name ("Destination" )
206197 .description ("Sets the destination for the resutls. When set to 'Content', attributes of flowfile won't be used for storing results. " )
207198 .required (true )
208199 .addValidator (StandardValidators .NON_EMPTY_VALIDATOR )
@@ -344,6 +335,20 @@ public void onTrigger(final ProcessContext context, final ProcessSession session
344335 }
345336 }
346337
338+ @ Override
339+ public void migrateProperties (PropertyConfiguration config ) {
340+ super .migrateProperties (config );
341+ config .renameProperty ("gethdfsfileinfo-full-path" , FULL_PATH .getName ());
342+ config .renameProperty ("gethdfsfileinfo-recurse-subdirs" , RECURSE_SUBDIRS .getName ());
343+ config .renameProperty ("gethdfsfileinfo-dir-filter" , DIR_FILTER .getName ());
344+ config .renameProperty ("gethdfsfileinfo-file-filter" , FILE_FILTER .getName ());
345+ config .renameProperty ("gethdfsfileinfo-file-exclude-filter" , FILE_EXCLUDE_FILTER .getName ());
346+ config .renameProperty ("gethdfsfileinfo-ignore-dotted-dirs" , IGNORE_DOTTED_DIRS .getName ());
347+ config .renameProperty ("gethdfsfileinfo-ignore-dotted-files" , IGNORE_DOTTED_FILES .getName ());
348+ config .renameProperty ("gethdfsfileinfo-group" , GROUPING .getName ());
349+ config .renameProperty ("gethdfsfileinfo-batch-size" , BATCH_SIZE .getName ());
350+ config .renameProperty ("gethdfsfileinfo-destination" , DESTINATION .getName ());
351+ }
347352
348353 /*
349354 * Walks thru HDFS tree. This method will return null to the main if there is no provided path existing.
0 commit comments