Package org.eclipse.jetty.jndi

Examples of org.eclipse.jetty.jndi.NamingContext


        {
            initCtx.lookup( JNDI_ENV_ROOT );
        }
        catch ( NameNotFoundException e )
        {
            initCtx.bind( JNDI_ENV_ROOT, new NamingContext(new Hashtable<String, Object>(), JNDI_ENV_ROOT, null, new InitialContextFactory.DefaultParser()) );
            log.error( "No JNDI " + JNDI_ENV_ROOT + " namespace found; creating it," );
        }
        log.info( "Initialized JNDI " + JNDI_ENV_ROOT + " namespace.=" + contextFactoryClass );
       
        // Initialize new Jetty server
View Full Code Here


        {
            initCtx.lookup( JNDI_ENV_ROOT );
        }
        catch ( NameNotFoundException e )
        {
            initCtx.bind( JNDI_ENV_ROOT, new NamingContext(new Hashtable<String, Object>(), JNDI_ENV_ROOT, null, new InitialContextFactory.DefaultParser()) );
            log.error( "No JNDI " + JNDI_ENV_ROOT + " namespace found; creating it," );
        }
        log.info( "Initialized JNDI " + JNDI_ENV_ROOT + " namespace.=" + contextFactoryClass );
       
        // Initialize new Jetty server
View Full Code Here

        {
            initCtx.lookup( "java:comp" );
        }
        catch ( NameNotFoundException e )
        {
            initCtx.bind( "java:comp", new NamingContext(new Hashtable<String, Object>(), "java:comp", null, new InitialContextFactory.DefaultParser()) );
            log.error( "No JNDI java:comp namespace found; creating it," );
        }
        log.info( "Initialized JNDI java:comp namespace.=" + contextFactoryClass );
       
        // Initialize new Jetty server
View Full Code Here

    public void destroy (WebAppContext context) throws Exception
    {
        try
        {
            //unbind any NamingEntries that were configured in this webapp's name space
            NamingContext scopeContext = (NamingContext)NamingEntryUtil.getContextForScope(context);
            scopeContext.getParent().destroySubcontext(scopeContext.getName());
        }
        catch (NameNotFoundException e)
        {
            LOG.ignore(e);
            LOG.debug("No naming entries configured in environment for webapp "+context);
View Full Code Here

            Name cname = __root.toCanonicalName(name);

            if (cname == null)
            {
                //If no name create copy of this context with same bindings, but with copy of the environment so it can be modified
                NamingContext ctx = new NamingContext (_env, null, null, __root.getNameParser(""));
                ctx.setBindings(__root.getBindings());
                return ctx;
            }

            if (cname.size() == 0)
                throw new NamingException ("Name is empty");
View Full Code Here

            Name cname = __root.toCanonicalName(name);

            if ((cname == null) || (cname.size() == 0))
            {
                __log.debug("Null or empty name, returning copy of this context");
                NamingContext ctx = new NamingContext (_env, null, null, __root.getNameParser(""));
                ctx.setBindings(__root.getBindings());
                return ctx;
            }


View Full Code Here

                Binding binding = __root.getBinding (cname);
                if (binding != null)
                    throw new NameAlreadyBoundException (cname.toString());

                //make a new naming context with the root as the parent
                Context ctx = new NamingContext ((Hashtable)_env.clone(), cname.get(0), __root,  __root.getNameParser(""));
                __root.addBinding (cname, ctx);
                return ctx;
            }

View Full Code Here

            n = n.getSuffix(1);
            if(LOG.isDebugEnabled())LOG.debug("getSuffix(1)="+n);
            if(LOG.isDebugEnabled())LOG.debug("get(0)="+n.get(0));
            if(LOG.isDebugEnabled())LOG.debug("getPrefix(1)="+n.getPrefix(1));

            NamingContext ncontext = (NamingContext)sub0;

            Name nn = ncontext.toCanonicalName(ncontext.getNameParser("").parse("/yellow/blue/"));
            LOG.debug(nn.toString());
            assertEquals (2, nn.size());

            nn = ncontext.toCanonicalName(ncontext.getNameParser("").parse("/yellow/blue"));
            LOG.debug(nn.toString());
            assertEquals (2, nn.size());

            nn = ncontext.toCanonicalName(ncontext.getNameParser("").parse("/"));
            if(LOG.isDebugEnabled())LOG.debug("/ parses as: "+nn+" with size="+nn.size());
            LOG.debug(nn.toString());
            assertEquals (1, nn.size());

            nn = ncontext.toCanonicalName(ncontext.getNameParser("").parse(""));
            LOG.debug(nn.toString());
            assertEquals (0, nn.size());

            Context fee = ncontext.createSubcontext("fee");
            fee.bind ("fi", "88");
            assertEquals("88", initCtx.lookup("java:/fee/fi"));
            assertEquals("88", initCtx.lookup("java:/fee/fi/"));
            assertTrue (initCtx.lookup("java:/fee/") instanceof javax.naming.Context);
        }
View Full Code Here

    public void destroy (WebAppContext context) throws Exception
    {
        try
        {
            //unbind any NamingEntries that were configured in this webapp's name space
            NamingContext scopeContext = (NamingContext)NamingEntryUtil.getContextForScope(context);
            scopeContext.getParent().destroySubcontext(scopeContext.getName());
        }
        catch (NameNotFoundException e)
        {
            LOG.ignore(e);
            LOG.debug("No naming entries configured in environment for webapp "+context);
View Full Code Here

TOP

Related Classes of org.eclipse.jetty.jndi.NamingContext

Copyright © 2018 www.massapicom. 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.