code: private ConnectionDefinition attachConnectionDefinition(String mcf, javax.resource.spi.ConnectionDefinition cd,
                                                             ClassLoader classLoader,
                                                             ArrayList<? extends ConfigProperty> configProperties,
                                                             ArrayList<? extends ConfigProperty> plainConfigProperties)
        throws Exception
     {
        if (trace)
           log.trace("Processing: " + cd);
  
        ArrayList<ConfigProperty> validProperties = new ArrayList<ConfigProperty>();
  
        if (configProperties != null)
        {
           for (ConfigProperty configProperty : configProperties)
  
           {
              if (mcf.equals(((ConfigPropertyImpl) configProperty).getAttachedClassName()))
              {
                 if (trace)
                    log.tracef("Attaching: %s (%s)", configProperty, mcf);
                    
                 validProperties.add(configProperty);
              }
           }
        }
        if (plainConfigProperties != null)
        {
           Set<String> mcfClasses = getClasses(mcf, classLoader);
  
           for (ConfigProperty configProperty : plainConfigProperties)
           {
              if (mcfClasses.contains(((ConfigPropertyImpl) configProperty).getAttachedClassName()))
              {
                 if (trace)
                    log.tracef("Attaching: %s (%s)", configProperty, mcf);
                    
                 validProperties.add(configProperty);
              }
           }
        }
  
        validProperties.trimToSize();
  
        XsdString connectionfactoryInterface = new XsdString(cd.connectionFactory().getName(), null);
        XsdString managedconnectionfactoryClass = new XsdString(mcf, null);
        XsdString connectionImplClass = new XsdString(cd.connectionImpl().getName(), null);
        XsdString connectionfactoryImplClass = new XsdString(cd.connectionFactoryImpl().getName(), null);
        XsdString connectionInterface = new XsdString(cd.connection().getName(), null);
        return new ConnectionDefinitionImpl(managedconnectionfactoryClass, validProperties,
                                            connectionfactoryInterface,
                                            connectionfactoryImplClass, connectionInterface, connectionImplClass, null);
     }
docs: Attach @ConnectionDefinition
  @param mcf The managed connection factory
  @param cd The connection definition
  @param classLoader The class loader
  @param configProperties The config properties
  @param plainConfigProperties The plain config properties
  @return The updated metadata
  @exception Exception Thrown if an error occurs