/** * Unbinds a name from ctx, and removes parents if they are empty * * @param ctx the parent JNDI Context under which the name will be unbound * @param name The name to unbind * @throws NamingException for any error */ public static void unbind(Context ctx, String name) throws NamingException { unbind(ctx, ctx.getNameParser("").parse(name)); }
private Name parseName(String jndiName, Context context) { try { return context.getNameParser( "" ).parse( jndiName ); } catch ( InvalidNameException e ) { throw new JndiNameException( "JNDI name [" + jndiName + "] was not valid", e ); } catch ( NamingException e ) { throw new JndiException( "Error parsing JNDI name [" + jndiName + "]", e ); } }
public void destroySubcontext(final String name) throws NamingException { Assert.checkNotNullParam("name", name); // reuse empty check below destroySubcontext(getNativeNameParser().parse(name)); }
public Context createSubcontext(final String name) throws NamingException { Assert.checkNotNullParam("name", name); // reuse empty check below return createSubcontext(getNativeNameParser().parse(name)); }
public void unbind(final String name) throws NamingException { Assert.checkNotNullParam("name", name); // reuse empty check below unbind(getNativeNameParser().parse(name)); }
public void bind(final String name, final Object obj) throws NamingException { Assert.checkNotNullParam("name", name); // reuse empty check below bind(getNativeNameParser().parse(name), obj); }
@Override public Attributes getAttributes(String name) throws NamingException { Assert.checkNotNullParam("name", name); final ReparsedName reparsedName = reparse(getNameParser().parse(name)); ContextResult result = getProviderContext(reparsedName.getUrlScheme()); if(result.oldStyle) { return ((DirContext)result.context).getAttributes(name); } else { return ((DirContext)result.context).getAttributes(reparsedName.getName()); } }
@Override public Attributes getAttributes(String name, String[] attrIds) throws NamingException { Assert.checkNotNullParam("name", name); final ReparsedName reparsedName = reparse(getNameParser().parse(name)); ContextResult result = getProviderContext(reparsedName.getUrlScheme()); if(result.oldStyle) { return ((DirContext)result.context).getAttributes(name, attrIds); } else { return ((DirContext)result.context).getAttributes(reparsedName.getName(), attrIds); } }
@Override public NamingEnumeration<SearchResult> search(String name, Attributes matchingAttributes) throws NamingException { Assert.checkNotNullParam("name", name); final ReparsedName reparsedName = reparse(getNameParser().parse(name)); ContextResult result = getProviderContext(reparsedName.getUrlScheme()); if(result.oldStyle) { return ((DirContext)result.context).search(name, matchingAttributes); } else { return ((DirContext)result.context).search(reparsedName.getName(), matchingAttributes); } }
@Override public NamingEnumeration<SearchResult> search(String name, String filterExpr, Object[] filterArgs, SearchControls cons) throws NamingException { Assert.checkNotNullParam("name", name); final ReparsedName reparsedName = reparse(getNameParser().parse(name)); ContextResult result = getProviderContext(reparsedName.getUrlScheme()); if(result.oldStyle) { return ((DirContext)result.context).search(name, filterExpr, filterArgs, cons); } else { return ((DirContext)result.context).search(reparsedName.getName(), filterExpr, filterArgs, cons); } }
@Override public void bind(final String name, final Object obj) throws NamingException { Assert.checkNotNullParam("name", name); final ReparsedName reparsedName = reparse(getNameParser().parse(name)); ContextResult result = getProviderContext(reparsedName.getUrlScheme()); if(result.oldStyle) { result.context.bind(name, obj); } else { result.context.bind(reparsedName.getName(), obj); } }
@Override public NamingEnumeration<SearchResult> search(String name, Attributes matchingAttributes, String[] attributesToReturn) throws NamingException { Assert.checkNotNullParam("name", name); final ReparsedName reparsedName = reparse(getNameParser().parse(name)); ContextResult result = getProviderContext(reparsedName.getUrlScheme()); if(result.oldStyle) { return ((DirContext)result.context).search(name, matchingAttributes, attributesToReturn); } else { return ((DirContext)result.context).search(reparsedName.getName(), matchingAttributes, attributesToReturn); } }
@Override public Object lookupLink(final String name) throws NamingException { Assert.checkNotNullParam("name", name); final ReparsedName reparsedName = reparse(getNameParser().parse(name)); ContextResult result = getProviderContext(reparsedName.getUrlScheme()); if(result.oldStyle) { return result.context.lookupLink(name); } else { return result.context.lookupLink(reparsedName.getName()); } }
@Override public void destroySubcontext(final String name) throws NamingException { Assert.checkNotNullParam("name", name); final ReparsedName reparsedName = reparse(getNameParser().parse(name)); ContextResult result = getProviderContext(reparsedName.getUrlScheme()); if(result.oldStyle) { result.context.destroySubcontext(name); } else { result.context.destroySubcontext(reparsedName.getName()); } }
@Override public void bind(String name, Object obj, Attributes attrs) throws NamingException { Assert.checkNotNullParam("name", name); final ReparsedName reparsedName = reparse(getNameParser().parse(name)); ContextResult result = getProviderContext(reparsedName.getUrlScheme()); if(result.oldStyle) { ((DirContext)result.context).bind(name, obj, attrs); } else { ((DirContext)result.context).bind(reparsedName.getName(), obj, attrs); } }
@Override public void modifyAttributes(String name, ModificationItem[] mods) throws NamingException { Assert.checkNotNullParam("name", name); final ReparsedName reparsedName = reparse(getNameParser().parse(name)); ContextResult result = getProviderContext(reparsedName.getUrlScheme()); if(result.oldStyle) { ((DirContext)result.context).modifyAttributes(name, mods); } else { ((DirContext)result.context).modifyAttributes(reparsedName.getName(), mods); } }
@Override public DirContext getSchema(String name) throws NamingException { Assert.checkNotNullParam("name", name); final ReparsedName reparsedName = reparse(getNameParser().parse(name)); ContextResult result = getProviderContext(reparsedName.getUrlScheme()); if(result.oldStyle) { return ((DirContext)result.context).getSchema(name); } else { return ((DirContext)result.context).getSchema(reparsedName.getName()); } }