Skip to content

Commit

Permalink
NIFI-12142: This closes apache#7806. Deleted many methods, classes, a…
Browse files Browse the repository at this point in the history
…nd references that were deprecated.

Signed-off-by: Joseph Witt <joewitt@apache.org>
  • Loading branch information
markap14 authored and joewitt committed Sep 28, 2023
1 parent acd9b5b commit db727aa
Show file tree
Hide file tree
Showing 278 changed files with 4,372 additions and 7,376 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@

package org.apache.nifi.c2.protocol.api;

import static java.lang.String.format;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.Map;
import java.util.Objects;
import java.util.Set;

import static java.lang.String.format;

@ApiModel
public class C2Operation implements Serializable {
private static final long serialVersionUID = 1L;
Expand All @@ -36,7 +36,7 @@ public class C2Operation implements Serializable {
private Map<String, String> args;
private Set<String> dependencies;

@ApiModelProperty(value = "A unique identifier for the operation", readOnly = true)
@ApiModelProperty(value = "A unique identifier for the operation", accessMode = ApiModelProperty.AccessMode.READ_ONLY)
public String getIdentifier() {
return identifier;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public void setTargetAgentId(String targetAgentId) {

@ApiModelProperty(
value = "The current state of the operation",
readOnly = true)
accessMode = ApiModelProperty.AccessMode.READ_ONLY)
public OperationState getState() {
return state;
}
Expand All @@ -62,8 +62,8 @@ public void setBulkOperationId(String bulkOperationId) {
}

@ApiModelProperty(value = "The verified identity of the C2 client that created the operation",
readOnly = true,
notes = "This field is set by the server when an operation request is submitted to identify the origin. " +
accessMode = ApiModelProperty.AccessMode.READ_ONLY,
notes = "This field is set by the server when an operation request is submitted to identify the origin. " +
"When the C2 instance is secured, this is the client principal identity (e.g., certificate DN). " +
"When the C2 instances is unsecured, this will be 'anonymous' as client identity can not be authenticated.")
public String getCreatedBy() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,10 @@

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.apache.nifi.expression.ExpressionLanguageScope;

import java.io.Serializable;
import java.util.Collections;
import java.util.List;
import org.apache.nifi.expression.ExpressionLanguageScope;


@ApiModel
Expand Down Expand Up @@ -118,7 +117,7 @@ public void setExpressionLanguageScope(ExpressionLanguageScope expressionLanguag
this.expressionLanguageScopeDescription = expressionLanguageScope == null ? null : expressionLanguageScope.getDescription();
}

@ApiModelProperty(value = "The description of the expression language scope supported by this property", readOnly = true)
@ApiModelProperty(value = "The description of the expression language scope supported by this property", accessMode = ApiModelProperty.AccessMode.READ_ONLY)
public String getExpressionLanguageScopeDescription() {
return expressionLanguageScope == null ? null : expressionLanguageScope.getDescription();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@

package org.apache.nifi.minifi.bootstrap.configuration;

import static java.util.Optional.ofNullable;
import static java.util.function.Predicate.not;
import static java.util.stream.Collectors.toList;

import java.io.Closeable;
import java.io.IOException;
import java.nio.ByteBuffer;
Expand All @@ -37,6 +33,10 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import static java.util.Optional.ofNullable;
import static java.util.function.Predicate.not;
import static java.util.stream.Collectors.toList;

public class ConfigurationChangeCoordinator implements Closeable, ConfigurationChangeNotifier {

public static final String NOTIFIER_INGESTORS_KEY = "nifi.minifi.notifier.ingestors";
Expand Down Expand Up @@ -118,11 +118,11 @@ private void closeIngestors() {
private void instantiateIngestor(Properties bootstrapProperties, String ingestorClassname) {
try {
Class<?> ingestorClass = Class.forName(ingestorClassname);
ChangeIngestor changeIngestor = (ChangeIngestor) ingestorClass.newInstance();
ChangeIngestor changeIngestor = (ChangeIngestor) ingestorClass.getDeclaredConstructor().newInstance();
changeIngestor.initialize(bootstrapProperties, runMiNiFi, this);
changeIngestors.add(changeIngestor);
LOGGER.info("Initialized ingestor: {}", ingestorClassname);
} catch (Exception e) {
} catch (final Exception e) {
LOGGER.error("Instantiating [{}] ingestor failed", ingestorClassname, e);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@

package org.apache.nifi.minifi.bootstrap.service;

import static org.apache.nifi.minifi.commons.api.MiNiFiProperties.NIFI_MINIFI_STATUS_REPORTER_COMPONENTS;

import java.lang.reflect.InvocationTargetException;
import java.util.Collections;
import java.util.HashSet;
import java.util.LinkedList;
Expand All @@ -33,6 +32,8 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import static org.apache.nifi.minifi.commons.api.MiNiFiProperties.NIFI_MINIFI_STATUS_REPORTER_COMPONENTS;

public class PeriodicStatusReporterManager implements QueryableStatusAggregator {
private static final Logger LOGGER = LoggerFactory.getLogger(PeriodicStatusReporterManager.class);
private static final String FLOW_STATUS_REPORT_CMD = "FLOW_STATUS_REPORT";
Expand Down Expand Up @@ -103,11 +104,11 @@ private Set<PeriodicStatusReporter> initializePeriodicNotifiers() {
for (String reporterClassname : reportersCsv.split(",")) {
try {
Class<?> reporterClass = Class.forName(reporterClassname);
PeriodicStatusReporter reporter = (PeriodicStatusReporter) reporterClass.newInstance();
PeriodicStatusReporter reporter = (PeriodicStatusReporter) reporterClass.getDeclaredConstructor().newInstance();
reporter.initialize(bootstrapProperties, this);
statusReporters.add(reporter);
LOGGER.debug("Initialized {} notifier", reporterClass.getCanonicalName());
} catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) {
} catch (InstantiationException | IllegalAccessException | ClassNotFoundException | NoSuchMethodException | InvocationTargetException e) {
throw new RuntimeException("Issue instantiating notifier " + reporterClassname, e);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@

package org.apache.nifi.minifi.bootstrap.configuration.ingestors;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;

import java.io.IOException;
import java.nio.ByteBuffer;
import java.util.Collections;
Expand All @@ -38,6 +34,10 @@
import org.junit.jupiter.api.Test;
import org.mockito.Mockito;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;

public abstract class RestChangeIngestorCommonTest {

private static final String testString = "This is a test string.";
Expand Down Expand Up @@ -84,7 +84,7 @@ public void testFileUploadNewConfig() throws Exception {

Request request = new Request.Builder()
.url(url)
.post(RequestBody.create(MEDIA_TYPE_MARKDOWN, testString))
.post(RequestBody.create(testString, MEDIA_TYPE_MARKDOWN))
.addHeader("charset", "UTF-8")
.build();

Expand All @@ -110,7 +110,7 @@ public void testFileUploadSameConfig() throws Exception {

Request request = new Request.Builder()
.url(url)
.post(RequestBody.create(MEDIA_TYPE_MARKDOWN, testString))
.post(RequestBody.create(testString, MEDIA_TYPE_MARKDOWN))
.addHeader("charset", "UTF-8")
.build();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,11 @@

package org.apache.nifi.minifi.c2.security.authentication;

import org.springframework.security.authentication.AbstractAuthenticationToken;
import org.springframework.security.core.GrantedAuthority;

import java.security.cert.X509Certificate;
import java.util.Arrays;
import java.util.Collection;
import org.springframework.security.authentication.AbstractAuthenticationToken;
import org.springframework.security.core.GrantedAuthority;

public class X509AuthenticationToken extends AbstractAuthenticationToken {
private final X509Certificate[] x509Certificates;
Expand All @@ -37,7 +36,7 @@ protected X509AuthenticationToken(X509Certificate[] x509Certificates, Collection
super(grantedAuthorities);
this.x509Certificates = Arrays.copyOf(x509Certificates, x509Certificates.length, X509Certificate[].class);
X509Certificate x509Certificate = x509Certificates[0];
this.subjectDn = x509Certificate.getSubjectDN().getName().trim();
this.subjectDn = x509Certificate.getSubjectX500Principal().getName().trim();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@

package org.apache.nifi.minifi.toolkit.schema.common;

import org.apache.nifi.minifi.toolkit.schema.exception.SchemaInstantiatonException;

import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
Expand All @@ -31,6 +29,7 @@
import java.util.function.Function;
import java.util.function.Supplier;
import java.util.stream.Collectors;
import org.apache.nifi.minifi.toolkit.schema.exception.SchemaInstantiatonException;

public abstract class BaseSchema implements Schema {
public static final String IT_WAS_NOT_FOUND_AND_IT_IS_REQUIRED = "it was not found and it is required";
Expand Down Expand Up @@ -176,8 +175,8 @@ private <T> T interpretValueAsType(Object obj, String key, Class targetClass, St
} else {
if(instantiateIfNull) {
try {
return (T) targetClass.newInstance();
} catch (InstantiationException | IllegalAccessException e) {
return (T) targetClass.getDeclaredConstructor().newInstance();
} catch (InstantiationException | IllegalAccessException | NoSuchMethodException | InvocationTargetException e) {
addValidationIssue(key, wrapperName, "no value was given, and it is supposed to be created with default values as a default, and when attempting to create it the following " +
"exception was thrown:" + e.getMessage());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@

String name();

@Deprecated
boolean supportsExpressionLanguage() default false;

String value();

String description();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
*/
package org.apache.nifi.components;

import java.time.Duration;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import org.apache.nifi.components.resource.ResourceReference;
import org.apache.nifi.components.resource.ResourceReferences;
import org.apache.nifi.controller.ControllerService;
Expand All @@ -25,9 +28,6 @@
import org.apache.nifi.processor.exception.ProcessException;
import org.apache.nifi.registry.EnvironmentVariables;

import java.util.Map;
import java.util.concurrent.TimeUnit;

/**
* <p>
* A PropertyValue provides a mechanism whereby the currently configured value
Expand Down Expand Up @@ -83,6 +83,13 @@ public interface PropertyValue {
*/
Long asTimePeriod(TimeUnit timeUnit);

/**
* Returns the value as a Duration
*
* @return a Duration representing the value, or <code>null</code> if the value is unset
*/
Duration asDuration();

/**
*
* @param dataUnit specifies the DataUnit to convert the data size into
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,29 +24,14 @@
* Provides a representation of a component's state at some point in time.
*/
public interface StateMap {
/**
* Each time that a component's state is updated, the state is assigned a new version.
* This version can then be used to atomically update state by the backing storage mechanism.
* Though this number is monotonically increasing, it should not be expected to increment always
* from X to X+1. I.e., version numbers may be skipped.
*
* @deprecated This method should be replaced with getStateVersion()
*
* @return the version associated with the state
*/
@Deprecated
long getVersion();

/**
* Get state version is not guaranteed to be numeric, but can be used to compare against an expected version.
* The default implementation uses the available version number and considers -1 as indicating an empty version
*
* @return State version or empty when not known
*/
default Optional<String> getStateVersion() {
final long version = getVersion();
return version == -1 ? Optional.empty() : Optional.of(String.valueOf(version));
}
Optional<String> getStateVersion();

/**
* Returns the value associated with the given key
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,19 @@
*/
package org.apache.nifi.documentation.xml;

import java.io.IOException;
import java.io.OutputStream;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.function.Function;
import javax.xml.stream.XMLOutputFactory;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamWriter;
import org.apache.nifi.annotation.behavior.DynamicProperty;
import org.apache.nifi.annotation.behavior.DynamicRelationship;
import org.apache.nifi.annotation.behavior.InputRequirement;
Expand All @@ -36,9 +49,9 @@
import org.apache.nifi.annotation.configuration.DefaultSettings;
import org.apache.nifi.annotation.documentation.DeprecationNotice;
import org.apache.nifi.annotation.documentation.MultiProcessorUseCase;
import org.apache.nifi.annotation.documentation.ProcessorConfiguration;
import org.apache.nifi.annotation.documentation.SeeAlso;
import org.apache.nifi.annotation.documentation.UseCase;
import org.apache.nifi.annotation.documentation.ProcessorConfiguration;
import org.apache.nifi.components.AllowableValue;
import org.apache.nifi.components.ConfigurableComponent;
import org.apache.nifi.components.PropertyDependency;
Expand All @@ -51,20 +64,6 @@
import org.apache.nifi.documentation.ServiceAPI;
import org.apache.nifi.processor.Relationship;

import javax.xml.stream.XMLOutputFactory;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamWriter;
import java.io.IOException;
import java.io.OutputStream;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.function.Function;

/**
* XML-based implementation of DocumentationWriter
*
Expand Down Expand Up @@ -277,7 +276,6 @@ private void writeDynamicProperty(final DynamicProperty property) throws IOExcep
writeTextElement("name", property.name());
writeTextElement("value", property.value());
writeTextElement("description", property.description());
writeBooleanElement("expressionLanguageSupported", property.supportsExpressionLanguage());
writeTextElement("expressionLanguageScope", property.expressionLanguageScope() == null ? null : property.expressionLanguageScope().name());

writeEndElement();
Expand Down
Loading

0 comments on commit db727aa

Please sign in to comment.