/** * Set the JNDI template to use for JNDI lookups. * @see org.springframework.jndi.JndiAccessor#setJndiTemplate */ public void setJndiTemplate(JndiTemplate jndiTemplate) { this.jndiLocator.setJndiTemplate(jndiTemplate); }
/** * Set the JNDI template to use for JNDI lookups. * @see org.springframework.jndi.JndiAccessor#setJndiTemplate */ public void setJndiTemplate(JndiTemplate jndiTemplate) { this.jndiLocator.setJndiTemplate(jndiTemplate); }
/** * Set the JNDI template to use for JNDI lookups. * @see org.springframework.jndi.JndiAccessor#setJndiTemplate */ public void setJndiTemplate(JndiTemplate jndiTemplate) { this.jndiLocator.setJndiTemplate(jndiTemplate); }
/** * Set the JNDI template to use for JNDI lookups. * @see org.springframework.jndi.JndiAccessor#setJndiTemplate */ public void setJndiTemplate(JndiTemplate jndiTemplate) { this.jndiLocator.setJndiTemplate(jndiTemplate); }
/** * Set the JNDI template to use for JNDI lookups. * @see org.springframework.jndi.JndiAccessor#setJndiTemplate */ public void setJndiTemplate(JndiTemplate jndiTemplate) { this.jndiLocator.setJndiTemplate(jndiTemplate); }
/** * Set the JNDI template to use for JNDI lookups. * @see org.springframework.jndi.JndiAccessor#setJndiTemplate */ public void setJndiTemplate(JndiTemplate jndiTemplate) { this.jndiLocator.setJndiTemplate(jndiTemplate); }
public <T> T lookup(String jndiName, Class<T> requiredType) throws Exception { JndiLocatorDelegate locator = new JndiLocatorDelegate(); if (jndiEnvironment instanceof JndiTemplate) { locator.setJndiTemplate((JndiTemplate) jndiEnvironment); } else if (jndiEnvironment instanceof Properties) { locator.setJndiEnvironment((Properties) jndiEnvironment); } else if (jndiEnvironment != null) { throw new IllegalStateException("Illegal 'jndiEnvironment' type: " + jndiEnvironment.getClass()); } locator.setResourceRef(resourceRef); return locator.lookup(jndiName, requiredType); } }
public <T> T lookup(String jndiName, Class<T> requiredType) throws Exception { JndiLocatorDelegate locator = new JndiLocatorDelegate(); if (jndiEnvironment instanceof JndiTemplate) { locator.setJndiTemplate((JndiTemplate) jndiEnvironment); } else if (jndiEnvironment instanceof Properties) { locator.setJndiEnvironment((Properties) jndiEnvironment); } else if (jndiEnvironment != null) { throw new IllegalStateException("Illegal 'jndiEnvironment' type: " + jndiEnvironment.getClass()); } locator.setResourceRef(resourceRef); return locator.lookup(jndiName, requiredType); } }
@Test public void nameBoundWithPrefix() { final SimpleNamingContext context = new SimpleNamingContext(); context.bind("java:comp/env/p1", "v1"); JndiTemplate jndiTemplate = new JndiTemplate() { @Override protected Context createInitialContext() throws NamingException { return context; } }; JndiLocatorDelegate jndiLocator = new JndiLocatorDelegate(); jndiLocator.setResourceRef(true); jndiLocator.setJndiTemplate(jndiTemplate); JndiPropertySource ps = new JndiPropertySource("jndiProperties", jndiLocator); assertThat(ps.getProperty("p1"), equalTo("v1")); }
@Test public void nameBoundWithoutPrefix() { final SimpleNamingContext context = new SimpleNamingContext(); context.bind("p1", "v1"); JndiTemplate jndiTemplate = new JndiTemplate() { @Override protected Context createInitialContext() throws NamingException { return context; } }; JndiLocatorDelegate jndiLocator = new JndiLocatorDelegate(); jndiLocator.setResourceRef(true); jndiLocator.setJndiTemplate(jndiTemplate); JndiPropertySource ps = new JndiPropertySource("jndiProperties", jndiLocator); assertThat(ps.getProperty("p1"), equalTo("v1")); }
/** * Set the JNDI template to use for JNDI lookups. * @see org.springframework.jndi.JndiAccessor#setJndiTemplate */ public void setJndiTemplate(JndiTemplate jndiTemplate) { this.jndiLocator.setJndiTemplate(jndiTemplate); }
/** * Set the JNDI template to use for JNDI lookups. * @see org.springframework.jndi.JndiAccessor#setJndiTemplate */ public void setJndiTemplate(JndiTemplate jndiTemplate) { this.jndiLocator.setJndiTemplate(jndiTemplate); }
/** * Set the JNDI template to use for JNDI lookups. * @see org.springframework.jndi.JndiAccessor#setJndiTemplate */ public void setJndiTemplate(JndiTemplate jndiTemplate) { this.jndiLocator.setJndiTemplate(jndiTemplate); }
public <T> T lookup(String jndiName, Class<T> requiredType) throws Exception { JndiLocatorDelegate locator = new JndiLocatorDelegate(); if (jndiEnvironment instanceof JndiTemplate) { locator.setJndiTemplate((JndiTemplate) jndiEnvironment); } else if (jndiEnvironment instanceof Properties) { locator.setJndiEnvironment((Properties) jndiEnvironment); } else if (jndiEnvironment != null) { throw new IllegalStateException("Illegal 'jndiEnvironment' type: " + jndiEnvironment.getClass()); } locator.setResourceRef(resourceRef); return locator.lookup(jndiName, requiredType); } }