List of usage examples for org.apache.commons.collections4 CollectionUtils isNotEmpty
public static boolean isNotEmpty(final Collection<?> coll)
From source file:cgeo.geocaching.CacheDetailActivity.java
@Override protected Pair<List<? extends Page>, Integer> getOrderedPages() { final ArrayList<Page> pages = new ArrayList<>(); pages.add(Page.WAYPOINTS);/* ww w. j a va 2 s . co m*/ pages.add(Page.DETAILS); final int detailsIndex = pages.size() - 1; pages.add(Page.DESCRIPTION); // enforce showing the empty log book if new entries can be added if (cache.supportsLogging() || !cache.getLogs().isEmpty()) { pages.add(Page.LOGS); } if (CollectionUtils.isNotEmpty(cache.getFriendsLogs())) { pages.add(Page.LOGSFRIENDS); } if (CollectionUtils.isNotEmpty(cache.getInventory()) || CollectionUtils.isNotEmpty(genericTrackables)) { pages.add(Page.INVENTORY); } if (CollectionUtils.isNotEmpty(cache.getNonStaticImages())) { pages.add(Page.IMAGES); } return new ImmutablePair<List<? extends Page>, Integer>(pages, detailsIndex); }
From source file:org.apache.nifi.admin.service.action.UpdateUserAuthoritiesCacheAction.java
@Override public Void execute(DAOFactory daoFactory, AuthorityProvider authorityProvider) throws DataAccessException { UserDAO userDao = daoFactory.getUserDAO(); AuthorityDAO authorityDao = daoFactory.getAuthorityDAO(); // get the user NiFiUser currentUser = userDao.findUserById(user.getId()); // ensure the user exists if (currentUser == null) { throw new AccountNotFoundException(String.format("Unable to find account with ID %s.", user.getId())); }/*from w w w .ja va 2 s. co m*/ // determine what authorities need to be added/removed Set<Authority> authorities = user.getAuthorities(); Set<Authority> authoritiesToAdd = determineAuthoritiesToAdd(currentUser, authorities); Set<Authority> authoritiesToRemove = determineAuthoritiesToRemove(currentUser, authorities); // update the user authorities locally if (CollectionUtils.isNotEmpty(authoritiesToAdd)) { authorityDao.createAuthorities(authoritiesToAdd, user.getId()); } if (CollectionUtils.isNotEmpty(authoritiesToRemove)) { authorityDao.deleteAuthorities(authoritiesToRemove, user.getId()); } return null; }
From source file:org.apache.nifi.audit.SnippetAuditor.java
/** * Audits a bulk move./*from ww w.j ava2 s. co m*/ * * @param proceedingJoinPoint join point * @param snippetDTO dto * @param snippetDAO dao * @return snippet * @throws Throwable ex */ @Around("within(org.apache.nifi.web.dao.SnippetDAO+) && " + "execution(org.apache.nifi.controller.Snippet updateSnippetComponents(org.apache.nifi.web.api.dto.SnippetDTO)) && " + "args(snippetDTO) && " + "target(snippetDAO)") public Snippet updateSnippetAdvice(ProceedingJoinPoint proceedingJoinPoint, SnippetDTO snippetDTO, SnippetDAO snippetDAO) throws Throwable { // get the snippet before removing it Snippet snippet = snippetDAO.getSnippet(snippetDTO.getId()); final String previousGroupId = snippet.getParentGroupId(); // perform the underlying operation snippet = (Snippet) proceedingJoinPoint.proceed(); // if this snippet is linked and its parent group id has changed final String groupId = snippetDTO.getParentGroupId(); if (!previousGroupId.equals(groupId)) { // create move audit records for all items in this snippet final Collection<Action> actions = new ArrayList<>(); for (String id : snippet.getProcessors().keySet()) { final ProcessorNode processor = processorDAO.getProcessor(id); final Action action = processorAuditor.generateAuditRecord(processor, Operation.Move, createMoveDetails(previousGroupId, groupId, logger)); if (action != null) { actions.add(action); } } for (String id : snippet.getFunnels().keySet()) { final Funnel funnel = funnelDAO.getFunnel(id); final Action action = funnelAuditor.generateAuditRecord(funnel, Operation.Move, createMoveDetails(previousGroupId, groupId, logger)); if (action != null) { actions.add(action); } } for (String id : snippet.getInputPorts().keySet()) { final Port port = inputPortDAO.getPort(id); final Action action = portAuditor.generateAuditRecord(port, Operation.Move, createMoveDetails(previousGroupId, groupId, logger)); if (action != null) { actions.add(action); } } for (String id : snippet.getOutputPorts().keySet()) { final Port port = outputPortDAO.getPort(id); final Action action = portAuditor.generateAuditRecord(port, Operation.Move, createMoveDetails(previousGroupId, groupId, logger)); if (action != null) { actions.add(action); } } for (String id : snippet.getRemoteProcessGroups().keySet()) { final RemoteProcessGroup remoteProcessGroup = remoteProcessGroupDAO.getRemoteProcessGroup(id); final Action action = remoteProcessGroupAuditor.generateAuditRecord(remoteProcessGroup, Operation.Move, createMoveDetails(previousGroupId, groupId, logger)); if (action != null) { actions.add(action); } } for (String id : snippet.getProcessGroups().keySet()) { final ProcessGroupDAO processGroupDAO = getProcessGroupDAO(); final ProcessGroup processGroup = processGroupDAO.getProcessGroup(id); final Action action = processGroupAuditor.generateAuditRecord(processGroup, Operation.Move, createMoveDetails(previousGroupId, groupId, logger)); if (action != null) { actions.add(action); } } for (String id : snippet.getConnections().keySet()) { final Connection connection = connectionDAO.getConnection(id); final Action action = relationshipAuditor.generateAuditRecordForConnection(connection, Operation.Move, createMoveDetails(previousGroupId, groupId, logger)); if (action != null) { actions.add(action); } } // save the actions if (CollectionUtils.isNotEmpty(actions)) { saveActions(actions, logger); } } return snippet; }
From source file:org.apache.nifi.audit.SnippetAuditor.java
/** * Audits bulk delete./* www . j a v a2 s . c o m*/ * * @param proceedingJoinPoint join point * @param snippetId snippet id * @param snippetDAO dao * @throws Throwable ex */ @Around("within(org.apache.nifi.web.dao.SnippetDAO+) && " + "execution(void deleteSnippetComponents(java.lang.String)) && " + "args(snippetId) && " + "target(snippetDAO)") public void removeSnippetAdvice(ProceedingJoinPoint proceedingJoinPoint, String snippetId, SnippetDAO snippetDAO) throws Throwable { // get the snippet before removing it final Snippet snippet = snippetDAO.getSnippet(snippetId); // locate all the components being removed final Set<Funnel> funnels = new HashSet<>(); for (String id : snippet.getFunnels().keySet()) { funnels.add(funnelDAO.getFunnel(id)); } final Set<Port> inputPorts = new HashSet<>(); for (String id : snippet.getInputPorts().keySet()) { inputPorts.add(inputPortDAO.getPort(id)); } final Set<Port> outputPorts = new HashSet<>(); for (String id : snippet.getOutputPorts().keySet()) { outputPorts.add(outputPortDAO.getPort(id)); } final Set<RemoteProcessGroup> remoteProcessGroups = new HashSet<>(); for (String id : snippet.getRemoteProcessGroups().keySet()) { remoteProcessGroups.add(remoteProcessGroupDAO.getRemoteProcessGroup(id)); } final Set<ProcessGroup> processGroups = new HashSet<>(); final ProcessGroupDAO processGroupDAO = getProcessGroupDAO(); for (String id : snippet.getProcessGroups().keySet()) { processGroups.add(processGroupDAO.getProcessGroup(id)); } final Set<ProcessorNode> processors = new HashSet<>(); for (String id : snippet.getProcessors().keySet()) { processors.add(processorDAO.getProcessor(id)); } final Set<Connection> connections = new HashSet<>(); for (String id : snippet.getConnections().keySet()) { connections.add(connectionDAO.getConnection(id)); } // remove the snippet and components proceedingJoinPoint.proceed(); final Collection<Action> actions = new ArrayList<>(); // audit funnel removal for (Funnel funnel : funnels) { final Action action = funnelAuditor.generateAuditRecord(funnel, Operation.Remove); if (action != null) { actions.add(action); } } for (Port inputPort : inputPorts) { final Action action = portAuditor.generateAuditRecord(inputPort, Operation.Remove); if (action != null) { actions.add(action); } } for (Port outputPort : outputPorts) { final Action action = portAuditor.generateAuditRecord(outputPort, Operation.Remove); if (action != null) { actions.add(action); } } for (RemoteProcessGroup remoteProcessGroup : remoteProcessGroups) { final Action action = remoteProcessGroupAuditor.generateAuditRecord(remoteProcessGroup, Operation.Remove); if (action != null) { actions.add(action); } } for (ProcessGroup processGroup : processGroups) { final Action action = processGroupAuditor.generateAuditRecord(processGroup, Operation.Remove); if (action != null) { actions.add(action); } } for (ProcessorNode processor : processors) { final Action action = processorAuditor.generateAuditRecord(processor, Operation.Remove); if (action != null) { actions.add(action); } } for (Connection connection : connections) { final ConnectDetails connectDetails = relationshipAuditor.createConnectDetails(connection, connection.getRelationships()); final Action action = relationshipAuditor.generateAuditRecordForConnection(connection, Operation.Disconnect, connectDetails); if (action != null) { actions.add(action); } } // save the actions if (CollectionUtils.isNotEmpty(actions)) { saveActions(actions, logger); } }
From source file:org.apache.nifi.connectable.StandardConnection.java
@Override public Resource getResource() { return new Resource() { @Override/*from www . j a va2 s . c o m*/ public String getIdentifier() { return "/connections/" + StandardConnection.this.getIdentifier(); } @Override public String getName() { String name = StandardConnection.this.getName(); final Collection<Relationship> relationships = getRelationships(); if (name == null && CollectionUtils.isNotEmpty(relationships)) { name = StringUtils.join(relationships.stream().map(relationship -> relationship.getName()) .collect(Collectors.toSet()), ", "); } if (name == null) { name = "Connection"; } return name; } @Override public String getSafeDescription() { return "Connection " + StandardConnection.this.getIdentifier(); } }; }
From source file:org.apache.nifi.integration.accesscontrol.AdminAccessControlTest.java
/** * Verifies the admin user can update a person. * * @throws Exception ex//w w w .j av a 2s. c o m */ //@Test public void testUserUpdate() throws Exception { String url = BASE_URL + "/controller/users"; // get all the users ClientResponse getResponse = ADMIN_USER.testGet(url); Assert.assertEquals(200, getResponse.getStatus()); // get the response entity UsersEntity userCollectionEntity = getResponse.getEntity(UsersEntity.class); Assert.assertTrue(CollectionUtils.isNotEmpty(userCollectionEntity.getUsers())); // get the first user UserDTO userDTO = (UserDTO) userCollectionEntity.getUsers().toArray()[0]; // create the form data Map<String, String> formData = new HashMap<>(); formData.put("status", "ACTIVE"); formData.put("authorities[]", "ROLE_MONITOR"); // perform the request ClientResponse putResponse = ADMIN_USER.testPut(url + "/" + userDTO.getId(), formData); // ensure the request succeeded Assert.assertEquals(200, putResponse.getStatus()); Assert.assertEquals("ACTIVE", putResponse.getEntity(UserEntity.class).getUser().getStatus()); }
From source file:org.apache.nifi.web.controller.ControllerFacade.java
private void setComponentDetails(final ProvenanceEventDTO dto) { final ProcessGroup root = flowController.getGroup(flowController.getRootGroupId()); final Connectable connectable = root.findLocalConnectable(dto.getComponentId()); if (connectable != null) { dto.setGroupId(connectable.getProcessGroup().getIdentifier()); dto.setComponentName(connectable.getName()); return;// ww w.j a v a 2s. c om } final RemoteGroupPort remoteGroupPort = root.findRemoteGroupPort(dto.getComponentId()); if (remoteGroupPort != null) { dto.setGroupId(remoteGroupPort.getProcessGroupIdentifier()); dto.setComponentName(remoteGroupPort.getName()); return; } final Connection connection = root.findConnection(dto.getComponentId()); if (connection != null) { dto.setGroupId(connection.getProcessGroup().getIdentifier()); String name = connection.getName(); final Collection<Relationship> relationships = connection.getRelationships(); if (StringUtils.isBlank(name) && CollectionUtils.isNotEmpty(relationships)) { name = StringUtils.join(relationships.stream().map(relationship -> relationship.getName()) .collect(Collectors.toSet()), ", "); } dto.setComponentName(name); return; } }
From source file:org.apache.nifi.web.controller.ControllerFacade.java
private ComponentSearchResultDTO search(final String searchStr, final ProcessorNode procNode) { final List<String> matches = new ArrayList<>(); final Processor processor = procNode.getProcessor(); addIfAppropriate(searchStr, procNode.getIdentifier(), "Id", matches); addIfAppropriate(searchStr, procNode.getName(), "Name", matches); addIfAppropriate(searchStr, procNode.getComments(), "Comments", matches); // consider scheduling strategy if (SchedulingStrategy.EVENT_DRIVEN.equals(procNode.getSchedulingStrategy()) && StringUtils.containsIgnoreCase("event", searchStr)) { matches.add("Scheduling strategy: Event driven"); } else if (SchedulingStrategy.TIMER_DRIVEN.equals(procNode.getSchedulingStrategy()) && StringUtils.containsIgnoreCase("timer", searchStr)) { matches.add("Scheduling strategy: Timer driven"); } else if (SchedulingStrategy.PRIMARY_NODE_ONLY.equals(procNode.getSchedulingStrategy()) && StringUtils.containsIgnoreCase("primary", searchStr)) { // PRIMARY_NODE_ONLY has been deprecated as a SchedulingStrategy and replaced by PRIMARY as an ExecutionNode. matches.add("Scheduling strategy: On primary node"); }/* ww w.j a v a 2 s .c om*/ // consider execution node if (ExecutionNode.PRIMARY.equals(procNode.getExecutionNode()) && StringUtils.containsIgnoreCase("primary", searchStr)) { matches.add("Execution node: primary"); } // consider scheduled state if (ScheduledState.DISABLED.equals(procNode.getScheduledState())) { if (StringUtils.containsIgnoreCase("disabled", searchStr)) { matches.add("Run status: Disabled"); } } else { if (StringUtils.containsIgnoreCase("invalid", searchStr) && !procNode.isValid()) { matches.add("Run status: Invalid"); } else if (ScheduledState.RUNNING.equals(procNode.getScheduledState()) && StringUtils.containsIgnoreCase("running", searchStr)) { matches.add("Run status: Running"); } else if (ScheduledState.STOPPED.equals(procNode.getScheduledState()) && StringUtils.containsIgnoreCase("stopped", searchStr)) { matches.add("Run status: Stopped"); } } for (final Relationship relationship : procNode.getRelationships()) { addIfAppropriate(searchStr, relationship.getName(), "Relationship", matches); } // Add both the actual class name and the component type. This allows us to search for 'Ghost' // to search for components that could not be instantiated. addIfAppropriate(searchStr, processor.getClass().getSimpleName(), "Type", matches); addIfAppropriate(searchStr, procNode.getComponentType(), "Type", matches); for (final Map.Entry<PropertyDescriptor, String> 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); } } // consider searching the processor directly if (processor instanceof Searchable) { final Searchable searchable = (Searchable) processor; final SearchContext context = new StandardSearchContext(searchStr, procNode, flowController, variableRegistry); // search the processor using the appropriate thread context classloader try (final NarCloseable x = NarCloseable.withComponentNarLoader(processor.getClass(), processor.getIdentifier())) { final Collection<SearchResult> searchResults = searchable.search(context); if (CollectionUtils.isNotEmpty(searchResults)) { for (final SearchResult searchResult : searchResults) { matches.add(searchResult.getLabel() + ": " + searchResult.getMatch()); } } } catch (final Throwable t) { // log this as error } } if (matches.isEmpty()) { return null; } final ComponentSearchResultDTO result = new ComponentSearchResultDTO(); result.setId(procNode.getIdentifier()); result.setMatches(matches); result.setName(procNode.getName()); return result; }
From source file:org.apache.nifi.web.controller.ControllerSearchService.java
private ComponentSearchResultDTO search(final String searchStr, final ProcessorNode procNode) { final List<String> matches = new ArrayList<>(); final Processor processor = procNode.getProcessor(); addIfAppropriate(searchStr, procNode.getIdentifier(), "Id", matches); addIfAppropriate(searchStr, procNode.getVersionedComponentId().orElse(null), "Version Control ID", matches); addIfAppropriate(searchStr, procNode.getName(), "Name", matches); addIfAppropriate(searchStr, procNode.getComments(), "Comments", matches); // consider scheduling strategy if (SchedulingStrategy.EVENT_DRIVEN.equals(procNode.getSchedulingStrategy()) && StringUtils.containsIgnoreCase("event", searchStr)) { matches.add("Scheduling strategy: Event driven"); } else if (SchedulingStrategy.TIMER_DRIVEN.equals(procNode.getSchedulingStrategy()) && StringUtils.containsIgnoreCase("timer", searchStr)) { matches.add("Scheduling strategy: Timer driven"); } else if (SchedulingStrategy.PRIMARY_NODE_ONLY.equals(procNode.getSchedulingStrategy()) && StringUtils.containsIgnoreCase("primary", searchStr)) { // PRIMARY_NODE_ONLY has been deprecated as a SchedulingStrategy and replaced by PRIMARY as an ExecutionNode. matches.add("Scheduling strategy: On primary node"); }// w w w . j a v a2 s . c o m // consider execution node if (ExecutionNode.PRIMARY.equals(procNode.getExecutionNode()) && StringUtils.containsIgnoreCase("primary", searchStr)) { matches.add("Execution node: primary"); } // consider scheduled state if (ScheduledState.DISABLED.equals(procNode.getScheduledState())) { if (StringUtils.containsIgnoreCase("disabled", searchStr)) { matches.add("Run status: Disabled"); } } else { if (StringUtils.containsIgnoreCase("invalid", searchStr) && procNode.getValidationStatus() == ValidationStatus.INVALID) { matches.add("Run status: Invalid"); } else if (StringUtils.containsIgnoreCase("validating", searchStr) && procNode.getValidationStatus() == ValidationStatus.VALIDATING) { matches.add("Run status: Validating"); } else if (ScheduledState.RUNNING.equals(procNode.getScheduledState()) && StringUtils.containsIgnoreCase("running", searchStr)) { matches.add("Run status: Running"); } else if (ScheduledState.STOPPED.equals(procNode.getScheduledState()) && StringUtils.containsIgnoreCase("stopped", searchStr)) { matches.add("Run status: Stopped"); } } for (final Relationship relationship : procNode.getRelationships()) { addIfAppropriate(searchStr, relationship.getName(), "Relationship", matches); } // Add both the actual class name and the component type. This allows us to search for 'Ghost' // to search for components that could not be instantiated. addIfAppropriate(searchStr, processor.getClass().getSimpleName(), "Type", matches); addIfAppropriate(searchStr, procNode.getComponentType(), "Type", matches); for (final Map.Entry<PropertyDescriptor, String> 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); } } // consider searching the processor directly if (processor instanceof Searchable) { final Searchable searchable = (Searchable) processor; final SearchContext context = new StandardSearchContext(searchStr, procNode, flowController.getControllerServiceProvider(), variableRegistry); // search the processor using the appropriate thread context classloader try (final NarCloseable x = NarCloseable.withComponentNarLoader(flowController.getExtensionManager(), processor.getClass(), processor.getIdentifier())) { final Collection<SearchResult> searchResults = searchable.search(context); if (CollectionUtils.isNotEmpty(searchResults)) { for (final SearchResult searchResult : searchResults) { matches.add(searchResult.getLabel() + ": " + searchResult.getMatch()); } } } catch (final Throwable t) { // log this as error } } if (matches.isEmpty()) { return null; } final ComponentSearchResultDTO result = new ComponentSearchResultDTO(); result.setId(procNode.getIdentifier()); result.setMatches(matches); result.setName(procNode.getName()); return result; }
From source file:org.apache.nifi.web.server.JettyServer.java
/** * Loads the WARs in the specified NAR working directories. A WAR file must * have a ".war" extension.//from w ww . j a v a 2 s. com * * @param narWorkingDirectories dirs */ private void loadWars(final Set<File> narWorkingDirectories) { // load WARs Map<File, File> warToNarWorkingDirectoryLookup = findWars(narWorkingDirectories); // locate each war being deployed File webUiWar = null; File webApiWar = null; File webErrorWar = null; File webDocsWar = null; File webContentViewerWar = null; List<File> otherWars = new ArrayList<>(); for (File war : warToNarWorkingDirectoryLookup.keySet()) { if (war.getName().toLowerCase().startsWith("nifi-web-api")) { webApiWar = war; } else if (war.getName().toLowerCase().startsWith("nifi-web-error")) { webErrorWar = war; } else if (war.getName().toLowerCase().startsWith("nifi-web-docs")) { webDocsWar = war; } else if (war.getName().toLowerCase().startsWith("nifi-web-content-viewer")) { webContentViewerWar = war; } else if (war.getName().toLowerCase().startsWith("nifi-web")) { webUiWar = war; } else { otherWars.add(war); } } // ensure the required wars were found if (webUiWar == null) { throw new RuntimeException("Unable to load nifi-web WAR"); } else if (webApiWar == null) { throw new RuntimeException("Unable to load nifi-web-api WAR"); } else if (webDocsWar == null) { throw new RuntimeException("Unable to load nifi-web-docs WAR"); } else if (webErrorWar == null) { throw new RuntimeException("Unable to load nifi-web-error WAR"); } else if (webContentViewerWar == null) { throw new RuntimeException("Unable to load nifi-web-content-viewer WAR"); } // handlers for each war and init params for the web api final HandlerCollection handlers = new HandlerCollection(); final Map<String, String> mimeMappings = new HashMap<>(); final ClassLoader frameworkClassLoader = getClass().getClassLoader(); final ClassLoader jettyClassLoader = frameworkClassLoader.getParent(); // deploy the other wars if (CollectionUtils.isNotEmpty(otherWars)) { // hold onto to the web contexts for all ui extensions componentUiExtensionWebContexts = new ArrayList<>(); contentViewerWebContexts = new ArrayList<>(); // ui extension organized by component type final Map<String, List<UiExtension>> componentUiExtensionsByType = new HashMap<>(); for (File war : otherWars) { // identify all known extension types in the war final Map<UiExtensionType, List<String>> uiExtensionInWar = new HashMap<>(); identifyUiExtensionsForComponents(uiExtensionInWar, war); // only include wars that are for custom processor ui's if (!uiExtensionInWar.isEmpty()) { // get the context path String warName = StringUtils.substringBeforeLast(war.getName(), "."); String warContextPath = String.format("/%s", warName); // attempt to locate the nar class loader for this war ClassLoader narClassLoaderForWar = NarClassLoaders.getInstance() .getExtensionClassLoader(warToNarWorkingDirectoryLookup.get(war)); // this should never be null if (narClassLoaderForWar == null) { narClassLoaderForWar = jettyClassLoader; } // create the extension web app context WebAppContext extensionUiContext = loadWar(war, warContextPath, narClassLoaderForWar); // create the ui extensions for (final Map.Entry<UiExtensionType, List<String>> entry : uiExtensionInWar.entrySet()) { final UiExtensionType extensionType = entry.getKey(); final List<String> types = entry.getValue(); if (UiExtensionType.ContentViewer.equals(extensionType)) { // consider each content type identified for (final String contentType : types) { // map the content type to the context path mimeMappings.put(contentType, warContextPath); } // this ui extension provides a content viewer contentViewerWebContexts.add(extensionUiContext); } else { // consider each component type identified for (final String componentType : types) { logger.info(String.format("Loading UI extension [%s, %s] for %s", extensionType, warContextPath, types)); // record the extension definition final UiExtension uiExtension = new UiExtension(extensionType, warContextPath); // create if this is the first extension for this component type List<UiExtension> componentUiExtensionsForType = componentUiExtensionsByType .get(componentType); if (componentUiExtensionsForType == null) { componentUiExtensionsForType = new ArrayList<>(); componentUiExtensionsByType.put(componentType, componentUiExtensionsForType); } // record this extension componentUiExtensionsForType.add(uiExtension); } // this ui extension provides a component custom ui componentUiExtensionWebContexts.add(extensionUiContext); } } // 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 { componentUiExtensions = new UiExtensionMapping(Collections.EMPTY_MAP); } // load the web ui app handlers.addHandler(loadWar(webUiWar, "/nifi", frameworkClassLoader)); // load the web api app webApiContext = loadWar(webApiWar, "/nifi-api", frameworkClassLoader); handlers.addHandler(webApiContext); // load the content viewer app 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"; // load the documentation war webDocsContext = loadWar(webDocsWar, docsContextPath, frameworkClassLoader); // overlay the actual documentation final ContextHandlerCollection documentationHandlers = new ContextHandlerCollection(); documentationHandlers.addHandler(createDocsWebApp(docsContextPath)); documentationHandlers.addHandler(webDocsContext); handlers.addHandler(documentationHandlers); // load the web error app handlers.addHandler(loadWar(webErrorWar, "/", frameworkClassLoader)); // deploy the web apps server.setHandler(gzip(handlers)); }