From a53cc3d707c735a42f025c883065b848490ea4db Mon Sep 17 00:00:00 2001 From: joewitt Date: Wed, 22 Apr 2015 23:42:19 -0400 Subject: [PATCH] NIFI-271 more cleanup --- nifi-parent/pom.xml | 3 + .../apache/nifi/web/server/JettyServer.java | 127 ++--- .../apache/nifi/ui/extension/UiExtension.java | 8 +- .../nifi/ui/extension/UiExtensionMapping.java | 17 +- .../nifi/audit/ControllerServiceAuditor.java | 25 +- .../org/apache/nifi/audit/FunnelAuditor.java | 4 +- .../org/apache/nifi/audit/NiFiAuditor.java | 2 +- .../org/apache/nifi/audit/PortAuditor.java | 4 +- .../nifi/audit/ProcessGroupAuditor.java | 2 +- .../apache/nifi/audit/ProcessorAuditor.java | 2 +- .../nifi/audit/RelationshipAuditor.java | 2 +- .../nifi/audit/RemoteProcessGroupAuditor.java | 8 +- .../nifi/audit/ReportingTaskAuditor.java | 3 +- .../org/apache/nifi/audit/SnippetAuditor.java | 2 +- .../apache/nifi/web/NiFiServiceFacade.java | 496 +++++++++--------- .../nifi/web/StandardNiFiContentAccess.java | 18 +- .../nifi/web/StandardNiFiServiceFacade.java | 119 ++--- .../StandardNiFiWebConfigurationContext.java | 104 ++-- .../nifi/web/StandardNiFiWebContext.java | 4 +- .../nifi/web/api/ApplicationResource.java | 2 +- .../nifi/web/api/ControllerResource.java | 8 +- .../web/api/ControllerServiceResource.java | 174 +++--- .../apache/nifi/web/api/FunnelResource.java | 3 +- .../apache/nifi/web/api/HistoryResource.java | 6 +- .../nifi/web/api/InputPortResource.java | 3 +- .../apache/nifi/web/api/LabelResource.java | 3 +- .../nifi/web/api/OutputPortResource.java | 3 +- .../nifi/web/api/ProcessorResource.java | 20 +- .../web/api/RemoteProcessGroupResource.java | 4 +- .../nifi/web/api/ReportingTaskResource.java | 131 ++--- .../apache/nifi/web/api/TemplateResource.java | 3 +- .../apache/nifi/web/api/dto/DtoFactory.java | 70 ++- .../ApplicationStartupContextListener.java | 17 +- .../nifi/web/controller/ControllerFacade.java | 47 +- .../apache/nifi/web/dao/ConnectionDAO.java | 37 +- .../nifi/web/dao/ControllerServiceDAO.java | 40 +- .../org/apache/nifi/web/dao/FunnelDAO.java | 25 +- .../org/apache/nifi/web/dao/LabelDAO.java | 21 +- .../java/org/apache/nifi/web/dao/PortDAO.java | 29 +- .../org/apache/nifi/web/dao/ProcessorDAO.java | 33 +- .../nifi/web/dao/RemoteProcessGroupDAO.java | 51 +- .../apache/nifi/web/dao/ReportingTaskDAO.java | 2 +- .../org/apache/nifi/web/dao/SnippetDAO.java | 25 +- .../org/apache/nifi/web/dao/TemplateDAO.java | 2 +- .../impl/StandardControllerServiceDAO.java | 49 +- .../web/dao/impl/StandardProcessorDAO.java | 2 +- .../impl/StandardRemoteProcessGroupDAO.java | 1 - .../dao/impl/StandardReportingTaskDAO.java | 4 +- .../nifi/web/dao/impl/StandardSnippetDAO.java | 8 +- .../ReportingTaskProviderFactoryBean.java | 1 - .../apache/nifi/web/util/Availability.java | 1 - .../apache/nifi/web/util/SnippetUtils.java | 137 +++-- .../nifi/integration/util/NiFiTestServer.java | 58 +- .../nifi/web/ContentViewerController.java | 55 +- .../cache/client/Deserializer.java | 8 +- .../client/DistributedMapCacheClient.java | 64 +-- .../client/DistributedSetCacheClient.java | 27 +- .../distributed/cache/client/Serializer.java | 9 +- 58 files changed, 1015 insertions(+), 1118 deletions(-) diff --git a/nifi-parent/pom.xml b/nifi-parent/pom.xml index 3cb90d1f14..2e888c51e9 100644 --- a/nifi-parent/pom.xml +++ b/nifi-parent/pom.xml @@ -372,6 +372,9 @@ checkstyle + + false + diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-jetty/src/main/java/org/apache/nifi/web/server/JettyServer.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-jetty/src/main/java/org/apache/nifi/web/server/JettyServer.java index 1134c774e3..99c11a87f6 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-jetty/src/main/java/org/apache/nifi/web/server/JettyServer.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-jetty/src/main/java/org/apache/nifi/web/server/JettyServer.java @@ -102,11 +102,11 @@ public class JettyServer implements NiFiServer { private final Server server; private final NiFiProperties props; - + private ExtensionMapping extensionMapping; private WebAppContext webApiContext; private WebAppContext webDocsContext; - + // content viewer and mime type specific extensions private WebAppContext webContentViewerContext; private Collection contentViewerWebContexts; @@ -114,10 +114,10 @@ public class JettyServer implements NiFiServer { // component (processor, controller service, reporting task) ui extensions private UiExtensionMapping componentUiExtensions; private Collection componentUiExtensionWebContexts; - + @Deprecated private Collection customUiWebContexts; - + /** * Creates and configures a new Jetty instance. * @@ -138,11 +138,6 @@ public class JettyServer implements NiFiServer { loadWars(locateNarWorkingDirectories()); } - /** - * Locates the working directory for each NAR. - * - * @return - */ private Set locateNarWorkingDirectories() { final File frameworkWorkingDir = props.getFrameworkWorkingDirectory(); final File extensionsWorkingDir = props.getExtensionsWorkingDirectory(); @@ -168,7 +163,7 @@ public class JettyServer implements NiFiServer { * Loads the WARs in the specified NAR working directories. A WAR file must * have a ".war" extension. * - * @param warDir a directory containing WARs to load + * @param narWorkingDirectories dirs */ private void loadWars(final Set narWorkingDirectories) { @@ -219,14 +214,14 @@ public class JettyServer implements NiFiServer { @Deprecated final Map customUiMappings = new HashMap<>(); - + // deploy the other wars if (CollectionUtils.isNotEmpty(otherWars)) { // hold onto to the web contexts for all ui extensions customUiWebContexts = new ArrayList<>(); componentUiExtensionWebContexts = new ArrayList<>(); contentViewerWebContexts = new ArrayList<>(); - + // ui extension organized by component type final Map> componentUiExtensionsByType = new HashMap<>(); for (File war : otherWars) { @@ -237,7 +232,7 @@ public class JettyServer implements NiFiServer { // identify all known extension types in the war final Map> uiExtensionInWar = new HashMap<>(); identifyUiExtensionsForComponents(uiExtensionInWar, war); - + // only include wars that are for custom processor ui's if (!customUiProcessorTypes.isEmpty() || !uiExtensionInWar.isEmpty()) { // get the context path @@ -258,7 +253,7 @@ public class JettyServer implements NiFiServer { // also store it by type so we can populate the appropriate initialization parameters if (!customUiProcessorTypes.isEmpty()) { customUiWebContexts.add(extensionUiContext); - + // @Deprecated - supported custom uis as init params to the web api for (String customUiProcessorType : customUiProcessorTypes) { // map the processor type to the custom ui path @@ -307,9 +302,9 @@ public class JettyServer implements NiFiServer { // include custom ui web context in the handlers handlers.addHandler(extensionUiContext); } - + } - + // record all ui extensions to give to the web api componentUiExtensions = new UiExtensionMapping(componentUiExtensionsByType); } else { @@ -328,7 +323,7 @@ public class JettyServer implements NiFiServer { webContentViewerContext = loadWar(webContentViewerWar, "/nifi-content-viewer", frameworkClassLoader); webContentViewerContext.getInitParams().putAll(mimeMappings); handlers.addHandler(webContentViewerContext); - + // create a web app for the docs final String docsContextPath = "/nifi-docs"; @@ -348,12 +343,6 @@ public class JettyServer implements NiFiServer { server.setHandler(handlers); } - /** - * Finds WAR files in the specified NAR working directories. - * - * @param narWorkingDirectories - * @return - */ private Map findWars(final Set narWorkingDirectories) { final Map wars = new HashMap<>(); @@ -381,7 +370,7 @@ public class JettyServer implements NiFiServer { if (jarEntry == null) { return; } - + // get an input stream for the nifi-processor configuration file BufferedReader in = new BufferedReader(new InputStreamReader(jarFile.getInputStream(jarEntry))); @@ -392,24 +381,24 @@ public class JettyServer implements NiFiServer { final String componentType = extractComponentType(rawComponentType); if (componentType != null) { List extensions = uiExtensions.get(uiExtensionType); - + // if there are currently no extensions for this type create it if (extensions == null) { extensions = new ArrayList<>(); uiExtensions.put(uiExtensionType, extensions); } - + // add the specified type extensions.add(componentType); } } } - + /** * Identifies all known UI extensions and stores them in the specified map. - * - * @param uiExtensions - * @param warFile + * + * @param uiExtensions extensions + * @param warFile war */ private void identifyUiExtensionsForComponents(final Map> uiExtensions, final File warFile) { try (final JarFile jarFile = new JarFile(warFile)) { @@ -422,12 +411,13 @@ public class JettyServer implements NiFiServer { logger.warn(String.format("Unable to inspect %s for a UI extensions.", warFile)); } } - + /** - * Extracts the component type. Trims the line and considers comments. Returns null if no type was found. - * - * @param line - * @return + * Extracts the component type. Trims the line and considers comments. + * Returns null if no type was found. + * + * @param line line + * @return type */ private String extractComponentType(final String line) { final String trimmedLine = line.trim(); @@ -437,12 +427,13 @@ public class JettyServer implements NiFiServer { } return null; } - + /** * Returns the extension in the specified WAR using the specified path. * - * @param war - * @return + * @param war war + * @param path path + * @return extensions */ private List getWarExtensions(final File war, final String path) { List processorTypes = new ArrayList<>(); @@ -529,10 +520,10 @@ public class JettyServer implements NiFiServer { final ResourceHandler resourceHandler = new ResourceHandler(); resourceHandler.setDirectoriesListed(false); - // load the docs directory + // load the docs directory final File docsDir = Paths.get("docs").toRealPath().toFile(); final Resource docsResource = Resource.newResource(docsDir); - + // load the component documentation working directory final String componentDocsDirPath = props.getProperty(NiFiProperties.COMPONENT_DOCS_DIRECTORY, "work/docs/components"); final File workingDocsDirectory = Paths.get(componentDocsDirPath).toRealPath().getParent().toFile(); @@ -547,7 +538,7 @@ public class JettyServer implements NiFiServer { } } final Resource webApiDocsResource = Resource.newResource(webApiDocsDir); - + // create resources for both docs locations final ResourceCollection resources = new ResourceCollection(docsResource, workingDocsResource, webApiDocsResource); resourceHandler.setBaseResource(resources); @@ -660,9 +651,6 @@ public class JettyServer implements NiFiServer { return contextFactory; } - /** - * Starts the web server. - */ @Override public void start() { try { @@ -682,21 +670,21 @@ public class JettyServer implements NiFiServer { } } } - - // ensure the appropriate wars deployed successfully before injecting the NiFi context and security filters - + + // ensure the appropriate wars deployed successfully before injecting the NiFi context and security filters // this must be done after starting the server (and ensuring there were no start up failures) if (webApiContext != null) { // give the web api the component ui extensions final ServletContext webApiServletContext = webApiContext.getServletHandler().getServletContext(); webApiServletContext.setAttribute("nifi-ui-extensions", componentUiExtensions); - + // get the application context final WebApplicationContext webApplicationContext = WebApplicationContextUtils.getRequiredWebApplicationContext(webApiServletContext); // @Deprecated if (CollectionUtils.isNotEmpty(customUiWebContexts)) { final NiFiWebContext niFiWebContext = webApplicationContext.getBean("nifiWebContext", NiFiWebContext.class); - + for (final WebAppContext customUiContext : customUiWebContexts) { // set the NiFi context in each custom ui servlet context final ServletContext customUiServletContext = customUiContext.getServletHandler().getServletContext(); @@ -709,7 +697,7 @@ public class JettyServer implements NiFiServer { } } } - + // component ui extensions if (CollectionUtils.isNotEmpty(componentUiExtensionWebContexts)) { final NiFiWebConfigurationContext configurationContext = webApplicationContext.getBean("nifiWebConfigurationContext", NiFiWebConfigurationContext.class); @@ -726,7 +714,7 @@ public class JettyServer implements NiFiServer { } } } - + // content viewer extensions if (CollectionUtils.isNotEmpty(contentViewerWebContexts)) { for (final WebAppContext contentViewerContext : contentViewerWebContexts) { @@ -737,35 +725,35 @@ public class JettyServer implements NiFiServer { } } } - + // content viewer controller if (webContentViewerContext != null) { final ContentAccess contentAccess = webApplicationContext.getBean("contentAccess", ContentAccess.class); - + // add the content access final ServletContext webContentViewerServletContext = webContentViewerContext.getServletHandler().getServletContext(); webContentViewerServletContext.setAttribute("nifi-content-access", contentAccess); - + final FilterHolder securityFilter = webApiContext.getServletHandler().getFilter("springSecurityFilterChain"); if (securityFilter != null) { webContentViewerContext.addFilter(securityFilter, "/*", EnumSet.allOf(DispatcherType.class)); } } } - + // ensure the web document war was loaded and provide the extension mapping if (webDocsContext != null) { final ServletContext webDocsServletContext = webDocsContext.getServletHandler().getServletContext(); webDocsServletContext.setAttribute("nifi-extension-mapping", extensionMapping); } - - // if this nifi is a node in a cluster, start the flow service and load the flow - the - // flow service is loaded here for clustered nodes because the loading of the flow will - // initialize the connection between the node and the NCM. if the node connects (starts - // heartbeating, etc), the NCM may issue web requests before the application (wars) have - // finished loading. this results in the node being disconnected since its unable to - // successfully respond to the requests. to resolve this, flow loading was moved to here - // (after the wars have been successfully deployed) when this nifi instance is a node + + // if this nifi is a node in a cluster, start the flow service and load the flow - the + // flow service is loaded here for clustered nodes because the loading of the flow will + // initialize the connection between the node and the NCM. if the node connects (starts + // heartbeating, etc), the NCM may issue web requests before the application (wars) have + // finished loading. this results in the node being disconnected since its unable to + // successfully respond to the requests. to resolve this, flow loading was moved to here + // (after the wars have been successfully deployed) when this nifi instance is a node // in a cluster if (props.isNode()) { @@ -799,11 +787,6 @@ public class JettyServer implements NiFiServer { } } - /** - * Dump each applicable url. - * - * @throws SocketException - */ private void dumpUrls() throws SocketException { final List urls = new ArrayList<>(); @@ -853,11 +836,6 @@ public class JettyServer implements NiFiServer { } } - /** - * Handles when a start up failure occurs. - * - * @param t - */ private void startUpFailure(Throwable t) { System.err.println("Failed to start web server: " + t.getMessage()); System.err.println("Shutting down..."); @@ -870,9 +848,6 @@ public class JettyServer implements NiFiServer { this.extensionMapping = extensionMapping; } - /** - * Stops the web server. - */ @Override public void stop() { try { @@ -881,4 +856,4 @@ public class JettyServer implements NiFiServer { logger.warn("Failed to stop web server", ex); } } -} \ No newline at end of file +} diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-ui-extension/src/main/java/org/apache/nifi/ui/extension/UiExtension.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-ui-extension/src/main/java/org/apache/nifi/ui/extension/UiExtension.java index e5b9b3e1ea..da921b4535 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-ui-extension/src/main/java/org/apache/nifi/ui/extension/UiExtension.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-ui-extension/src/main/java/org/apache/nifi/ui/extension/UiExtension.java @@ -32,18 +32,14 @@ public class UiExtension { } /** - * The type of this UI extension. - * - * @return + * @return type of this UI extension */ public UiExtensionType getExtensionType() { return extensionType; } /** - * The context path of this UI extenion. - * - * @return + * @return The context path of this UI extension */ public String getContextPath() { return contextPath; diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-ui-extension/src/main/java/org/apache/nifi/ui/extension/UiExtensionMapping.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-ui-extension/src/main/java/org/apache/nifi/ui/extension/UiExtensionMapping.java index 16bffd0b43..73e39f827c 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-ui-extension/src/main/java/org/apache/nifi/ui/extension/UiExtensionMapping.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-ui-extension/src/main/java/org/apache/nifi/ui/extension/UiExtensionMapping.java @@ -31,22 +31,21 @@ public class UiExtensionMapping { } /** - * Returns whether there are any UI extensions for the specified component type. - * - * @param type - * @return + * @param type type + * @return whether there are any UI extensions for the specified component + * type */ public boolean hasUiExtension(final String type) { return uiExtensions.containsKey(type); } - + /** - * Gets the listing of all discovered UI extensions for the specified component type. - * @param type - * @return + * @param type type + * @return the listing of all discovered UI extensions for the specified + * component type */ public List getUiExtension(final String type) { return uiExtensions.get(type); } - + } diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/audit/ControllerServiceAuditor.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/audit/ControllerServiceAuditor.java index ea3af14905..a044b4697a 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/audit/ControllerServiceAuditor.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/audit/ControllerServiceAuditor.java @@ -230,35 +230,35 @@ public class ControllerServiceAuditor extends NiFiAuditor { public Object updateControllerServiceReferenceAdvice(ProceedingJoinPoint proceedingJoinPoint) throws Throwable { // update the controller service references final ControllerServiceReference controllerServiceReference = (ControllerServiceReference) proceedingJoinPoint.proceed(); - + // get the current user final NiFiUser user = NiFiUserUtils.getNiFiUser(); - + if (user != null) { final Collection actions = new ArrayList<>(); final Collection visitedServices = new ArrayList<>(); visitedServices.add(controllerServiceReference.getReferencedComponent().getIdentifier()); - + // get all applicable actions getUpdateActionsForReferencingComponents(user, actions, visitedServices, controllerServiceReference.getReferencingComponents()); - + // ensure there are actions to record if (!actions.isEmpty()) { // save the actions saveActions(actions, logger); } } - + return controllerServiceReference; } - + /** * Gets the update actions for all specified referencing components. - * + * * @param user * @param actions * @param visitedServices - * @param referencingComponents + * @param referencingComponents */ private void getUpdateActionsForReferencingComponents(final NiFiUser user, final Collection actions, final Collection visitedServices, final Set referencingComponents) { // consider each component updates @@ -325,7 +325,7 @@ public class ControllerServiceAuditor extends NiFiAuditor { } } } - + /** * Audits the removal of a controller service via deleteControllerService(). * @@ -464,10 +464,11 @@ public class ControllerServiceAuditor extends NiFiAuditor { } /** - * Returns whether the specified controller service is disabled (or disabling). - * + * Returns whether the specified controller service is disabled (or + * disabling). + * * @param controllerService - * @return + * @return */ private boolean isDisabled(final ControllerServiceNode controllerService) { return ControllerServiceState.DISABLED.equals(controllerService.getState()) || ControllerServiceState.DISABLING.equals(controllerService.getState()); diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/audit/FunnelAuditor.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/audit/FunnelAuditor.java index b079da893b..e96604ca2a 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/audit/FunnelAuditor.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/audit/FunnelAuditor.java @@ -99,7 +99,7 @@ public class FunnelAuditor extends NiFiAuditor { * * @param funnel * @param operation - * @return + * @return */ public Action generateAuditRecord(Funnel funnel, Operation operation) { return generateAuditRecord(funnel, operation, null); @@ -111,7 +111,7 @@ public class FunnelAuditor extends NiFiAuditor { * @param funnel * @param operation * @param actionDetails - * @return + * @return */ public Action generateAuditRecord(Funnel funnel, Operation operation, ActionDetails actionDetails) { Action action = null; diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/audit/NiFiAuditor.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/audit/NiFiAuditor.java index adff9d1d4c..e61a4a63e7 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/audit/NiFiAuditor.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/audit/NiFiAuditor.java @@ -58,7 +58,7 @@ public abstract class NiFiAuditor { */ protected void saveActions(Collection actions, Logger logger) { ClusterContext ctx = ClusterContextThreadLocal.getContext(); - + // if we're a connected node, then put audit actions on threadlocal to propagate back to manager if (ctx != null) { ctx.getActions().addAll(actions); diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/audit/PortAuditor.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/audit/PortAuditor.java index af4b5bd06b..479842c48d 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/audit/PortAuditor.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/audit/PortAuditor.java @@ -295,7 +295,7 @@ public class PortAuditor extends NiFiAuditor { * * @param port * @param operation - * @return + * @return */ public Action generateAuditRecord(Port port, Operation operation) { return generateAuditRecord(port, operation, null); @@ -307,7 +307,7 @@ public class PortAuditor extends NiFiAuditor { * @param port * @param operation * @param actionDetails - * @return + * @return */ public Action generateAuditRecord(Port port, Operation operation, ActionDetails actionDetails) { Action action = null; diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/audit/ProcessGroupAuditor.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/audit/ProcessGroupAuditor.java index 43918812cf..7acf4e2cf1 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/audit/ProcessGroupAuditor.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/audit/ProcessGroupAuditor.java @@ -55,7 +55,7 @@ public class ProcessGroupAuditor extends NiFiAuditor { * alleviate this issue. * * @param proceedingJoinPoint - * @return + * @return * @throws java.lang.Throwable */ @Around("within(org.apache.nifi.web.dao.ProcessGroupDAO+) && " diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/audit/ProcessorAuditor.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/audit/ProcessorAuditor.java index ff377a3413..0a9f857294 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/audit/ProcessorAuditor.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/audit/ProcessorAuditor.java @@ -79,7 +79,7 @@ public class ProcessorAuditor extends NiFiAuditor { * alleviate this issue. * * @param proceedingJoinPoint - * @return + * @return * @throws java.lang.Throwable */ @Around("within(org.apache.nifi.web.dao.ProcessorDAO+) && " diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/audit/RelationshipAuditor.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/audit/RelationshipAuditor.java index ba7814194b..b6519041c0 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/audit/RelationshipAuditor.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/audit/RelationshipAuditor.java @@ -77,7 +77,7 @@ public class RelationshipAuditor extends NiFiAuditor { * alleviate this issue. * * @param proceedingJoinPoint - * @return + * @return * @throws java.lang.Throwable */ @Around("within(org.apache.nifi.web.dao.ConnectionDAO+) && " diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/audit/RemoteProcessGroupAuditor.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/audit/RemoteProcessGroupAuditor.java index d0836d4adb..ba9e629749 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/audit/RemoteProcessGroupAuditor.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/audit/RemoteProcessGroupAuditor.java @@ -61,8 +61,8 @@ public class RemoteProcessGroupAuditor extends NiFiAuditor { * alleviate this issue. * * @param proceedingJoinPoint - * @return - * @throws java.lang.Throwable + * @return + * @throws java.lang.Throwable */ @Around("within(org.apache.nifi.web.dao.RemoteProcessGroupDAO+) && " + "execution(org.apache.nifi.groups.RemoteProcessGroup createRemoteProcessGroup(java.lang.String, org.apache.nifi.web.api.dto.RemoteProcessGroupDTO))") @@ -331,7 +331,7 @@ public class RemoteProcessGroupAuditor extends NiFiAuditor { * * @param remoteProcessGroup * @param operation - * @return + * @return */ public Action generateAuditRecord(RemoteProcessGroup remoteProcessGroup, Operation operation) { return generateAuditRecord(remoteProcessGroup, operation, null); @@ -343,7 +343,7 @@ public class RemoteProcessGroupAuditor extends NiFiAuditor { * @param remoteProcessGroup * @param operation * @param actionDetails - * @return + * @return */ public Action generateAuditRecord(RemoteProcessGroup remoteProcessGroup, Operation operation, ActionDetails actionDetails) { Action action = null; diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/audit/ReportingTaskAuditor.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/audit/ReportingTaskAuditor.java index ba2cdfb4c5..38aaf1fcfd 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/audit/ReportingTaskAuditor.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/audit/ReportingTaskAuditor.java @@ -297,7 +297,8 @@ public class ReportingTaskAuditor extends NiFiAuditor { } /** - * Extracts the values for the configured properties from the specified ReportingTask. + * Extracts the values for the configured properties from the specified + * ReportingTask. * * @param reportingTask * @param reportingTaskDTO diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/audit/SnippetAuditor.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/audit/SnippetAuditor.java index 1f8942b4f2..38769bbfff 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/audit/SnippetAuditor.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/audit/SnippetAuditor.java @@ -258,7 +258,7 @@ public class SnippetAuditor extends NiFiAuditor { * @param proceedingJoinPoint * @param snippetDTO * @param snippetDAO - * @return + * @return * @throws Throwable */ @Around("within(org.apache.nifi.web.dao.SnippetDAO+) && " diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/NiFiServiceFacade.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/NiFiServiceFacade.java index 8d9dade7b9..6cf22c00d9 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/NiFiServiceFacade.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/NiFiServiceFacade.java @@ -85,87 +85,87 @@ public interface NiFiServiceFacade { /** * Searches the controller for the specified query string. * - * @param query - * @return + * @param query query + * @return results */ SearchResultsDTO searchController(String query); /** * Submits a provenance request. * - * @param query - * @return + * @param query query + * @return results */ ProvenanceDTO submitProvenance(ProvenanceDTO query); /** * Submits a new replay request. * - * @param eventId - * @return + * @param eventId id + * @return event */ ProvenanceEventDTO submitReplay(Long eventId); /** * Gets the content for the specified claim. * - * @param eventId - * @param uri - * @param contentDirection - * @return + * @param eventId id + * @param uri uri + * @param contentDirection direction + * @return content */ DownloadableContent getContent(Long eventId, String uri, ContentDirection contentDirection); /** * Retrieves provenance. * - * @param queryId - * @return + * @param queryId identifier + * @return result */ ProvenanceDTO getProvenance(String queryId); /** * Deletes provenance. * - * @param queryId + * @param queryId identifier */ void deleteProvenance(String queryId); /** * Returns the available options for searching provenance. * - * @return + * @return options */ ProvenanceOptionsDTO getProvenanceSearchOptions(); /** * Submits a lineage request. * - * @param lineage - * @return + * @param lineage lineage + * @return lineage */ LineageDTO submitLineage(LineageDTO lineage); /** * Gets the lineage with the specified id. * - * @param lineageId - * @return + * @param lineageId id + * @return lineage */ LineageDTO getLineage(String lineageId); /** * Deletes the lineage with the specified id. * - * @param lineageId + * @param lineageId lineage */ void deleteLineage(String lineageId); /** * Gets the provenance event with the specified id. * - * @param id - * @return + * @param id id + * @return event */ ProvenanceEventDTO getProvenanceEvent(Long id); @@ -189,7 +189,7 @@ public interface NiFiServiceFacade { * Creates a new archive of the flow configuration. * * @param revision Revision to compare with current base revision - * @return + * @return snapshot */ ConfigurationSnapshot createArchive(Revision revision); @@ -200,14 +200,14 @@ public interface NiFiServiceFacade { * @param processorId the id of the processor to update * @param annotationData the annotation data * - * @return + * @return snapshot */ ConfigurationSnapshot setProcessorAnnotationData(Revision revision, String processorId, String annotationData); /** * Returns the process group status. * - * @param groupId + * @param groupId group * @return The process group status */ ProcessGroupStatusDTO getProcessGroupStatus(String groupId); @@ -215,23 +215,23 @@ public interface NiFiServiceFacade { /** * Gets the process group status history. * - * @param groupId - * @return + * @param groupId id + * @return history */ StatusHistoryDTO getProcessGroupStatusHistory(String groupId); /** * Returns the controller status. * - * @return + * @return status */ ControllerStatusDTO getControllerStatus(); /** * Updates the specified counter by setting its value to 0. * - * @param counterId - * @return + * @param counterId id + * @return counter */ CounterDTO updateCounter(String counterId); @@ -248,22 +248,22 @@ public interface NiFiServiceFacade { * @return The list of available processor types */ Set getProcessorTypes(); - + /** * Returns the list of controller service types. - * + * * @param serviceType Filters only service types that implement this type * @return The list of available controller types */ Set getControllerServiceTypes(String serviceType); - + /** * Returns the list of reporting task types. - * + * * @return The list of available reporting task types */ Set getReportingTaskTypes(); - + /** * Returns the list of prioritizer types. * @@ -274,7 +274,7 @@ public interface NiFiServiceFacade { /** * Returns the current revision. * - * @return + * @return revision */ RevisionDTO getRevision(); @@ -284,10 +284,10 @@ public interface NiFiServiceFacade { /** * Creates a new Template based off the specified snippet. * - * @param name - * @param description - * @param snippetId - * @return + * @param name name + * @param description description + * @param snippetId id + * @return template */ TemplateDTO createTemplate(String name, String description, String snippetId); @@ -302,35 +302,35 @@ public interface NiFiServiceFacade { /** * Instantiate the corresponding template. * - * @param revision - * @param groupId - * @param templateId - * @param originX - * @param originY - * @return + * @param revision revision + * @param groupId group id + * @param templateId template id + * @param originX x + * @param originY y + * @return snapshot */ ConfigurationSnapshot createTemplateInstance(Revision revision, String groupId, Double originX, Double originY, String templateId); /** * Gets the template with the specified id. * - * @param id - * @return + * @param id id + * @return template */ TemplateDTO getTemplate(String id); /** * Gets the template, includes contents, with the specified id. * - * @param id - * @return + * @param id id + * @return template */ TemplateDTO exportTemplate(String id); /** * Gets all templates. * - * @return + * @return templates */ Set getTemplates(); @@ -374,26 +374,26 @@ public interface NiFiServiceFacade { /** * Gets the processor status history. * - * @param groupId - * @param id - * @return + * @param groupId group + * @param id id + * @return history */ StatusHistoryDTO getProcessorStatusHistory(String groupId, String id); /** * Get the descriptor for the specified property of the specified processor. - * - * @param groupId - * @param id - * @param property - * @return + * + * @param groupId group + * @param id id + * @param property property + * @return descriptor */ PropertyDescriptorDTO getProcessorPropertyDescriptor(String groupId, String id, String property); - + /** * Gets all the Processor transfer objects for this controller. * - * @param groupId + * @param groupId group * @return List of all the Processor transfer object */ Set getProcessors(String groupId); @@ -401,15 +401,15 @@ public interface NiFiServiceFacade { /** * Verifies the specified processor can be updated. * - * @param processorDTO + * @param processorDTO processor */ void verifyUpdateProcessor(ProcessorDTO processorDTO); /** * Verifies the specified processor can be updated. * - * @param groupId - * @param processorDTO + * @param groupId group + * @param processorDTO processor */ void verifyUpdateProcessor(String groupId, ProcessorDTO processorDTO); @@ -417,7 +417,7 @@ public interface NiFiServiceFacade { * Updates the specified Processor. * * @param revision Revision to compare with current base revision - * @param groupId + * @param groupId group * @param processorDTO The processorDTO * @return The updated processor */ @@ -426,8 +426,8 @@ public interface NiFiServiceFacade { /** * Verifies the specified processor can be removed. * - * @param groupId - * @param processorId + * @param groupId group + * @param processorId processor */ void verifyDeleteProcessor(String groupId, String processorId); @@ -435,9 +435,9 @@ public interface NiFiServiceFacade { * Deletes the specified processor. * * @param revision Revision to compare with current base revision - * @param groupId + * @param groupId group * @param processorId The processor id to delete - * @return + * @return snapshot */ ConfigurationSnapshot deleteProcessor(Revision revision, String groupId, String processorId); @@ -447,7 +447,7 @@ public interface NiFiServiceFacade { /** * Gets the Connection transfer objects for the specified source processor. * - * @param groupId + * @param groupId group * @return The Connection transfer objects */ Set getConnections(String groupId); @@ -455,7 +455,7 @@ public interface NiFiServiceFacade { /** * Gets the specified Connection transfer object. * - * @param groupId + * @param groupId group * @param connectionId The ID of the connection * @return The Connection transfer object */ @@ -464,9 +464,9 @@ public interface NiFiServiceFacade { /** * Gets the status history of the specified connection. * - * @param groupId - * @param connectionId - * @return + * @param groupId group + * @param connectionId connection + * @return history */ StatusHistoryDTO getConnectionStatusHistory(String groupId, String connectionId); @@ -474,7 +474,7 @@ public interface NiFiServiceFacade { * Creates a new Relationship target. * * @param revision Revision to compare with current base revision - * @param groupId + * @param groupId group * @param connectionDTO The Connection DTO * @return The Connection DTO */ @@ -483,16 +483,16 @@ public interface NiFiServiceFacade { /** * Determines if this connection can be created. * - * @param groupId - * @param connectionDTO + * @param groupId group + * @param connectionDTO connection */ void verifyCreateConnection(String groupId, ConnectionDTO connectionDTO); /** * Determines if this connection can be updated. * - * @param groupId - * @param connectionDTO + * @param groupId group + * @param connectionDTO connection */ void verifyUpdateConnection(String groupId, ConnectionDTO connectionDTO); @@ -500,7 +500,7 @@ public interface NiFiServiceFacade { * Updates the specified Relationship target. * * @param revision Revision to compare with current base revision - * @param groupId + * @param groupId group * @param connectionDTO The Connection DTO * @return The Connection DTO */ @@ -509,8 +509,8 @@ public interface NiFiServiceFacade { /** * Determines if this connection can be removed. * - * @param groupId - * @param connectionId + * @param groupId group + * @param connectionId connection */ void verifyDeleteConnection(String groupId, String connectionId); @@ -518,9 +518,9 @@ public interface NiFiServiceFacade { * Deletes the specified relationship target. * * @param revision Revision to compare with current base revision - * @param groupId + * @param groupId group * @param connectionId The ID of the connection - * @return + * @return snapshot */ ConfigurationSnapshot deleteConnection(Revision revision, String groupId, String connectionId); @@ -533,7 +533,7 @@ public interface NiFiServiceFacade { * @param revision Revision to compare with current base revision * @param groupId The id of the group this port should be create in * @param inputPortDTO The input PortDTO - * @return + * @return snapshot */ ConfigurationSnapshot createInputPort(Revision revision, String groupId, PortDTO inputPortDTO); @@ -542,7 +542,7 @@ public interface NiFiServiceFacade { * * @param groupId The id of the group this port is in * @param inputPortId The input port id - * @return + * @return port */ PortDTO getInputPort(String groupId, String inputPortId); @@ -550,7 +550,7 @@ public interface NiFiServiceFacade { * Gets all input ports in a given group. * * @param groupId The id of the group - * @return + * @return port */ Set getInputPorts(String groupId); @@ -568,7 +568,7 @@ public interface NiFiServiceFacade { * @param revision Revision to compare with current base revision * @param groupId The id of the group * @param inputPortDTO The input PortDTO - * @return + * @return snapshort */ ConfigurationSnapshot updateInputPort(Revision revision, String groupId, PortDTO inputPortDTO); @@ -586,7 +586,7 @@ public interface NiFiServiceFacade { * @param revision Revision to compare with current base revision * @param groupId The id of the group * @param inputPortId The id of the input port - * @return + * @return snapshot */ ConfigurationSnapshot deleteInputPort(Revision revision, String groupId, String inputPortId); @@ -599,7 +599,7 @@ public interface NiFiServiceFacade { * @param revision Revision to compare with current base revision * @param groupId The id of the group this port should be create in * @param outputPortDTO The output PortDTO - * @return + * @return snapshot */ ConfigurationSnapshot createOutputPort(Revision revision, String groupId, PortDTO outputPortDTO); @@ -608,7 +608,7 @@ public interface NiFiServiceFacade { * * @param groupId The id of the group this port is in * @param outputPortId The output port id - * @return + * @return port */ PortDTO getOutputPort(String groupId, String outputPortId); @@ -616,7 +616,7 @@ public interface NiFiServiceFacade { * Gets all output ports in a given group. * * @param groupId The id of the group - * @return + * @return ports */ Set getOutputPorts(String groupId); @@ -634,7 +634,7 @@ public interface NiFiServiceFacade { * @param revision Revision to compare with current base revision * @param groupId The id of the group * @param outputPortDTO The output PortDTO - * @return + * @return snapshot */ ConfigurationSnapshot updateOutputPort(Revision revision, String groupId, PortDTO outputPortDTO); @@ -649,10 +649,10 @@ public interface NiFiServiceFacade { /** * Determines if the output port could be deleted. * - * @param revision + * @param revision revision * @param groupId The id of the group * @param outputPortId The id of the output port - * @return + * @return snapshot */ ConfigurationSnapshot deleteOutputPort(Revision revision, String groupId, String outputPortId); @@ -665,15 +665,15 @@ public interface NiFiServiceFacade { * @param parentGroupId The id of the parent group * @param revision Revision to compare with current base revision * @param processGroupDTO The ProcessGroupDTO - * @return + * @return snapshot */ ConfigurationSnapshot createProcessGroup(String parentGroupId, Revision revision, ProcessGroupDTO processGroupDTO); /** * Returns the process group. * - * @param groupId - * @param recurse + * @param groupId group + * @param recurse recurse * @return ProcessGroup transfer object */ ConfigurationSnapshot getProcessGroup(String groupId, boolean recurse); @@ -682,7 +682,7 @@ public interface NiFiServiceFacade { * Gets all process groups in the specified parent group. * * @param parentGroupId The id of the parent group - * @return + * @return process group */ Set getProcessGroups(String parentGroupId); @@ -699,7 +699,7 @@ public interface NiFiServiceFacade { * @param revision Revision to compare with current base revision * @param parentGroupId The id of the parent group * @param processGroupDTO The ProcessGroupDTO - * @return + * @return snapshot */ ConfigurationSnapshot updateProcessGroup(Revision revision, String parentGroupId, ProcessGroupDTO processGroupDTO); @@ -715,14 +715,14 @@ public interface NiFiServiceFacade { * * @param revision Revision to compare with current base revision * @param groupId The id of the process group - * @return + * @return snapshot */ ConfigurationSnapshot deleteProcessGroup(Revision revision, String groupId); /** * The instance id of this NiFi. * - * @return + * @return identifier */ String getInstanceId(); @@ -735,7 +735,7 @@ public interface NiFiServiceFacade { * @param revision Revision to compare with current base revision * @param groupId The id of the parent group * @param remoteProcessGroupDTO The RemoteProcessGroupDTO - * @return + * @return snapshot */ ConfigurationSnapshot createRemoteProcessGroup(Revision revision, String groupId, RemoteProcessGroupDTO remoteProcessGroupDTO); @@ -744,7 +744,7 @@ public interface NiFiServiceFacade { * * @param groupId The id of the parent group * @param remoteProcessGroupId The id of the remote process group - * @return + * @return group */ RemoteProcessGroupDTO getRemoteProcessGroup(String groupId, String remoteProcessGroupId); @@ -752,7 +752,7 @@ public interface NiFiServiceFacade { * Gets all remote process groups in the a given parent group. * * @param groupId The id of the parent group - * @return + * @return group */ Set getRemoteProcessGroups(String groupId); @@ -761,7 +761,7 @@ public interface NiFiServiceFacade { * * @param groupId The id of the parent group * @param id The id of the remote process group - * @return + * @return history */ StatusHistoryDTO getRemoteProcessGroupStatusHistory(String groupId, String id); @@ -799,7 +799,7 @@ public interface NiFiServiceFacade { * @param revision Revision to compare with current base revision * @param groupId The id of the parent group * @param remoteProcessGroupDTO The RemoteProcessGroupDTO - * @return + * @return snapshot */ ConfigurationSnapshot updateRemoteProcessGroup(Revision revision, String groupId, RemoteProcessGroupDTO remoteProcessGroupDTO); @@ -811,7 +811,7 @@ public interface NiFiServiceFacade { * @param groupId The id of the parent group * @param remoteProcessGroupId The id of the remote process group * @param remoteProcessGroupPortDTO The RemoteProcessGroupPortDTO - * @return + * @return snapshot */ ConfigurationSnapshot updateRemoteProcessGroupInputPort(Revision revision, String groupId, String remoteProcessGroupId, RemoteProcessGroupPortDTO remoteProcessGroupPortDTO); @@ -823,7 +823,7 @@ public interface NiFiServiceFacade { * @param groupId The id of the parent group * @param remoteProcessGroupId The id of the remote process group * @param remoteProcessGroupPortDTO The RemoteProcessGroupPortDTO - * @return + * @return snapshot */ ConfigurationSnapshot updateRemoteProcessGroupOutputPort(Revision revision, String groupId, String remoteProcessGroupId, RemoteProcessGroupPortDTO remoteProcessGroupPortDTO); @@ -842,7 +842,7 @@ public interface NiFiServiceFacade { * @param revision Revision to compare with current base revision * @param groupId The id of the parent group * @param remoteProcessGroupId The id of the remote process group - * @return + * @return snapshot */ ConfigurationSnapshot deleteRemoteProcessGroup(Revision revision, String groupId, String remoteProcessGroupId); @@ -853,8 +853,8 @@ public interface NiFiServiceFacade { * Creates a funnel. * * @param revision Revision to compare with current base revision - * @param groupId - * @param funnelDTO + * @param groupId group + * @param funnelDTO funnel * @return The funnel DTO */ ConfigurationSnapshot createFunnel(Revision revision, String groupId, FunnelDTO funnelDTO); @@ -862,7 +862,7 @@ public interface NiFiServiceFacade { /** * Gets the specified funnel. * - * @param groupId + * @param groupId group * @param funnelId The funnel id * @return The funnel transfer object */ @@ -871,7 +871,7 @@ public interface NiFiServiceFacade { /** * Gets all of the funnels. * - * @param groupId + * @param groupId group * @return The funnel transfer objects */ Set getFunnels(String groupId); @@ -880,7 +880,7 @@ public interface NiFiServiceFacade { * Updates the specified label. * * @param revision Revision to compare with current base revision - * @param groupId + * @param groupId group * @param funnelDTO The funnel DTO * @return The funnel DTO */ @@ -889,8 +889,8 @@ public interface NiFiServiceFacade { /** * Verifies the specified funnel can be deleted. * - * @param groupId - * @param funnelId + * @param groupId group + * @param funnelId funnel */ void verifyDeleteFunnel(String groupId, String funnelId); @@ -898,9 +898,9 @@ public interface NiFiServiceFacade { * Deletes the specified label. * * @param revision Revision to compare with current base revision - * @param groupId + * @param groupId group * @param funnelId The funnel id - * @return + * @return snapshot */ ConfigurationSnapshot deleteFunnel(Revision revision, String groupId, String funnelId); @@ -911,7 +911,7 @@ public interface NiFiServiceFacade { * Creates a label. * * @param revision Revision to compare with current base revision - * @param groupId + * @param groupId group * @param labelDTO The label DTO * @return The label DTO */ @@ -920,7 +920,7 @@ public interface NiFiServiceFacade { /** * Gets the specified label. * - * @param groupId + * @param groupId group * @param labelId The label id * @return The label transfer object */ @@ -929,7 +929,7 @@ public interface NiFiServiceFacade { /** * Gets all of the labels. * - * @param groupId + * @param groupId group * @return The label transfer objects */ Set getLabels(String groupId); @@ -938,7 +938,7 @@ public interface NiFiServiceFacade { * Updates the specified label. * * @param revision Revision to compare with current base revision - * @param groupId + * @param groupId group * @param labelDTO The label DTO * @return The label DTO */ @@ -948,16 +948,15 @@ public interface NiFiServiceFacade { * Deletes the specified label. * * @param revision Revision to compare with current base revision - * @param groupId + * @param groupId group * @param labelId The label id - * @return + * @return snapshot */ ConfigurationSnapshot deleteLabel(Revision revision, String groupId, String labelId); // ---------------------------------------- // Controller Services methods // ---------------------------------------- - /** * Creates a controller service. * @@ -966,50 +965,52 @@ public interface NiFiServiceFacade { * @return The controller service DTO */ ConfigurationSnapshot createControllerService(Revision revision, ControllerServiceDTO controllerServiceDTO); - + /** * Gets all controller services. - * - * @return + * + * @return services */ Set getControllerServices(); - + /** * Gets the specified controller service. - * - * @param controllerServiceId - * @return + * + * @param controllerServiceId id + * @return service */ ControllerServiceDTO getControllerService(String controllerServiceId); - + /** - * Get the descriptor for the specified property of the specified controller service. - * - * @param id - * @param property - * @return + * Get the descriptor for the specified property of the specified controller + * service. + * + * @param id id + * @param property property + * @return property */ PropertyDescriptorDTO getControllerServicePropertyDescriptor(String id, String property); - + /** * Gets the references for specified controller service. - * - * @param controllerServiceId - * @return + * + * @param controllerServiceId id + * @return service reference */ Set getControllerServiceReferencingComponents(String controllerServiceId); - + /** * Updates the referencing components for the specified controller service. - * - * @param revision - * @param controllerServiceId - * @param scheduledState - * @param controllerServiceState the value of state + * + * @param revision revision + * @param controllerServiceId id + * @param scheduledState state + * @param controllerServiceState the value of state * @return The referencing component dtos */ - ConfigurationSnapshot> updateControllerServiceReferencingComponents(Revision revision, String controllerServiceId, ScheduledState scheduledState, ControllerServiceState controllerServiceState); - + ConfigurationSnapshot> updateControllerServiceReferencingComponents( + Revision revision, String controllerServiceId, ScheduledState scheduledState, ControllerServiceState controllerServiceState); + /** * Updates the specified label. * @@ -1024,37 +1025,37 @@ public interface NiFiServiceFacade { * * @param revision Revision to compare with current base revision * @param controllerServiceId The controller service id - * @return + * @return snapshot */ ConfigurationSnapshot deleteControllerService(Revision revision, String controllerServiceId); - + /** * Verifies the specified controller service can be updated. * - * @param controllerServiceDTO + * @param controllerServiceDTO service */ void verifyUpdateControllerService(ControllerServiceDTO controllerServiceDTO); - + /** - * Verifies the referencing components of the specified controller service can be updated. - * - * @param controllerServiceId - * @param scheduledState - * @param controllerServiceState + * Verifies the referencing components of the specified controller service + * can be updated. + * + * @param controllerServiceId id + * @param scheduledState schedule state + * @param controllerServiceState service state */ void verifyUpdateControllerServiceReferencingComponents(String controllerServiceId, ScheduledState scheduledState, ControllerServiceState controllerServiceState); - + /** * Verifies the specified controller service can be removed. * - * @param controllerServiceId + * @param controllerServiceId id */ void verifyDeleteControllerService(String controllerServiceId); - + // ---------------------------------------- // Reporting Task methods // ---------------------------------------- - /** * Creates a reporting task. * @@ -1063,31 +1064,32 @@ public interface NiFiServiceFacade { * @return The reporting task DTO */ ConfigurationSnapshot createReportingTask(Revision revision, ReportingTaskDTO reportingTaskDTO); - + /** * Gets all reporting tasks. - * - * @return + * + * @return tasks */ Set getReportingTasks(); - + /** * Gets the specified reporting task. - * - * @param reportingTaskId - * @return + * + * @param reportingTaskId id + * @return task */ ReportingTaskDTO getReportingTask(String reportingTaskId); - + /** - * Get the descriptor for the specified property of the specified reporting task. - * - * @param id - * @param property - * @return + * Get the descriptor for the specified property of the specified reporting + * task. + * + * @param id id + * @param property property + * @return descriptor */ PropertyDescriptorDTO getReportingTaskPropertyDescriptor(String id, String property); - + /** * Updates the specified reporting task. * @@ -1102,40 +1104,40 @@ public interface NiFiServiceFacade { * * @param revision Revision to compare with current base revision * @param reportingTaskId The reporting task id - * @return + * @return snapshot */ ConfigurationSnapshot deleteReportingTask(Revision revision, String reportingTaskId); - + /** * Verifies the specified reporting task can be updated. * - * @param reportingTaskDTO + * @param reportingTaskDTO task */ void verifyUpdateReportingTask(ReportingTaskDTO reportingTaskDTO); /** * Verifies the specified reporting task can be removed. * - * @param reportingTaskId + * @param reportingTaskId id */ void verifyDeleteReportingTask(String reportingTaskId); - + // ---------------------------------------- // History methods // ---------------------------------------- /** * Returns actions that meet the specified criteria. * - * @param historyQuery - * @return + * @param historyQuery query + * @return history */ HistoryDTO getActions(HistoryQueryDTO historyQuery); /** * Returns the details for the specified action id. * - * @param actionId - * @return + * @param actionId id + * @return action */ ActionDTO getAction(Integer actionId); @@ -1149,8 +1151,8 @@ public interface NiFiServiceFacade { /** * Gets the history for the specified property for the specified component. * - * @param componentId - * @return + * @param componentId id + * @return history */ ComponentHistoryDTO getComponentHistory(String componentId); @@ -1160,36 +1162,36 @@ public interface NiFiServiceFacade { /** * Creates a new snippet based off the existing snippet. * - * @param revision - * @param groupId - * @param snippetId - * @param originX - * @param originY - * @return + * @param revision revision + * @param groupId group id + * @param snippetId snippet id + * @param originX x + * @param originY y + * @return snapshot */ ConfigurationSnapshot copySnippet(Revision revision, String groupId, String snippetId, Double originX, Double originY); /** * Creates a new snippet. * - * @param revision - * @param snippet - * @return + * @param revision revision + * @param snippet snippet + * @return snapshot */ ConfigurationSnapshot createSnippet(Revision revision, SnippetDTO snippet); /** * Gets the specified snippet. * - * @param snippetId - * @return + * @param snippetId id + * @return snippet */ SnippetDTO getSnippet(String snippetId); /** * Determines if this snippet can be updated. * - * @param snippetDto + * @param snippetDto snippet */ void verifyUpdateSnippet(SnippetDTO snippetDto); @@ -1197,25 +1199,25 @@ public interface NiFiServiceFacade { * If group id is specified, moves the specified snippet to the specified * group. * - * @param revision - * @param snippetDto - * @return + * @param revision revision + * @param snippetDto snippet + * @return snapshot */ ConfigurationSnapshot updateSnippet(Revision revision, SnippetDTO snippetDto); /** * Determines if this snippet can be removed. * - * @param id + * @param id id */ void verifyDeleteSnippet(String id); /** * Removes the specified snippet. * - * @param revision - * @param snippetId - * @return + * @param revision revision + * @param snippetId snippet + * @return snapshot */ ConfigurationSnapshot deleteSnippet(Revision revision, String snippetId); @@ -1226,15 +1228,15 @@ public interface NiFiServiceFacade { * Gets the user with the specified id. * * @param userId The user id - * @return + * @return user */ UserDTO getUser(String userId); /** * Gets all of the users registered with this controller. * - * @param grouped - * @return + * @param grouped grouped + * @return user */ Collection getUsers(Boolean grouped); @@ -1242,14 +1244,14 @@ public interface NiFiServiceFacade { * Updates the specified user accordingly. * * @param user The user to update - * @return + * @return user */ UserDTO updateUser(UserDTO user); /** * Invalidates the specified user. * - * @param userId + * @param userId user */ void invalidateUser(String userId); @@ -1257,15 +1259,15 @@ public interface NiFiServiceFacade { * Invalidates the specified user accounts and all accounts associated with * this group. * - * @param userGroup - * @param userIds + * @param userGroup group + * @param userIds id */ void invalidateUserGroup(String userGroup, Set userIds); /** * Deletes the specified user. * - * @param userId + * @param userId user id */ void deleteUser(String userId); @@ -1273,20 +1275,22 @@ public interface NiFiServiceFacade { * Updates a user group with the specified group and comprised of the * specified users. * - * @param userGroup - * @return + * @param userGroup group + * @return group */ UserGroupDTO updateUserGroup(UserGroupDTO userGroup); /** * Ungroups the specified user. - * @param userId + * + * @param userId id */ void removeUserFromGroup(String userId); /** * Deletes the specified user group. - * @param userGroup + * + * @param userGroup group */ void removeUserGroup(String userGroup); @@ -1300,15 +1304,11 @@ public interface NiFiServiceFacade { boolean isClustered(); /** - * Gets the id of this node, if clustered. If not clustered, returns null. - * - * @return + * @return the id of this node, if clustered. If not clustered, returns null */ String getNodeId(); /** - * Returns the contents of cluster. - * * @return the contents of cluster */ ClusterDTO getCluster(); @@ -1325,7 +1325,7 @@ public interface NiFiServiceFacade { * Updates the contents of the node. * * @param nodeDTO a node transfer object - * @return + * @return node */ NodeDTO updateNode(NodeDTO nodeDTO); @@ -1368,11 +1368,9 @@ public interface NiFiServiceFacade { ClusterProcessorStatusDTO getClusterProcessorStatus(String processorId); /** - * Returns the processor status history for each node connected to the - * cluster. - * - * @param processorId - * @return + * @param processorId id + * @return the processor status history for each node connected to the + * cluster */ ClusterStatusHistoryDTO getClusterProcessorStatusHistory(String processorId); @@ -1385,29 +1383,23 @@ public interface NiFiServiceFacade { ClusterConnectionStatusDTO getClusterConnectionStatus(String connectionId); /** - * Returns the connection status history for each node connected to the - * cluster. - * - * @param connectionId - * @return + * @param connectionId id + * @return the connection status history for each node connected to the + * cluster */ ClusterStatusHistoryDTO getClusterConnectionStatusHistory(String connectionId); /** - * Returns the process group status history for each node connected to the - * cluster. - * - * @param processGroupId - * @return + * @param processGroupId id + * @return the process group status history for each node connected to the + * cluster */ ClusterStatusHistoryDTO getClusterProcessGroupStatusHistory(String processGroupId); /** - * Returns the remote process group status history for each node connected - * to the cluster. - * - * @param remoteProcessGroupId - * @return + * @param remoteProcessGroupId id + * @return the remote process group status history for each node connected + * to the cluster */ ClusterStatusHistoryDTO getClusterRemoteProcessGroupStatusHistory(String remoteProcessGroupId); @@ -1438,22 +1430,18 @@ public interface NiFiServiceFacade { // ---------------------------------------- // BulletinBoard methods - // ---------------------------------------- + // ---------------------------------------- /** - * Returns the bulletin board for this NiFi. - * - * @param query - * @return + * @param query query + * @return the bulletin board for this NiFi */ BulletinBoardDTO getBulletinBoard(BulletinQueryDTO query); // ---------------------------------------- // System diagnostics methods - // ---------------------------------------- + // ---------------------------------------- /** - * Returns the system diagnostics. - * - * @return + * @return the system diagnostics */ SystemDiagnosticsDTO getSystemDiagnostics(); } diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/StandardNiFiContentAccess.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/StandardNiFiContentAccess.java index ed581433c4..18c888ec11 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/StandardNiFiContentAccess.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/StandardNiFiContentAccess.java @@ -50,11 +50,11 @@ public class StandardNiFiContentAccess implements ContentAccess { private static final Logger logger = LoggerFactory.getLogger(StandardNiFiContentAccess.class); public static final String CLIENT_ID_PARAM = "clientId"; - + private NiFiProperties properties; private NiFiServiceFacade serviceFacade; private WebClusterManager clusterManager; - + @Override @PreAuthorize("hasRole('ROLE_PROVENANCE')") public DownloadableContent getContent(final ContentRequestContext request) { @@ -67,11 +67,11 @@ public class StandardNiFiContentAccess implements ContentAccess { } catch (final URISyntaxException use) { throw new ClusterRequestException(use); } - + // set the request parameters final MultivaluedMap parameters = new MultivaluedMapImpl(); parameters.add(CLIENT_ID_PARAM, request.getClientId()); - + // set the headers final Map headers = new HashMap<>(); if (StringUtils.isNotBlank(request.getProxiedEntitiesChain())) { @@ -90,7 +90,7 @@ public class StandardNiFiContentAccess implements ContentAccess { headers.put("X-ProxiedEntityUserDetails", hexEncodedUserDetails); } } - + // get the target node and ensure it exists final Node targetNode = clusterManager.getNode(request.getClusterNodeId()); if (targetNode == null) { @@ -104,14 +104,14 @@ public class StandardNiFiContentAccess implements ContentAccess { final NodeResponse nodeResponse = clusterManager.applyRequest(HttpMethod.GET, dataUri, parameters, headers, targetNodes); final ClientResponse clientResponse = nodeResponse.getClientResponse(); final MultivaluedMap responseHeaders = clientResponse.getHeaders(); - + // get the file name final String contentDisposition = responseHeaders.getFirst("Content-Disposition"); final String filename = StringUtils.substringAfterLast(contentDisposition, "filename="); - + // get the content type final String contentType = responseHeaders.getFirst("Content-Type"); - + // create the downloadable content return new DownloadableContent(filename, contentType, clientResponse.getEntityInputStream()); } else { @@ -119,7 +119,7 @@ public class StandardNiFiContentAccess implements ContentAccess { final String eventDetails = StringUtils.substringAfterLast(request.getDataUri(), "events/"); final String rawEventId = StringUtils.substringBefore(eventDetails, "/content/"); final String rawDirection = StringUtils.substringAfterLast(eventDetails, "/content/"); - + // get the content type final Long eventId; final ContentDirection direction; diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/StandardNiFiServiceFacade.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/StandardNiFiServiceFacade.java index 88637b4e03..df4cdf1d07 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/StandardNiFiServiceFacade.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/StandardNiFiServiceFacade.java @@ -211,7 +211,6 @@ public class StandardNiFiServiceFacade implements NiFiServiceFacade { // ----------------------------------------- // Verification Operations // ----------------------------------------- - @Override public void verifyCreateConnection(String groupId, ConnectionDTO connectionDTO) { connectionDAO.verifyCreate(groupId, connectionDTO); @@ -365,21 +364,20 @@ public class StandardNiFiServiceFacade implements NiFiServiceFacade { // ----------------------------------------- // Write Operations // ----------------------------------------- - @Override public ConfigurationSnapshot updateConnection(final Revision revision, final String groupId, final ConnectionDTO connectionDTO) { // if connection does not exist, then create new connection if (connectionDAO.hasConnection(groupId, connectionDTO.getId()) == false) { return createConnection(revision, groupId, connectionDTO); } - + return optimisticLockingManager.configureFlow(revision, new ConfigurationRequest() { @Override public ConnectionDTO execute() { final Connection connection = connectionDAO.updateConnection(groupId, connectionDTO); controllerFacade.save(); - + return dtoFactory.createConnectionDto(connection); } }); @@ -391,7 +389,7 @@ public class StandardNiFiServiceFacade implements NiFiServiceFacade { if (processorDAO.hasProcessor(groupId, processorDTO.getId()) == false) { return createProcessor(revision, groupId, processorDTO); } - + return optimisticLockingManager.configureFlow(revision, new ConfigurationRequest() { @Override public ProcessorDTO execute() { @@ -400,7 +398,7 @@ public class StandardNiFiServiceFacade implements NiFiServiceFacade { // save the flow controllerFacade.save(); - + return dtoFactory.createProcessorDto(processor); } }); @@ -412,7 +410,7 @@ public class StandardNiFiServiceFacade implements NiFiServiceFacade { if (labelDAO.hasLabel(groupId, labelDTO.getId()) == false) { return createLabel(revision, groupId, labelDTO); } - + return optimisticLockingManager.configureFlow(revision, new ConfigurationRequest() { @Override public LabelDTO execute() { @@ -421,7 +419,7 @@ public class StandardNiFiServiceFacade implements NiFiServiceFacade { // save updated controller controllerFacade.save(); - + return dtoFactory.createLabelDto(label); } }); @@ -433,7 +431,7 @@ public class StandardNiFiServiceFacade implements NiFiServiceFacade { if (funnelDAO.hasFunnel(groupId, funnelDTO.getId()) == false) { return createFunnel(revision, groupId, funnelDTO); } - + return optimisticLockingManager.configureFlow(revision, new ConfigurationRequest() { @Override public FunnelDTO execute() { @@ -442,7 +440,7 @@ public class StandardNiFiServiceFacade implements NiFiServiceFacade { // save updated controller controllerFacade.save(); - + return dtoFactory.createFunnelDto(funnel); } }); @@ -463,7 +461,7 @@ public class StandardNiFiServiceFacade implements NiFiServiceFacade { if (snippetDAO.hasSnippet(snippetDto.getId()) == false) { return createSnippet(revision, snippetDto); } - + return optimisticLockingManager.configureFlow(revision, new ConfigurationRequest() { @Override public SnippetDTO execute() { @@ -478,7 +476,7 @@ public class StandardNiFiServiceFacade implements NiFiServiceFacade { if (snippetDto.getParentGroupId() != null && snippet.isLinked()) { controllerFacade.save(); } - + return responseSnippetDto; } }); @@ -490,7 +488,7 @@ public class StandardNiFiServiceFacade implements NiFiServiceFacade { if (inputPortDAO.hasPort(groupId, inputPortDTO.getId()) == false) { return createInputPort(revision, groupId, inputPortDTO); } - + return optimisticLockingManager.configureFlow(revision, new ConfigurationRequest() { @Override public PortDTO execute() { @@ -498,8 +496,8 @@ public class StandardNiFiServiceFacade implements NiFiServiceFacade { // save updated controller controllerFacade.save(); - - return dtoFactory.createPortDto(inputPort); + + return dtoFactory.createPortDto(inputPort); } }); } @@ -510,7 +508,7 @@ public class StandardNiFiServiceFacade implements NiFiServiceFacade { if (outputPortDAO.hasPort(groupId, outputPortDTO.getId()) == false) { return createOutputPort(revision, groupId, outputPortDTO); } - + return optimisticLockingManager.configureFlow(revision, new ConfigurationRequest() { @Override public PortDTO execute() { @@ -518,7 +516,7 @@ public class StandardNiFiServiceFacade implements NiFiServiceFacade { // save updated controller controllerFacade.save(); - + return dtoFactory.createPortDto(outputPort); } }); @@ -530,7 +528,7 @@ public class StandardNiFiServiceFacade implements NiFiServiceFacade { if (remoteProcessGroupDAO.hasRemoteProcessGroup(groupId, remoteProcessGroupDTO.getId()) == false) { return createRemoteProcessGroup(revision, groupId, remoteProcessGroupDTO); } - + return optimisticLockingManager.configureFlow(revision, new ConfigurationRequest() { @Override public RemoteProcessGroupDTO execute() { @@ -538,7 +536,7 @@ public class StandardNiFiServiceFacade implements NiFiServiceFacade { // save updated controller controllerFacade.save(); - + return dtoFactory.createRemoteProcessGroupDto(remoteProcessGroup); } }); @@ -554,7 +552,7 @@ public class StandardNiFiServiceFacade implements NiFiServiceFacade { // save updated controller controllerFacade.save(); - + return dtoFactory.createRemoteProcessGroupPortDto(remoteGroupPort); } }); @@ -570,7 +568,7 @@ public class StandardNiFiServiceFacade implements NiFiServiceFacade { // save updated controller controllerFacade.save(); - + return dtoFactory.createRemoteProcessGroupPortDto(remoteGroupPort); } }); @@ -586,7 +584,7 @@ public class StandardNiFiServiceFacade implements NiFiServiceFacade { return createProcessGroup(parentGroupId, revision, processGroupDTO); } } - + return optimisticLockingManager.configureFlow(revision, new ConfigurationRequest() { @Override public ProcessGroupDTO execute() { @@ -595,7 +593,7 @@ public class StandardNiFiServiceFacade implements NiFiServiceFacade { // save updated controller controllerFacade.save(); - + return dtoFactory.createProcessGroupDto(processGroup); } }); @@ -625,7 +623,7 @@ public class StandardNiFiServiceFacade implements NiFiServiceFacade { // save the flow controllerFacade.save(); - + return controllerConfig; } }); @@ -662,14 +660,14 @@ public class StandardNiFiServiceFacade implements NiFiServiceFacade { @Override public ConfigurationSnapshot deleteConnection(final Revision revision, final String groupId, final String connectionId) { - return optimisticLockingManager.configureFlow(revision, new ConfigurationRequest(){ + return optimisticLockingManager.configureFlow(revision, new ConfigurationRequest() { @Override public Void execute() { connectionDAO.deleteConnection(groupId, connectionId); // save the flow controllerFacade.save(); - + return null; } }); @@ -685,7 +683,7 @@ public class StandardNiFiServiceFacade implements NiFiServiceFacade { // save the flow controllerFacade.save(); - + return null; } }); @@ -701,7 +699,7 @@ public class StandardNiFiServiceFacade implements NiFiServiceFacade { // save the flow controllerFacade.save(); - + return null; } }); @@ -717,7 +715,7 @@ public class StandardNiFiServiceFacade implements NiFiServiceFacade { // save the flow controllerFacade.save(); - + return null; } }); @@ -744,7 +742,7 @@ public class StandardNiFiServiceFacade implements NiFiServiceFacade { if (linked) { controllerFacade.save(); } - + return null; } }); @@ -759,7 +757,7 @@ public class StandardNiFiServiceFacade implements NiFiServiceFacade { // save the flow controllerFacade.save(); - + return null; } }); @@ -774,7 +772,7 @@ public class StandardNiFiServiceFacade implements NiFiServiceFacade { // save the flow controllerFacade.save(); - + return null; } }); @@ -789,7 +787,7 @@ public class StandardNiFiServiceFacade implements NiFiServiceFacade { // save the flow controllerFacade.save(); - + return null; } }); @@ -804,7 +802,7 @@ public class StandardNiFiServiceFacade implements NiFiServiceFacade { // save the flow controllerFacade.save(); - + return null; } }); @@ -830,7 +828,7 @@ public class StandardNiFiServiceFacade implements NiFiServiceFacade { // save the flow controllerFacade.save(); - + return dtoFactory.createConnectionDto(connection); } }); @@ -851,7 +849,7 @@ public class StandardNiFiServiceFacade implements NiFiServiceFacade { // save the flow controllerFacade.save(); - + return dtoFactory.createProcessorDto(processor); } }); @@ -872,7 +870,7 @@ public class StandardNiFiServiceFacade implements NiFiServiceFacade { // save the flow controllerFacade.save(); - + return dtoFactory.createLabelDto(label); } }); @@ -893,7 +891,7 @@ public class StandardNiFiServiceFacade implements NiFiServiceFacade { // save the flow controllerFacade.save(); - + return dtoFactory.createFunnelDto(funnel); } }); @@ -960,7 +958,7 @@ public class StandardNiFiServiceFacade implements NiFiServiceFacade { @Override public FlowSnippetDTO execute() { String id = snippetId; - + // ensure id is set if (StringUtils.isBlank(id)) { id = UUID.randomUUID().toString(); @@ -974,7 +972,7 @@ public class StandardNiFiServiceFacade implements NiFiServiceFacade { // save the flow controllerFacade.save(); - + return flowSnippet; } }); @@ -994,7 +992,7 @@ public class StandardNiFiServiceFacade implements NiFiServiceFacade { final Snippet snippet = snippetDAO.createSnippet(snippetDTO); final SnippetDTO responseSnippetDTO = dtoFactory.createSnippetDto(snippet); responseSnippetDTO.setContents(snippetUtils.populateFlowSnippet(snippet, false)); - + return responseSnippetDTO; } }); @@ -1014,7 +1012,7 @@ public class StandardNiFiServiceFacade implements NiFiServiceFacade { // save the flow controllerFacade.save(); - + return dtoFactory.createPortDto(inputPort); } }); @@ -1034,7 +1032,7 @@ public class StandardNiFiServiceFacade implements NiFiServiceFacade { // save the flow controllerFacade.save(); - + return dtoFactory.createPortDto(outputPort); } }); @@ -1054,7 +1052,7 @@ public class StandardNiFiServiceFacade implements NiFiServiceFacade { // save the flow controllerFacade.save(); - + return dtoFactory.createProcessGroupDto(processGroup); } }); @@ -1074,7 +1072,7 @@ public class StandardNiFiServiceFacade implements NiFiServiceFacade { // save the flow controllerFacade.save(); - + return dtoFactory.createRemoteProcessGroupDto(remoteProcessGroup); } }); @@ -1136,7 +1134,7 @@ public class StandardNiFiServiceFacade implements NiFiServiceFacade { // save the flow controllerFacade.save(); - + return flowSnippet; } }); @@ -1206,7 +1204,7 @@ public class StandardNiFiServiceFacade implements NiFiServiceFacade { } else { controllerFacade.save(); } - + return dtoFactory.createControllerServiceDto(controllerService); } }); @@ -1218,7 +1216,7 @@ public class StandardNiFiServiceFacade implements NiFiServiceFacade { if (controllerServiceDAO.hasControllerService(controllerServiceDTO.getId()) == false) { return createControllerService(revision, controllerServiceDTO); } - + return optimisticLockingManager.configureFlow(revision, new ConfigurationRequest() { @Override public ControllerServiceDTO execute() { @@ -1261,7 +1259,7 @@ public class StandardNiFiServiceFacade implements NiFiServiceFacade { } else { controllerFacade.save(); } - + return null; } }); @@ -1286,7 +1284,7 @@ public class StandardNiFiServiceFacade implements NiFiServiceFacade { } else { controllerFacade.save(); } - + return dtoFactory.createReportingTaskDto(reportingTask); } }); @@ -1298,7 +1296,7 @@ public class StandardNiFiServiceFacade implements NiFiServiceFacade { if (reportingTaskDAO.hasReportingTask(reportingTaskDTO.getId()) == false) { return createReportingTask(revision, reportingTaskDTO); } - + return optimisticLockingManager.configureFlow(revision, new ConfigurationRequest() { @Override public ReportingTaskDTO execute() { @@ -1330,7 +1328,7 @@ public class StandardNiFiServiceFacade implements NiFiServiceFacade { } else { controllerFacade.save(); } - + return null; } }); @@ -1488,7 +1486,6 @@ public class StandardNiFiServiceFacade implements NiFiServiceFacade { // ----------------------------------------- // Read Operations // ----------------------------------------- - @Override public RevisionDTO getRevision() { return dtoFactory.createRevisionDTO(optimisticLockingManager.getLastModification()); @@ -1738,12 +1735,12 @@ public class StandardNiFiServiceFacade implements NiFiServiceFacade { public PropertyDescriptorDTO getProcessorPropertyDescriptor(String groupId, String id, String property) { final ProcessorNode processor = processorDAO.getProcessor(groupId, id); PropertyDescriptor descriptor = processor.getPropertyDescriptor(property); - + // return an invalid descriptor if the processor doesn't suppor this property if (descriptor == null) { descriptor = new PropertyDescriptor.Builder().name(property).addValidator(Validator.INVALID).dynamic(true).build(); } - + return dtoFactory.createPropertyDescriptorDto(descriptor); } @@ -2057,15 +2054,15 @@ public class StandardNiFiServiceFacade implements NiFiServiceFacade { public PropertyDescriptorDTO getControllerServicePropertyDescriptor(String id, String property) { final ControllerServiceNode controllerService = controllerServiceDAO.getControllerService(id); PropertyDescriptor descriptor = controllerService.getControllerServiceImplementation().getPropertyDescriptor(property); - + // return an invalid descriptor if the controller service doesn't support this property if (descriptor == null) { descriptor = new PropertyDescriptor.Builder().name(property).addValidator(Validator.INVALID).dynamic(true).build(); } - + return dtoFactory.createPropertyDescriptorDto(descriptor); } - + @Override public Set getControllerServiceReferencingComponents(String controllerServiceId) { final ControllerServiceNode service = controllerServiceDAO.getControllerService(controllerServiceId); @@ -2090,15 +2087,15 @@ public class StandardNiFiServiceFacade implements NiFiServiceFacade { public PropertyDescriptorDTO getReportingTaskPropertyDescriptor(String id, String property) { final ReportingTaskNode reportingTask = reportingTaskDAO.getReportingTask(id); PropertyDescriptor descriptor = reportingTask.getReportingTask().getPropertyDescriptor(property); - + // return an invalid descriptor if the reporting task doesn't support this property if (descriptor == null) { descriptor = new PropertyDescriptor.Builder().name(property).addValidator(Validator.INVALID).dynamic(true).build(); } - + return dtoFactory.createPropertyDescriptorDto(descriptor); } - + @Override public StatusHistoryDTO getProcessGroupStatusHistory(String groupId) { return controllerFacade.getProcessGroupStatusHistory(groupId); diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/StandardNiFiWebConfigurationContext.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/StandardNiFiWebConfigurationContext.java index 8d51a584f5..a1cfcd5867 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/StandardNiFiWebConfigurationContext.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/StandardNiFiWebConfigurationContext.java @@ -68,8 +68,8 @@ import org.apache.nifi.web.api.entity.ReportingTaskEntity; import org.apache.nifi.web.util.ClientResponseUtils; /** - * Implements the NiFiWebConfigurationContext interface to support a context in both - * standalone and clustered environments. + * Implements the NiFiWebConfigurationContext interface to support a context in + * both standalone and clustered environments. */ public class StandardNiFiWebConfigurationContext implements NiFiWebConfigurationContext { @@ -99,7 +99,7 @@ public class StandardNiFiWebConfigurationContext implements NiFiWebConfiguration if (requestContext.getExtensionType() == null) { throw new IllegalArgumentException("The UI extension type must be specified."); } - + Component componentType = null; switch (requestContext.getExtensionType()) { case ProcessorConfiguration: @@ -116,7 +116,7 @@ public class StandardNiFiWebConfigurationContext implements NiFiWebConfiguration if (componentType == null) { throw new IllegalArgumentException("UI extension type must support Processor, ControllerService, or ReportingTask configuration."); } - + // - when running standalone or cluster ncm - actions from custom UIs are stored locally // - clustered nodes do not serve custom UIs directly to users so they should never be invoking this method final Date now = new Date(); @@ -192,25 +192,25 @@ public class StandardNiFiWebConfigurationContext implements NiFiWebConfiguration if (requestContext.getExtensionType() == null) { throw new IllegalArgumentException("The UI extension type must be specified."); } - + // get the component facade for interacting directly with that type of object ComponentFacade componentFacade = null; switch (requestContext.getExtensionType()) { case ProcessorConfiguration: componentFacade = new ProcessorFacade(); break; - case ControllerServiceConfiguration: + case ControllerServiceConfiguration: componentFacade = new ControllerServiceFacade(); break; case ReportingTaskConfiguration: componentFacade = new ReportingTaskFacade(); break; } - + if (componentFacade == null) { throw new IllegalArgumentException("UI extension type must support Processor, ControllerService, or ReportingTask configuration."); } - + return componentFacade.getComponentDetails(requestContext); } @@ -224,7 +224,7 @@ public class StandardNiFiWebConfigurationContext implements NiFiWebConfiguration if (StringUtils.isBlank(id)) { throw new ResourceNotFoundException(String.format("Configuration request context did not have a component ID.")); } - + // ensure the path could be if (requestContext.getExtensionType() == null) { throw new IllegalArgumentException("The UI extension type must be specified."); @@ -236,18 +236,18 @@ public class StandardNiFiWebConfigurationContext implements NiFiWebConfiguration case ProcessorConfiguration: componentFacade = new ProcessorFacade(); break; - case ControllerServiceConfiguration: + case ControllerServiceConfiguration: componentFacade = new ControllerServiceFacade(); break; case ReportingTaskConfiguration: componentFacade = new ReportingTaskFacade(); break; } - + if (componentFacade == null) { throw new IllegalArgumentException("UI extension type must support Processor, ControllerService, or ReportingTask configuration."); } - + return componentFacade.setAnnotationData(requestContext, annotationData); } @@ -255,32 +255,34 @@ public class StandardNiFiWebConfigurationContext implements NiFiWebConfiguration * Facade over accessing different types of NiFi components. */ private interface ComponentFacade { + /** * Gets the component details using the specified request context. - * + * * @param requestContext - * @return + * @return */ ComponentDetails getComponentDetails(NiFiWebRequestContext requestContext); - + /** * Sets the annotation data using the specified request context. - * + * * @param requestContext * @param annotationData - * @return + * @return */ ComponentDetails setAnnotationData(NiFiWebConfigurationRequestContext requestContext, String annotationData); } - + /** * Interprets the request/response with the underlying Processor model. */ private class ProcessorFacade implements ComponentFacade { + @Override public ComponentDetails getComponentDetails(final NiFiWebRequestContext requestContext) { final String id = requestContext.getId(); - + final ProcessorDTO processor; if (properties.isClusterManager()) { // create the request URL @@ -320,7 +322,7 @@ public class StandardNiFiWebConfigurationContext implements NiFiWebConfiguration public ComponentDetails setAnnotationData(final NiFiWebConfigurationRequestContext requestContext, final String annotationData) { final Revision revision = requestContext.getRevision(); final String id = requestContext.getId(); - + final ProcessorDTO processor; if (properties.isClusterManager()) { // create the request URL @@ -360,7 +362,7 @@ public class StandardNiFiWebConfigurationContext implements NiFiWebConfiguration // check for issues replicating request checkResponse(nodeResponse, id); - + // return processor ProcessorEntity entity = (ProcessorEntity) nodeResponse.getUpdatedEntity(); if (entity == null) { @@ -371,11 +373,11 @@ public class StandardNiFiWebConfigurationContext implements NiFiWebConfiguration final ConfigurationSnapshot response = serviceFacade.setProcessorAnnotationData(revision, id, annotationData); processor = response.getConfiguration(); } - + // return the processor info return getComponentConfiguration(processor); } - + private ComponentDetails getComponentConfiguration(final ProcessorDTO processor) { final ProcessorConfigDTO processorConfig = processor.getConfig(); return new ComponentDetails.Builder() @@ -388,16 +390,18 @@ public class StandardNiFiWebConfigurationContext implements NiFiWebConfiguration .validateErrors(processor.getValidationErrors()).build(); } } - + /** - * Interprets the request/response with the underlying ControllerService model. + * Interprets the request/response with the underlying ControllerService + * model. */ private class ControllerServiceFacade implements ComponentFacade { + @Override public ComponentDetails getComponentDetails(final NiFiWebRequestContext requestContext) { final String id = requestContext.getId(); final ControllerServiceDTO controllerService; - + // if the lookup has the service that means we are either a node or // the ncm and the service is available there only if (controllerServiceLookup.getControllerService(id) != null) { @@ -408,7 +412,7 @@ public class StandardNiFiWebConfigurationContext implements NiFiWebConfiguration if (!properties.isClusterManager()) { throw new ResourceNotFoundException(String.format("Controller service[%s] could not be found on this NiFi.", id)); } - + // create the request URL URI requestUrl; try { @@ -443,13 +447,13 @@ public class StandardNiFiWebConfigurationContext implements NiFiWebConfiguration public ComponentDetails setAnnotationData(final NiFiWebConfigurationRequestContext requestContext, final String annotationData) { final Revision revision = requestContext.getRevision(); final String id = requestContext.getId(); - + final ControllerServiceDTO controllerService; if (controllerServiceLookup.getControllerService(id) != null) { final ControllerServiceDTO controllerServiceDto = new ControllerServiceDTO(); controllerServiceDto.setId(id); controllerServiceDto.setAnnotationData(annotationData); - + final ConfigurationSnapshot response = serviceFacade.updateControllerService(revision, controllerServiceDto); controllerService = response.getConfiguration(); } else { @@ -458,13 +462,13 @@ public class StandardNiFiWebConfigurationContext implements NiFiWebConfiguration if (!properties.isClusterManager()) { throw new ResourceNotFoundException(String.format("Controller service[%s] could not be found on this NiFi.", id)); } - + // since this PUT request can be interpreted as a request to create a controller service // we need to be sure that this service exists on the node before the request is replicated. // this is done by attempting to get the details. if the service doesn't exist it will // throw a ResourceNotFoundException getComponentDetails(requestContext); - + // create the request URL URI requestUrl; try { @@ -498,7 +502,7 @@ public class StandardNiFiWebConfigurationContext implements NiFiWebConfiguration // check for issues replicating request checkResponse(nodeResponse, id); - + // return controller service ControllerServiceEntity entity = (ControllerServiceEntity) nodeResponse.getUpdatedEntity(); if (entity == null) { @@ -506,11 +510,11 @@ public class StandardNiFiWebConfigurationContext implements NiFiWebConfiguration } controllerService = entity.getControllerService(); } - + // return the controller service info return getComponentConfiguration(controllerService); } - + private ComponentDetails getComponentConfiguration(final ControllerServiceDTO controllerService) { return new ComponentDetails.Builder() .id(controllerService.getId()) @@ -522,16 +526,18 @@ public class StandardNiFiWebConfigurationContext implements NiFiWebConfiguration .validateErrors(controllerService.getValidationErrors()).build(); } } - + /** - * Interprets the request/response with the underlying ControllerService model. + * Interprets the request/response with the underlying ControllerService + * model. */ private class ReportingTaskFacade implements ComponentFacade { + @Override public ComponentDetails getComponentDetails(final NiFiWebRequestContext requestContext) { final String id = requestContext.getId(); final ReportingTaskDTO reportingTask; - + // if the provider has the service that means we are either a node or // the ncm and the service is available there only if (reportingTaskProvider.getReportingTaskNode(id) != null) { @@ -542,7 +548,7 @@ public class StandardNiFiWebConfigurationContext implements NiFiWebConfiguration if (!properties.isClusterManager()) { throw new ResourceNotFoundException(String.format("Reporting task[%s] could not be found on this NiFi.", id)); } - + // create the request URL URI requestUrl; try { @@ -577,13 +583,13 @@ public class StandardNiFiWebConfigurationContext implements NiFiWebConfiguration public ComponentDetails setAnnotationData(final NiFiWebConfigurationRequestContext requestContext, final String annotationData) { final Revision revision = requestContext.getRevision(); final String id = requestContext.getId(); - + final ReportingTaskDTO reportingTask; if (reportingTaskProvider.getReportingTaskNode(id) != null) { final ReportingTaskDTO reportingTaskDto = new ReportingTaskDTO(); reportingTaskDto.setId(id); reportingTaskDto.setAnnotationData(annotationData); - + final ConfigurationSnapshot response = serviceFacade.updateReportingTask(revision, reportingTaskDto); reportingTask = response.getConfiguration(); } else { @@ -592,13 +598,13 @@ public class StandardNiFiWebConfigurationContext implements NiFiWebConfiguration if (!properties.isClusterManager()) { throw new ResourceNotFoundException(String.format("Reporting task[%s] could not be found on this NiFi.", id)); } - + // since this PUT request can be interpreted as a request to create a reporting task // we need to be sure that this task exists on the node before the request is replicated. // this is done by attempting to get the details. if the service doesn't exist it will // throw a ResourceNotFoundException getComponentDetails(requestContext); - + // create the request URL URI requestUrl; try { @@ -632,7 +638,7 @@ public class StandardNiFiWebConfigurationContext implements NiFiWebConfiguration // check for issues replicating request checkResponse(nodeResponse, id); - + // return reporting task ReportingTaskEntity entity = (ReportingTaskEntity) nodeResponse.getUpdatedEntity(); if (entity == null) { @@ -640,11 +646,11 @@ public class StandardNiFiWebConfigurationContext implements NiFiWebConfiguration } reportingTask = entity.getReportingTask(); } - + // return the processor info return getComponentConfiguration(reportingTask); } - + private ComponentDetails getComponentConfiguration(final ReportingTaskDTO reportingTask) { return new ComponentDetails.Builder() .id(reportingTask.getId()) @@ -656,7 +662,7 @@ public class StandardNiFiWebConfigurationContext implements NiFiWebConfiguration .validateErrors(reportingTask.getValidationErrors()).build(); } } - + /** * Gets the headers for the request to replicate to each node while * clustered. @@ -685,13 +691,13 @@ public class StandardNiFiWebConfigurationContext implements NiFiWebConfiguration } return headers; } - + /** * Checks the specified response and drains the stream appropriately. - * + * * @param nodeResponse * @param revision - * @param id + * @param id */ private void checkResponse(final NodeResponse nodeResponse, final String id) { if (nodeResponse.hasThrowable()) { diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/StandardNiFiWebContext.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/StandardNiFiWebContext.java index eaf457ed45..07b982f446 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/StandardNiFiWebContext.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/StandardNiFiWebContext.java @@ -288,8 +288,8 @@ public class StandardNiFiWebContext implements NiFiWebContext { * Gets the headers for the request to replicate to each node while * clustered. * - * @param config - * @return + * @param config config + * @return headers */ private Map getHeaders(final NiFiWebContextConfig config) { final Map headers = new HashMap<>(); diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ApplicationResource.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ApplicationResource.java index 787fffaf45..66b237eb3f 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ApplicationResource.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ApplicationResource.java @@ -179,7 +179,7 @@ public abstract class ApplicationResource { // get cluster context from threadlocal ClusterContext clusterCtx = ClusterContextThreadLocal.getContext(); if (clusterCtx != null) { - + // serialize cluster context String serializedClusterContext = WebUtils.serializeObjectToHex(clusterCtx); if (serializedClusterContext.length() > CLUSTER_CONTEXT_HEADER_VALUE_MAX_BYTES) { diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ControllerResource.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ControllerResource.java index c0b4cd7519..9228be47a0 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ControllerResource.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ControllerResource.java @@ -159,7 +159,7 @@ public class ControllerResource extends ApplicationResource { public SnippetResource getSnippetResource() { return resourceContext.getResource(SnippetResource.class); } - + /** * Locates the Controller Services sub-resource. * @@ -169,7 +169,7 @@ public class ControllerResource extends ApplicationResource { public ControllerServiceResource getControllerServiceResource() { return resourceContext.getResource(ControllerServiceResource.class); } - + /** * Locates the Reporting Tasks sub-resource. * @@ -730,7 +730,7 @@ public class ControllerResource extends ApplicationResource { // generate the response return clusterContext(generateOkResponse(entity)).build(); } - + /** * Retrieves the types of controller services that this NiFi supports. * @@ -766,7 +766,7 @@ public class ControllerResource extends ApplicationResource { // generate the response return clusterContext(generateOkResponse(entity)).build(); } - + /** * Retrieves the types of reporting tasks that this NiFi supports. * diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ControllerServiceResource.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ControllerServiceResource.java index 1711f3cd67..bd3daf2136 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ControllerServiceResource.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ControllerServiceResource.java @@ -84,12 +84,12 @@ public class ControllerServiceResource extends ApplicationResource { @Context private ServletContext servletContext; - + /** * Populates the uri for the specified controller service. - * + * * @param controllerServices - * @return + * @return */ private Set populateRemainingControllerServicesContent(final String availability, final Set controllerServices) { for (ControllerServiceDTO controllerService : controllerServices) { @@ -97,7 +97,7 @@ public class ControllerServiceResource extends ApplicationResource { } return controllerServices; } - + /** * Populates the uri for the specified controller service. */ @@ -105,7 +105,7 @@ public class ControllerServiceResource extends ApplicationResource { // populate the controller service href controllerService.setUri(generateResourceUri("controller", "controller-services", availability, controllerService.getId())); controllerService.setAvailability(availability); - + // see if this processor has any ui extensions final UiExtensionMapping uiExtensionMapping = (UiExtensionMapping) servletContext.getAttribute("nifi-ui-extensions"); if (uiExtensionMapping.hasUiExtension(controllerService.getType())) { @@ -116,16 +116,16 @@ public class ControllerServiceResource extends ApplicationResource { } } } - + return controllerService; } /** - * Parses the availability and ensure that the specified availability makes sense for the - * given NiFi instance. - * + * Parses the availability and ensure that the specified availability makes + * sense for the given NiFi instance. + * * @param availability - * @return + * @return */ private Availability parseAvailability(final String availability) { final Availability avail; @@ -134,23 +134,24 @@ public class ControllerServiceResource extends ApplicationResource { } catch (IllegalArgumentException iae) { throw new IllegalArgumentException(String.format("Availability: Value must be one of [%s]", StringUtils.join(Availability.values(), ", "))); } - + // ensure this nifi is an NCM is specifying NCM availability if (!properties.isClusterManager() && Availability.NCM.equals(avail)) { throw new IllegalArgumentException("Availability of NCM is only applicable when the NiFi instance is the cluster manager."); } - + return avail; } - + /** * Retrieves all the of controller services in this NiFi. * * @param clientId Optional client id. If the client id is not specified, a * new one will be generated. This value (whether specified or generated) is * included in the response. - * @param availability Whether the controller service is available on the NCM only (ncm) or on the - * nodes only (node). If this instance is not clustered all services should use the node availability. + * @param availability Whether the controller service is available on the + * NCM only (ncm) or on the nodes only (node). If this instance is not + * clustered all services should use the node availability. * @return A controllerServicesEntity. */ @GET @@ -160,7 +161,7 @@ public class ControllerServiceResource extends ApplicationResource { @TypeHint(ControllerServicesEntity.class) public Response getControllerServices(@QueryParam(CLIENT_ID) @DefaultValue(StringUtils.EMPTY) ClientIdParameter clientId, @PathParam("availability") String availability) { final Availability avail = parseAvailability(availability); - + // replicate if cluster manager if (properties.isClusterManager() && Availability.NODE.equals(avail)) { return clusterManager.applyRequest(HttpMethod.GET, getAbsolutePath(), getRequestParameters(true), getHeaders()).getResponse(); @@ -168,7 +169,7 @@ public class ControllerServiceResource extends ApplicationResource { // get all the controller services final Set controllerServices = populateRemainingControllerServicesContent(availability, serviceFacade.getControllerServices()); - + // create the revision final RevisionDTO revision = new RevisionDTO(); revision.setClientId(clientId.getClientId()); @@ -191,8 +192,9 @@ public class ControllerServiceResource extends ApplicationResource { * @param clientId Optional client id. If the client id is not specified, a * new one will be generated. This value (whether specified or generated) is * included in the response. - * @param availability Whether the controller service is available on the NCM only (ncm) or on the - * nodes only (node). If this instance is not clustered all services should use the node availability. + * @param availability Whether the controller service is available on the + * NCM only (ncm) or on the nodes only (node). If this instance is not + * clustered all services should use the node availability. * @param type The type of controller service to create. * @return A controllerServiceEntity. */ @@ -206,9 +208,9 @@ public class ControllerServiceResource extends ApplicationResource { @Context HttpServletRequest httpServletRequest, @FormParam(VERSION) LongParameter version, @FormParam(CLIENT_ID) @DefaultValue(StringUtils.EMPTY) ClientIdParameter clientId, - @PathParam("availability") String availability, + @PathParam("availability") String availability, @FormParam("type") String type) { - + // create the controller service DTO final ControllerServiceDTO controllerServiceDTO = new ControllerServiceDTO(); controllerServiceDTO.setType(type); @@ -232,8 +234,9 @@ public class ControllerServiceResource extends ApplicationResource { * Creates a new Controller Service. * * @param httpServletRequest - * @param availability Whether the controller service is available on the NCM only (ncm) or on the - * nodes only (node). If this instance is not clustered all services should use the node availability. + * @param availability Whether the controller service is available on the + * NCM only (ncm) or on the nodes only (node). If this instance is not + * clustered all services should use the node availability. * @param controllerServiceEntity A controllerServiceEntity. * @return A controllerServiceEntity. */ @@ -245,19 +248,19 @@ public class ControllerServiceResource extends ApplicationResource { @TypeHint(ControllerServiceEntity.class) public Response createControllerService( @Context HttpServletRequest httpServletRequest, - @PathParam("availability") String availability, + @PathParam("availability") String availability, ControllerServiceEntity controllerServiceEntity) { - + final Availability avail = parseAvailability(availability); - if (controllerServiceEntity == null || controllerServiceEntity.getControllerService()== null) { + if (controllerServiceEntity == null || controllerServiceEntity.getControllerService() == null) { throw new IllegalArgumentException("Controller service details must be specified."); } if (controllerServiceEntity.getRevision() == null) { throw new IllegalArgumentException("Revision must be specified."); } - + if (controllerServiceEntity.getControllerService().getId() != null) { throw new IllegalArgumentException("Controller service ID cannot be specified."); } @@ -265,10 +268,10 @@ public class ControllerServiceResource extends ApplicationResource { if (StringUtils.isBlank(controllerServiceEntity.getControllerService().getType())) { throw new IllegalArgumentException("The type of controller service to create must be specified."); } - + // get the revision final RevisionDTO revision = controllerServiceEntity.getRevision(); - + // if cluster manager, convert POST to PUT (to maintain same ID across nodes) and replicate if (properties.isClusterManager() && Availability.NODE.equals(avail)) { // create ID for resource @@ -324,8 +327,9 @@ public class ControllerServiceResource extends ApplicationResource { * @param clientId Optional client id. If the client id is not specified, a * new one will be generated. This value (whether specified or generated) is * included in the response. - * @param availability Whether the controller service is available on the NCM only (ncm) or on the - * nodes only (node). If this instance is not clustered all services should use the node availability. + * @param availability Whether the controller service is available on the + * NCM only (ncm) or on the nodes only (node). If this instance is not + * clustered all services should use the node availability. * @param id The id of the controller service to retrieve * @return A controllerServiceEntity. */ @@ -334,11 +338,11 @@ public class ControllerServiceResource extends ApplicationResource { @Path("/{availability}/{id}") @PreAuthorize("hasAnyRole('ROLE_MONITOR', 'ROLE_DFM', 'ROLE_ADMIN')") @TypeHint(ControllerServiceEntity.class) - public Response getControllerService(@QueryParam(CLIENT_ID) @DefaultValue(StringUtils.EMPTY) ClientIdParameter clientId, + public Response getControllerService(@QueryParam(CLIENT_ID) @DefaultValue(StringUtils.EMPTY) ClientIdParameter clientId, @PathParam("availability") String availability, @PathParam("id") String id) { final Availability avail = parseAvailability(availability); - + // replicate if cluster manager if (properties.isClusterManager() && Availability.NODE.equals(avail)) { return clusterManager.applyRequest(HttpMethod.GET, getAbsolutePath(), getRequestParameters(true), getHeaders()).getResponse(); @@ -358,10 +362,10 @@ public class ControllerServiceResource extends ApplicationResource { return clusterContext(generateOkResponse(entity)).build(); } - + /** * Returns the descriptor for the specified property. - * + * * @param clientId Optional client id. If the client id is not specified, a * new one will be generated. This value (whether specified or generated) is * included in the response. @@ -376,46 +380,47 @@ public class ControllerServiceResource extends ApplicationResource { @PreAuthorize("hasAnyRole('ROLE_MONITOR', 'ROLE_DFM', 'ROLE_ADMIN')") @TypeHint(PropertyDescriptorEntity.class) public Response getPropertyDescriptor( - @QueryParam(CLIENT_ID) @DefaultValue(StringUtils.EMPTY) ClientIdParameter clientId, - @PathParam("availability") String availability, @PathParam("id") String id, + @QueryParam(CLIENT_ID) @DefaultValue(StringUtils.EMPTY) ClientIdParameter clientId, + @PathParam("availability") String availability, @PathParam("id") String id, @QueryParam("propertyName") String propertyName) { - + final Availability avail = parseAvailability(availability); - + // ensure the property name is specified if (propertyName == null) { throw new IllegalArgumentException("The property name must be specified."); } - + // replicate if cluster manager and service is on node if (properties.isClusterManager() && Availability.NODE.equals(avail)) { return clusterManager.applyRequest(HttpMethod.GET, getAbsolutePath(), getRequestParameters(true), getHeaders()).getResponse(); } - + // get the property descriptor final PropertyDescriptorDTO descriptor = serviceFacade.getControllerServicePropertyDescriptor(id, propertyName); - + // create the revision final RevisionDTO revision = new RevisionDTO(); revision.setClientId(clientId.getClientId()); - + // generate the response entity final PropertyDescriptorEntity entity = new PropertyDescriptorEntity(); entity.setRevision(revision); entity.setPropertyDescriptor(descriptor); - + // generate the response return clusterContext(generateOkResponse(entity)).build(); } - + /** * Retrieves the references of the specified controller service. * * @param clientId Optional client id. If the client id is not specified, a * new one will be generated. This value (whether specified or generated) is * included in the response. - * @param availability Whether the controller service is available on the NCM only (ncm) or on the - * nodes only (node). If this instance is not clustered all services should use the node availability. + * @param availability Whether the controller service is available on the + * NCM only (ncm) or on the nodes only (node). If this instance is not + * clustered all services should use the node availability. * @param id The id of the controller service to retrieve * @return A controllerServiceEntity. */ @@ -429,7 +434,7 @@ public class ControllerServiceResource extends ApplicationResource { @PathParam("availability") String availability, @PathParam("id") String id) { final Availability avail = parseAvailability(availability); - + // replicate if cluster manager if (properties.isClusterManager() && Availability.NODE.equals(avail)) { return clusterManager.applyRequest(HttpMethod.GET, getAbsolutePath(), getRequestParameters(true), getHeaders()).getResponse(); @@ -449,7 +454,7 @@ public class ControllerServiceResource extends ApplicationResource { return clusterContext(generateOkResponse(entity)).build(); } - + /** * Updates the references of the specified controller service. * @@ -459,12 +464,14 @@ public class ControllerServiceResource extends ApplicationResource { * @param clientId Optional client id. If the client id is not specified, a * new one will be generated. This value (whether specified or generated) is * included in the response. - * @param availability Whether the controller service is available on the NCM only (ncm) or on the - * nodes only (node). If this instance is not clustered all services should use the node availability. + * @param availability Whether the controller service is available on the + * NCM only (ncm) or on the nodes only (node). If this instance is not + * clustered all services should use the node availability. * @param id The id of the controller service to retrieve - * @param state Sets the state of referencing components. A value of RUNNING or STOPPED will update - * referencing schedulable components (Processors and Reporting Tasks). A value of ENABLED or - * DISABLED will update referencing controller services. + * @param state Sets the state of referencing components. A value of RUNNING + * or STOPPED will update referencing schedulable components (Processors and + * Reporting Tasks). A value of ENABLED or DISABLED will update referencing + * controller services. * @return A controllerServiceEntity. */ @PUT @@ -481,7 +488,6 @@ public class ControllerServiceResource extends ApplicationResource { @FormParam("state") @DefaultValue(StringUtils.EMPTY) String state) { // parse the state to determine the desired action - // need to consider controller service state first as it shares a state with // scheduled state (disabled) which is applicable for referencing services // but not referencing schedulable components @@ -491,29 +497,29 @@ public class ControllerServiceResource extends ApplicationResource { } catch (final IllegalArgumentException iae) { // ignore } - + ScheduledState scheduledState = null; try { scheduledState = ScheduledState.valueOf(state); } catch (final IllegalArgumentException iae) { // ignore } - + // ensure an action has been specified if (scheduledState == null && controllerServiceState == null) { throw new IllegalArgumentException("Must specify the updated state. To update referencing Processors " + "and Reporting Tasks the state should be RUNNING or STOPPED. To update the referencing Controller Services the " + "state should be ENABLED or DISABLED."); } - + // ensure the controller service state is not ENABLING or DISABLING if (controllerServiceState != null && (ControllerServiceState.ENABLING.equals(controllerServiceState) || ControllerServiceState.DISABLING.equals(controllerServiceState))) { throw new IllegalArgumentException("Cannot set the referencing services to ENABLING or DISABLING"); } - + // determine the availability final Availability avail = parseAvailability(availability); - + // replicate if cluster manager if (properties.isClusterManager() && Availability.NODE.equals(avail)) { return clusterManager.applyRequest(HttpMethod.PUT, getAbsolutePath(), getRequestParameters(true), getHeaders()).getResponse(); @@ -525,16 +531,16 @@ public class ControllerServiceResource extends ApplicationResource { serviceFacade.verifyUpdateControllerServiceReferencingComponents(id, scheduledState, controllerServiceState); return generateContinueResponse().build(); } - + // determine the specified version Long clientVersion = null; if (version != null) { clientVersion = version.getLong(); } - + // get the controller service - final ConfigurationSnapshot> response = - serviceFacade.updateControllerServiceReferencingComponents(new Revision(clientVersion, clientId.getClientId()), id, scheduledState, controllerServiceState); + final ConfigurationSnapshot> response + = serviceFacade.updateControllerServiceReferencingComponents(new Revision(clientVersion, clientId.getClientId()), id, scheduledState, controllerServiceState); // create the revision final RevisionDTO revision = new RevisionDTO(); @@ -558,14 +564,17 @@ public class ControllerServiceResource extends ApplicationResource { * @param clientId Optional client id. If the client id is not specified, a * new one will be generated. This value (whether specified or generated) is * included in the response. - * @param availability Whether the controller service is available on the NCM only (ncm) or on the - * nodes only (node). If this instance is not clustered all services should use the node availability. + * @param availability Whether the controller service is available on the + * NCM only (ncm) or on the nodes only (node). If this instance is not + * clustered all services should use the node availability. * @param id The id of the controller service to update. * @param name The name of the controller service * @param annotationData The annotation data for the controller service * @param comments The comments for the controller service - * @param state The state of this controller service. Should be ENABLED or DISABLED. - * @param markedForDeletion Array of property names whose value should be removed. + * @param state The state of this controller service. Should be ENABLED or + * DISABLED. + * @param markedForDeletion Array of property names whose value should be + * removed. * @param formParams Additionally, the processor properties and styles are * specified in the form parameters. Because the property names and styles * differ from processor to processor they are specified in a map-like @@ -599,7 +608,7 @@ public class ControllerServiceResource extends ApplicationResource { // create collections for holding the controller service properties final Map updatedProperties = new LinkedHashMap<>(); - + // go through each parameter and look for processor properties for (String parameterName : formParams.keySet()) { if (StringUtils.isNotBlank(parameterName)) { @@ -615,12 +624,12 @@ public class ControllerServiceResource extends ApplicationResource { } } } - + // set the properties to remove for (String propertyToDelete : markedForDeletion) { updatedProperties.put(propertyToDelete, null); } - + // create the controller service DTO final ControllerServiceDTO controllerServiceDTO = new ControllerServiceDTO(); controllerServiceDTO.setId(id); @@ -633,7 +642,7 @@ public class ControllerServiceResource extends ApplicationResource { if (!updatedProperties.isEmpty()) { controllerServiceDTO.setProperties(updatedProperties); } - + // create the revision final RevisionDTO revision = new RevisionDTO(); revision.setClientId(clientId.getClientId()); @@ -654,8 +663,9 @@ public class ControllerServiceResource extends ApplicationResource { * Updates the specified a new Controller Service. * * @param httpServletRequest - * @param availability Whether the controller service is available on the NCM only (ncm) or on the - * nodes only (node). If this instance is not clustered all services should use the node availability. + * @param availability Whether the controller service is available on the + * NCM only (ncm) or on the nodes only (node). If this instance is not + * clustered all services should use the node availability. * @param id The id of the controller service to update. * @param controllerServiceEntity A controllerServiceEntity. * @return A controllerServiceEntity. @@ -668,13 +678,13 @@ public class ControllerServiceResource extends ApplicationResource { @TypeHint(ControllerServiceEntity.class) public Response updateControllerService( @Context HttpServletRequest httpServletRequest, - @PathParam("availability") String availability, + @PathParam("availability") String availability, @PathParam("id") String id, ControllerServiceEntity controllerServiceEntity) { final Availability avail = parseAvailability(availability); - - if (controllerServiceEntity == null || controllerServiceEntity.getControllerService()== null) { + + if (controllerServiceEntity == null || controllerServiceEntity.getControllerService() == null) { throw new IllegalArgumentException("Controller service details must be specified."); } @@ -698,7 +708,7 @@ public class ControllerServiceResource extends ApplicationResource { // replicate the request return clusterManager.applyRequest(HttpMethod.PUT, getAbsolutePath(), updateClientId(controllerServiceEntity), getHeaders(headersToOverride)).getResponse(); } - + // handle expects request (usually from the cluster manager) final String expects = httpServletRequest.getHeader(WebClusterManager.NCM_EXPECTS_HTTP_HEADER); if (expects != null) { @@ -736,8 +746,9 @@ public class ControllerServiceResource extends ApplicationResource { * @param clientId Optional client id. If the client id is not specified, a * new one will be generated. This value (whether specified or generated) is * included in the response. - * @param availability Whether the controller service is available on the NCM only (ncm) or on the - * nodes only (node). If this instance is not clustered all services should use the node availability. + * @param availability Whether the controller service is available on the + * NCM only (ncm) or on the nodes only (node). If this instance is not + * clustered all services should use the node availability. * @param id The id of the controller service to remove. * @return A entity containing the client id and an updated revision. */ @@ -753,7 +764,7 @@ public class ControllerServiceResource extends ApplicationResource { @PathParam("availability") String availability, @PathParam("id") String id) { final Availability avail = parseAvailability(availability); - + // replicate if cluster manager if (properties.isClusterManager() && Availability.NODE.equals(avail)) { return clusterManager.applyRequest(HttpMethod.DELETE, getAbsolutePath(), getRequestParameters(true), getHeaders()).getResponse(); @@ -788,7 +799,6 @@ public class ControllerServiceResource extends ApplicationResource { } // setters - public void setServiceFacade(NiFiServiceFacade serviceFacade) { this.serviceFacade = serviceFacade; } diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/FunnelResource.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/FunnelResource.java index 3492de2093..4e6095eb17 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/FunnelResource.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/FunnelResource.java @@ -72,8 +72,9 @@ public class FunnelResource extends ApplicationResource { /** * Populates the uri for the specified funnels. + * * @param funnels - * @return + * @return */ public Set populateRemainingFunnelsContent(Set funnels) { for (FunnelDTO funnel : funnels) { diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/HistoryResource.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/HistoryResource.java index 0f60f52fad..49bede821d 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/HistoryResource.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/HistoryResource.java @@ -262,7 +262,7 @@ public class HistoryResource extends ApplicationResource { // generate the response return generateOkResponse(entity).build(); } - + /** * Gets the actions for the specified controller service. * @@ -293,7 +293,7 @@ public class HistoryResource extends ApplicationResource { // generate the response return generateOkResponse(entity).build(); } - + /** * Gets the actions for the specified reporting task. * @@ -324,7 +324,7 @@ public class HistoryResource extends ApplicationResource { // generate the response return generateOkResponse(entity).build(); } - + /* setters */ public void setServiceFacade(NiFiServiceFacade serviceFacade) { this.serviceFacade = serviceFacade; diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/InputPortResource.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/InputPortResource.java index f3a6326604..9b5eeba5c1 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/InputPortResource.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/InputPortResource.java @@ -74,8 +74,9 @@ public class InputPortResource extends ApplicationResource { /** * Populates the uri for the specified input ports. + * * @param inputPorts - * @return + * @return */ public Set populateRemainingInputPortsContent(Set inputPorts) { for (PortDTO inputPort : inputPorts) { diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/LabelResource.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/LabelResource.java index 6435671d49..4905ad39da 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/LabelResource.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/LabelResource.java @@ -74,8 +74,9 @@ public class LabelResource extends ApplicationResource { /** * Populates the uri for the specified labels. + * * @param labels - * @return + * @return */ public Set populateRemainingLabelsContent(Set labels) { for (LabelDTO label : labels) { diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/OutputPortResource.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/OutputPortResource.java index a9dce5fdfa..168ec906ff 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/OutputPortResource.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/OutputPortResource.java @@ -74,8 +74,9 @@ public class OutputPortResource extends ApplicationResource { /** * Populates the uri for the specified output ports. + * * @param outputPorts - * @return + * @return */ public Set populateRemainingOutputPortsContent(Set outputPorts) { for (PortDTO outputPort : outputPorts) { diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ProcessorResource.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ProcessorResource.java index 31ab10b6d9..00b6fe3125 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ProcessorResource.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ProcessorResource.java @@ -262,7 +262,7 @@ public class ProcessorResource extends ApplicationResource { if (processorEntity.getProcessor().getId() != null) { throw new IllegalArgumentException("Processor ID cannot be specified."); } - + if (StringUtils.isBlank(processorEntity.getProcessor().getType())) { throw new IllegalArgumentException("The type of processor to create must be specified."); } @@ -394,10 +394,10 @@ public class ProcessorResource extends ApplicationResource { // generate the response return clusterContext(generateOkResponse(entity)).build(); } - + /** * Returns the descriptor for the specified property. - * + * * @param clientId Optional client id. If the client id is not specified, a * new one will be generated. This value (whether specified or generated) is * included in the response. @@ -411,31 +411,31 @@ public class ProcessorResource extends ApplicationResource { @PreAuthorize("hasAnyRole('ROLE_MONITOR', 'ROLE_DFM', 'ROLE_ADMIN')") @TypeHint(PropertyDescriptorEntity.class) public Response getPropertyDescriptor( - @QueryParam(CLIENT_ID) @DefaultValue(StringUtils.EMPTY) ClientIdParameter clientId, + @QueryParam(CLIENT_ID) @DefaultValue(StringUtils.EMPTY) ClientIdParameter clientId, @PathParam("id") String id, @QueryParam("propertyName") String propertyName) { - + // ensure the property name is specified if (propertyName == null) { throw new IllegalArgumentException("The property name must be specified."); } - + // replicate if cluster manager if (properties.isClusterManager()) { return clusterManager.applyRequest(HttpMethod.GET, getAbsolutePath(), getRequestParameters(true), getHeaders()).getResponse(); } - + // get the property descriptor final PropertyDescriptorDTO descriptor = serviceFacade.getProcessorPropertyDescriptor(groupId, id, propertyName); - + // create the revision final RevisionDTO revision = new RevisionDTO(); revision.setClientId(clientId.getClientId()); - + // generate the response entity final PropertyDescriptorEntity entity = new PropertyDescriptorEntity(); entity.setRevision(revision); entity.setPropertyDescriptor(descriptor); - + // generate the response return clusterContext(generateOkResponse(entity)).build(); } diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/RemoteProcessGroupResource.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/RemoteProcessGroupResource.java index 4e15c36743..b1718359ef 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/RemoteProcessGroupResource.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/RemoteProcessGroupResource.java @@ -370,7 +370,7 @@ public class RemoteProcessGroupResource extends ApplicationResource { if (uri.getScheme() == null || uri.getHost() == null) { throw new IllegalArgumentException("The specified remote process group URL is malformed: " + requestProcessGroupDTO.getTargetUri()); } - + if (!(uri.getScheme().equalsIgnoreCase("http") || uri.getScheme().equalsIgnoreCase("https"))) { throw new IllegalArgumentException("The specified remote process group URL is invalid because it is not http or https: " + requestProcessGroupDTO.getTargetUri()); } @@ -864,7 +864,7 @@ public class RemoteProcessGroupResource extends ApplicationResource { if (uri.getScheme() == null || uri.getHost() == null) { throw new IllegalArgumentException("The specified remote process group URL is malformed: " + requestRemoteProcessGroup.getTargetUri()); } - + if (!(uri.getScheme().equalsIgnoreCase("http") || uri.getScheme().equalsIgnoreCase("https"))) { throw new IllegalArgumentException("The specified remote process group URL is invalid because it is not http or https: " + requestRemoteProcessGroup.getTargetUri()); } diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ReportingTaskResource.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ReportingTaskResource.java index 38ddc36628..485b8fdc58 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ReportingTaskResource.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ReportingTaskResource.java @@ -77,15 +77,15 @@ public class ReportingTaskResource extends ApplicationResource { private NiFiServiceFacade serviceFacade; private WebClusterManager clusterManager; private NiFiProperties properties; - + @Context private ServletContext servletContext; - + /** * Populates the uri for the specified reporting task. - * + * * @param reportingTasks - * @return + * @return */ private Set populateRemainingReportingTasksContent(final String availability, final Set reportingTasks) { for (ReportingTaskDTO reportingTask : reportingTasks) { @@ -93,7 +93,7 @@ public class ReportingTaskResource extends ApplicationResource { } return reportingTasks; } - + /** * Populates the uri for the specified reporting task. */ @@ -101,7 +101,7 @@ public class ReportingTaskResource extends ApplicationResource { // populate the reporting task href reportingTask.setUri(generateResourceUri("controller", "reporting-tasks", availability, reportingTask.getId())); reportingTask.setAvailability(availability); - + // see if this processor has any ui extensions final UiExtensionMapping uiExtensionMapping = (UiExtensionMapping) servletContext.getAttribute("nifi-ui-extensions"); if (uiExtensionMapping.hasUiExtension(reportingTask.getType())) { @@ -112,16 +112,16 @@ public class ReportingTaskResource extends ApplicationResource { } } } - + return reportingTask; } /** - * Parses the availability and ensure that the specified availability makes sense for the - * given NiFi instance. - * + * Parses the availability and ensure that the specified availability makes + * sense for the given NiFi instance. + * * @param availability - * @return + * @return */ private Availability parseAvailability(final String availability) { final Availability avail; @@ -130,23 +130,24 @@ public class ReportingTaskResource extends ApplicationResource { } catch (IllegalArgumentException iae) { throw new IllegalArgumentException(String.format("Availability: Value must be one of [%s]", StringUtils.join(Availability.values(), ", "))); } - + // ensure this nifi is an NCM is specifying NCM availability if (!properties.isClusterManager() && Availability.NCM.equals(avail)) { throw new IllegalArgumentException("Availability of NCM is only applicable when the NiFi instance is the cluster manager."); } - + return avail; } - + /** * Retrieves all the of reporting tasks in this NiFi. * * @param clientId Optional client id. If the client id is not specified, a * new one will be generated. This value (whether specified or generated) is * included in the response. - * @param availability Whether the reporting task is available on the NCM only (ncm) or on the - * nodes only (node). If this instance is not clustered all tasks should use the node availability. + * @param availability Whether the reporting task is available on the NCM + * only (ncm) or on the nodes only (node). If this instance is not clustered + * all tasks should use the node availability. * @return A reportingTasksEntity. */ @GET @@ -156,7 +157,7 @@ public class ReportingTaskResource extends ApplicationResource { @TypeHint(ReportingTasksEntity.class) public Response getReportingTasks(@QueryParam(CLIENT_ID) @DefaultValue(StringUtils.EMPTY) ClientIdParameter clientId, @PathParam("availability") String availability) { final Availability avail = parseAvailability(availability); - + // replicate if cluster manager if (properties.isClusterManager() && Availability.NODE.equals(avail)) { return clusterManager.applyRequest(HttpMethod.GET, getAbsolutePath(), getRequestParameters(true), getHeaders()).getResponse(); @@ -164,7 +165,7 @@ public class ReportingTaskResource extends ApplicationResource { // get all the reporting tasks final Set reportingTasks = populateRemainingReportingTasksContent(availability, serviceFacade.getReportingTasks()); - + // create the revision final RevisionDTO revision = new RevisionDTO(); revision.setClientId(clientId.getClientId()); @@ -187,8 +188,9 @@ public class ReportingTaskResource extends ApplicationResource { * @param clientId Optional client id. If the client id is not specified, a * new one will be generated. This value (whether specified or generated) is * included in the response. - * @param availability Whether the reporting task is available on the NCM only (ncm) or on the - * nodes only (node). If this instance is not clustered all tasks should use the node availability. + * @param availability Whether the reporting task is available on the NCM + * only (ncm) or on the nodes only (node). If this instance is not clustered + * all tasks should use the node availability. * @param type The type of reporting task to create. * @return A reportingTaskEntity. */ @@ -202,9 +204,9 @@ public class ReportingTaskResource extends ApplicationResource { @Context HttpServletRequest httpServletRequest, @FormParam(VERSION) LongParameter version, @FormParam(CLIENT_ID) @DefaultValue(StringUtils.EMPTY) ClientIdParameter clientId, - @PathParam("availability") String availability, + @PathParam("availability") String availability, @FormParam("type") String type) { - + // create the reporting task DTO final ReportingTaskDTO reportingTaskDTO = new ReportingTaskDTO(); reportingTaskDTO.setType(type); @@ -228,8 +230,9 @@ public class ReportingTaskResource extends ApplicationResource { * Creates a new Reporting Task. * * @param httpServletRequest - * @param availability Whether the reporting task is available on the NCM only (ncm) or on the - * nodes only (node). If this instance is not clustered all tasks should use the node availability. + * @param availability Whether the reporting task is available on the NCM + * only (ncm) or on the nodes only (node). If this instance is not clustered + * all tasks should use the node availability. * @param reportingTaskEntity A reportingTaskEntity. * @return A reportingTaskEntity. */ @@ -241,27 +244,27 @@ public class ReportingTaskResource extends ApplicationResource { @TypeHint(ReportingTaskEntity.class) public Response createReportingTask( @Context HttpServletRequest httpServletRequest, - @PathParam("availability") String availability, + @PathParam("availability") String availability, ReportingTaskEntity reportingTaskEntity) { - + final Availability avail = parseAvailability(availability); - if (reportingTaskEntity == null || reportingTaskEntity.getReportingTask()== null) { + if (reportingTaskEntity == null || reportingTaskEntity.getReportingTask() == null) { throw new IllegalArgumentException("Reporting task details must be specified."); } if (reportingTaskEntity.getRevision() == null) { throw new IllegalArgumentException("Revision must be specified."); } - + if (reportingTaskEntity.getReportingTask().getId() != null) { throw new IllegalArgumentException("Reporting task ID cannot be specified."); } - + if (StringUtils.isBlank(reportingTaskEntity.getReportingTask().getType())) { throw new IllegalArgumentException("The type of reporting task to create must be specified."); } - + // get the revision final RevisionDTO revision = reportingTaskEntity.getRevision(); @@ -320,8 +323,9 @@ public class ReportingTaskResource extends ApplicationResource { * @param clientId Optional client id. If the client id is not specified, a * new one will be generated. This value (whether specified or generated) is * included in the response. - * @param availability Whether the reporting task is available on the NCM only (ncm) or on the - * nodes only (node). If this instance is not clustered all tasks should use the node availability. + * @param availability Whether the reporting task is available on the NCM + * only (ncm) or on the nodes only (node). If this instance is not clustered + * all tasks should use the node availability. * @param id The id of the reporting task to retrieve * @return A reportingTaskEntity. */ @@ -330,11 +334,11 @@ public class ReportingTaskResource extends ApplicationResource { @Path("/{availability}/{id}") @PreAuthorize("hasAnyRole('ROLE_MONITOR', 'ROLE_DFM', 'ROLE_ADMIN')") @TypeHint(ReportingTaskEntity.class) - public Response getReportingTask(@QueryParam(CLIENT_ID) @DefaultValue(StringUtils.EMPTY) ClientIdParameter clientId, + public Response getReportingTask(@QueryParam(CLIENT_ID) @DefaultValue(StringUtils.EMPTY) ClientIdParameter clientId, @PathParam("availability") String availability, @PathParam("id") String id) { final Availability avail = parseAvailability(availability); - + // replicate if cluster manager if (properties.isClusterManager() && Availability.NODE.equals(avail)) { return clusterManager.applyRequest(HttpMethod.GET, getAbsolutePath(), getRequestParameters(true), getHeaders()).getResponse(); @@ -354,10 +358,10 @@ public class ReportingTaskResource extends ApplicationResource { return clusterContext(generateOkResponse(entity)).build(); } - + /** * Returns the descriptor for the specified property. - * + * * @param clientId Optional client id. If the client id is not specified, a * new one will be generated. This value (whether specified or generated) is * included in the response. @@ -372,38 +376,38 @@ public class ReportingTaskResource extends ApplicationResource { @PreAuthorize("hasAnyRole('ROLE_MONITOR', 'ROLE_DFM', 'ROLE_ADMIN')") @TypeHint(PropertyDescriptorEntity.class) public Response getPropertyDescriptor( - @QueryParam(CLIENT_ID) @DefaultValue(StringUtils.EMPTY) ClientIdParameter clientId, - @PathParam("availability") String availability, @PathParam("id") String id, + @QueryParam(CLIENT_ID) @DefaultValue(StringUtils.EMPTY) ClientIdParameter clientId, + @PathParam("availability") String availability, @PathParam("id") String id, @QueryParam("propertyName") String propertyName) { - + final Availability avail = parseAvailability(availability); - + // ensure the property name is specified if (propertyName == null) { throw new IllegalArgumentException("The property name must be specified."); } - + // replicate if cluster manager and task is on node if (properties.isClusterManager() && Availability.NODE.equals(avail)) { return clusterManager.applyRequest(HttpMethod.GET, getAbsolutePath(), getRequestParameters(true), getHeaders()).getResponse(); } - + // get the property descriptor final PropertyDescriptorDTO descriptor = serviceFacade.getReportingTaskPropertyDescriptor(id, propertyName); - + // create the revision final RevisionDTO revision = new RevisionDTO(); revision.setClientId(clientId.getClientId()); - + // generate the response entity final PropertyDescriptorEntity entity = new PropertyDescriptorEntity(); entity.setRevision(revision); entity.setPropertyDescriptor(descriptor); - + // generate the response return clusterContext(generateOkResponse(entity)).build(); } - + /** * Updates the specified reporting task. * @@ -413,12 +417,14 @@ public class ReportingTaskResource extends ApplicationResource { * @param clientId Optional client id. If the client id is not specified, a * new one will be generated. This value (whether specified or generated) is * included in the response. - * @param availability Whether the reporting task is available on the NCM only (ncm) or on the - * nodes only (node). If this instance is not clustered all tasks should use the node availability. + * @param availability Whether the reporting task is available on the NCM + * only (ncm) or on the nodes only (node). If this instance is not clustered + * all tasks should use the node availability. * @param id The id of the reporting task to update. * @param name The name of the reporting task * @param annotationData The annotation data for the reporting task - * @param markedForDeletion Array of property names whose value should be removed. + * @param markedForDeletion Array of property names whose value should be + * removed. * @param state The updated scheduled state * @param schedulingStrategy The scheduling strategy for this reporting task * @param schedulingPeriod The scheduling period for this reporting task @@ -457,7 +463,7 @@ public class ReportingTaskResource extends ApplicationResource { // create collections for holding the reporting task properties final Map updatedProperties = new LinkedHashMap<>(); - + // go through each parameter and look for processor properties for (String parameterName : formParams.keySet()) { if (StringUtils.isNotBlank(parameterName)) { @@ -473,12 +479,12 @@ public class ReportingTaskResource extends ApplicationResource { } } } - + // set the properties to remove for (String propertyToDelete : markedForDeletion) { updatedProperties.put(propertyToDelete, null); } - + // create the reporting task DTO final ReportingTaskDTO reportingTaskDTO = new ReportingTaskDTO(); reportingTaskDTO.setId(id); @@ -493,7 +499,7 @@ public class ReportingTaskResource extends ApplicationResource { if (!updatedProperties.isEmpty()) { reportingTaskDTO.setProperties(updatedProperties); } - + // create the revision final RevisionDTO revision = new RevisionDTO(); revision.setClientId(clientId.getClientId()); @@ -514,8 +520,9 @@ public class ReportingTaskResource extends ApplicationResource { * Updates the specified a Reporting Task. * * @param httpServletRequest - * @param availability Whether the reporting task is available on the NCM only (ncm) or on the - * nodes only (node). If this instance is not clustered all tasks should use the node availability. + * @param availability Whether the reporting task is available on the NCM + * only (ncm) or on the nodes only (node). If this instance is not clustered + * all tasks should use the node availability. * @param id The id of the reporting task to update. * @param reportingTaskEntity A reportingTaskEntity. * @return A reportingTaskEntity. @@ -528,12 +535,12 @@ public class ReportingTaskResource extends ApplicationResource { @TypeHint(ReportingTaskEntity.class) public Response updateReportingTask( @Context HttpServletRequest httpServletRequest, - @PathParam("availability") String availability, + @PathParam("availability") String availability, @PathParam("id") String id, ReportingTaskEntity reportingTaskEntity) { final Availability avail = parseAvailability(availability); - + if (reportingTaskEntity == null || reportingTaskEntity.getReportingTask() == null) { throw new IllegalArgumentException("Reporting task details must be specified."); } @@ -558,7 +565,7 @@ public class ReportingTaskResource extends ApplicationResource { // replicate the request return clusterManager.applyRequest(HttpMethod.PUT, getAbsolutePath(), updateClientId(reportingTaskEntity), getHeaders(headersToOverride)).getResponse(); } - + // handle expects request (usually from the cluster manager) final String expects = httpServletRequest.getHeader(WebClusterManager.NCM_EXPECTS_HTTP_HEADER); if (expects != null) { @@ -596,8 +603,9 @@ public class ReportingTaskResource extends ApplicationResource { * @param clientId Optional client id. If the client id is not specified, a * new one will be generated. This value (whether specified or generated) is * included in the response. - * @param availability Whether the reporting task is available on the NCM only (ncm) or on the - * nodes only (node). If this instance is not clustered all tasks should use the node availability. + * @param availability Whether the reporting task is available on the NCM + * only (ncm) or on the nodes only (node). If this instance is not clustered + * all tasks should use the node availability. * @param id The id of the reporting task to remove. * @return A entity containing the client id and an updated revision. */ @@ -613,7 +621,7 @@ public class ReportingTaskResource extends ApplicationResource { @PathParam("availability") String availability, @PathParam("id") String id) { final Availability avail = parseAvailability(availability); - + // replicate if cluster manager if (properties.isClusterManager() && Availability.NODE.equals(avail)) { return clusterManager.applyRequest(HttpMethod.DELETE, getAbsolutePath(), getRequestParameters(true), getHeaders()).getResponse(); @@ -648,7 +656,6 @@ public class ReportingTaskResource extends ApplicationResource { } // setters - public void setServiceFacade(NiFiServiceFacade serviceFacade) { this.serviceFacade = serviceFacade; } diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/TemplateResource.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/TemplateResource.java index 0c1b23f6cb..24292e9b6e 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/TemplateResource.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/TemplateResource.java @@ -71,8 +71,9 @@ public class TemplateResource extends ApplicationResource { /** * Populates the uri for the specified templates. + * * @param templates - * @return + * @return */ public Set populateRemainingTemplatesContent(Set templates) { for (TemplateDTO template : templates) { diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/dto/DtoFactory.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/dto/DtoFactory.java index 4e83ac5df0..56ee9badad 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/dto/DtoFactory.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/dto/DtoFactory.java @@ -854,7 +854,7 @@ public final class DtoFactory { defaultSchedulingPeriod.put(SchedulingStrategy.TIMER_DRIVEN.name(), SchedulingStrategy.TIMER_DRIVEN.getDefaultSchedulingPeriod()); defaultSchedulingPeriod.put(SchedulingStrategy.CRON_DRIVEN.name(), SchedulingStrategy.CRON_DRIVEN.getDefaultSchedulingPeriod()); dto.setDefaultSchedulingPeriod(defaultSchedulingPeriod); - + // sort a copy of the properties final Map sortedProperties = new TreeMap<>(new Comparator() { @Override @@ -874,7 +874,7 @@ public final class DtoFactory { } } orderedProperties.putAll(sortedProperties); - + // build the descriptor and property dtos dto.setDescriptors(new LinkedHashMap()); dto.setProperties(new LinkedHashMap()); @@ -893,7 +893,7 @@ public final class DtoFactory { // set the property value dto.getProperties().put(descriptor.getName(), propertyValue); } - + // add the validation errors final Collection validationErrors = reportingTaskNode.getValidationErrors(); if (validationErrors != null && !validationErrors.isEmpty()) { @@ -904,10 +904,10 @@ public final class DtoFactory { dto.setValidationErrors(errors); } - + return dto; } - + public ControllerServiceDTO createControllerServiceDto(final ControllerServiceNode controllerServiceNode) { final ControllerServiceDTO dto = new ControllerServiceDTO(); dto.setId(controllerServiceNode.getIdentifier()); @@ -916,7 +916,7 @@ public final class DtoFactory { dto.setState(controllerServiceNode.getState().name()); dto.setAnnotationData(controllerServiceNode.getAnnotationData()); dto.setComments(controllerServiceNode.getComments()); - + // sort a copy of the properties final Map sortedProperties = new TreeMap<>(new Comparator() { @Override @@ -936,7 +936,7 @@ public final class DtoFactory { } } orderedProperties.putAll(sortedProperties); - + // build the descriptor and property dtos dto.setDescriptors(new LinkedHashMap()); dto.setProperties(new LinkedHashMap()); @@ -955,7 +955,7 @@ public final class DtoFactory { // set the property value dto.getProperties().put(descriptor.getName(), propertyValue); } - + // create the reference dto's dto.setReferencingComponents(createControllerServiceReferencingComponentsDto(controllerServiceNode.getReferences())); @@ -969,23 +969,23 @@ public final class DtoFactory { dto.setValidationErrors(errors); } - + return dto; } - + public Set createControllerServiceReferencingComponentsDto(final ControllerServiceReference reference) { return createControllerServiceReferencingComponentsDto(reference, new HashSet()); } - + private Set createControllerServiceReferencingComponentsDto(final ControllerServiceReference reference, final Set visited) { final Set referencingComponents = new LinkedHashSet<>(); - + // get all references for (final ConfiguredComponent component : reference.getReferencingComponents()) { final ControllerServiceReferencingComponentDTO dto = new ControllerServiceReferencingComponentDTO(); dto.setId(component.getIdentifier()); dto.setName(component.getName()); - + List propertyDescriptors = null; Collection validationErrors = null; if (component instanceof ProcessorNode) { @@ -995,7 +995,7 @@ public final class DtoFactory { dto.setActiveThreadCount(node.getActiveThreadCount()); dto.setType(node.getProcessor().getClass().getName()); dto.setReferenceType(Processor.class.getSimpleName()); - + propertyDescriptors = node.getProcessor().getPropertyDescriptors(); validationErrors = node.getValidationErrors(); } else if (component instanceof ControllerServiceNode) { @@ -1004,12 +1004,12 @@ public final class DtoFactory { dto.setType(node.getControllerServiceImplementation().getClass().getName()); dto.setReferenceType(ControllerService.class.getSimpleName()); dto.setReferenceCycle(visited.contains(node)); - + // if we haven't encountered this service before include it's referencing components if (!dto.getReferenceCycle()) { dto.setReferencingComponents(createControllerServiceReferencingComponentsDto(node.getReferences(), visited)); } - + propertyDescriptors = node.getControllerServiceImplementation().getPropertyDescriptors(); validationErrors = node.getValidationErrors(); } else if (component instanceof ReportingTaskNode) { @@ -1018,11 +1018,11 @@ public final class DtoFactory { dto.setActiveThreadCount(node.getActiveThreadCount()); dto.setType(node.getReportingTask().getClass().getName()); dto.setReferenceType(ReportingTask.class.getSimpleName()); - + propertyDescriptors = node.getReportingTask().getPropertyDescriptors(); validationErrors = node.getValidationErrors(); } - + if (propertyDescriptors != null && !propertyDescriptors.isEmpty()) { final Map sortedProperties = new TreeMap<>(new Comparator() { @Override @@ -1057,7 +1057,7 @@ public final class DtoFactory { dto.getProperties().put(descriptor.getName(), propertyValue); } } - + if (validationErrors != null && !validationErrors.isEmpty()) { final List errors = new ArrayList<>(); for (final ValidationResult validationResult : validationErrors) { @@ -1066,13 +1066,13 @@ public final class DtoFactory { dto.setValidationErrors(errors); } - + referencingComponents.add(dto); } - + return referencingComponents; } - + public RemoteProcessGroupPortDTO createRemoteProcessGroupPortDto(final RemoteGroupPort port) { if (port == null) { return null; @@ -1324,13 +1324,13 @@ public final class DtoFactory { @SuppressWarnings("deprecation") private String getCapabilityDescription(final Class cls) { final CapabilityDescription capabilityDesc = cls.getAnnotation(CapabilityDescription.class); - if ( capabilityDesc != null ) { + if (capabilityDesc != null) { return capabilityDesc.value(); } - - final org.apache.nifi.processor.annotation.CapabilityDescription deprecatedCapabilityDesc = - cls.getAnnotation(org.apache.nifi.processor.annotation.CapabilityDescription.class); - + + final org.apache.nifi.processor.annotation.CapabilityDescription deprecatedCapabilityDesc + = cls.getAnnotation(org.apache.nifi.processor.annotation.CapabilityDescription.class); + return (deprecatedCapabilityDesc == null) ? null : deprecatedCapabilityDesc.value(); } @@ -1350,8 +1350,8 @@ public final class DtoFactory { } } else { final org.apache.nifi.processor.annotation.Tags deprecatedTagsAnnotation = cls.getAnnotation(org.apache.nifi.processor.annotation.Tags.class); - if ( deprecatedTagsAnnotation != null ) { - for ( final String tag : deprecatedTagsAnnotation.value() ) { + if (deprecatedTagsAnnotation != null) { + for (final String tag : deprecatedTagsAnnotation.value()) { tags.add(tag); } } @@ -1382,7 +1382,7 @@ public final class DtoFactory { return types; } - + /** * Creates a ProcessorDTO from the specified ProcessorNode. * @@ -1829,7 +1829,7 @@ public final class DtoFactory { dto.setDescription(propertyDescriptor.getDescription()); dto.setDefaultValue(propertyDescriptor.getDefaultValue()); dto.setSupportsEl(propertyDescriptor.isExpressionLanguageSupported()); - + // set the identifies controller service is applicable if (propertyDescriptor.getControllerServiceDefinition() != null) { dto.setIdentifiesControllerService(propertyDescriptor.getControllerServiceDefinition().getName()); @@ -1842,7 +1842,7 @@ public final class DtoFactory { } else { final List allowableValues = new ArrayList<>(); for (final String serviceIdentifier : controllerServiceLookup.getControllerServiceIdentifiers(serviceDefinition)) { - final String displayName = controllerServiceLookup.getControllerServiceName(serviceIdentifier); + final String displayName = controllerServiceLookup.getControllerServiceName(serviceIdentifier); final AllowableValueDTO allowableValue = new AllowableValueDTO(); allowableValue.setDisplayName(displayName); @@ -1883,7 +1883,6 @@ public final class DtoFactory { return copy; } - public ControllerServiceDTO copy(final ControllerServiceDTO original) { final ControllerServiceDTO copy = new ControllerServiceDTO(); copy.setAnnotationData(original.getAnnotationData()); @@ -1901,7 +1900,7 @@ public final class DtoFactory { copy.setValidationErrors(copy(original.getValidationErrors())); return copy; } - + public FunnelDTO copy(final FunnelDTO original) { final FunnelDTO copy = new FunnelDTO(); copy.setId(original.getId()); @@ -2294,7 +2293,7 @@ public final class DtoFactory { */ public RevisionDTO createRevisionDTO(FlowModification lastMod) { final Revision revision = lastMod.getRevision(); - + // create the dto final RevisionDTO revisionDTO = new RevisionDTO(); revisionDTO.setVersion(revision.getVersion()); @@ -2409,7 +2408,6 @@ public final class DtoFactory { } /* setters */ - public void setControllerServiceLookup(ControllerServiceLookup lookup) { this.controllerServiceLookup = lookup; } diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/contextlistener/ApplicationStartupContextListener.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/contextlistener/ApplicationStartupContextListener.java index 8b48abf323..de54dd24fb 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/contextlistener/ApplicationStartupContextListener.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/contextlistener/ApplicationStartupContextListener.java @@ -39,7 +39,6 @@ import org.springframework.web.context.support.WebApplicationContextUtils; * clustered environment. In this case, the cluster manager is created and * managed. * - * @author unattributed */ public class ApplicationStartupContextListener implements ServletContextListener { @@ -68,14 +67,14 @@ public class ApplicationStartupContextListener implements ServletContextListener try { flowService = ctx.getBean("flowService", FlowService.class); - // start and load the flow if we're not clustered (clustered flow loading should - // happen once the application (wars) is fully loaded and initialized). non clustered - // nifi instance need to load the flow before the application (wars) are fully loaded. - // during the flow loading (below) the flow controller is lazily initialized. when the - // flow is loaded after the application is completely initialized (wars deploy), as - // required with a clustered node, users are able to make web requests before the flow - // is loaded (and the flow controller is initialized) which shouldn't be allowed. moving - // the flow loading here when not clustered resolves this. + // start and load the flow if we're not clustered (clustered flow loading should + // happen once the application (wars) is fully loaded and initialized). non clustered + // nifi instance need to load the flow before the application (wars) are fully loaded. + // during the flow loading (below) the flow controller is lazily initialized. when the + // flow is loaded after the application is completely initialized (wars deploy), as + // required with a clustered node, users are able to make web requests before the flow + // is loaded (and the flow controller is initialized) which shouldn't be allowed. moving + // the flow loading here when not clustered resolves this. if (!properties.isNode()) { logger.info("Starting Flow Controller..."); diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/controller/ControllerFacade.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/controller/ControllerFacade.java index b5e6f7e2f7..0f384e3243 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/controller/ControllerFacade.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/controller/ControllerFacade.java @@ -347,10 +347,10 @@ public class ControllerFacade { public Set getFlowFileComparatorTypes() { return dtoFactory.fromDocumentedTypes(ExtensionManager.getExtensions(FlowFilePrioritizer.class)); } - + /** * Returns whether the specified type implements the specified serviceType. - * + * * @param baseType * @param type * @return @@ -362,24 +362,24 @@ public class ControllerFacade { return true; } } - + return false; } - + /** * Gets the ControllerService types that this controller supports. - * + * * @param serviceType - * @return + * @return */ - public Set getControllerServiceTypes(final String serviceType) { + public Set getControllerServiceTypes(final String serviceType) { final Set serviceImplementations = ExtensionManager.getExtensions(ControllerService.class); - + // identify the controller services that implement the specified serviceType if applicable final Set matchingServiceImplementions; if (serviceType != null) { matchingServiceImplementions = new HashSet<>(); - + // check each type and remove those that aren't in the specified ancestry for (final Class type : serviceImplementations) { if (implementsServiceType(serviceType, type)) { @@ -389,14 +389,14 @@ public class ControllerFacade { } else { matchingServiceImplementions = serviceImplementations; } - + return dtoFactory.fromDocumentedTypes(matchingServiceImplementions); } - + /** * Gets the ReportingTask types that this controller supports. - * - * @return + * + * @return */ public Set getReportingTaskTypes() { return dtoFactory.fromDocumentedTypes(ExtensionManager.getExtensions(ReportingTask.class)); @@ -413,8 +413,9 @@ public class ControllerFacade { /** * Resets the counter with the specified id. + * * @param id - * @return + * @return */ public Counter resetCounter(final String id) { final Counter counter = flowController.resetCounter(id); @@ -425,7 +426,7 @@ public class ControllerFacade { return counter; } - + /** * Gets the status of this controller. * @@ -831,7 +832,7 @@ public class ControllerFacade { if (!downloadAuthorization.isApproved()) { throw new AccessDeniedException(downloadAuthorization.getExplanation()); } - + // get the filename and fall back to the idnetifier (should never happen) String filename = event.getAttributes().get(CoreAttributes.FILENAME.key()); if (filename == null) { @@ -1193,22 +1194,22 @@ public class ControllerFacade { for (final Map.Entry entry : procNode.getProperties().entrySet()) { final PropertyDescriptor descriptor = entry.getKey(); - + addIfAppropriate(searchStr, descriptor.getName(), "Property name", matches); addIfAppropriate(searchStr, descriptor.getDescription(), "Property description", matches); - + // never include sensitive properties values in search results if (descriptor.isSensitive()) { continue; } - + String value = entry.getValue(); - + // if unset consider default value if (value == null) { value = descriptor.getDefaultValue(); } - + // evaluate if the value matches the search criteria if (StringUtils.containsIgnoreCase(value, searchStr)) { matches.add("Property value: " + descriptor.getName() + " - " + value); @@ -1286,7 +1287,7 @@ public class ControllerFacade { for (final FlowFilePrioritizer comparator : queue.getPriorities()) { addIfAppropriate(searchStr, comparator.getClass().getName(), "Prioritizer", matches); } - + // search expiration if (StringUtils.containsIgnoreCase("expires", searchStr) || StringUtils.containsIgnoreCase("expiration", searchStr)) { final int expirationMillis = connection.getFlowFileQueue().getFlowFileExpiration(TimeUnit.MILLISECONDS); @@ -1294,7 +1295,7 @@ public class ControllerFacade { matches.add("FlowFile expiration: " + connection.getFlowFileQueue().getFlowFileExpiration()); } } - + // search back pressure if (StringUtils.containsIgnoreCase("back pressure", searchStr) || StringUtils.containsIgnoreCase("pressure", searchStr)) { final String backPressureDataSize = connection.getFlowFileQueue().getBackPressureDataSizeThreshold(); diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/dao/ConnectionDAO.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/dao/ConnectionDAO.java index 119a47a57d..e0fb89e387 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/dao/ConnectionDAO.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/dao/ConnectionDAO.java @@ -20,15 +20,12 @@ import java.util.Set; import org.apache.nifi.connectable.Connection; import org.apache.nifi.web.api.dto.ConnectionDTO; -/** - * - */ public interface ConnectionDAO { /** * Gets the specified Connection. * - * @param groupId + * @param groupId group id * @param id The connection id * @return The connection */ @@ -37,25 +34,25 @@ public interface ConnectionDAO { /** * Gets the connections for the specified source processor. * - * @param groupId - * @param processorId - * @return + * @param groupId group id + * @param processorId processor id + * @return connections */ Set getConnectionsForSource(String groupId, String processorId); /** * Determines if the specified connection exists. * - * @param groupId - * @param id - * @return + * @param groupId group id + * @param id id + * @return true if connection exists */ boolean hasConnection(String groupId, String id); /** * Gets all of the connections. * - * @param groupId + * @param groupId group identifier * @return The connections */ Set getConnections(String groupId); @@ -63,7 +60,7 @@ public interface ConnectionDAO { /** * Creates a new Connection. * - * @param groupId + * @param groupId group id * @param connectionDTO The connection DTO * @return The connection */ @@ -72,23 +69,23 @@ public interface ConnectionDAO { /** * Verifies the create request can be processed. * - * @param groupId - * @param connectionDTO + * @param groupId group id + * @param connectionDTO connection */ void verifyCreate(String groupId, ConnectionDTO connectionDTO); /** * Verifies the update request can be processed. * - * @param groupId - * @param connectionDTO + * @param groupId group id + * @param connectionDTO connection */ void verifyUpdate(String groupId, ConnectionDTO connectionDTO); /** * Updates the specified Connection. * - * @param groupId + * @param groupId group id * @param connectionDTO The connection DTO * @return The connection */ @@ -97,15 +94,15 @@ public interface ConnectionDAO { /** * Verifies the delete request can be processed. * - * @param groupId - * @param id + * @param groupId group id + * @param id id */ void verifyDelete(String groupId, String id); /** * Deletes the specified Connection. * - * @param groupId + * @param groupId group id * @param id The id of the connection */ void deleteConnection(String groupId, String id); diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/dao/ControllerServiceDAO.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/dao/ControllerServiceDAO.java index c1fba0c6b5..52cba66ffc 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/dao/ControllerServiceDAO.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/dao/ControllerServiceDAO.java @@ -24,16 +24,11 @@ import org.apache.nifi.controller.service.ControllerServiceReference; import org.apache.nifi.controller.service.ControllerServiceState; import org.apache.nifi.web.api.dto.ControllerServiceDTO; -/** - * - */ public interface ControllerServiceDAO { /** - * Determines if the specified controller service exists. - * - * @param controllerServiceId - * @return + * @param controllerServiceId service id + * @return Determines if the specified controller service exists */ boolean hasControllerService(String controllerServiceId); @@ -70,34 +65,35 @@ public interface ControllerServiceDAO { /** * Updates the referencing components for the specified controller service. - * - * @param controllerServiceId - * @param scheduledState - * @param controllerServiceState the value of state - * @return the org.apache.nifi.controller.service.ControllerServiceReference + * + * @param controllerServiceId service id + * @param scheduledState scheduled state + * @param controllerServiceState the value of state + * @return the org.apache.nifi.controller.service.ControllerServiceReference */ ControllerServiceReference updateControllerServiceReferencingComponents(String controllerServiceId, ScheduledState scheduledState, ControllerServiceState controllerServiceState); - + /** * Determines whether this controller service can be updated. * - * @param controllerServiceDTO + * @param controllerServiceDTO service */ void verifyUpdate(ControllerServiceDTO controllerServiceDTO); - + /** - * Determines whether the referencing component of the specified controller service can be updated. - * - * @param controllerServiceId - * @param scheduledState - * @param controllerServiceState + * Determines whether the referencing component of the specified controller + * service can be updated. + * + * @param controllerServiceId service id + * @param scheduledState scheduled state + * @param controllerServiceState service state */ void verifyUpdateReferencingComponents(String controllerServiceId, ScheduledState scheduledState, ControllerServiceState controllerServiceState); - + /** * Determines whether this controller service can be removed. * - * @param controllerServiceId + * @param controllerServiceId service id */ void verifyDelete(String controllerServiceId); diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/dao/FunnelDAO.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/dao/FunnelDAO.java index 0d8624ff05..278405a87c 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/dao/FunnelDAO.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/dao/FunnelDAO.java @@ -21,24 +21,19 @@ import java.util.Set; import org.apache.nifi.connectable.Funnel; import org.apache.nifi.web.api.dto.FunnelDTO; -/** - * - */ public interface FunnelDAO { /** - * Determines if the specified funnel exists in the specified group. - * - * @param groupId - * @param funnelId - * @return + * @param groupId group id + * @param funnelId funnel id + * @return Determines if the specified funnel exists in the specified group */ boolean hasFunnel(String groupId, String funnelId); /** * Creates a funnel in the specified group. * - * @param groupId + * @param groupId group id * @param funnelDTO The funnel DTO * @return The funnel */ @@ -47,7 +42,7 @@ public interface FunnelDAO { /** * Gets the specified funnel in the specified group. * - * @param groupId + * @param groupId group id * @param funnelId The funnel id * @return The funnel */ @@ -56,7 +51,7 @@ public interface FunnelDAO { /** * Gets all of the funnels in the specified group. * - * @param groupId + * @param groupId group id * @return The funnels */ Set getFunnels(String groupId); @@ -64,7 +59,7 @@ public interface FunnelDAO { /** * Updates the specified funnel in the specified group. * - * @param groupId + * @param groupId group id * @param funnelDTO The funnel DTO * @return The funnel */ @@ -73,15 +68,15 @@ public interface FunnelDAO { /** * Determines whether this funnel can be removed. * - * @param groupId - * @param funnelId + * @param groupId group id + * @param funnelId funnel id */ void verifyDelete(String groupId, String funnelId); /** * Deletes the specified Funnel in the specified group. * - * @param groupId + * @param groupId group id * @param funnelId The funnel id */ void deleteFunnel(String groupId, String funnelId); diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/dao/LabelDAO.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/dao/LabelDAO.java index edd024ce90..2a908ac5b9 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/dao/LabelDAO.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/dao/LabelDAO.java @@ -20,24 +20,19 @@ import java.util.Set; import org.apache.nifi.controller.label.Label; import org.apache.nifi.web.api.dto.LabelDTO; -/** - * - */ public interface LabelDAO { /** - * Determines if the specified label exists in the specified group. - * - * @param groupId - * @param labelId - * @return + * @param groupId group id + * @param labelId label id + * @return Determines if the specified label exists in the specified group */ boolean hasLabel(String groupId, String labelId); /** * Creates a label in the specified group. * - * @param groupId + * @param groupId group id * @param labelDTO The label DTO * @return The label */ @@ -46,7 +41,7 @@ public interface LabelDAO { /** * Gets the specified label in the specified group. * - * @param groupId + * @param groupId group id * @param labelId The label id * @return The label */ @@ -55,7 +50,7 @@ public interface LabelDAO { /** * Gets all of the labels in the specified group. * - * @param groupId + * @param groupId group id * @return The labels */ Set