/** * Return the JNDI environment to use for JNDI lookups. */ @Nullable public Properties getJndiEnvironment() { return this.jndiTemplate.getEnvironment(); }
/** * Return the JNDI environment to use for JNDI lookups. */ @Nullable public Properties getJndiEnvironment() { return this.jndiTemplate.getEnvironment(); }
/** * Return the JNDI environment to use for JNDI lookups. */ @Nullable public Properties getJndiEnvironment() { return this.jndiTemplate.getEnvironment(); }
/** * Return the JNDI environment to use for JNDI lookups. */ @Nullable public Properties getJndiEnvironment() { return this.jndiTemplate.getEnvironment(); }
/** * Create a new JNDI initial context. Invoked by {@link #getContext}. * <p>The default implementation use this template's environment settings. * Can be subclassed for custom contexts, e.g. for testing. * @return the initial Context instance * @throws NamingException in case of initialization errors */ protected Context createInitialContext() throws NamingException { Hashtable<?, ?> icEnv = null; Properties env = getEnvironment(); if (env != null) { icEnv = new Hashtable<>(env.size()); CollectionUtils.mergePropertiesIntoMap(env, icEnv); } return new InitialContext(icEnv); }
/** * Create a new JNDI initial context. Invoked by {@link #getContext}. * <p>The default implementation use this template's environment settings. * Can be subclassed for custom contexts, e.g. for testing. * @return the initial Context instance * @throws NamingException in case of initialization errors */ protected Context createInitialContext() throws NamingException { Hashtable<?, ?> icEnv = null; Properties env = getEnvironment(); if (env != null) { icEnv = new Hashtable<>(env.size()); CollectionUtils.mergePropertiesIntoMap(env, icEnv); } return new InitialContext(icEnv); }
@Test public void testCustomEnvironment() { JndiTemplateEditor je = new JndiTemplateEditor(); // These properties are meaningless for JNDI, but we don't worry about that: // the underlying JNDI implementation will throw exceptions when the user tries // to look anything up je.setAsText("jndiInitialSomethingOrOther=org.springframework.myjndi.CompleteRubbish\nfoo=bar"); JndiTemplate jt = (JndiTemplate) je.getValue(); assertTrue(jt.getEnvironment().size() == 2); assertTrue(jt.getEnvironment().getProperty("jndiInitialSomethingOrOther").equals("org.springframework.myjndi.CompleteRubbish")); assertTrue(jt.getEnvironment().getProperty("foo").equals("bar")); }
@Test public void testEmptyStringMeansNullEnvironment() { JndiTemplateEditor je = new JndiTemplateEditor(); je.setAsText(""); JndiTemplate jt = (JndiTemplate) je.getValue(); assertTrue(jt.getEnvironment() == null); }
/** * Return the JNDI environment to use for JNDI lookups. */ public Properties getJndiEnvironment() { return this.jndiTemplate.getEnvironment(); }
/** * Return the JNDI environment to use for JNDI lookups. */ @Nullable public Properties getJndiEnvironment() { return this.jndiTemplate.getEnvironment(); }
/** * Return the JNDI environment to use for JNDI lookups. */ @Nullable public Properties getJndiEnvironment() { return this.jndiTemplate.getEnvironment(); }
/** * Return the JNDI environment to use for JNDI lookups. */ @Nullable public Properties getJndiEnvironment() { return this.jndiTemplate.getEnvironment(); }
/** * Create a new JNDI initial context. Invoked by {@link #getContext}. * <p>The default implementation use this template's environment settings. * Can be subclassed for custom contexts, e.g. for testing. * @return the initial Context instance * @throws NamingException in case of initialization errors */ protected Context createInitialContext() throws NamingException { Hashtable<?, ?> icEnv = null; Properties env = getEnvironment(); if (env != null) { icEnv = new Hashtable<>(env.size()); CollectionUtils.mergePropertiesIntoMap(env, icEnv); } return new InitialContext(icEnv); }