private void addChild(final String childName, final TreeNode childNode) throws NamingException { if (childrenUpdater.putIfAbsent(this, childName, childNode) != null) { throw nameAlreadyBoundException(fullName.add(childName)); } }
protected Name decomposeName(CompositeName compositeName) throws NamingException { final NameParser parser = getNativeNameParser(); if (compositeName.isEmpty()) { return parser.parse(""); } final Name name = parser.parse(compositeName.get(0)); if(name.isEmpty())name.add(""); for (int i = 1; i < compositeName.size(); i ++) { final String part = compositeName.get(i); final Name parsed = parser.parse(part); // make sure empty segments are preserved if (parsed.isEmpty()) parsed.add(""); name.addAll(parsed); } return name; }
/** @param newServiceName javax.naming.Name */ public void setServiceName(Name newServiceName) throws InvalidNameException { Name newKey = newName().addAll(newServiceName).add(getLocalKey()); setCompositeKey(newKey); cachedServiceName = newServiceName; } /** @return int */
/** * Creates a CompositeName from a NameComponent[]. * Used by ExceptionMapper and CNBindingEnumeration to convert * a NameComponent[] into a composite name. */ static Name cosNameToName(NameComponent[] cname) { Name nm = new CompositeName(); for (int i = 0; cname != null && i < cname.length; i++) { try { nm.add(stringifyComponent(cname[i])); } catch (InvalidNameException e) { // ignore } } return nm; }
/** @param newServiceName javax.naming.Name */ public void setServiceName(Name newServiceName) throws InvalidNameException { Name newKey = newName().addAll(newServiceName).add(getLocalKey()); setCompositeKey(newKey); cachedServiceName = newServiceName; } /** @return int */
private Name getAbsoluteName(final Name name) throws NamingException { if(name.isEmpty()) { return composeName(name, prefix); } final String firstComponent = name.get(0); if(firstComponent.startsWith("java:")) { final String cleaned = firstComponent.substring(5); final Name suffix = name.getSuffix(1); if(cleaned.isEmpty()) { return suffix; } return suffix.add(0, cleaned); } else if(firstComponent.isEmpty()) { return name.getSuffix(1); } else { return composeName(name, prefix); } }
ReparsedName reparse(final Name origName) throws InvalidNameException { final Name name = (Name) origName.clone(); if (name.isEmpty()) { return new ReparsedName(null, name); } final String first = name.get(0); final int idx = first.indexOf(':'); final String urlScheme; if (idx != -1) { urlScheme = first.substring(0, idx); final String segment = first.substring(idx+1); name.remove(0); if(segment.length()>0 || (origName.size()>1 && origName.get(1).length()>0)){ name.add(0, segment); } return new ReparsedName(urlScheme.isEmpty() ? null : urlScheme, name); } else { return new ReparsedName(null, name); } }
Name getRealName(Name name) throws InvalidNameException { // this could go away after WFNC-20 if (scheme == null) { return name; } if (name.isEmpty()) { return new CompositeName(scheme + ":"); } final String part0 = name.get(0); final Name clone = (Name) name.clone(); clone.remove(0); clone.add(0, scheme + ":" + part0); return clone; }
results.add(new Binding(contextName, new NamingContext(((Name) name.clone()).add(contextName), this, null)));
public final T visit(final ContextNode contextNode) throws NamingException { if (isEmpty(currentName)) { return found(contextNode); } final String childName = currentName.get(0); traversedName.add(childName); currentName = currentName.getSuffix(1); final TreeNode node = contextNode.children.get(childName); if (node == null) { if (createIfMissing) { final NamingContext subContext = new NamingContext((Name)traversedName.clone(), InMemoryNamingStore.this, new Hashtable<String, Object>()); return contextNode.addOrGetChild(childName, new ContextNode(contextNode, childName, (Name)traversedName.clone(), subContext)).accept(this); } else { throw nameNotFoundException(childName, contextNode.fullName); } } return node.accept(this); }
} else { cname.add(""); cpe.setAltName(cname);
@Override protected Name getName(Name name) throws NamingException { String first = name.get(0); if (!first.startsWith("java:")) { throw new NameNotFoundException("Name must be in java: namespace"); } first = first.substring("java:".length()); name = name.getSuffix(1); return name.add(0, first); }
@Override protected Name getName(Name name) throws NamingException { String first = name.get(0); if (!first.startsWith("java:")) { throw new NameNotFoundException("Name must be in java: namespace"); } first = first.substring("java:".length()); name = name.getSuffix(1); return name.add(0, first); }
public static Context getContextForScope(Object scope) throws NamingException { InitialContext ic = new InitialContext(); NameParser parser = ic.getNameParser(""); Name name = parser.parse(""); if (scope != null) { name.add(canonicalizeScope(scope)); } return (Context)ic.lookup(name); }
private void addChild(final String childName, final TreeNode childNode) throws NamingException { if (childrenUpdater.putIfAbsent(this, childName, childNode) != null) { throw nameAlreadyBoundException(fullName.add(childName)); } }
public static Context getContextForScope(Object scope) throws NamingException { InitialContext ic = new InitialContext(); NameParser parser = ic.getNameParser(""); Name name = parser.parse(""); if (scope != null) { name.add(canonicalizeScope(scope)); } return (Context)ic.lookup(name); }
private void addChild(final String childName, final TreeNode childNode) throws NamingException { if (childrenUpdater.putIfAbsent(this, childName, childNode) != null) { throw nameAlreadyBoundException(fullName.add(childName)); } }
public static Context getContextForScope(Object scope) throws NamingException { InitialContext ic = new InitialContext(); NameParser parser = ic.getNameParser(""); Name name = parser.parse(""); if (scope != null) { name.add(canonicalizeScope(scope)); } return (Context)ic.lookup(name); }
public static Context getContextForScope(Object scope) throws NamingException { InitialContext ic = new InitialContext(); NameParser parser = ic.getNameParser(""); Name name = parser.parse(""); if (scope != null) { name.add(canonicalizeScope(scope)); } return (Context)ic.lookup(name); }
private void addChild(final String childName, final TreeNode childNode) throws NamingException { if (childrenUpdater.putIfAbsent(this, childName, childNode) != null) { throw nameAlreadyBoundException(fullName.add(childName)); } }