code: public void associateEnvironmentToJndi(JNDIResourceModel resource, EnvironmentReferenceModel ref)
      {
          LOG.info("Associating JNDI: " + resource + " to Environmental Ref: " + ref.getName() + ", " + ref.getReferenceId() + ", "
                      + ref.getReferenceType());
          // hook up the JNDI resource to the environment reference
          if (ref.getJndiReference() == null)
          {
              ref.setJndiReference(resource);
          }
          jndiResourceService.associateTypeJndiResource(resource, ref.getReferenceType());
      }
docs: Associate a {@link EnvironmentReferenceModel} to the given {@link JNDIResourceModel}.