/** * Obtains an ancestor of the current Fqn. Literally performs <code>elements.subList(0, generation)</code> such that * if <code> generation == Fqn.size() </code> then the return value is the Fqn itself (current generation), and if * <code> generation == Fqn.size() - 1 </code> then the return value is the same as <code> Fqn.getParent() </code> * i.e., just one generation behind the current generation. <code> generation == 0 </code> would return Fqn.ROOT. * * @param generation the generation of the ancestor to retrieve * @return an ancestor of the current Fqn */ public Fqn<E> getAncestor(int generation) { if (generation == 0) return root(); return getSubFqn(0, generation); }
/** * Returns the parent of this Fqn. The parent of the root node is {@link #ROOT}. Examples: * <pre> * Fqn<String> f1 = Fqn.fromString("/a"); * Fqn<String> f2 = Fqn.fromString("/a/b"); * assertEquals(f1, f2.getParent()); * assertEquals(Fqn.ROOT, f1.getParent().getParent()); * assertEquals(Fqn.ROOT, Fqn.ROOT.getParent()); * </pre> * * @return the parent Fqn */ public Fqn<E> getParent() { switch (elements.length) { case 0: case 1: return root(); default: return getSubFqn(0, elements.length - 1); } }
/** * Returns a new Fqn from a string, where the elements are deliminated by one or more separator ({@link #SEPARATOR}) * characters.<br><br> Example use:<br> * <pre> * Fqn.fromString("/a/b/c/"); * </pre><br> * is equivalent to:<br> * <pre> * Fqn.fromElements("a", "b", "c"); * </pre> * * @param stringRepresentation String representation of the Fqn * @return an Fqn<String> constructed from the string representation passed in */ @SuppressWarnings("unchecked") public static Fqn<String> fromString(String stringRepresentation) { if (stringRepresentation == null || stringRepresentation.equals(SEPARATOR) || stringRepresentation.equals("")) return root(); String toMatch = stringRepresentation.startsWith(SEPARATOR) ? stringRepresentation.substring(1) : stringRepresentation; Object[] el = toMatch.split(SEPARATOR); return new Fqn(el, true); }
/** * Returns the buddy backp root portion of a given Fqn, provided it is a backup Fqn. If it is not a backup Fqn, Fqn.ROOT is returned. * * @param fqn fqn * @return a backup root from an Fqn */ public Fqn getBackupRootFromFqn(Fqn fqn) { if (isBackupFqn(fqn) && fqn.size() > 1) { return fqn.getSubFqn(0, isDeadBackupFqn(fqn) ? 3 : 2); } else { return Fqn.root(); } }
EvictionRegionConfig evictionRegionConfig = new EvictionRegionConfig(Fqn.root()); ExpirationAlgorithmConfig expirationAlgorithm = new ExpirationAlgorithmConfig(); int maxCacheSize = getIntConfigurationValue(facesContext, CoreConfiguration.Items.resourcesCacheSize);