28
28
*/
29
29
public abstract class AbstractTDFProcessor extends AbstractProcessor {
30
30
31
+ /**
32
+ * Configuration property representing the limit on the number of FlowFiles
33
+ * that can be pulled from the FlowFile queue at a time.
34
+ * It supports expression language through the variable registry and has a default value of 10.
35
+ */
31
36
public static final PropertyDescriptor FLOWFILE_PULL_SIZE = new org .apache .nifi .components .PropertyDescriptor .Builder ()
32
37
.name ("FlowFile queue pull limit" )
33
38
.description ("FlowFile queue pull size limit" )
@@ -37,55 +42,92 @@ public abstract class AbstractTDFProcessor extends AbstractProcessor {
37
42
.addValidator (StandardValidators .INTEGER_VALIDATOR )
38
43
.build ();
39
44
45
+ /**
46
+ * Property descriptor representing an optional SSL Context Service.
47
+ * This descriptor defines a property that can be used to configure
48
+ * an SSLContextService, which is optional for the processor. This
49
+ * service provides the SSL/TLS context needed for secure communication.
50
+ */
40
51
public static final PropertyDescriptor SSL_CONTEXT_SERVICE = new org .apache .nifi .components .PropertyDescriptor .Builder ()
41
52
.name ("SSL Context Service" )
42
53
.description ("Optional SSL Context Service" )
43
54
.required (false )
44
55
.identifiesControllerService (SSLContextService .class )
45
56
.build ();
46
57
58
+ /**
59
+ * Represents a property descriptor for the OpenTDF Config Service.
60
+ * <p>
61
+ * This descriptor specifies that the property is required and identifies
62
+ * a controller service of type {@link OpenTDFControllerService}. The controller service
63
+ * provides the necessary configuration for the OpenTDF platform.
64
+ */
47
65
public static final PropertyDescriptor OPENTDF_CONFIG_SERVICE = new org .apache .nifi .components .PropertyDescriptor .Builder ()
48
66
.name ("OpenTDF Config Service" )
49
67
.description ("Controller Service providing OpenTDF Platform Configuration" )
50
68
.required (true )
51
69
.identifiesControllerService (OpenTDFControllerService .class )
52
70
.build ();
53
71
72
+ /**
73
+ * Defines a successful relationship for the NiFi processor. This relationship is used to route flow files
74
+ * that have been successfully processed. Flow files sent to this relationship indicate that the processor
75
+ * completed its intended action without errors.
76
+ * <p>
77
+ * This relationship is commonly used as an output route for data that has passed all validation, transformation,
78
+ * and processing steps.
79
+ */
54
80
public static final Relationship REL_SUCCESS = new Relationship .Builder ()
55
81
.name ("success" )
56
82
.description ("" )
57
83
.build ();
58
84
85
+ /**
86
+ * Relationship representing a failure in processing flow files.
87
+ * <p>
88
+ * This relationship should be used to route flow files that could not
89
+ * be processed successfully by the processor. The reasons for failure
90
+ * can vary widely and may include issues like invalid data, processing
91
+ * errors, or configuration issues.
92
+ */
59
93
public static final Relationship REL_FAILURE = new Relationship .Builder ()
60
94
.name ("failure" )
61
95
.description ("" )
62
96
.build ();
63
97
64
98
/**
65
- * Get a property value by evaluating attribute expressions if present.
99
+ * Evaluates the provided PropertyValue if expression language is present,
100
+ * otherwise returns the original PropertyValue.
66
101
*
67
- * @param propertyValue
68
- * @return
102
+ * @param propertyValue The PropertyValue to evaluate or return.
103
+ * @return The evaluated PropertyValue if expression language is present,
104
+ * otherwise the original PropertyValue.
69
105
*/
70
106
PropertyValue getPropertyValue (PropertyValue propertyValue ) {
71
107
return propertyValue .isExpressionLanguagePresent () ? propertyValue .evaluateAttributeExpressions () : propertyValue ;
72
108
}
73
109
74
- Optional <PropertyValue > getPropertyValue (PropertyDescriptor propertyDescriptor , ProcessContext processContext ) {
110
+ /**
111
+ * Retrieves the value of the specified property from the given process context.
112
+ *
113
+ * @param processContext The context from which to retrieve the property value.
114
+ * @return An Optional containing the PropertyValue if it is set, or an empty Optional otherwise.
115
+ */
116
+ Optional <PropertyValue > getPropertyValue (ProcessContext processContext ) {
75
117
PropertyValue propertyValue = null ;
76
- if (processContext .getProperty (propertyDescriptor ).isSet ()){
77
- propertyValue = getPropertyValue (processContext .getProperty (propertyDescriptor ));
118
+ if (processContext .getProperty (ConvertToZTDF . SIGN_ASSERTIONS ).isSet ()){
119
+ propertyValue = getPropertyValue (processContext .getProperty (ConvertToZTDF . SIGN_ASSERTIONS ));
78
120
}
79
121
return Optional .ofNullable (propertyValue );
80
122
}
81
123
82
124
private SDK sdk ;
83
125
84
126
/**
85
- * Create a new TDF SDK using the OpenTDFController Service as a source of configuration
127
+ * Retrieves an instance of the TDF SDK, initializing it if it is not already created.
86
128
*
87
- * @param processContext
88
- * @return
129
+ * @param processContext the NiFi ProcessContext providing necessary configuration and controller services.
130
+ * @return an instance of the initialized SDK.
89
131
*/
90
132
SDK getTDFSDK (ProcessContext processContext ) {
91
133
if (sdk == null ) {
@@ -159,17 +201,45 @@ public void onTrigger(ProcessContext processContext, ProcessSession processSessi
159
201
*/
160
202
abstract void processFlowFiles (ProcessContext processContext , ProcessSession processSession , List <FlowFile > flowFiles ) throws ProcessException ;
161
203
204
+ /**
205
+ * Creates and returns a new instance of TDF.
206
+ *
207
+ * @return A new instance of TDF.
208
+ */
162
209
TDF getTDF () {
163
210
return new TDF ();
164
211
}
165
212
213
+ /**
214
+ * Creates and returns a new instance of NanoTDF.
215
+ *
216
+ * @return A new instance of NanoTDF.
217
+ */
166
218
NanoTDF getNanoTDF (){
167
219
return new NanoTDF ();
168
220
}
169
221
222
+ /**
223
+ * Retrieves the list of property descriptors that are supported by this processor.
224
+ *
225
+ * @return A list containing the supported property descriptors.
226
+ */
170
227
@ Override
171
228
public List <PropertyDescriptor > getSupportedPropertyDescriptors () {
172
- return Collections .unmodifiableList (Arrays .asList (SSL_CONTEXT_SERVICE , OPENTDF_CONFIG_SERVICE , FLOWFILE_PULL_SIZE ));
229
+ return List .of (SSL_CONTEXT_SERVICE , OPENTDF_CONFIG_SERVICE , FLOWFILE_PULL_SIZE );
230
+ }
231
+
232
+ @ Override
233
+ public boolean equals (Object o ) {
234
+ if (this == o ) return true ;
235
+ if (o == null || getClass () != o .getClass ()) return false ;
236
+ if (!super .equals (o )) return false ;
237
+ AbstractTDFProcessor that = (AbstractTDFProcessor ) o ;
238
+ return Objects .equals (sdk , that .sdk );
173
239
}
174
240
241
+ @ Override
242
+ public int hashCode () {
243
+ return Objects .hash (super .hashCode (), sdk );
244
+ }
175
245
}
0 commit comments