Find a new node handling this request.

@param entry the resolved virtual host entry
@return the context, {@code null} if not found
553812
Context findNewNode(final VirtualHost.HostEntry entry) {
        return electNode(entry.getContexts(), false, null);
    }
1342271
public void add(FutureReadResultEntry entry) {
        synchronized (this.reads) {
            Exceptions.checkNotClosed(this.closed, this);
            this.reads.add(entry);
        }
    }
1213144
public int lookupIndex (Object entry)
    {
        if (entry == null)
            throw new IllegalArgumentException ("Can't lookup \"null\" in an Alphabet.");
        int ret = map.get(entry);
        if (ret <= 0 && !growthStopped) {
            numEntries++;
            ret = numEntries;
            map.put(entry, ret);
        }
        return ret;
    }
1123230
static <K, V> Map.Entry<K, V> exportEntry(final OMVRBTreeEntryPosition<K, V> omvrbTreeEntryPosition) {
    return omvrbTreeEntryPosition == null ? null : new OSimpleImmutableEntry<K, V>(omvrbTreeEntryPosition.entry);
  }
946341
protected Boolean comesFromInternalNode(Response externalResponse,InvocationContext ctx,String host,Integer port,String transport,Boolean isIpV6)
	{
		boolean found = false;
		if(host!=null && port!=null)
		{
			if(ctx.sipNodeMap(isIpV6).containsKey(new KeySip(host, port,isIpV6)))
				found = true;
//			for(Node node : ctx.nodes) {
//				if(node.getIp().equals(host)) {
//					if(port.equals(node.getProperties().get(transport+"Port"))) {
//						found = true;
//						break;
//					}
//				}
//			}
		}
		return found;
	}
734927
public int lookupIndex (long entry)
    {
        int ret = map.get(entry);
        if (ret <= 0 && !growthStopped) {
            numEntries++;
            ret = numEntries;
            map.put (entry, ret);
        }
        return ret - 1;	// feature id should be 0-based
    }
278362
private ChmEntry findEntry(String file) {
        for (ChmEntry entry : entries) {
            if (file.equals(entry.getSourcePath())) {
                return entry;
            }
        }

        return null;
    }
301111
public <ReturnValue> ReturnValue executeOnEntry(@NotNull Entry entry, @NotNull CacheEntryProcessor<Long, Entry, ReturnValue> entryProcessor) {
        long key = buildHashCode(entry);

        if (!cache.containsKey(key)) {
            List<Object> primaryKeys = getPrimaryKeys(entry);

            List<Entry> entries = super.fetch(primaryKeys);

            Optional<Entry> first = entries.stream().findFirst();

            if (first.isPresent()) {
                cache.putIfAbsent(key, first.get());
            }
        }

        return cache.invoke(key, entryProcessor);
    }
368155
public static String createEntryIdentity(Entry entry) throws UnableToAdaptException {
        String result = "";
        while (entry != null && !entry.getPath().isEmpty()) {
            result = entry.getPath() + result;
            entry = entry.getRoot().adapt(Entry.class);
        }

        return result;
    }
1121512
public Object process(InvocableMap.Entry entry) {
        Object oldValue = fReturnOld ? entry.getValue() : null;
        entry.remove(false);
        return oldValue;
    }
291496
public Integer lookup(String entry) {
    if (!data.containsKey(entry)) {
      int oldsize = data.size();
      data.put(entry, data.size() + 1);
      String msg = String.format(
        "new entry: %s (size: %d -> %d)",
        entry, oldsize, data.size()
      );
      if (fileName != null) {
        msg += " " + fileName;
      }
      LOGGER.info(msg);
    }
    return data.get(entry);
  }
179213
@Override
    public ICodeBaseEntry lookupResource(String resourceName) {

        // Translate resource name, in case a resource name
        // has been overridden and the resource is being accessed
        // using the overridden name.
        resourceName = translateResourceName(resourceName);
        if (!entries.contains(resourceName)) {
            return null;
        }

        try {
            ZipInputStreamCodeBaseEntry z = map.get(resourceName);
            if (z != null) {
                return z;
            }
            ZipInputStream zis = new ZipInputStream(new FileInputStream(file));
            try {
                ZipEntry ze;

                boolean found = false;
                int countDown = 20;
                while ((ze = zis.getNextEntry()) != null && countDown >= 0) {
                    if (ze.getName().equals(resourceName)) {
                        found = true;
                    }
                    if (found) {
                        countDown--;
                        if (map.containsKey(ze.getName())) {
                            continue;
                        }
                        z = build(zis, ze);
                        map.put(ze.getName(), z);
                    }
                    zis.closeEntry();
                }
            } finally {
                zis.close();
            }
            z = map.get(resourceName);
            if (z == null) {
                throw new AssertionError("Could not find " + resourceName);
            }
            return z;
        } catch (IOException e) {
            return null;
        }
    }
