mirror of https://github.com/apache/nifi.git
NIFI-13187 - Modernize Archetypes
This closes #8783. Signed-off-by: Joseph Witt <joewitt@apache.org>
This commit is contained in:
parent
4c68691faf
commit
4faad38c16
|
@ -33,9 +33,6 @@ import org.apache.nifi.processor.ProcessorInitializationContext;
|
|||
import org.apache.nifi.processor.Relationship;
|
||||
import org.apache.nifi.processor.util.StandardValidators;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
|
@ -47,16 +44,17 @@ import java.util.Set;
|
|||
public class MyProcessor extends AbstractProcessor {
|
||||
|
||||
public static final PropertyDescriptor MY_PROPERTY = new PropertyDescriptor
|
||||
.Builder().name("MY_PROPERTY")
|
||||
.displayName("My property")
|
||||
.Builder()
|
||||
.name("My Property")
|
||||
.displayName("My Property")
|
||||
.description("Example Property")
|
||||
.required(true)
|
||||
.addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
|
||||
.build();
|
||||
|
||||
public static final Relationship MY_RELATIONSHIP = new Relationship.Builder()
|
||||
.name("MY_RELATIONSHIP")
|
||||
.description("Example relationship")
|
||||
public static final Relationship REL_SUCCESS = new Relationship.Builder()
|
||||
.name("success")
|
||||
.description("Example success relationship")
|
||||
.build();
|
||||
|
||||
private List<PropertyDescriptor> descriptors;
|
||||
|
@ -65,13 +63,9 @@ public class MyProcessor extends AbstractProcessor {
|
|||
|
||||
@Override
|
||||
protected void init(final ProcessorInitializationContext context) {
|
||||
descriptors = new ArrayList<>();
|
||||
descriptors.add(MY_PROPERTY);
|
||||
descriptors = Collections.unmodifiableList(descriptors);
|
||||
descriptors = List.of(MY_PROPERTY);
|
||||
|
||||
relationships = new HashSet<>();
|
||||
relationships.add(MY_RELATIONSHIP);
|
||||
relationships = Collections.unmodifiableSet(relationships);
|
||||
relationships = Set.of(REL_SUCCESS);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -96,5 +90,7 @@ public class MyProcessor extends AbstractProcessor {
|
|||
return;
|
||||
}
|
||||
// TODO implement
|
||||
|
||||
session.transfer(flowFile, REL_SUCCESS);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,8 +16,6 @@
|
|||
*/
|
||||
package ${package};
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.nifi.annotation.documentation.CapabilityDescription;
|
||||
|
@ -35,20 +33,15 @@ import org.apache.nifi.reporting.InitializationException;
|
|||
public class StandardMyService extends AbstractControllerService implements MyService {
|
||||
|
||||
public static final PropertyDescriptor MY_PROPERTY = new PropertyDescriptor
|
||||
.Builder().name("MY_PROPERTY")
|
||||
.Builder()
|
||||
.name("My Property")
|
||||
.displayName("My Property")
|
||||
.description("Example Property")
|
||||
.required(true)
|
||||
.addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
|
||||
.build();
|
||||
|
||||
private static final List<PropertyDescriptor> properties;
|
||||
|
||||
static {
|
||||
final List<PropertyDescriptor> props = new ArrayList<>();
|
||||
props.add(MY_PROPERTY);
|
||||
properties = Collections.unmodifiableList(props);
|
||||
}
|
||||
private static final List<PropertyDescriptor> properties = List.of(MY_PROPERTY);
|
||||
|
||||
@Override
|
||||
protected List<PropertyDescriptor> getSupportedPropertyDescriptors() {
|
||||
|
|
Loading…
Reference in New Issue