inigoao commented on a change in pull request #257: URL: https://github.com/apache/plc4x/pull/257#discussion_r735657004
########## File path: plc4j/integrations/apache-nifi/nifi-plc4x-processors/src/main/java/org/apache/plc4x/nifi/BasePlc4xProcessor.java ########## @@ -31,46 +32,66 @@ Licensed to the Apache Software Foundation (ASF) under one public abstract class BasePlc4xProcessor extends AbstractProcessor { - private static final PropertyDescriptor PLC_CONNECTION_STRING = new PropertyDescriptor + public static final PropertyDescriptor PLC_CONNECTION_STRING = new PropertyDescriptor .Builder().name("PLC_CONNECTION_STRING") .displayName("PLC connection String") .description("PLC4X connection string used to connect to a given PLC device.") .required(true) .addValidator(new Plc4xConnectionStringValidator()) + //.expressionLanguageSupported(ExpressionLanguageScope.FLOWFILE_ATTRIBUTES) + //TODO this could be better implemented on a service .build(); - private static final PropertyDescriptor PLC_ADDRESS_STRING = new PropertyDescriptor + + public static final PropertyDescriptor PLC_ADDRESS_STRING = new PropertyDescriptor .Builder().name("PLC_ADDRESS_STRING") .displayName("PLC resource address String") .description("PLC4X address string used identify the resource to read/write on a given PLC device " + "(Multiple values supported). The expected format is: {name}={address}(;{name}={address})*") .required(true) .addValidator(new Plc4xAddressStringValidator()) + .expressionLanguageSupported(ExpressionLanguageScope.FLOWFILE_ATTRIBUTES) .build(); - static final Relationship SUCCESS = new Relationship.Builder() - .name("SUCCESS") + public static final Relationship REL_SUCCESS = new Relationship.Builder() + .name("success") .description("Successfully processed") .build(); - static final Relationship FAILURE = new Relationship.Builder() - .name("FAILURE") + public static final Relationship REL_FAILURE = new Relationship.Builder() + .name("failure") .description("An error occurred processing") .build(); - private List<PropertyDescriptor> descriptors; - - Set<Relationship> relationships; - - private String connectionString; + //TODO protected could be changed by private with getters + protected List<PropertyDescriptor> properties; + protected Set<Relationship> relationships; + + protected String connectionString; private Map<String, String> addressMap; private final PooledPlcDriverManager driverManager = new PooledPlcDriverManager(); @Override protected void init(final ProcessorInitializationContext context) { - this.descriptors = Arrays.asList(PLC_CONNECTION_STRING, PLC_ADDRESS_STRING); - this.relationships = new HashSet<>(Arrays.asList(SUCCESS, FAILURE)); + + //mio + final List<PropertyDescriptor> properties = new ArrayList<>(); + properties.add(PLC_CONNECTION_STRING); + properties.add(PLC_ADDRESS_STRING); + this.properties = Collections.unmodifiableList(properties); + + + final Set<Relationship> relationships = new HashSet<>(); + relationships.add(REL_SUCCESS); + relationships.add(REL_FAILURE); + this.relationships = Collections.unmodifiableSet(relationships); + } + Review comment: the class is declared as abstract, and class attributes are set to protected.. will this be enough? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@plc4x.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org