private static Object createJndiObjectProxy(JndiObjectFactoryBean jof) throws NamingException { JndiObjectTargetSource targetSource = new JndiObjectTargetSource(); targetSource.setJndiTemplate(jof.getJndiTemplate()); String jndiName = jof.getJndiName(); Assert.state(jndiName != null, "No JNDI name specified"); targetSource.setJndiName(jndiName); targetSource.setExpectedType(jof.getExpectedType()); targetSource.setResourceRef(jof.isResourceRef()); targetSource.setLookupOnStartup(jof.lookupOnStartup); targetSource.setCache(jof.cache); targetSource.afterPropertiesSet(); Class<?> targetClass = targetSource.getTargetClass(); if (targetClass == null) { throw new IllegalStateException(
@Override @Nullable public Class<?> getTargetClass() { if (this.cachedObject != null) { return this.cachedObject.getClass(); } else if (this.targetClass != null) { return this.targetClass; } else { return getExpectedType(); } }
@Override @Nullable public Object getTarget() { try { if (this.lookupOnStartup || !this.cache) { return (this.cachedObject != null ? this.cachedObject : lookup()); } else { synchronized (this) { if (this.cachedObject == null) { this.cachedObject = lookup(); } return this.cachedObject; } } } catch (NamingException ex) { throw new JndiLookupFailureException("JndiObjectTargetSource failed to obtain new target object", ex); } }
private static Object createJndiObjectProxy(JndiObjectFactoryBean jof) throws NamingException { JndiObjectTargetSource targetSource = new JndiObjectTargetSource(); targetSource.setJndiTemplate(jof.getJndiTemplate()); String jndiName = jof.getJndiName(); Assert.state(jndiName != null, "No JNDI name specified"); targetSource.setJndiName(jndiName); targetSource.setExpectedType(jof.getExpectedType()); targetSource.setResourceRef(jof.isResourceRef()); targetSource.setLookupOnStartup(jof.lookupOnStartup); targetSource.setCache(jof.cache); targetSource.afterPropertiesSet(); Class<?> targetClass = targetSource.getTargetClass(); if (targetClass == null) { throw new IllegalStateException(
@Override public void afterPropertiesSet() throws NamingException { super.afterPropertiesSet(); if (this.lookupOnStartup) { Object object = lookup(); if (this.cache) { this.cachedObject = object; } else { this.targetClass = object.getClass(); } } }
@Override @Nullable public Class<?> getTargetClass() { if (this.cachedObject != null) { return this.cachedObject.getClass(); } else if (this.targetClass != null) { return this.targetClass; } else { return getExpectedType(); } }
private static Object createJndiObjectProxy(JndiObjectFactoryBean jof) throws NamingException { JndiObjectTargetSource targetSource = new JndiObjectTargetSource(); targetSource.setJndiTemplate(jof.getJndiTemplate()); String jndiName = jof.getJndiName(); Assert.state(jndiName != null, "No JNDI name specified"); targetSource.setJndiName(jndiName); targetSource.setExpectedType(jof.getExpectedType()); targetSource.setResourceRef(jof.isResourceRef()); targetSource.setLookupOnStartup(jof.lookupOnStartup); targetSource.setCache(jof.cache); targetSource.afterPropertiesSet(); Class<?> targetClass = targetSource.getTargetClass(); if (targetClass == null) { throw new IllegalStateException(
@Override public void afterPropertiesSet() throws NamingException { super.afterPropertiesSet(); if (this.lookupOnStartup) { Object object = lookup(); if (this.cache) { this.cachedObject = object; } else { this.targetClass = object.getClass(); } } }
@Override @Nullable public Class<?> getTargetClass() { if (this.cachedObject != null) { return this.cachedObject.getClass(); } else if (this.targetClass != null) { return this.targetClass; } else { return getExpectedType(); } }
@Override @Nullable public Object getTarget() { try { if (this.lookupOnStartup || !this.cache) { return (this.cachedObject != null ? this.cachedObject : lookup()); } else { synchronized (this) { if (this.cachedObject == null) { this.cachedObject = lookup(); } return this.cachedObject; } } } catch (NamingException ex) { throw new JndiLookupFailureException("JndiObjectTargetSource failed to obtain new target object", ex); } }
@Override @Nullable public Object getTarget() { try { if (this.lookupOnStartup || !this.cache) { return (this.cachedObject != null ? this.cachedObject : lookup()); } else { synchronized (this) { if (this.cachedObject == null) { this.cachedObject = lookup(); } return this.cachedObject; } } } catch (NamingException ex) { throw new JndiLookupFailureException("JndiObjectTargetSource failed to obtain new target object", ex); } }
@Override public void afterPropertiesSet() throws NamingException { super.afterPropertiesSet(); if (this.lookupOnStartup) { Object object = lookup(); if (this.cache) { this.cachedObject = object; } else { this.targetClass = object.getClass(); } } }