public Object getObjectInstance(Object object, Name name, Context context, Hashtable environment) throws Exception { Reference ref = (Reference) object; // the jndi context to use for the lookup (usually null which is the default context) String jndiProviderId = getProperty(ref, JNDI_PROVIDER_ID); // the jndi name String jndiName = getProperty(ref, JNDI_NAME); if (jndiName == null) { jndiName = buildJndiName(ref); } // look up the reference Object value = lookup(jndiProviderId, jndiName); return value; }
protected Object lookup(String jndiProviderId, String jndiName) throws NamingException { Context externalContext = getContext(jndiProviderId); synchronized (externalContext) { /* According to the JNDI SPI specification multiple threads may not access the same JNDI Context *instance* concurrently. Since we don't know the origines of the federated context we must synchonrize access to it. JNDI SPI Sepecifiation 1.2 Section 2.2 */ return externalContext.lookup(jndiName); } }
public Object getObjectInstance(Object object, Name name, Context context, Hashtable environment) throws Exception { Reference reference = ((Reference) object); if (reference.getClassName().equals("java.net.URL")) { String resourceId = getProperty(reference, RESOURCE_ID); return new URL(resourceId); } return super.getObjectInstance(object, name, context, environment); }
public Object getObjectInstance(Object object, Name name, Context context, Hashtable environment) throws Exception { // ignore non ejb-refs if (!(object instanceof EjbRef)) { return null; } // lookup the value Object value = super.getObjectInstance(object, name, context, environment); // if this is an external reference, copy it into the local class loader if (isPropertyTrue((Reference) object, EXTERNAL)) { value = copy(value); } // done return value; }
public Object getObjectInstance(Object object, Name name, Context context, Hashtable environment) throws Exception { // ignore non resource-refs if (!(object instanceof ResourceRef)) { return null; } Reference ref = (Reference) object; Object value; if (getProperty(ref, JNDI_NAME) != null) { // lookup the value in JNDI value = super.getObjectInstance(object, name, context, environment); } else { // value is hard hard coded in the properties value = getStaticValue(ref); } return value; }
public Object getObjectInstance(Object object, Name name, Context context, Hashtable environment) throws Exception { // ignore non resource-refs if (!(object instanceof ResourceRef)) { return null; } Reference ref = (Reference) object; Object value; if (getProperty(ref, JNDI_NAME) != null) { // lookup the value in JNDI value = super.getObjectInstance(object, name, context, environment); } else { // value is hard hard coded in the properties value = getStaticValue(ref); } return value; }
if (getProperty(ref, JNDI_NAME) != null) { value = super.getObjectInstance(object, name, context, environment); } else {