Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public interface ConfigurableComponent {
* onPropertyModified method. This can be done as follows:
* </p>
*
* <pre>{@code
* {@snippet :
* private volatile boolean configurationRestored = false;
*
* @OnConfigurationRestored
Expand All @@ -76,7 +76,7 @@ public interface ConfigurableComponent {
* return;
* }
* }
* }</pre>
* }
*
* @param descriptor the descriptor for the property being modified
* @param oldValue the value that was previously set. Will be <code>null</code> if no value
Expand Down
12 changes: 9 additions & 3 deletions src/main/java/org/apache/nifi/components/PropertyDescriptor.java
Original file line number Diff line number Diff line change
Expand Up @@ -561,9 +561,15 @@ private boolean isValueAllowed(final String value) {
* Any property descriptor that identifies an external resource will be automatically validated against the following rules:
* <ul>
* <li>If the ResourceCardinality is SINGLE, the given property value must be a file, a directory, or a URL that uses a protocol of http/https/file.</li>
* <li>The given resourceTypes dictate which types of input are allowed. For example, if <code>identifiesExternalResource(ResourceCardinality.SINGLE, ResourceType.FILE)</code>
* is used, the input must be a regular file. If <code>identifiesExternalResource(ResourceCardinality.SINGLE, ResourceType.FILE, ResourceType.DIRECTORY)</code> is used, then the input
* must be exactly one file OR directory.
* <li>The given resourceTypes dictate which types of input are allowed. For example, if
* {@snippet :
* identifiesExternalResource(ResourceCardinality.SINGLE, ResourceType.FILE)
* }
* is used, the input must be a regular file. If
* {@snippet :
* identifiesExternalResource(ResourceCardinality.SINGLE, ResourceType.FILE, ResourceType.DIRECTORY)
* }
* is used, then the input must be exactly one file OR directory.
* </li>
* <li>If the ResourceCardinality is MULTIPLE, the given property value may consist of one or more resources, each separated by a comma and optional white space.</li>
* </ul>
Expand Down
19 changes: 10 additions & 9 deletions src/main/java/org/apache/nifi/controller/ControllerService.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,21 +70,22 @@
* <p>
* For example:
* </p>
* <pre><code>
* {@snippet :
* public static final PropertyDescriptor MY_PROPERTY = new PropertyDescriptor.Builder()
* .name("My Property")
* .description("Example Property")
* .identifiesControllerService( MyControllerServiceInterface.class )
* .build();
*
* ...
* // Other code
*
* public void onTrigger(ProcessContext context, ProcessSessionFactory sessionFactory) throws ProcessException {
* // Obtain the user-selected controller service
* final MyControllerServiceInterface service = context.getProperty(MY_PROPERTY).asControllerService( MyControllerServiceInterface.class );
* ...
* }
*
* </code></pre>
* // Other code
* }
* }
* <li>A Controller Service can be obtained via a
* {@link ControllerServiceLookup}. This lookup may be obtained, for example,
* from the {@link ProcessContext} that is provided to a {@link Processor}'s
Expand All @@ -94,11 +95,11 @@
* For example:
* </p>
*
* <pre><code>
* {@snippet :
* public void onTrigger(ProcessContext context, ProcessSessionFactory sessionFactory) throws ProcessException {
* final MyControllerServiceInterface service = (MyControllerServiceInterface) context.getControllerServiceLookup().getControllerService("service_identifier");
* }
* </code></pre>
* }
* </li>
* </ul>
*
Expand Down Expand Up @@ -139,14 +140,14 @@
*
* <p>
* Typically, this is done by creating a NAR structure as follows:
* <pre>
* {@snippet lang="text" :
* + my-services-api-nar
* +--- service-X-implementation-nar
* +--- service-Y-implementation-nar
* +--- service-Z-implementation-nar
* +--- processor-A-nar
* +--- processor-B-nar
* </pre>
* }
*
* <p>
* In this case, the {@code MyControllerServiceInterface} interface, and any
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ public interface PropertyConfiguration {
* <p>
* An idiom to determine if the property was explicitly set to <code>null</code> is as follows:
* </p>
* <pre><code>
* final boolean setToNull = configuration.hasProperty("MyProperty") &amp;&amp; !configuration.isPropertySet("MyProperty");
* </code></pre>
* {@snippet :
* final boolean setToNull = configuration.hasProperty("MyProperty") && !configuration.isPropertySet("MyProperty");
* }
*
* @param propertyName the name of the property
* @return <code>true</code> if the property name is known to this configuration, <code>false</code> otherwise.
Expand All @@ -69,9 +69,9 @@ public interface PropertyConfiguration {
* <p>
* An idiom to determine if the property was explicitly set to <code>null</code> is as follows:
* </p>
* <pre><code>
* final boolean setToNull = configuration.hasProperty(MY_PROPERTY) &amp;&amp; !configuration.isSet(MY_PROPERTY);
* </code></pre>
* {@snippet :
* final boolean setToNull = configuration.hasProperty(MY_PROPERTY) && !configuration.isSet(MY_PROPERTY);
* }
*
* @param descriptor the property descriptor that identifies the property
* @return <code>true</code> if the property name is known to this configuration, <code>false</code> otherwise.
Expand Down Expand Up @@ -176,10 +176,10 @@ default Optional<String> getRawPropertyValue(PropertyDescriptor descriptor) {
* use this method as such:
* </p>
*
* <pre><code>
* {@snippet :
* // Create a new Controller Service of type org.apache.nifi.services.authentication.UsernamePassword whose Username and Password
* // properties match those currently configured for this Processor.
* final Map&lt;String, String&gt; serviceProperties = Map.of("Username", propertyConfiguration.getRawPropertyValue("Username"),
* final Map<String, String> serviceProperties = Map.of("Username", propertyConfiguration.getRawPropertyValue("Username"),
* "Password", propertyConfiguration.getRawPropertyValue("Password"));
* final String serviceId = propertyConfiguration.createControllerService("org.apache.nifi.services.authentication.UsernamePassword", serviceProperties);
*
Expand All @@ -189,7 +189,7 @@ default Optional<String> getRawPropertyValue(PropertyDescriptor descriptor) {
* // Remove the Username and Password properties from this Processor, since we are now going to use then Authentication Service.
* propertyConfiguration.removeProperty("Username");
* propertyConfiguration.removeProperty("Password");
* </code></pre>
* }
*
* <p>
* Note the use of {@link #getRawPropertyValue(String)} here instead of {@link #getPropertyValue(String)}. Because we want to set
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ public interface RelationshipConfiguration {
* It is possible to split an existing relationship into the same relationship and additional relationships. For example, it is
* valid to call this method as:
* </p>
* <pre><code>
* relationshipConfiguration.splitRelationship("A", "A", "B", "C");
* </code></pre>
* {@snippet :
* relationshipConfiguration.splitRelationship("A", "A", "B", "C");
* }
*
* <p>
* In order to split the "A" relationship into three relationships: "A", "B", and "C". However, upon restart, NiFi will have already split the "A"
Expand All @@ -69,11 +69,11 @@ public interface RelationshipConfiguration {
* exist first:
* </p>
*
* <pre><code>
* if (!relationshipConfiguration.hasRelationship("B")) {
* relationshipConfiguration.splitRelationship("A", "A", "B", "C");
* {@snippet :
* if (!relationshipConfiguration.hasRelationship("B")) {
* relationshipConfiguration.splitRelationship("A", "A", "B", "C");
* }
* }
* </code></pre>
*
* <p>
* This ensures that we do not attempt to split relationship "A" if it has already been done.
Expand Down
28 changes: 14 additions & 14 deletions src/main/java/org/apache/nifi/processor/ProcessSession.java
Original file line number Diff line number Diff line change
Expand Up @@ -105,24 +105,24 @@ public interface ProcessSession {
* and implementing that action in the provided callback.
* <p>
* As a result, the following very common idiom:
* <pre><code>
* getDataFromSource();
* session.commit();
* acknowledgeReceiptOfData();
* </code></pre>
* {@snippet :
* getDataFromSource();
* session.commit();
* acknowledgeReceiptOfData();
* }
* Cannot be simply changed to:
* <pre><code>
* getDataFromSource();
* session.commitAsync();
* acknowledgeReceiptOfData();
* </code></pre>
* {@snippet :
* getDataFromSource();
* session.commitAsync();
* acknowledgeReceiptOfData();
* }
* Doing so could result in acknowledging receipt of data from the source system before data has been committed to the repositories.
* If NiFi were to then be restarted, there is potential for data loss.
* Rather, the following idiom should take its place to ensure that there is no data loss:
* <pre><code>
* getDataFromSource();
* session.commitAsync( () -> acknowledgeReceiptOfData() );
* </code></pre>
* {@snippet :
* getDataFromSource();
* session.commitAsync( () -> acknowledgeReceiptOfData() );
* }
* <p>
* If the session cannot be committed, an error will be logged and the session will be rolled back instead.
*
Expand Down
14 changes: 7 additions & 7 deletions src/main/java/org/apache/nifi/time/DurationFormat.java
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,13 @@ public static long getTimeDuration(final String value, final TimeUnit desiredUni
* This method handles decimal values over {@code 1 ns}, but {@code < 1 ns} will return {@code 0} in any other unit.
* <p>
* Examples:
* <p>
* "10 seconds", {@code TimeUnit.MILLISECONDS} -> 10_000.0
* "0.010 s", {@code TimeUnit.MILLISECONDS} -> 10.0
* "0.010 s", {@code TimeUnit.SECONDS} -> 0.010
* "0.010 ns", {@code TimeUnit.NANOSECONDS} -> 1
* "0.010 ns", {@code TimeUnit.MICROSECONDS} -> 0
*
* {@snippet lang="text" :
* "10 seconds", {@code TimeUnit.MILLISECONDS} -> 10_000.0
* "0.010 s", {@code TimeUnit.MILLISECONDS} -> 10.0
* "0.010 s", {@code TimeUnit.SECONDS} -> 0.010
* "0.010 ns", {@code TimeUnit.NANOSECONDS} -> 1
* "0.010 ns", {@code TimeUnit.MICROSECONDS} -> 0
* }
* @param value the {@code String} input
* @param desiredUnit the desired output {@link TimeUnit}
* @return the parsed and converted amount (without a unit)
Expand Down