1203207
public static Map<String, String> nodeData(final INodeEntry nodeentry) {
        final HashMap<String, String> data = new HashMap<String, String>();
        if(null!=nodeentry) {
            HashSet<String> skipProps = new HashSet<String>();
            skipProps.addAll(Arrays.asList("nodename", "osName", "osVersion", "osArch", "osFamily"));
            data.put("name", notNull(nodeentry.getNodename()));
            data.put("hostname", notNull(nodeentry.getHostname()));
            data.put("os-name", notNull(nodeentry.getOsName()));
            data.put("os-version", notNull(nodeentry.getOsVersion()));
            data.put("os-arch", notNull(nodeentry.getOsArch()));
            data.put("os-family", notNull(nodeentry.getOsFamily()));
            data.put("username", notNull(nodeentry.getUsername()));
            data.put("description", notNull(nodeentry.getDescription()));
            data.put("tags", null != nodeentry.getTags() ? join(nodeentry.getTags(), ",") : "");
            //include attributes data
            if (null != nodeentry.getAttributes()) {
                for (final String name : nodeentry.getAttributes().keySet()) {
                    if (null != nodeentry.getAttributes().get(name) && !data.containsKey(name) && !skipProps.contains(
                        name)) {

                        data.put(name, notNull(nodeentry.getAttributes().get(name)));
                    }
                }
            }
        }
        return data;
    }
320731
public static Node searchNodeById(Node rootNode, int nodeId) {
        if (rootNode.getNodeId() == nodeId) {
            return rootNode;
        }
        Node foundNode = null;
        for (Node n : rootNode.getChilds()) {
            foundNode = searchNodeById(n, nodeId);
            if (foundNode != null) {
                break;
            }
        }
        return foundNode;
    }
1118260
@Override
    public ICodeBaseEntry lookupResource(String resourceName) throws ResourceNotFoundException {
        // See if we have cached the codebase entry for this resource
        ICodeBaseEntry result = codeBaseEntryMap.get(resourceName);

        if (result == null) {
            // No previously resolved entry - look up the resources in the
            // codebases

            // First try application codebases
            result = search(appCodeBaseList, resourceName);
            if (result == null) {
                // Next try aux codebases
                result = search(auxCodeBaseList, resourceName);
            }

            // If not found in any codebase, then throw
            // ResourceNotFoundException
            if (result == null) {
                throw new ResourceNotFoundException(resourceName);
            }

            // Cache the entry for future lookups
            codeBaseEntryMap.put(resourceName, result);
        }

        return result;
    }
927493
public boolean containsEntityEntry(String entityName) {
        if (StringUtils.isBlank(entityName)) {
            throw new IllegalArgumentException("entityName cannot be null or empty.");
        }
        return entries.containsKey(entityName);
    }
