protected BindingContextVisitor(final boolean createIfMissing, final Name targetName) { super(createIfMissing, targetName.getPrefix(targetName.size() - 1)); this.targetName = targetName; }
public static Name parentOf(final Name name) { return name.isEmpty() ? name : name.getPrefix(name.size() - 1); }
/** * 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, Name name) throws NamingException { ctx.unbind(name); //unbind the end node in the name int sz = name.size(); // walk the tree backwards, stopping at the domain while (--sz > 0) { Name pname = name.getPrefix(sz); try { ctx.destroySubcontext(pname); } catch (NamingException e) { //log.trace("Unable to remove context " + pname, e); break; } } } }
/** * Rebind val to name in ctx, and make sure that all intermediate contexts exist * * @param ctx the parent JNDI Context under which value will be bound * @param name the name relative to ctx where value will be bound * @param value the value to bind. * @throws NamingException for any error */ public static void rebind(final Context ctx, final Name name, final Object value) throws NamingException { final int size = name.size(); final String atom = name.get(size - 1); final Context parentCtx = createSubcontext(ctx, name.getPrefix(size - 1)); parentCtx.rebind(atom, value); }
final TargetScope targetScope = new TargetScope(name.getPrefix(name.size() - 1).toString(), EventContext.ONELEVEL_SCOPE); final List<ListenerHolder> holders = holdersByTarget.get(targetScope); if (holders != null) { final Name parentName = name.getPrefix(i); final TargetScope targetScope = new TargetScope(parentName.toString(), EventContext.SUBTREE_SCOPE); final List<ListenerHolder> holders = holdersByTarget.get(targetScope);
throw notAContextException(absoluteName.getPrefix(absoluteName.size() - resolveResult.getRemainingName().size()));
/** * Get name components minus leaf name component. * * @param name the name elements leading up to last element * @return the name * @throws javax.naming.NamingException if an error occurs */ protected Name getPathName( final Name name ) throws NamingException { return name.getPrefix( name.size() - 1 ); }
protected BindingContextVisitor(final boolean createIfMissing, final Name targetName) { super(createIfMissing, targetName.getPrefix(targetName.size() - 1)); this.targetName = targetName; }
protected BindingContextVisitor(final boolean createIfMissing, final Name targetName) { super(createIfMissing, targetName.getPrefix(targetName.size() - 1)); this.targetName = targetName; }
protected BindingContextVisitor(final boolean createIfMissing, final Name targetName) { super(createIfMissing, targetName.getPrefix(targetName.size() - 1)); this.targetName = targetName; }
public Attributes getAttributes(Name name) throws NamingException { if (name.size() <= 1) return this.attributes; /* find context */ Name child = name.getPrefix(2).getSuffix(1); Name descendant = name.getSuffix(1); DirContext ctx = (DirContext) children.get(child); if (ctx == null) throw new NamingException("Cannot resolve name " + name); return ctx.getAttributes(descendant); }
/** * Returns every elements of the {@linkplain #getParsedNames() parsed names list} except for * the {@linkplain #tip() tip}. This implementation creates a new generic name from the JNDI * name {@linkplain Name#getPrefix(int) prefix}. * * @see Name#getPrefix(int) */ @Override public GenericName path() { return create(scope, name.getPrefix(name.size() - 1)); } }
public static Name parentOf(final Name name) { return name.isEmpty() ? name : name.getPrefix(name.size() - 1); }
/** Bind val to name in ctx, and make sure that all intermediate contexts exist @param ctx the parent JNDI Context under which value will be bound @param name the name relative to ctx where value will be bound @param value the value to bind. @throws NamingException for any error */ public static void bind(Context ctx, Name name, Object value) throws NamingException { int size = name.size(); String atom = name.get(size - 1); Context parentCtx = createSubcontext(ctx, name.getPrefix(size - 1)); parentCtx.bind(atom, value); }
/** Rebind val to name in ctx, and make sure that all intermediate contexts exist @param ctx the parent JNDI Context under which value will be bound @param name the name relative to ctx where value will be bound @param value the value to bind. @throws NamingException for any error */ public static void rebind(Context ctx, Name name, Object value) throws NamingException { int size = name.size(); String atom = name.get(size - 1); Context parentCtx = createSubcontext(ctx, name.getPrefix(size - 1)); parentCtx.rebind(atom, value); }
/** * Rebind val to name in ctx, and make sure that all intermediate contexts exist * * @param ctx the parent JNDI Context under which value will be bound * @param name the name relative to ctx where value will be bound * @param value the value to bind. * @throws NamingException for any error */ public static void rebind(final Context ctx, final Name name, final Object value) throws NamingException { final int size = name.size(); final String atom = name.get(size - 1); final Context parentCtx = createSubcontext(ctx, name.getPrefix(size - 1)); parentCtx.rebind(atom, value); }
/** * Rebind val to name in ctx, and make sure that all intermediate contexts exist * * @param ctx the parent JNDI Context under which value will be bound * @param name the name relative to ctx where value will be bound * @param value the value to bind. * @throws javax.naming.NamingException for any error */ public static void rebind(final Context ctx, final Name name, final Object value) throws NamingException { final int size = name.size(); final String atom = name.get(size - 1); final Context parentCtx = createSubcontext(ctx, name.getPrefix(size - 1)); parentCtx.rebind(atom, value); }
private Context getContext(Name name) throws NamingException { if (name.size() == 1) { return this; } name = name.getPrefix(name.size() - 1); return (Context) lookup(name); }
protected void doBind(Name n, Object obj) throws NamingException { LOG.trace(format("binding obj [%s] into name [%s] %d", obj, n, n.size())); // create context for all except for the last cause that is the name where we // want to bind our obj createContextForBinding(n.getPrefix(n.size()-1)); initialContext.bind(n, obj); }
public static void unbind(Context ctx, String strName) throws NamingException { Name name = ctx.getNameParser("").parse(strName); int size = name.size(); String atom = name.get(size - 1); Context parentCtx = Util.createSubcontext(ctx, name.getPrefix(size - 1)); String key = parentCtx.getNameInNamespace() + "/" + atom; wrapperMap.remove(key); Util.unbind(ctx, strName); }