Package org.apache.xbean.naming.context

Examples of org.apache.xbean.naming.context.ImmutableContext


    public static class MockInitialContextFactory implements InitialContextFactory {
        private static ImmutableContext immutableContext;

        public static void install(Map bindings) throws NamingException {
            immutableContext = new ImmutableContext(bindings);
            System.setProperty(Context.INITIAL_CONTEXT_FACTORY, MockInitialContextFactory.class.getName());
            new InitialContext();
        }
View Full Code Here


        Map globalBindings = new HashMap(javaCompOnlyBindings);
        globalBindings.put("test/env/foo", new Integer(42));
        globalBindings.put("test/baz", "caz");

        Map javaCompBindings = getNestedBindings(globalBindings, "java:");
        ImmutableContext javaCompContext = new ImmutableContext(javaCompBindings);
        RootContext.setComponentContext(javaCompContext);

        GBeanData javaComp = configurationData.addGBean("JavaComp", JavaCompContextGBean.class);
        AbstractName javaCompName = javaComp.getAbstractName();
View Full Code Here

        envBinding.put("link", link);

        RootContext.setComponentContext(readOnlyContext);

        Context javaCompContext = new JavaCompContextGBean();
        Context globalContext = new ImmutableContext(Collections.<String, Object>singletonMap(javaCompContext.getNameInNamespace(), javaCompContext));
        GlobalContextManager.setGlobalContext(globalContext);

        initialContext = new InitialContext();
        compContext = (Context) initialContext.lookup("java:comp");
        envContext = (Context) initialContext.lookup("java:comp/env");
View Full Code Here

        Map javaCompBindings = new HashMap();
        javaCompBindings.put("foo", "bar");

        // a regular context doesn't contain env
        Thread.currentThread().setContextClassLoader(javaURLContextFactory.class.getClassLoader());
        RootContext.setComponentContext(new ImmutableContext(javaCompBindings));
        try {
            new InitialContext().lookup("java:comp/env");
            fail("Expected NameNotFoundException");
        } catch (NotContextException expected) {
            // expected
        } catch (NameNotFoundException expected) {
            // expected
        }

        // ENC adds env if not present
        javaCompBindings.put("comp/env/foo", "bar");
        RootContext.setComponentContext(new ImmutableContext(javaCompBindings));
        new InitialContext().lookup("java:comp/env");
    }
View Full Code Here

                           @ParamSpecial(type = SpecialAttributeType.kernel) Kernel kernel,
                           @ParamSpecial(type = SpecialAttributeType.classLoader) ClassLoader classLoader,
                           @ParamSpecial(type = SpecialAttributeType.bundle) Bundle bundle
                           ) throws NamingException {
        this.liveGlobalMap = EnterpriseNamingContext.livenReferencesToMap(globalContextSegment, null, kernel, classLoader, bundle, JndiScope.global.name() + "/");
        this.globalAdditions = new ImmutableContext(this.liveGlobalMap, false);
        this.globalContext = globalContext;
        this.globalContext.federateContext(this.globalAdditions);
        this.applicationContext = EnterpriseNamingContext.livenReferences(applicationContext, null, kernel, classLoader, bundle, JndiScope.app.name() + "/");
    }
View Full Code Here

    public static Context livenReferences(Map<String, Object> componentContext, UserTransaction userTransaction, Kernel kernel, ClassLoader classLoader, Bundle bundle, String prefix)
            throws NamingException {
        Map<String, Object> map = livenReferencesToMap(componentContext, userTransaction, kernel, classLoader, bundle, prefix);

        return new ImmutableContext(map, false);
    }
View Full Code Here

            }
        }


        if (!containsEnv) {
            Context env = new ImmutableContext("java:" + prefix + "env", Collections.<String, Object>emptyMap(), false);
            map.put(prefix + "env", env);
        }

        if (userTransaction != null) {
            map.put(prefix + "UserTransaction", userTransaction);
View Full Code Here

    public static class MockInitialContextFactory implements InitialContextFactory {
        private static ImmutableContext immutableContext;

        public static void install(Map bindings) throws NamingException {
            immutableContext = new ImmutableContext(bindings);
            System.setProperty(Context.INITIAL_CONTEXT_FACTORY, MockInitialContextFactory.class.getName());
            new InitialContext();
        }
View Full Code Here

    public static class MockInitialContextFactory implements InitialContextFactory {
        private static ImmutableContext immutableContext;

        public static void install(Map bindings) throws NamingException {
            immutableContext = new ImmutableContext(bindings);
            System.setProperty(Context.INITIAL_CONTEXT_FACTORY, MockInitialContextFactory.class.getName());
            new InitialContext();
        }
View Full Code Here

    public static class MockInitialContextFactory implements InitialContextFactory {
        private static ImmutableContext immutableContext;

        public static void install(Map bindings) throws NamingException {
            immutableContext = new ImmutableContext(bindings);
            System.setProperty(Context.INITIAL_CONTEXT_FACTORY, MockInitialContextFactory.class.getName());
            new InitialContext();
        }
View Full Code Here

TOP

Related Classes of org.apache.xbean.naming.context.ImmutableContext

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.