NIFI-12113 Replaced Validate.notNull() with Objects.requireNonNull()

This closes #7779

Signed-off-by: David Handermann <exceptionfactory@apache.org>
This commit is contained in:
Pierre Villard 2023-09-22 16:14:31 +02:00 committed by exceptionfactory
parent 140ac52e9d
commit 4b9eb8361c
No known key found for this signature in database
GPG Key ID: 29B6A52D2AAE8DBA
61 changed files with 166 additions and 235 deletions

View File

@ -16,12 +16,12 @@
*/
package org.apache.nifi.security.krb;
import org.apache.commons.lang3.Validate;
import org.apache.nifi.logging.ComponentLog;
import org.apache.nifi.processor.exception.ProcessException;
import java.security.PrivilegedActionException;
import java.security.PrivilegedExceptionAction;
import java.util.Objects;
/**
* Helper class for processors to perform an action as a KerberosUser.
@ -43,13 +43,10 @@ public class KerberosAction<T> {
final PrivilegedExceptionAction<T> action,
final ComponentLog logger,
final ClassLoader contextClassLoader) {
this.kerberosUser = kerberosUser;
this.action = action;
this.logger = logger;
this.kerberosUser = Objects.requireNonNull(kerberosUser);
this.action = Objects.requireNonNull(action);
this.logger = Objects.requireNonNull(logger);
this.contextClassLoader = contextClassLoader;
Validate.notNull(this.kerberosUser);
Validate.notNull(this.action);
Validate.notNull(this.logger);
}
public T execute() {

View File

@ -16,8 +16,9 @@
*/
package org.apache.nifi.processor.util.listen.event;
import org.apache.commons.lang3.Validate;
import org.apache.nifi.logging.ComponentLog;
import java.util.Objects;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.TimeUnit;
@ -42,11 +43,9 @@ public class EventQueue<E extends Event> {
}
public EventQueue(final BlockingQueue<E> events, final long offerWaitMs, final ComponentLog logger) {
this.events = events;
this.events = Objects.requireNonNull(events);
this.offerWaitMs = offerWaitMs;
this.logger = logger;
Validate.notNull(this.events);
Validate.notNull(this.logger);
this.logger = Objects.requireNonNull(logger);
}
/**

View File

@ -30,6 +30,7 @@ import java.security.AccessControlContext;
import java.security.AccessController;
import java.security.PrivilegedActionException;
import java.security.PrivilegedExceptionAction;
import java.util.Objects;
import java.util.Random;
import java.util.stream.Collectors;
@ -70,9 +71,9 @@ public class SecurityUtil {
*/
public static synchronized UserGroupInformation loginKerberos(final Configuration config, final String principal, final String keyTab)
throws IOException {
Validate.notNull(config);
Validate.notNull(principal);
Validate.notNull(keyTab);
Objects.requireNonNull(config);
Objects.requireNonNull(principal);
Objects.requireNonNull(keyTab);
UserGroupInformation.setConfiguration(config);
UserGroupInformation.loginUserFromKeytab(principal.trim(), keyTab.trim());
@ -128,7 +129,7 @@ public class SecurityUtil {
* @throws IOException if login failed
*/
public static synchronized UserGroupInformation loginSimple(final Configuration config) throws IOException {
Validate.notNull(config);
Objects.requireNonNull(config);
UserGroupInformation.setConfiguration(config);
return UserGroupInformation.getLoginUser();
}
@ -144,7 +145,7 @@ public class SecurityUtil {
*
*/
public static boolean isSecurityEnabled(final Configuration config) {
Validate.notNull(config);
Objects.requireNonNull(config);
return KERBEROS.equalsIgnoreCase(config.get(HADOOP_SECURITY_AUTHENTICATION));
}

View File

@ -16,12 +16,12 @@
*/
package org.apache.nifi.registry.client.impl.request;
import org.apache.commons.lang3.Validate;
import org.apache.nifi.registry.client.RequestConfig;
import org.apache.nifi.registry.security.util.ProxiedEntitiesUtils;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
/**
* Implementation of RequestConfig that produces headers for a request with proxied-entities.
@ -31,7 +31,7 @@ public class ProxiedEntityRequestConfig implements RequestConfig {
private final String proxiedEntitiesChain;
public ProxiedEntityRequestConfig(final String... proxiedEntities) {
Validate.notNull(proxiedEntities);
Objects.requireNonNull(proxiedEntities);
this.proxiedEntitiesChain = ProxiedEntitiesUtils.getProxiedEntitiesChain(proxiedEntities);
}

View File

@ -16,7 +16,6 @@
*/
package org.apache.nifi.registry.event;
import org.apache.commons.lang3.Validate;
import org.apache.nifi.registry.hook.Event;
import org.apache.nifi.registry.hook.EventField;
import org.apache.nifi.registry.hook.EventFieldName;
@ -38,10 +37,9 @@ public class StandardEvent implements Event {
private final List<EventField> eventFields;
private StandardEvent(final Builder builder) {
this.eventType = builder.eventType;
this.eventType = Objects.requireNonNull(builder.eventType);
this.eventFields = Collections.unmodifiableList(builder.eventFields == null
? Collections.emptyList() : new ArrayList<>(builder.eventFields));
Validate.notNull(this.eventType);
}
@Override

View File

@ -16,7 +16,6 @@
*/
package org.apache.nifi.registry.event;
import org.apache.commons.lang3.Validate;
import org.apache.nifi.registry.hook.EventField;
import org.apache.nifi.registry.hook.EventFieldName;
@ -32,10 +31,8 @@ public class StandardEventField implements EventField {
private final String value;
public StandardEventField(final EventFieldName name, final String value) {
this.name = name;
this.value = value;
Validate.notNull(this.name);
Validate.notNull(this.value);
this.name = Objects.requireNonNull(name);
this.value = Objects.requireNonNull(value);
}
@Override

View File

@ -16,6 +16,8 @@
*/
package org.apache.nifi.registry.provider.extension;
import java.util.Objects;
import org.apache.commons.lang3.Validate;
import org.apache.nifi.registry.extension.BundlePersistenceContext;
import org.apache.nifi.registry.extension.BundleVersionCoordinate;
@ -28,11 +30,10 @@ public class StandardBundlePersistenceContext implements BundlePersistenceContex
private final long bundleSize;
private StandardBundlePersistenceContext(final Builder builder) {
this.coordinate = builder.coordinate;
this.coordinate = Objects.requireNonNull(builder.coordinate);
this.bundleSize = builder.bundleSize;
this.author = builder.author;
this.timestamp = builder.timestamp;
Validate.notNull(this.coordinate);
Validate.notBlank(this.author);
}

View File

@ -17,7 +17,6 @@
package org.apache.nifi.registry.security.authorization;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.Validate;
import org.apache.nifi.properties.SensitivePropertyProtectionException;
import org.apache.nifi.properties.SensitivePropertyProvider;
import org.apache.nifi.properties.SensitivePropertyProviderFactory;
@ -71,6 +70,7 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
/**
@ -125,12 +125,12 @@ public class AuthorizerFactory implements UserGroupProviderLookup, AccessPolicyP
final DataSource dataSource,
final IdentityMapper identityMapper) {
this.properties = Validate.notNull(properties);
this.extensionManager = Validate.notNull(extensionManager);
this.properties = Objects.requireNonNull(properties);
this.extensionManager = Objects.requireNonNull(extensionManager);
this.sensitivePropertyProviderFactory = sensitivePropertyProviderFactory;
this.registryService = Validate.notNull(registryService);
this.dataSource = Validate.notNull(dataSource);
this.identityMapper = Validate.notNull(identityMapper);
this.registryService = Objects.requireNonNull(registryService);
this.dataSource = Objects.requireNonNull(dataSource);
this.identityMapper = Objects.requireNonNull(identityMapper);
}
/***** UserGroupProviderLookup *****/

View File

@ -48,6 +48,7 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
/**
@ -158,7 +159,7 @@ public class DatabaseAccessPolicyProvider extends AbstractConfigurableAccessPoli
@Override
public AccessPolicy addAccessPolicy(final AccessPolicy accessPolicy) throws AuthorizationAccessException {
Validate.notNull(accessPolicy);
Objects.requireNonNull(accessPolicy);
// insert to the policy table
final String policySql = "INSERT INTO APP_POLICY(IDENTIFIER, RESOURCE, ACTION) VALUES (?, ?, ?)";
@ -172,7 +173,7 @@ public class DatabaseAccessPolicyProvider extends AbstractConfigurableAccessPoli
@Override
public AccessPolicy updateAccessPolicy(final AccessPolicy accessPolicy) throws AuthorizationAccessException {
Validate.notNull(accessPolicy);
Objects.requireNonNull(accessPolicy);
// determine if policy exists
final DatabaseAccessPolicy existingPolicy = getDatabaseAcessPolicy(accessPolicy.getIdentifier());
@ -250,7 +251,7 @@ public class DatabaseAccessPolicyProvider extends AbstractConfigurableAccessPoli
@Override
public AccessPolicy getAccessPolicy(final String resourceIdentifier, RequestAction action) throws AuthorizationAccessException {
Validate.notBlank(resourceIdentifier);
Validate.notNull(action);
Objects.requireNonNull(action);
final String policySql = "SELECT * FROM APP_POLICY WHERE RESOURCE = ? AND ACTION = ?";
final Object[] args = new Object[]{resourceIdentifier, action.toString()};
@ -266,7 +267,7 @@ public class DatabaseAccessPolicyProvider extends AbstractConfigurableAccessPoli
@Override
public AccessPolicy deleteAccessPolicy(final AccessPolicy accessPolicy) throws AuthorizationAccessException {
Validate.notNull(accessPolicy);
Objects.requireNonNull(accessPolicy);
final String sql = "DELETE FROM APP_POLICY WHERE IDENTIFIER = ?";
final int rowsUpdated = jdbcTemplate.update(sql, accessPolicy.getIdentifier());

View File

@ -46,6 +46,7 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
/**
@ -120,7 +121,7 @@ public class DatabaseUserGroupProvider implements ConfigurableUserGroupProvider
@Override
public User addUser(final User user) throws AuthorizationAccessException {
Validate.notNull(user);
Objects.requireNonNull(user);
final String sql = "INSERT INTO UGP_USER(IDENTIFIER, IDENTITY) VALUES (?, ?)";
jdbcTemplate.update(sql, new Object[] {user.getIdentifier(), user.getIdentity()});
return user;
@ -128,7 +129,7 @@ public class DatabaseUserGroupProvider implements ConfigurableUserGroupProvider
@Override
public User updateUser(final User user) throws AuthorizationAccessException {
Validate.notNull(user);
Objects.requireNonNull(user);
// update the user identity
final String sql = "UPDATE UGP_USER SET IDENTITY = ? WHERE IDENTIFIER = ?";
@ -226,7 +227,7 @@ public class DatabaseUserGroupProvider implements ConfigurableUserGroupProvider
@Override
public User deleteUser(final User user) throws AuthorizationAccessException {
Validate.notNull(user);
Objects.requireNonNull(user);
final String deleteFromUserGroupSql = "DELETE FROM UGP_USER_GROUP WHERE USER_IDENTIFIER = ?";
jdbcTemplate.update(deleteFromUserGroupSql, user.getIdentifier());
@ -256,7 +257,7 @@ public class DatabaseUserGroupProvider implements ConfigurableUserGroupProvider
@Override
public Group addGroup(final Group group) throws AuthorizationAccessException {
Validate.notNull(group);
Objects.requireNonNull(group);
// insert to the group table...
final String groupSql = "INSERT INTO UGP_GROUP(IDENTIFIER, IDENTITY) VALUES (?, ?)";
@ -270,7 +271,7 @@ public class DatabaseUserGroupProvider implements ConfigurableUserGroupProvider
@Override
public Group updateGroup(final Group group) throws AuthorizationAccessException {
Validate.notNull(group);
Objects.requireNonNull(group);
// update the group identity
final String updateGroupSql = "UPDATE UGP_GROUP SET IDENTITY = ? WHERE IDENTIFIER = ?";
@ -330,7 +331,7 @@ public class DatabaseUserGroupProvider implements ConfigurableUserGroupProvider
@Override
public Group deleteGroup(final Group group) throws AuthorizationAccessException {
Validate.notNull(group);
Objects.requireNonNull(group);
final String sql = "DELETE FROM UGP_GROUP WHERE IDENTIFIER = ?";
final int rowsUpdated = jdbcTemplate.update(sql, group.getIdentifier());

View File

@ -18,7 +18,6 @@ package org.apache.nifi.registry.service;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.Validate;
import org.apache.nifi.registry.bucket.Bucket;
import org.apache.nifi.registry.bucket.BucketItem;
import org.apache.nifi.registry.db.entity.BucketEntity;
@ -70,6 +69,7 @@ import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.SortedSet;
import java.util.TreeSet;
@ -98,12 +98,12 @@ public class RegistryService {
final FlowContentSerializer flowContentSerializer,
final Validator validator,
final RegistryUrlAliasService registryUrlAliasService) {
this.metadataService = Validate.notNull(metadataService);
this.flowPersistenceProvider = Validate.notNull(flowPersistenceProvider);
this.bundlePersistenceProvider = Validate.notNull(bundlePersistenceProvider);
this.flowContentSerializer = Validate.notNull(flowContentSerializer);
this.validator = Validate.notNull(validator);
this.registryUrlAliasService = Validate.notNull(registryUrlAliasService);
this.metadataService = Objects.requireNonNull(metadataService);
this.flowPersistenceProvider = Objects.requireNonNull(flowPersistenceProvider);
this.bundlePersistenceProvider = Objects.requireNonNull(bundlePersistenceProvider);
this.flowContentSerializer = Objects.requireNonNull(flowContentSerializer);
this.validator = Objects.requireNonNull(validator);
this.registryUrlAliasService = Objects.requireNonNull(registryUrlAliasService);
}
private <T> void validate(T t, String invalidMessage) {

View File

@ -20,7 +20,6 @@ import org.apache.commons.codec.binary.Hex;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.Validate;
import org.apache.nifi.registry.bucket.Bucket;
import org.apache.nifi.registry.bundle.extract.BundleExtractor;
import org.apache.nifi.registry.bundle.model.BundleDetails;
@ -89,6 +88,7 @@ import java.util.Comparator;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.SortedSet;
import java.util.TreeSet;
@ -118,19 +118,13 @@ public class StandardExtensionService implements ExtensionService {
final BundlePersistenceProvider bundlePersistenceProvider,
final Validator validator,
final NiFiRegistryProperties properties) {
this.extensionSerializer = extensionSerializer;
this.extensionSerializer = Objects.requireNonNull(extensionSerializer);
this.extensionDocWriter = extensionDocWriter;
this.metadataService = metadataService;
this.extractors = extractors;
this.bundlePersistenceProvider = bundlePersistenceProvider;
this.validator = validator;
this.extensionsWorkingDir = properties.getExtensionsWorkingDirectory();
Validate.notNull(this.extensionSerializer);
Validate.notNull(this.metadataService);
Validate.notNull(this.extractors);
Validate.notNull(this.bundlePersistenceProvider);
Validate.notNull(this.validator);
Validate.notNull(this.extensionsWorkingDir);
this.metadataService = Objects.requireNonNull(metadataService);
this.extractors = Objects.requireNonNull(extractors);
this.bundlePersistenceProvider = Objects.requireNonNull(bundlePersistenceProvider);
this.validator = Objects.requireNonNull(validator);
this.extensionsWorkingDir = Objects.requireNonNull(properties.getExtensionsWorkingDirectory());
}
private <T> void validate(T t, String invalidMessage) {

View File

@ -17,7 +17,6 @@
package org.apache.nifi.registry.web.api;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.Validate;
import org.apache.nifi.registry.event.EventService;
import org.apache.nifi.registry.hook.Event;
import org.apache.nifi.registry.revision.entity.RevisionInfo;
@ -36,6 +35,7 @@ import javax.ws.rs.core.UriBuilderException;
import javax.ws.rs.core.UriInfo;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.Objects;
public class ApplicationResource {
@ -67,10 +67,8 @@ public class ApplicationResource {
public ApplicationResource(final ServiceFacade serviceFacade,
final EventService eventService) {
this.serviceFacade = serviceFacade;
this.eventService = eventService;
Validate.notNull(this.serviceFacade);
Validate.notNull(this.eventService);
this.serviceFacade = Objects.requireNonNull(serviceFacade);
this.eventService = Objects.requireNonNull(eventService);
}
// We don't want an error creating/publishing an event to cause the overall request to fail, so catch all throwables here

View File

@ -16,7 +16,8 @@
*/
package org.apache.nifi.toolkit.cli.api;
import org.apache.commons.lang3.Validate;
import java.util.Objects;
import org.apache.nifi.toolkit.cli.impl.command.CommandOption;
/**
@ -38,12 +39,9 @@ public class ResolvedReference {
final String displayName,
final String resolvedValue) {
this.option = option;
this.position = position;
this.displayName = displayName;
this.resolvedValue = resolvedValue;
Validate.notNull(this.position);
Validate.notNull(this.displayName);
Validate.notNull(this.resolvedValue);
this.position = Objects.requireNonNull(position);
this.displayName = Objects.requireNonNull(displayName);
this.resolvedValue = Objects.requireNonNull(resolvedValue);
}
public CommandOption getOption() {

View File

@ -18,7 +18,6 @@ package org.apache.nifi.toolkit.cli.impl.client;
import org.apache.commons.cli.MissingOptionException;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.Validate;
import org.apache.nifi.registry.security.util.KeystoreType;
import org.apache.nifi.toolkit.cli.api.ClientFactory;
import org.apache.nifi.toolkit.cli.impl.client.nifi.AccessClient;
@ -51,6 +50,7 @@ import org.apache.nifi.toolkit.cli.impl.client.nifi.impl.request.ProxiedEntityRe
import org.apache.nifi.toolkit.cli.impl.command.CommandOption;
import java.io.IOException;
import java.util.Objects;
import java.util.Properties;
/**
@ -195,7 +195,7 @@ public class NiFiClientFactory implements ClientFactory<NiFiClient> {
public NiFiClientWithRequestConfig(final NiFiClient wrappedClient, final RequestConfig requestConfig) {
this.wrappedClient = wrappedClient;
this.requestConfig = Validate.notNull(requestConfig);
this.requestConfig = Objects.requireNonNull(requestConfig);
}
@Override

View File

@ -17,7 +17,6 @@
package org.apache.nifi.toolkit.cli.impl.client.nifi.impl.request;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.Validate;
import org.apache.nifi.registry.security.util.ProxiedEntitiesUtils;
import org.apache.nifi.toolkit.cli.impl.client.nifi.RequestConfig;
@ -25,6 +24,7 @@ import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;
/**
@ -35,7 +35,7 @@ public class ProxiedEntityRequestConfig implements RequestConfig {
private final String[] proxiedEntities;
public ProxiedEntityRequestConfig(final String... proxiedEntities) {
this.proxiedEntities = Validate.notNull(proxiedEntities);
this.proxiedEntities = Objects.requireNonNull(proxiedEntities);
}
@Override

View File

@ -22,7 +22,6 @@ import org.apache.commons.cli.Option;
import org.apache.commons.cli.Options;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.Validate;
import org.apache.nifi.toolkit.cli.api.Command;
import org.apache.nifi.toolkit.cli.api.Context;
import org.apache.nifi.toolkit.cli.api.Result;
@ -36,6 +35,7 @@ import java.net.URI;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.nio.file.Paths;
import java.util.Objects;
import java.util.Properties;
/**
@ -51,13 +51,9 @@ public abstract class AbstractCommand<R extends Result> implements Command<R> {
private PrintStream output;
public AbstractCommand(final String name, final Class<R> resultClass) {
this.name = name;
this.resultClass = resultClass;
Validate.notNull(this.name);
Validate.notNull(this.resultClass);
this.name = Objects.requireNonNull(name);
this.resultClass = Objects.requireNonNull(resultClass);
this.options = createBaseOptions();
Validate.notNull(this.options);
}
protected Options createBaseOptions() {
@ -94,10 +90,8 @@ public abstract class AbstractCommand<R extends Result> implements Command<R> {
@Override
public final void initialize(final Context context) {
Validate.notNull(context);
Validate.notNull(context.getOutput());
this.context = context;
this.output = context.getOutput();
this.context = Objects.requireNonNull(context);
this.output = Objects.requireNonNull(context.getOutput());
this.doInitialize(context);
}

View File

@ -26,6 +26,7 @@ import java.io.PrintStream;
import java.io.PrintWriter;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
/**
* Base class for CommandGroups to extend from.
@ -43,7 +44,7 @@ public abstract class AbstractCommandGroup implements CommandGroup {
@Override
public final void initialize(final Context context) {
Validate.notNull(context);
Objects.requireNonNull(context);
this.output = context.getOutput();
this.commands = Collections.unmodifiableList(createCommands());
this.commands.stream().forEach(c -> c.initialize(context));

View File

@ -21,7 +21,6 @@ import org.apache.commons.cli.CommandLineParser;
import org.apache.commons.cli.DefaultParser;
import org.apache.commons.cli.Options;
import org.apache.commons.cli.ParseException;
import org.apache.commons.lang3.Validate;
import org.apache.nifi.toolkit.cli.api.Command;
import org.apache.nifi.toolkit.cli.api.CommandException;
import org.apache.nifi.toolkit.cli.api.CommandGroup;
@ -37,6 +36,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.atomic.AtomicReference;
/**
@ -54,14 +54,10 @@ public class CommandProcessor {
private final AtomicReference<ReferenceResolver> backReferenceHolder = new AtomicReference<>(null);
public CommandProcessor(final Map<String,Command> topLevelCommands, final Map<String,CommandGroup> commandGroups, final Context context) {
this.topLevelCommands = topLevelCommands;
this.commandGroups = commandGroups;
this.context = context;
this.out = context.getOutput();
Validate.notNull(this.topLevelCommands);
Validate.notNull(this.commandGroups);
Validate.notNull(this.context);
Validate.notNull(this.out);
this.topLevelCommands = Objects.requireNonNull(topLevelCommands);
this.commandGroups = Objects.requireNonNull(commandGroups);
this.context = Objects.requireNonNull(context);
this.out = Objects.requireNonNull(context.getOutput());
}
public void printBasicUsage(String errorMessage) {

View File

@ -17,7 +17,6 @@
package org.apache.nifi.toolkit.cli.impl.command.nifi.params;
import org.apache.commons.cli.MissingOptionException;
import org.apache.commons.lang3.Validate;
import org.apache.nifi.toolkit.cli.api.CommandException;
import org.apache.nifi.toolkit.cli.api.Context;
import org.apache.nifi.toolkit.cli.api.WritableResult;
@ -38,6 +37,7 @@ import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintStream;
import java.util.Comparator;
import java.util.Objects;
import java.util.Properties;
import java.util.Set;
import java.util.TreeSet;
@ -116,9 +116,8 @@ public class ExportParamContext extends AbstractNiFiCommand<ExportParamContext.E
private final String outputFilename;
public ExportedParamContextResult(final ParameterContextDTO parameterContext, final String outputFilename) {
this.parameterContext = parameterContext;
this.parameterContext = Objects.requireNonNull(parameterContext);
this.outputFilename = outputFilename;
Validate.notNull(this.parameterContext);
}
@Override

View File

@ -16,7 +16,6 @@
*/
package org.apache.nifi.toolkit.cli.impl.context;
import org.apache.commons.lang3.Validate;
import org.apache.nifi.registry.client.NiFiRegistryClient;
import org.apache.nifi.toolkit.cli.api.ClientFactory;
import org.apache.nifi.toolkit.cli.api.Context;
@ -24,6 +23,7 @@ import org.apache.nifi.toolkit.cli.api.Session;
import org.apache.nifi.toolkit.cli.impl.client.nifi.NiFiClient;
import java.io.PrintStream;
import java.util.Objects;
/**
* Context for the CLI which will be passed to each command.
@ -37,16 +37,11 @@ public class StandardContext implements Context {
private final boolean isInteractive;
private StandardContext(final Builder builder) {
this.niFiClientFactory = builder.niFiClientFactory;
this.niFiRegistryClientFactory = builder.niFiRegistryClientFactory;
this.session = builder.session;
this.output = builder.output;
this.niFiClientFactory = Objects.requireNonNull(builder.niFiClientFactory);
this.niFiRegistryClientFactory = Objects.requireNonNull(builder.niFiRegistryClientFactory);
this.session = Objects.requireNonNull(builder.session);
this.output = Objects.requireNonNull(builder.output);
this.isInteractive = builder.isInteractive;
Validate.notNull(this.niFiClientFactory);
Validate.notNull(this.niFiRegistryClientFactory);
Validate.notNull(this.session);
Validate.notNull(this.output);
}
@Override

View File

@ -16,13 +16,13 @@
*/
package org.apache.nifi.toolkit.cli.impl.result;
import org.apache.commons.lang3.Validate;
import org.apache.nifi.toolkit.cli.api.ResultType;
import org.apache.nifi.toolkit.cli.api.WritableResult;
import org.apache.nifi.toolkit.cli.impl.util.JacksonUtils;
import java.io.IOException;
import java.io.PrintStream;
import java.util.Objects;
/**
* Base class for writable results that have either JSON or simple output.
@ -34,8 +34,7 @@ public abstract class AbstractWritableResult<T> implements WritableResult<T> {
protected final ResultType resultType;
public AbstractWritableResult(final ResultType resultType) {
this.resultType = resultType;
Validate.notNull(resultType);
this.resultType = Objects.requireNonNull(resultType);
}
@Override

View File

@ -16,10 +16,10 @@
*/
package org.apache.nifi.toolkit.cli.impl.result;
import org.apache.commons.lang3.Validate;
import org.apache.nifi.toolkit.cli.api.WritableResult;
import java.io.PrintStream;
import java.util.Objects;
/**
* Result for a single string value.
@ -30,9 +30,8 @@ public class StringResult implements WritableResult<String> {
private final boolean isInteractive;
public StringResult(final String value, final boolean isInteractive) {
this.value = value;
this.value = Objects.requireNonNull(value);
this.isInteractive = isInteractive;
Validate.notNull(this.value);
}
@Override

View File

@ -16,7 +16,6 @@
*/
package org.apache.nifi.toolkit.cli.impl.result.nifi;
import org.apache.commons.lang3.Validate;
import org.apache.nifi.toolkit.cli.api.ResultType;
import org.apache.nifi.toolkit.cli.impl.result.AbstractWritableResult;
import org.apache.nifi.web.api.dto.AccessPolicyDTO;
@ -25,6 +24,7 @@ import org.apache.nifi.web.api.entity.TenantEntity;
import java.io.IOException;
import java.io.PrintStream;
import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors;
@ -34,8 +34,7 @@ public class AccessPolicyResult extends AbstractWritableResult<AccessPolicyEntit
public AccessPolicyResult(ResultType resultType, AccessPolicyEntity accessPolicyEntity) {
super(resultType);
this.accessPolicyEntity = accessPolicyEntity;
Validate.notNull(accessPolicyEntity);
this.accessPolicyEntity = Objects.requireNonNull(accessPolicyEntity);
}
@Override

View File

@ -16,12 +16,12 @@
*/
package org.apache.nifi.toolkit.cli.impl.result.nifi;
import org.apache.commons.lang3.Validate;
import org.apache.nifi.toolkit.cli.api.ResultType;
import org.apache.nifi.toolkit.cli.impl.result.AbstractWritableResult;
import org.apache.nifi.web.api.entity.ClusteSummaryEntity;
import java.io.PrintStream;
import java.util.Objects;
/**
* Result for CurrentUserEntity from NiFi.
@ -32,8 +32,7 @@ public class ClusterSummaryEntityResult extends AbstractWritableResult<ClusteSum
public ClusterSummaryEntityResult(final ResultType resultType, final ClusteSummaryEntity clusteSummaryEntity) {
super(resultType);
this.clusteSummaryEntity = clusteSummaryEntity;
Validate.notNull(this.clusteSummaryEntity);
this.clusteSummaryEntity = Objects.requireNonNull(clusteSummaryEntity);
}
@Override

View File

@ -16,7 +16,6 @@
*/
package org.apache.nifi.toolkit.cli.impl.result.nifi;
import org.apache.commons.lang3.Validate;
import org.apache.nifi.toolkit.cli.api.ResultType;
import org.apache.nifi.toolkit.cli.impl.result.AbstractWritableResult;
import org.apache.nifi.toolkit.cli.impl.util.JacksonUtils;
@ -24,14 +23,14 @@ import org.apache.nifi.web.api.entity.ControllerConfigurationEntity;
import java.io.IOException;
import java.io.PrintStream;
import java.util.Objects;
public class ControllerConfigurationResult extends AbstractWritableResult<ControllerConfigurationEntity> {
private final ControllerConfigurationEntity controllerConfigurationEntity;
public ControllerConfigurationResult(final ResultType resultType, final ControllerConfigurationEntity controllerConfigurationEntity) {
super(resultType);
this.controllerConfigurationEntity = controllerConfigurationEntity;
Validate.notNull(controllerConfigurationEntity);
this.controllerConfigurationEntity = Objects.requireNonNull(controllerConfigurationEntity);
}
@Override

View File

@ -16,7 +16,6 @@
*/
package org.apache.nifi.toolkit.cli.impl.result.nifi;
import org.apache.commons.lang3.Validate;
import org.apache.nifi.toolkit.cli.api.ResultType;
import org.apache.nifi.toolkit.cli.impl.result.AbstractWritableResult;
import org.apache.nifi.web.api.dto.BundleDTO;
@ -25,6 +24,7 @@ import org.apache.nifi.web.api.entity.ControllerServiceEntity;
import java.io.IOException;
import java.io.PrintStream;
import java.util.Objects;
public class ControllerServiceResult extends AbstractWritableResult<ControllerServiceEntity> {
@ -32,8 +32,7 @@ public class ControllerServiceResult extends AbstractWritableResult<ControllerSe
public ControllerServiceResult(ResultType resultType, ControllerServiceEntity controllerServiceEntity) {
super(resultType);
this.controllerServiceEntity = controllerServiceEntity;
Validate.notNull(controllerServiceEntity);
this.controllerServiceEntity = Objects.requireNonNull(controllerServiceEntity);
}
@Override

View File

@ -16,7 +16,6 @@
*/
package org.apache.nifi.toolkit.cli.impl.result.nifi;
import org.apache.commons.lang3.Validate;
import org.apache.nifi.toolkit.cli.api.ResultType;
import org.apache.nifi.toolkit.cli.impl.result.AbstractWritableResult;
import org.apache.nifi.toolkit.cli.impl.result.writer.DynamicTableWriter;
@ -31,6 +30,7 @@ import java.io.PrintStream;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors;
@ -43,8 +43,7 @@ public class ControllerServicesResult extends AbstractWritableResult<ControllerS
public ControllerServicesResult(final ResultType resultType, final ControllerServicesEntity controllerServicesEntity) {
super(resultType);
this.controllerServicesEntity = controllerServicesEntity;
Validate.notNull(this.controllerServicesEntity);
this.controllerServicesEntity = Objects.requireNonNull(controllerServicesEntity);
}
@Override

View File

@ -16,12 +16,12 @@
*/
package org.apache.nifi.toolkit.cli.impl.result.nifi;
import org.apache.commons.lang3.Validate;
import org.apache.nifi.toolkit.cli.api.ResultType;
import org.apache.nifi.toolkit.cli.impl.result.AbstractWritableResult;
import org.apache.nifi.web.api.entity.CurrentUserEntity;
import java.io.PrintStream;
import java.util.Objects;
/**
* Result for CurrentUserEntity from NiFi.
@ -32,8 +32,7 @@ public class CurrentUserEntityResult extends AbstractWritableResult<CurrentUserE
public CurrentUserEntityResult(final ResultType resultType, final CurrentUserEntity currentUserEntity) {
super(resultType);
this.currentUserEntity = currentUserEntity;
Validate.notNull(this.currentUserEntity);
this.currentUserEntity = Objects.requireNonNull(currentUserEntity);
}
@Override

View File

@ -16,12 +16,12 @@
*/
package org.apache.nifi.toolkit.cli.impl.result.nifi;
import org.apache.commons.lang3.Validate;
import org.apache.nifi.registry.authorization.CurrentUser;
import org.apache.nifi.toolkit.cli.api.ResultType;
import org.apache.nifi.toolkit.cli.impl.result.AbstractWritableResult;
import java.io.PrintStream;
import java.util.Objects;
/**
* Result for CurrentUser from registry.
@ -32,8 +32,7 @@ public class CurrentUserResult extends AbstractWritableResult<CurrentUser> {
public CurrentUserResult(final ResultType resultType, final CurrentUser currentUser) {
super(resultType);
this.currentUser = currentUser;
Validate.notNull(this.currentUser);
this.currentUser = Objects.requireNonNull(currentUser);
}
@Override

View File

@ -16,7 +16,6 @@
*/
package org.apache.nifi.toolkit.cli.impl.result.nifi;
import org.apache.commons.lang3.Validate;
import org.apache.nifi.toolkit.cli.api.ResultType;
import org.apache.nifi.toolkit.cli.impl.result.AbstractWritableResult;
import org.apache.nifi.web.api.dto.NodeDTO;
@ -24,6 +23,7 @@ import org.apache.nifi.web.api.entity.NodeEntity;
import java.io.IOException;
import java.io.PrintStream;
import java.util.Objects;
public class NodeResult extends AbstractWritableResult<NodeEntity> {
@ -31,8 +31,7 @@ public class NodeResult extends AbstractWritableResult<NodeEntity> {
public NodeResult(ResultType resultType, NodeEntity nodeEntity) {
super(resultType);
this.nodeEntity = nodeEntity;
Validate.notNull(nodeEntity);
this.nodeEntity = Objects.requireNonNull(nodeEntity);
}
@Override

View File

@ -16,7 +16,6 @@
*/
package org.apache.nifi.toolkit.cli.impl.result.nifi;
import org.apache.commons.lang3.Validate;
import org.apache.nifi.toolkit.cli.api.ResultType;
import org.apache.nifi.toolkit.cli.impl.result.AbstractWritableResult;
import org.apache.nifi.toolkit.cli.impl.result.writer.DynamicTableWriter;
@ -29,6 +28,7 @@ import org.glassfish.jersey.internal.guava.Lists;
import java.io.IOException;
import java.io.PrintStream;
import java.util.List;
import java.util.Objects;
public class NodesResult extends AbstractWritableResult<ClusterEntity> {
@ -36,8 +36,7 @@ public class NodesResult extends AbstractWritableResult<ClusterEntity> {
public NodesResult(ResultType resultType, ClusterEntity clusterEntity) {
super(resultType);
this.clusterEntity = clusterEntity;
Validate.notNull(clusterEntity);
this.clusterEntity = Objects.requireNonNull(clusterEntity);
}
@Override

View File

@ -16,7 +16,6 @@
*/
package org.apache.nifi.toolkit.cli.impl.result.nifi;
import org.apache.commons.lang3.Validate;
import org.apache.nifi.toolkit.cli.api.Context;
import org.apache.nifi.toolkit.cli.api.ReferenceResolver;
import org.apache.nifi.toolkit.cli.api.Referenceable;
@ -38,6 +37,7 @@ import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
@ -49,7 +49,7 @@ public class ParamContextsResult extends AbstractWritableResult<ParameterContext
public ParamContextsResult(final ResultType resultType, final ParameterContextsEntity parameterContexts) {
super(resultType);
this.parameterContexts = Validate.notNull(parameterContexts);
this.parameterContexts = Objects.requireNonNull(parameterContexts);
this.results = new ArrayList<>();
// If there is a param context that the user doesn't have permissions to then the entity will be returned with

View File

@ -16,7 +16,6 @@
*/
package org.apache.nifi.toolkit.cli.impl.result.nifi;
import org.apache.commons.lang3.Validate;
import org.apache.nifi.toolkit.cli.api.ResultType;
import org.apache.nifi.toolkit.cli.impl.result.AbstractWritableResult;
import org.apache.nifi.web.api.entity.ProcessGroupEntity;
@ -24,6 +23,7 @@ import org.apache.nifi.web.api.entity.ProcessGroupEntity;
import java.io.IOException;
import java.io.PrintStream;
import java.util.Collections;
import java.util.Objects;
public class ProcessGroupResult extends AbstractWritableResult<ProcessGroupEntity> {
@ -31,8 +31,7 @@ public class ProcessGroupResult extends AbstractWritableResult<ProcessGroupEntit
public ProcessGroupResult(final ResultType resultType, final ProcessGroupEntity entity) {
super(resultType);
this.entity = entity;
Validate.notNull(entity);
this.entity = Objects.requireNonNull(entity);
}
@Override

View File

@ -16,7 +16,6 @@
*/
package org.apache.nifi.toolkit.cli.impl.result.nifi;
import org.apache.commons.lang3.Validate;
import org.apache.nifi.toolkit.cli.api.Context;
import org.apache.nifi.toolkit.cli.api.ReferenceResolver;
import org.apache.nifi.toolkit.cli.api.Referenceable;
@ -34,6 +33,7 @@ import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.atomic.AtomicInteger;
/**
@ -45,8 +45,7 @@ public class ProcessGroupsResult extends AbstractWritableResult<List<ProcessGrou
public ProcessGroupsResult(final ResultType resultType, final List<ProcessGroupDTO> processGroups) {
super(resultType);
this.processGroups = processGroups;
Validate.notNull(this.processGroups);
this.processGroups = Objects.requireNonNull(processGroups);
this.processGroups.sort(Comparator.comparing(ProcessGroupDTO::getName));
}

View File

@ -16,7 +16,6 @@
*/
package org.apache.nifi.toolkit.cli.impl.result.nifi;
import org.apache.commons.lang3.Validate;
import org.apache.nifi.toolkit.cli.api.ResultType;
import org.apache.nifi.toolkit.cli.impl.result.AbstractWritableResult;
import org.apache.nifi.web.api.dto.BundleDTO;
@ -25,6 +24,7 @@ import org.apache.nifi.web.api.entity.ProcessorEntity;
import java.io.IOException;
import java.io.PrintStream;
import java.util.Objects;
public class ProcessorResult extends AbstractWritableResult<ProcessorEntity> {
@ -32,8 +32,7 @@ public class ProcessorResult extends AbstractWritableResult<ProcessorEntity> {
public ProcessorResult(ResultType resultType, ProcessorEntity processorEntity) {
super(resultType);
this.processorEntity = processorEntity;
Validate.notNull(processorEntity);
this.processorEntity = Objects.requireNonNull(processorEntity);
}
@Override

View File

@ -16,7 +16,6 @@
*/
package org.apache.nifi.toolkit.cli.impl.result.nifi;
import org.apache.commons.lang3.Validate;
import org.apache.nifi.toolkit.cli.api.ResultType;
import org.apache.nifi.toolkit.cli.impl.result.AbstractWritableResult;
import org.apache.nifi.toolkit.cli.impl.result.writer.DynamicTableWriter;
@ -30,6 +29,7 @@ import java.io.IOException;
import java.io.PrintStream;
import java.util.Comparator;
import java.util.List;
import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors;
@ -39,8 +39,7 @@ public class ProcessorsResult extends AbstractWritableResult<ProcessorsEntity> {
public ProcessorsResult(ResultType resultType, ProcessorsEntity processorsEntity) {
super(resultType);
this.processorsEntity = processorsEntity;
Validate.notNull(processorsEntity);
this.processorsEntity = Objects.requireNonNull(processorsEntity);
}
@Override

View File

@ -16,12 +16,12 @@
*/
package org.apache.nifi.toolkit.cli.impl.result.nifi;
import org.apache.commons.lang3.Validate;
import org.apache.nifi.toolkit.cli.api.ResultType;
import org.apache.nifi.toolkit.cli.impl.result.AbstractWritableResult;
import org.apache.nifi.web.api.dto.FlowRegistryClientDTO;
import java.io.PrintStream;
import java.util.Objects;
public class RegistryClientIDResult extends AbstractWritableResult<FlowRegistryClientDTO> {
@ -29,8 +29,7 @@ public class RegistryClientIDResult extends AbstractWritableResult<FlowRegistryC
public RegistryClientIDResult(final ResultType resultType, final FlowRegistryClientDTO flowRegistryClientDTO) {
super(resultType);
this.flowRegistryClientDTO = flowRegistryClientDTO;
Validate.notNull(this.flowRegistryClientDTO);
this.flowRegistryClientDTO = Objects.requireNonNull(flowRegistryClientDTO);
}
@Override

View File

@ -16,7 +16,6 @@
*/
package org.apache.nifi.toolkit.cli.impl.result.nifi;
import org.apache.commons.lang3.Validate;
import org.apache.nifi.toolkit.cli.api.ResultType;
import org.apache.nifi.toolkit.cli.impl.result.AbstractWritableResult;
import org.apache.nifi.toolkit.cli.impl.result.writer.DynamicTableWriter;
@ -29,6 +28,7 @@ import org.apache.nifi.web.api.entity.FlowRegistryClientsEntity;
import java.io.PrintStream;
import java.util.Comparator;
import java.util.List;
import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors;
@ -41,8 +41,7 @@ public class RegistryClientsResult extends AbstractWritableResult<FlowRegistryCl
public RegistryClientsResult(final ResultType resultType, final FlowRegistryClientsEntity registryClients) {
super(resultType);
this.registryClients = registryClients;
Validate.notNull(this.registryClients);
this.registryClients = Objects.requireNonNull(registryClients);
}
@Override

View File

@ -17,7 +17,6 @@
*/
package org.apache.nifi.toolkit.cli.impl.result.nifi;
import org.apache.commons.lang3.Validate;
import org.apache.nifi.toolkit.cli.api.ResultType;
import org.apache.nifi.toolkit.cli.impl.result.AbstractWritableResult;
import org.apache.nifi.web.api.dto.BundleDTO;
@ -26,6 +25,7 @@ import org.apache.nifi.web.api.entity.ReportingTaskEntity;
import java.io.IOException;
import java.io.PrintStream;
import java.util.Objects;
public class ReportingTaskResult extends AbstractWritableResult<ReportingTaskEntity> {
@ -33,8 +33,7 @@ public class ReportingTaskResult extends AbstractWritableResult<ReportingTaskEnt
public ReportingTaskResult(final ResultType resultType, final ReportingTaskEntity reportingTaskEntity) {
super(resultType);
this.reportingTaskEntity = reportingTaskEntity;
Validate.notNull(reportingTaskEntity);
this.reportingTaskEntity = Objects.requireNonNull(reportingTaskEntity);
}
@Override

View File

@ -16,7 +16,6 @@
*/
package org.apache.nifi.toolkit.cli.impl.result.nifi;
import org.apache.commons.lang3.Validate;
import org.apache.nifi.toolkit.cli.api.ResultType;
import org.apache.nifi.toolkit.cli.impl.result.AbstractWritableResult;
import org.apache.nifi.toolkit.cli.impl.result.writer.DynamicTableWriter;
@ -30,6 +29,7 @@ import java.io.IOException;
import java.io.PrintStream;
import java.util.Comparator;
import java.util.List;
import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors;
@ -42,8 +42,7 @@ public class ReportingTasksResult extends AbstractWritableResult<ReportingTasksE
public ReportingTasksResult(final ResultType resultType, final ReportingTasksEntity reportingTasksEntity) {
super(resultType);
this.reportingTasksEntity = reportingTasksEntity;
Validate.notNull(this.reportingTasksEntity);
this.reportingTasksEntity = Objects.requireNonNull(reportingTasksEntity);
}
@Override

View File

@ -16,7 +16,6 @@
*/
package org.apache.nifi.toolkit.cli.impl.result.nifi;
import org.apache.commons.lang3.Validate;
import org.apache.nifi.toolkit.cli.api.ResultType;
import org.apache.nifi.toolkit.cli.impl.result.AbstractWritableResult;
import org.apache.nifi.toolkit.cli.impl.result.writer.DynamicTableWriter;
@ -32,6 +31,7 @@ import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
/**
@ -43,8 +43,7 @@ public class UserGroupsResult extends AbstractWritableResult<UserGroupsEntity> {
public UserGroupsResult(final ResultType resultType, final UserGroupsEntity userGroupsEntity) {
super(resultType);
this.userGroupsEntity = userGroupsEntity;
Validate.notNull(this.userGroupsEntity);
this.userGroupsEntity = Objects.requireNonNull(userGroupsEntity);
}
@Override

View File

@ -16,7 +16,6 @@
*/
package org.apache.nifi.toolkit.cli.impl.result.nifi;
import org.apache.commons.lang3.Validate;
import org.apache.nifi.toolkit.cli.api.ResultType;
import org.apache.nifi.toolkit.cli.impl.result.AbstractWritableResult;
import org.apache.nifi.toolkit.cli.impl.result.writer.DynamicTableWriter;
@ -32,6 +31,7 @@ import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
/**
@ -43,8 +43,7 @@ public class UsersResult extends AbstractWritableResult<UsersEntity> {
public UsersResult(final ResultType resultType, final UsersEntity usersEntity) {
super(resultType);
this.usersEntity = usersEntity;
Validate.notNull(this.usersEntity);
this.usersEntity = Objects.requireNonNull(usersEntity);
}
@Override

View File

@ -16,7 +16,6 @@
*/
package org.apache.nifi.toolkit.cli.impl.result.nifi;
import org.apache.commons.lang3.Validate;
import org.apache.nifi.toolkit.cli.api.ResultType;
import org.apache.nifi.toolkit.cli.impl.result.AbstractWritableResult;
import org.apache.nifi.toolkit.cli.impl.result.writer.DynamicTableWriter;
@ -30,6 +29,7 @@ import java.io.PrintStream;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
/**
@ -41,8 +41,7 @@ public class VariableRegistryResult extends AbstractWritableResult<VariableRegis
public VariableRegistryResult(final ResultType resultType, final VariableRegistryEntity variableRegistryEntity) {
super(resultType);
this.variableRegistryEntity = variableRegistryEntity;
Validate.notNull(this.variableRegistryEntity);
this.variableRegistryEntity = Objects.requireNonNull(variableRegistryEntity);
}
@Override

View File

@ -16,7 +16,6 @@
*/
package org.apache.nifi.toolkit.cli.impl.result.nifi;
import org.apache.commons.lang3.Validate;
import org.apache.nifi.toolkit.cli.api.ResultType;
import org.apache.nifi.toolkit.cli.impl.result.AbstractWritableResult;
import org.apache.nifi.toolkit.cli.impl.result.writer.DynamicTableWriter;
@ -26,6 +25,7 @@ import org.apache.nifi.web.api.dto.VersionControlInformationDTO;
import org.apache.nifi.web.api.entity.VersionControlInformationEntity;
import java.io.PrintStream;
import java.util.Objects;
/**
* Result for VersionControlInformationEntity.
@ -37,8 +37,7 @@ public class VersionControlInfoResult extends AbstractWritableResult<VersionCont
public VersionControlInfoResult(final ResultType resultType,
final VersionControlInformationEntity versionControlInformationEntity) {
super(resultType);
this.versionControlInformationEntity = versionControlInformationEntity;
Validate.notNull(this.versionControlInformationEntity);
this.versionControlInformationEntity = Objects.requireNonNull(versionControlInformationEntity);
}
@Override

View File

@ -16,7 +16,6 @@
*/
package org.apache.nifi.toolkit.cli.impl.result.registry;
import org.apache.commons.lang3.Validate;
import org.apache.nifi.registry.authorization.AccessPolicy;
import org.apache.nifi.registry.authorization.Tenant;
import org.apache.nifi.toolkit.cli.api.ResultType;
@ -24,6 +23,7 @@ import org.apache.nifi.toolkit.cli.impl.result.AbstractWritableResult;
import java.io.IOException;
import java.io.PrintStream;
import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors;
@ -32,8 +32,7 @@ public class AccessPolicyResult extends AbstractWritableResult<AccessPolicy> {
public AccessPolicyResult(ResultType resultType, AccessPolicy accessPolicy) {
super(resultType);
this.accessPolicy = accessPolicy;
Validate.notNull(accessPolicy);
this.accessPolicy = Objects.requireNonNull(accessPolicy);
}
@Override

View File

@ -16,7 +16,6 @@
*/
package org.apache.nifi.toolkit.cli.impl.result.registry;
import org.apache.commons.lang3.Validate;
import org.apache.nifi.registry.bucket.Bucket;
import org.apache.nifi.toolkit.cli.api.Context;
import org.apache.nifi.toolkit.cli.api.ReferenceResolver;
@ -34,6 +33,7 @@ import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.atomic.AtomicInteger;
/**
@ -45,8 +45,7 @@ public class BucketsResult extends AbstractWritableResult<List<Bucket>> implemen
public BucketsResult(final ResultType resultType, final List<Bucket> buckets) {
super(resultType);
this.buckets = buckets;
Validate.notNull(buckets);
this.buckets = Objects.requireNonNull(buckets);
// NOTE: it is important that the order the buckets are printed is the same order for the ReferenceResolver
this.buckets.sort(Comparator.comparing(Bucket::getName));

View File

@ -16,7 +16,6 @@
*/
package org.apache.nifi.toolkit.cli.impl.result.registry;
import org.apache.commons.lang3.Validate;
import org.apache.nifi.extension.ExtensionMetadata;
import org.apache.nifi.toolkit.cli.api.ResultType;
import org.apache.nifi.toolkit.cli.impl.result.AbstractWritableResult;
@ -27,6 +26,7 @@ import org.apache.nifi.toolkit.cli.impl.result.writer.TableWriter;
import java.io.IOException;
import java.io.PrintStream;
import java.util.List;
import java.util.Objects;
public class ExtensionMetadataResult extends AbstractWritableResult<List<ExtensionMetadata>> {
@ -34,8 +34,7 @@ public class ExtensionMetadataResult extends AbstractWritableResult<List<Extensi
public ExtensionMetadataResult(final ResultType resultType, final List<ExtensionMetadata> extensionMetadata) {
super(resultType);
this.extensionMetadata = extensionMetadata;
Validate.notNull(this.extensionMetadata);
this.extensionMetadata = Objects.requireNonNull(this.extensionMetadata);
}
@Override

View File

@ -16,7 +16,6 @@
*/
package org.apache.nifi.toolkit.cli.impl.result.registry;
import org.apache.commons.lang3.Validate;
import org.apache.nifi.registry.extension.repo.ExtensionRepoArtifact;
import org.apache.nifi.toolkit.cli.api.ResultType;
import org.apache.nifi.toolkit.cli.impl.result.AbstractWritableResult;
@ -28,6 +27,7 @@ import java.io.IOException;
import java.io.PrintStream;
import java.util.Comparator;
import java.util.List;
import java.util.Objects;
/**
* Result for list of bundle artifacts.
@ -38,8 +38,7 @@ public class ExtensionRepoArtifactsResult extends AbstractWritableResult<List<Ex
public ExtensionRepoArtifactsResult(final ResultType resultType, final List<ExtensionRepoArtifact> bundleArtifacts) {
super(resultType);
this.bundleArtifacts = bundleArtifacts;
Validate.notNull(this.bundleArtifacts);
this.bundleArtifacts = Objects.requireNonNull(bundleArtifacts);
this.bundleArtifacts.sort(
Comparator.comparing(ExtensionRepoArtifact::getBucketName)

View File

@ -16,7 +16,6 @@
*/
package org.apache.nifi.toolkit.cli.impl.result.registry;
import org.apache.commons.lang3.Validate;
import org.apache.nifi.registry.extension.repo.ExtensionRepoGroup;
import org.apache.nifi.toolkit.cli.api.ResultType;
import org.apache.nifi.toolkit.cli.impl.result.AbstractWritableResult;
@ -28,6 +27,7 @@ import java.io.IOException;
import java.io.PrintStream;
import java.util.Comparator;
import java.util.List;
import java.util.Objects;
/**
* Result for list of bundle groups.
@ -38,8 +38,7 @@ public class ExtensionRepoGroupsResult extends AbstractWritableResult<List<Exten
public ExtensionRepoGroupsResult(final ResultType resultType, final List<ExtensionRepoGroup> bundleGroups) {
super(resultType);
this.bundleGroups = bundleGroups;
Validate.notNull(this.bundleGroups);
this.bundleGroups = Objects.requireNonNull(bundleGroups);
this.bundleGroups.sort(
Comparator.comparing(ExtensionRepoGroup::getBucketName)

View File

@ -16,7 +16,6 @@
*/
package org.apache.nifi.toolkit.cli.impl.result.registry;
import org.apache.commons.lang3.Validate;
import org.apache.nifi.registry.extension.repo.ExtensionRepoVersionSummary;
import org.apache.nifi.toolkit.cli.api.ResultType;
import org.apache.nifi.toolkit.cli.impl.result.AbstractWritableResult;
@ -27,6 +26,7 @@ import org.apache.nifi.toolkit.cli.impl.result.writer.TableWriter;
import java.io.PrintStream;
import java.util.Comparator;
import java.util.List;
import java.util.Objects;
public class ExtensionRepoVersionSummariesResult extends AbstractWritableResult<List<ExtensionRepoVersionSummary>> {
@ -34,8 +34,7 @@ public class ExtensionRepoVersionSummariesResult extends AbstractWritableResult<
public ExtensionRepoVersionSummariesResult(final ResultType resultType, final List<ExtensionRepoVersionSummary> bundleVersions) {
super(resultType);
this.bundleVersions = bundleVersions;
Validate.notNull(this.bundleVersions);
this.bundleVersions = Objects.requireNonNull(bundleVersions);
this.bundleVersions.sort(
Comparator.comparing(ExtensionRepoVersionSummary::getBucketName)

View File

@ -16,7 +16,6 @@
*/
package org.apache.nifi.toolkit.cli.impl.result.registry;
import org.apache.commons.lang3.Validate;
import org.apache.nifi.registry.flow.VersionedFlowSnapshotMetadata;
import org.apache.nifi.toolkit.cli.api.ResultType;
import org.apache.nifi.toolkit.cli.impl.result.AbstractWritableResult;
@ -28,6 +27,7 @@ import java.io.PrintStream;
import java.util.Comparator;
import java.util.Date;
import java.util.List;
import java.util.Objects;
/**
* Result for a list of RegisteredFlowSnapshotMetadata.
@ -38,8 +38,7 @@ public class RegisteredFlowSnapshotMetadataResult extends AbstractWritableResult
public RegisteredFlowSnapshotMetadataResult(final ResultType resultType, final List<VersionedFlowSnapshotMetadata> versions) {
super(resultType);
this.versions = versions;
Validate.notNull(this.versions);
this.versions = Objects.requireNonNull(versions);
this.versions.sort(Comparator.comparing(VersionedFlowSnapshotMetadata::getVersion));
}

View File

@ -16,7 +16,6 @@
*/
package org.apache.nifi.toolkit.cli.impl.result.registry;
import org.apache.commons.lang3.Validate;
import org.apache.nifi.extension.TagCount;
import org.apache.nifi.toolkit.cli.api.ResultType;
import org.apache.nifi.toolkit.cli.impl.result.AbstractWritableResult;
@ -27,6 +26,7 @@ import org.apache.nifi.toolkit.cli.impl.result.writer.TableWriter;
import java.io.IOException;
import java.io.PrintStream;
import java.util.List;
import java.util.Objects;
public class TagCountResult extends AbstractWritableResult<List<TagCount>> {
@ -34,8 +34,7 @@ public class TagCountResult extends AbstractWritableResult<List<TagCount>> {
public TagCountResult(ResultType resultType, final List<TagCount> tagCounts) {
super(resultType);
this.tagCounts = tagCounts;
Validate.notNull(this.tagCounts);
this.tagCounts = Objects.requireNonNull(tagCounts);
}
@Override

View File

@ -16,7 +16,6 @@
*/
package org.apache.nifi.toolkit.cli.impl.result.registry;
import org.apache.commons.lang3.Validate;
import org.apache.nifi.registry.authorization.Tenant;
import org.apache.nifi.registry.authorization.UserGroup;
import org.apache.nifi.toolkit.cli.api.ResultType;
@ -27,6 +26,7 @@ import org.apache.nifi.toolkit.cli.impl.result.writer.TableWriter;
import java.io.PrintStream;
import java.util.List;
import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors;
@ -38,8 +38,7 @@ public class UserGroupsResult extends AbstractWritableResult<List<UserGroup>> {
public UserGroupsResult(final ResultType resultType, final List<UserGroup> userGroups) {
super(resultType);
this.userGroups = userGroups;
Validate.notNull(userGroups);
this.userGroups = Objects.requireNonNull(userGroups);
}
@Override

View File

@ -16,7 +16,6 @@
*/
package org.apache.nifi.toolkit.cli.impl.result.registry;
import org.apache.commons.lang3.Validate;
import org.apache.nifi.registry.authorization.User;
import org.apache.nifi.toolkit.cli.api.ResultType;
import org.apache.nifi.toolkit.cli.impl.result.AbstractWritableResult;
@ -26,6 +25,7 @@ import org.apache.nifi.toolkit.cli.impl.result.writer.TableWriter;
import java.io.PrintStream;
import java.util.List;
import java.util.Objects;
/**
* Result for a list of users.
@ -35,8 +35,7 @@ public class UsersResult extends AbstractWritableResult<List<User>> {
public UsersResult(ResultType resultType, List<User> users) {
super(resultType);
this.users = users;
Validate.notNull(users);
this.users = Objects.requireNonNull(users);
}
@Override

View File

@ -16,7 +16,6 @@
*/
package org.apache.nifi.toolkit.cli.impl.result.registry;
import org.apache.commons.lang3.Validate;
import org.apache.nifi.registry.diff.ComponentDifference;
import org.apache.nifi.registry.diff.ComponentDifferenceGroup;
import org.apache.nifi.registry.diff.VersionedFlowDifference;
@ -32,6 +31,7 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Objects;
public class VersionedFlowDifferenceResult extends AbstractWritableResult<VersionedFlowDifference> {
@ -39,7 +39,7 @@ public class VersionedFlowDifferenceResult extends AbstractWritableResult<Versio
public VersionedFlowDifferenceResult(final ResultType resultType, final VersionedFlowDifference flowDifference) {
super(resultType);
this.flowDifference = Validate.notNull(flowDifference);
this.flowDifference = Objects.requireNonNull(flowDifference);
}
@Override

View File

@ -16,7 +16,6 @@
*/
package org.apache.nifi.toolkit.cli.impl.result.registry;
import org.apache.commons.lang3.Validate;
import org.apache.nifi.registry.flow.RegisteredFlowSnapshotMetadata;
import org.apache.nifi.registry.flow.VersionedFlowSnapshotMetadata;
import org.apache.nifi.toolkit.cli.api.ResultType;
@ -28,6 +27,7 @@ import org.apache.nifi.web.api.entity.VersionedFlowSnapshotMetadataSetEntity;
import java.io.IOException;
import java.io.PrintStream;
import java.util.List;
import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors;
@ -41,8 +41,7 @@ public class VersionedFlowSnapshotMetadataSetResult extends AbstractWritableResu
public VersionedFlowSnapshotMetadataSetResult(final ResultType resultType,
final VersionedFlowSnapshotMetadataSetEntity versionedFlowSnapshotMetadataSetEntity) {
super(resultType);
this.versionedFlowSnapshotMetadataSetEntity = versionedFlowSnapshotMetadataSetEntity;
Validate.notNull(this.versionedFlowSnapshotMetadataSetEntity);
this.versionedFlowSnapshotMetadataSetEntity = Objects.requireNonNull(versionedFlowSnapshotMetadataSetEntity);
}
@Override

View File

@ -16,7 +16,6 @@
*/
package org.apache.nifi.toolkit.cli.impl.result.registry;
import org.apache.commons.lang3.Validate;
import org.apache.nifi.registry.flow.VersionedFlowSnapshot;
import org.apache.nifi.toolkit.cli.api.WritableResult;
import org.apache.nifi.toolkit.cli.impl.util.JacksonUtils;
@ -25,6 +24,7 @@ import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintStream;
import java.util.Objects;
/**
* Result for a VersionedFlowSnapshot.
@ -42,9 +42,8 @@ public class VersionedFlowSnapshotResult implements WritableResult<VersionedFlow
private final String exportFileName;
public VersionedFlowSnapshotResult(final VersionedFlowSnapshot versionedFlowSnapshot, final String exportFileName) {
this.versionedFlowSnapshot = versionedFlowSnapshot;
this.versionedFlowSnapshot = Objects.requireNonNull(versionedFlowSnapshot);
this.exportFileName = exportFileName;
Validate.notNull(this.versionedFlowSnapshot);
}
@Override

View File

@ -16,7 +16,6 @@
*/
package org.apache.nifi.toolkit.cli.impl.result.registry;
import org.apache.commons.lang3.Validate;
import org.apache.nifi.registry.flow.VersionedFlowSnapshot;
import org.apache.nifi.toolkit.cli.api.WritableResult;
import org.apache.nifi.toolkit.cli.impl.util.JacksonUtils;
@ -27,6 +26,7 @@ import java.io.PrintStream;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.Iterator;
import java.util.Objects;
/**
* Result for a list of VersionedFlowSnapshots.
@ -47,9 +47,8 @@ public class VersionedFlowSnapshotsResult implements WritableResult<Iterator<Ver
private final String exportDirectoryName;
public VersionedFlowSnapshotsResult(final Iterator<VersionedFlowSnapshot> versionedFlowSnapshots, final String exportDirectoryName) {
this.versionedFlowSnapshots = versionedFlowSnapshots;
this.versionedFlowSnapshots = Objects.requireNonNull(versionedFlowSnapshots);
this.exportDirectoryName = exportDirectoryName;
Validate.notNull(this.versionedFlowSnapshots);
}
@Override

View File

@ -16,7 +16,6 @@
*/
package org.apache.nifi.toolkit.cli.impl.result.registry;
import org.apache.commons.lang3.Validate;
import org.apache.nifi.registry.flow.VersionedFlow;
import org.apache.nifi.toolkit.cli.api.Context;
import org.apache.nifi.toolkit.cli.api.ReferenceResolver;
@ -34,6 +33,7 @@ import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.atomic.AtomicInteger;
/**
@ -45,8 +45,7 @@ public class VersionedFlowsResult extends AbstractWritableResult<List<VersionedF
public VersionedFlowsResult(final ResultType resultType, final List<VersionedFlow> flows) {
super(resultType);
this.versionedFlows = flows;
Validate.notNull(this.versionedFlows);
this.versionedFlows = Objects.requireNonNull(flows);
// NOTE: it is important that the order the flows are printed is the same order for the ReferenceResolver
this.versionedFlows.sort(Comparator.comparing(VersionedFlow::getName));

View File

@ -16,7 +16,6 @@
*/
package org.apache.nifi.toolkit.cli.impl.session;
import org.apache.commons.lang3.Validate;
import org.apache.nifi.toolkit.cli.api.Session;
import org.apache.nifi.toolkit.cli.api.SessionException;
@ -26,6 +25,7 @@ import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintStream;
import java.util.Objects;
import java.util.Properties;
import java.util.Set;
@ -36,10 +36,8 @@ public class PersistentSession implements Session {
private final Session wrappedSession;
public PersistentSession(final File persistenceFile, final Session wrappedSession) {
this.persistenceFile = persistenceFile;
this.wrappedSession = wrappedSession;
Validate.notNull(persistenceFile);
Validate.notNull(wrappedSession);
this.persistenceFile = Objects.requireNonNull(persistenceFile);
this.wrappedSession = Objects.requireNonNull(wrappedSession);
}
@Override