Examples of NamingEntry


Examples of org.mortbay.jetty.plus.naming.NamingEntry

        //when we processed the server and the webapp's naming environment
        //@see EnvConfiguration.bindEnvEntries()
        ic = new InitialContext();
        try
        {
            NamingEntry ne = (NamingEntry)ic.lookup("java:comp/env/"+NamingEntryUtil.makeNamingEntryName(ic.getNameParser(""), name));
            if (ne!=null && ne instanceof EnvEntry)
            {
                EnvEntry ee = (EnvEntry)ne;
                bound = ee.isOverrideWebXml();
            }
View Full Code Here

Examples of org.mortbay.jetty.plus.naming.NamingEntry

        boolean bound = false;
       
        //check if the name in web.xml has been mapped to something else
        //check a context-specific naming environment first
        Object scope = getWebAppContext();
        NamingEntry ne = NamingEntryUtil.lookupNamingEntry(scope, name);
   
        if (ne!=null && (ne instanceof Link))
        {
            //if we found a mapping, get out name it is mapped to in the environment
            nameInEnvironment = (String)((Link)ne).getObjectToBind();
            Link l = (Link)ne;
        }

        //try finding that mapped name in the webapp's environment first
        scope = getWebAppContext();
        bound = NamingEntryUtil.bindToENC(scope, name, nameInEnvironment);
       
        if (bound)
            return;

        //try the server's environment
        scope = getWebAppContext().getServer();
        bound = NamingEntryUtil.bindToENC(scope, name, nameInEnvironment);
        if (bound)
            return;

        //try the jvm environment
        bound = NamingEntryUtil.bindToENC(null, name, nameInEnvironment);
        if (bound)
            return;


        //There is no matching resource so try a default name.
        //The default name syntax is: the [res-type]/default
        //eg       javax.sql.DataSource/default
        nameInEnvironment = typeClass.getName()+"/default";
        //First try the server scope
        NamingEntry defaultNE = NamingEntryUtil.lookupNamingEntry(getWebAppContext().getServer(), nameInEnvironment);
        if (defaultNE==null)
            defaultNE = NamingEntryUtil.lookupNamingEntry(null, nameInEnvironment);
       
        if (defaultNE!=null)
            defaultNE.bindToENC(name);
        else
            throw new IllegalStateException("Nothing to bind for name "+nameInEnvironment);
    }
View Full Code Here

Examples of org.mortbay.jetty.plus.naming.NamingEntry

        val = (String)ic.lookup("java:comp/env/zzz/d");
        assertEquals("400", val);//from server naming
        val = (String)ic.lookup("java:comp/env/zzz/e");
        assertEquals("930", val);//from webapp naming
       
        NamingEntry ne = (NamingEntry)ic.lookup("java:comp/env/"+NamingEntry.__contextName+"/xxx/a");
        assertNotNull(ne);
        ne = (NamingEntry)ic.lookup("java:comp/env/"+NamingEntry.__contextName+"/yyy/b");
        assertNotNull(ne);
        ne = (NamingEntry)ic.lookup("java:comp/env/"+NamingEntry.__contextName+"/zzz/c");
        assertNotNull(ne);
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.