1311745
public CmsSitemapTreeNode createNode(final CmsSitemapTreeNodeData entry) {

        final CmsSitemapTreeNode node = new CmsSitemapTreeNode();

        node.addLayoutClickListener(new LayoutClickListener() {

            private static final long serialVersionUID = 1L;

            @SuppressWarnings("synthetic-access")
            public void layoutClick(LayoutClickEvent event) {

                Component currentComponent = event.getClickedComponent();
                if (currentComponent != null) {
                    boolean linked = false;
                    do {
                        currentComponent = currentComponent.getParent();
                        if ((currentComponent != null)
                            && "linked".equals(((AbstractComponent)currentComponent).getData())) {
                            linked = true;
                        }
                        if (event.getClickedComponent() instanceof CmsResourceIcon) {
                            if (currentComponent == node) {
                                openTargetPage((CmsSitemapTreeNodeData)(node.getData()), linked);
                            } else if (currentComponent instanceof CmsSitemapTreeNode) {
                                break;
                            }
                        }
                    } while (currentComponent != null);
                }

            }

        });
        Resource icon = CmsResourceIcon.getSitemapResourceIcon(
            A_CmsUI.getCmsObject(),
            entry.getResource(),
            IconMode.localeCompare);
        CmsResourceInfo info = new CmsResourceInfo(
            entry.getClientEntry().getTitle(),
            entry.getClientEntry().getSitePath(),
            icon);
        info = CmsResourceInfo.createSitemapResourceInfo(
            entry.getResource(),
            OpenCms.getSiteManager().getSiteForRootPath(m_localeContext.getRoot().getRootPath()));
        info.getResourceIcon().addStyleName(OpenCmsTheme.POINTER);
        info.getResourceIcon().setDescription(CmsVaadinUtils.getMessageText(Messages.GUI_LOCALECOMPARE_OPEN_PAGE_0));

        if (entry.getClientEntry().isHiddenNavigationEntry()) {
            info.addStyleName(OpenCmsTheme.RESOURCE_INFO_WEAK);
        }
        final MenuBar menu = new MenuBar();
        boolean noTranslation = false;
        noTranslation = entry.isMarkedNoTranslation(m_localeContext.getComparisonLocale());

        final MenuItem main = menu.addItem("", null);
        main.setIcon(FontOpenCms.CONTEXT_MENU);
        CssLayout rightSide = new CssLayout();
        info.setButtonWidget(rightSide);
        rightSide.addComponent(menu);
        main.setCommand(new Command() {

            /** Serial version id. */
            private static final long serialVersionUID = 1L;

            public void menuSelected(MenuItem selectedItem) {

                List<I_CmsSimpleContextMenuEntry<MenuContext>> entries = Arrays.asList(

                    new EntryOpen(),
                    new EntryExplorer(),
                    new EntryProperties(),
                    new EntryLink(),
                    new EntryUnlink(),
                    new EntryMark(),
                    new EntryRemoveMark(),
                    new EntryCopy(),
                    new EntryInfo());

                MenuContext context = new MenuContext(entry, node);
                m_menu.setEntries(entries, context);
                m_menu.open(menu);

            }

        });

        menu.addStyleName("borderless o-toolbar-button o-resourceinfo-toolbar");
        if (entry.isLinked()) {
            CmsSite site = OpenCms.getSiteManager().getSiteForRootPath(m_localeContext.getRoot().getRootPath());
            CmsResourceInfo linkedInfo = CmsResourceInfo.createSitemapResourceInfo(
                readSitemapEntryFolderIfPossible(entry.getLinkedResource()),
                site);
            linkedInfo.addStyleName(OpenCmsTheme.RESOURCE_INFO_DIRECTLINK);
            rightSide.addComponent(linkedInfo, 0);
            linkedInfo.setWidth(RHS_WIDTH + "px");
            node.setContent(info);
            linkedInfo.setData("linked"); // Data used by click handler to distinguish clicked resource icons
            linkedInfo.getResourceIcon().setDescription(
                CmsVaadinUtils.getMessageText(Messages.GUI_LOCALECOMPARE_OPEN_PAGE_0));
            linkedInfo.getResourceIcon().addStyleName(OpenCmsTheme.POINTER);
        } else {
            if (noTranslation) {
                CmsResourceInfo noTranslationInfo = new CmsResourceInfo();
                String topMessage = CmsVaadinUtils.getMessageText(Messages.GUI_LOCALECOMPARE_NO_TRANSLATION_TOP_0);
                String bottomMessage = CmsVaadinUtils.getMessageText(
                    Messages.GUI_LOCALECOMPARE_NO_TRANSLATION_BOTTOM_0);
                noTranslationInfo.getTopLine().setValue(topMessage);
                noTranslationInfo.getBottomLine().setValue(bottomMessage);
                noTranslationInfo.getResourceIcon().setValue(
                    "<span class=\""
                        + OpenCmsTheme.RESOURCE_ICON
                        + " "
                        + OpenCmsTheme.NO_TRANSLATION_ICON
                        + "\">"
                        + FontAwesome.BAN.getHtml()
                        + "</span>");
                noTranslationInfo.addStyleName(OpenCmsTheme.RESOURCE_INFO_DIRECTLINK);
                noTranslationInfo.setWidth(RHS_WIDTH + "px");
                rightSide.addComponent(noTranslationInfo, 0);
            }
            node.setContent(info);
        }

        if (entry.hasNoChildren()) {
            node.setOpen(true);
            node.setOpenerVisible(false);
        }
        node.setData(entry);
        return node;

    }