Examples of CompositeName


Examples of javax.naming.CompositeName

    public void rename(String oldName, String newName) throws NamingException {
        rename(new CompositeName(oldName), new CompositeName(newName));
    }

    public Context createSubcontext(String name) throws NamingException {
        return createSubcontext(new CompositeName(name));
    }
View Full Code Here

Examples of javax.naming.CompositeName

        }
        return childContext;
    }

    public void destroySubcontext(String name) throws NamingException {
        destroySubcontext(new CompositeName(name));
    }
View Full Code Here

Examples of javax.naming.CompositeName

            }
    }

    public String composeName(String name1, String name2)
            throws NamingException {
        Name name = composeName(new CompositeName(name1), new CompositeName(
                name2));
        return name == null ? null : name.toString();
    }
View Full Code Here

Examples of javax.naming.CompositeName

                    .getString("WinstoneBindingEnumeration.AlreadyClosed"));

        String name = (String) this.nameEnumeration.nextElement();
        Object value = this.bindings.get(name);
        try {
            value = NamingManager.getObjectInstance(value, new CompositeName()
                    .add(name), this.context, this.contextEnvironment);
        } catch (Throwable err) {
            NamingException errNaming = new NamingException(
                    ContainerJNDIManager.JNDI_RESOURCES
                            .getString("WinstoneBindingEnumeration.FailedToGetInstance"));
View Full Code Here

Examples of javax.naming.CompositeName

     * @throws NamingException if a naming exception is encountered
     */
    public Object lookup(final String name) throws NamingException {
        logger.debug("lookup {0}", name);

        Name n = new CompositeName(name);
        if (n.size() < 1) {
            // Empty name means this context
            logger.debug("Empty name");
            return this;
        }

        if (n.size() > 1) {
            // sub context in the env tree
            String suffix = n.getSuffix(1).toString();
            // should throw exception if sub context not found!
            Context subctx = lookupCtx(n.get(0));
            return subctx.lookup(suffix);
        }
        // leaf in the env tree
        Object ret = this.bindings.get(name);
        if (ret == null) {
View Full Code Here

Examples of javax.naming.CompositeName

     * @see javax.naming.NameAlreadyBoundException
     */
    public void bind(final String name, final Object obj) throws NamingException {
        logger.debug("bind {0}", name);

        Name n = new CompositeName(name);
        if (n.size() < 1) {
            logger.error("CompNamingContext bind empty name ?");

            throw new InvalidNameException("CompNamingContext cannot bind empty name");
        }

        if (n.size() == 1) {
            // leaf in the env tree
            if (this.bindings.get(name) != null) {
                logger.error("CompNamingContext: trying to overbind");
                throw new NameAlreadyBoundException("CompNamingContext: Use rebind to bind over a name");
            }
            this.bindings.put(name, obj);
        } else {
            // sub context in the env tree
            String suffix = n.getSuffix(1).toString();
            // must create the subcontext first if it does not exist yet.
            Context subctx;
            try {
                subctx = lookupCtx(n.get(0));
            } catch (NameNotFoundException e) {
                subctx = createSubcontext(n.get(0));
            }
            subctx.bind(suffix, obj);
        }
    }
View Full Code Here

Examples of javax.naming.CompositeName

     */
    public void rebind(final String name, final Object obj) throws NamingException {

        logger.debug("rebind {0}", name);

        Name n = new CompositeName(name);
        if (n.size() < 1) {
            logger.error("CompNamingContext rebind empty name ?");
            throw new InvalidNameException("CompNamingContext cannot rebind empty name");
        }

        if (n.size() == 1) {
            // leaf in the env tree
            this.bindings.put(name, obj);
        } else {
            // sub context in the env tree
            String suffix = n.getSuffix(1).toString();
            // must create the subcontext first if it does not exist yet.
            Context subctx;
            try {
                subctx = lookupCtx(n.get(0));
            } catch (NameNotFoundException e) {
                subctx = createSubcontext(n.get(0));
            }
            subctx.rebind(suffix, obj);
        }
    }
View Full Code Here

Examples of javax.naming.CompositeName

     */
    public void unbind(final String name) throws NamingException {

        logger.debug("unbind {0}", name);

        Name n = new CompositeName(name);
        if (n.size() < 1) {
            logger.error("CompNamingContext rebind empty name ?");
            throw new InvalidNameException("CompNamingContext cannot unbind empty name");
        }

        if (n.size() == 1) {
            // leaf in the env tree
            if (this.bindings.get(name) == null) {
                logger.error("CompNamingContext nothing to unbind");
                throw new NameNotFoundException(name);
            }
            this.bindings.remove(name);
        } else {
            // sub context in the env tree
            String suffix = n.getSuffix(1).toString();
            // should throw exception if sub context not found!
            Context subctx = lookupCtx(n.get(0));
            subctx.unbind(suffix);
        }
    }
View Full Code Here

Examples of javax.naming.CompositeName

     */
    @SuppressWarnings("unchecked")
    public Context createSubcontext(final String name) throws NamingException {
        logger.debug("createSubcontext {0}", name);

        Name n = new CompositeName(name);
        if (n.size() < 1) {
            logger.error("CompNamingContext createSubcontext with empty name ?");
            throw new InvalidNameException("CompNamingContext cannot create empty Subcontext");
        }

        Context ctx = null; // returned ctx
        if (n.size() == 1) {
            // leaf in the env tree: create ctx and bind it in parent.
            ctx = new ContextImpl(this.compId, this.environment);
            this.bindings.put(name, ctx);
        } else {
            // as for bind, we must create first all the subcontexts
            // if they don't exist yet.
            String suffix = n.getSuffix(1).toString();
            Context subctx;
            String newName = n.get(0);
            try {
                subctx = lookupCtx(newName);
            } catch (NameNotFoundException e) {
                subctx = createSubcontext(newName);
            }
View Full Code Here

Examples of javax.naming.CompositeName

        base = null;
        super.release();
    }

    public Object lookup(String name) throws NamingException {
        return lookup(new CompositeName(name));
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.