/** * Remove the binding for the given name from the current JNDI context. * @param name the JNDI name of the object * @throws NamingException thrown by JNDI, mostly name not found */ public void unbind(final String name) throws NamingException { if (logger.isDebugEnabled()) { logger.debug("Unbinding JNDI object with name [" + name + "]"); } execute(ctx -> { ctx.unbind(name); return null; }); }
/** * Bind the given object to the current JNDI context, using the given name. * @param name the JNDI name of the object * @param object the object to bind * @throws NamingException thrown by JNDI, mostly name already bound */ public void bind(final String name, final Object object) throws NamingException { if (logger.isDebugEnabled()) { logger.debug("Binding JNDI object with name [" + name + "]"); } execute(ctx -> { ctx.bind(name, object); return null; }); }
/** * Rebind the given object to the current JNDI context, using the given name. * Overwrites any existing binding. * @param name the JNDI name of the object * @param object the object to rebind * @throws NamingException thrown by JNDI */ public void rebind(final String name, final Object object) throws NamingException { if (logger.isDebugEnabled()) { logger.debug("Rebinding JNDI object with name [" + name + "]"); } execute(ctx -> { ctx.rebind(name, object); return null; }); }
/** * Remove the binding for the given name from the current JNDI context. * @param name the JNDI name of the object * @throws NamingException thrown by JNDI, mostly name not found */ public void unbind(final String name) throws NamingException { if (logger.isDebugEnabled()) { logger.debug("Unbinding JNDI object with name [" + name + "]"); } execute(ctx -> { ctx.unbind(name); return null; }); }
/** * Look up the object with the given name in the current JNDI context. * @param name the JNDI name of the object * @return object found (cannot be {@code null}; if a not so well-behaved * JNDI implementations returns null, a NamingException gets thrown) * @throws NamingException if there is no object with the given * name bound to JNDI */ public Object lookup(final String name) throws NamingException { if (logger.isDebugEnabled()) { logger.debug("Looking up JNDI object with name [" + name + "]"); } Object result = execute(ctx -> ctx.lookup(name)); if (result == null) { throw new NameNotFoundException( "JNDI object with [" + name + "] not found: JNDI implementation returned null"); } return result; }
/** * Rebind the given object to the current JNDI context, using the given name. * Overwrites any existing binding. * @param name the JNDI name of the object * @param object the object to rebind * @throws NamingException thrown by JNDI */ public void rebind(final String name, final Object object) throws NamingException { if (logger.isDebugEnabled()) { logger.debug("Rebinding JNDI object with name [" + name + "]"); } execute(ctx -> { ctx.rebind(name, object); return null; }); }
/** * Bind the given object to the current JNDI context, using the given name. * @param name the JNDI name of the object * @param object the object to bind * @throws NamingException thrown by JNDI, mostly name already bound */ public void bind(final String name, final Object object) throws NamingException { if (logger.isDebugEnabled()) { logger.debug("Binding JNDI object with name [" + name + "]"); } execute(ctx -> { ctx.bind(name, object); return null; }); }
/** * Look up the object with the given name in the current JNDI context. * @param name the JNDI name of the object * @return object found (cannot be {@code null}; if a not so well-behaved * JNDI implementations returns null, a NamingException gets thrown) * @throws NamingException if there is no object with the given * name bound to JNDI */ public Object lookup(final String name) throws NamingException { if (logger.isDebugEnabled()) { logger.debug("Looking up JNDI object with name [" + name + "]"); } Object result = execute(ctx -> ctx.lookup(name)); if (result == null) { throw new NameNotFoundException( "JNDI object with [" + name + "] not found: JNDI implementation returned null"); } return result; }
/** * Bind the given object to the current JNDI context, using the given name. * @param name the JNDI name of the object * @param object the object to bind * @throws NamingException thrown by JNDI, mostly name already bound */ public void bind(final String name, final Object object) throws NamingException { if (logger.isDebugEnabled()) { logger.debug("Binding JNDI object with name [" + name + "]"); } execute(ctx -> { ctx.bind(name, object); return null; }); }
/** * Remove the binding for the given name from the current JNDI context. * @param name the JNDI name of the object * @throws NamingException thrown by JNDI, mostly name not found */ public void unbind(final String name) throws NamingException { if (logger.isDebugEnabled()) { logger.debug("Unbinding JNDI object with name [" + name + "]"); } execute(ctx -> { ctx.unbind(name); return null; }); }
/** * Rebind the given object to the current JNDI context, using the given name. * Overwrites any existing binding. * @param name the JNDI name of the object * @param object the object to rebind * @throws NamingException thrown by JNDI */ public void rebind(final String name, final Object object) throws NamingException { if (logger.isDebugEnabled()) { logger.debug("Rebinding JNDI object with name [" + name + "]"); } execute(ctx -> { ctx.rebind(name, object); return null; }); }
/** * Look up the object with the given name in the current JNDI context. * @param name the JNDI name of the object * @return object found (cannot be {@code null}; if a not so well-behaved * JNDI implementations returns null, a NamingException gets thrown) * @throws NamingException if there is no object with the given * name bound to JNDI */ public Object lookup(final String name) throws NamingException { if (logger.isDebugEnabled()) { logger.debug("Looking up JNDI object with name [" + name + "]"); } Object result = execute(ctx -> ctx.lookup(name)); if (result == null) { throw new NameNotFoundException( "JNDI object with [" + name + "] not found: JNDI implementation returned null"); } return result; }