public void finishBMDInitWithReferenceContext(BeanMetaData bmd) throws ContainerException, EJBConfigurationException {
        final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();

        if (isTraceOn && tc.isEntryEnabled()) //367834.5
            Tr.entry(tc, "finishBMDInitWithReferenceContext", bmd.j2eeName); //367834.5  d640935.1

        try {
            processReferenceContext(bmd);
        } catch (InjectionException ex) {
            // Unwrap the exception thrown by ComponentNameSpaceConfigurationProviderImpl.
            for (Throwable cause = ex.getCause(); cause != null; cause = cause.getCause()) {
                if (cause instanceof EJBConfigurationException) {
                    throw (EJBConfigurationException) cause;
                }
                if (cause instanceof ContainerException) {
                    throw (ContainerException) cause;
                }
            }

            throw new EJBConfigurationException(ex);
        }

        EnterpriseBean eb = bmd.wccm.enterpriseBean;

        // -----------------------------------------------------------------------
        // Look for Session Synchronization methods for Stateful beans  F743-25855
        // -----------------------------------------------------------------------
        if (bmd.isStatefulSessionBean() &&
            !bmd.usesBeanManagedTx) {
            processSessionSynchronizationMD(bmd, (Session) eb);
        }

        // -----------------------------------------------------------------------
        // Get the managed object factory or constructor for non-entity
        // -----------------------------------------------------------------------
        // Must obtain managed object factory before generating the implementation
        // classes, as the wrapper may be different if managed object factory will
        // handle injection and interceptors.
        if (!bmd.isEntityBean()) {
            initializeManagedObjectFactoryOrConstructor(bmd);
        }

        // ------------------------------------------------------------------------------
        // Load the all the generated (ie. EJBDeploy or JITDeploy)implementation classes
        // ------------------------------------------------------------------------------
        loadGeneratedImplementationClasses(bmd,
                                           bmd.methodsExposedOnLocalInterface, // F743-17630
                                           bmd.methodsExposedOnRemoteInterface, // F743-17630
                                           bmd.methodsExposedOnLocalHomeInterface, // F743-17630
                                           bmd.methodsExposedOnRemoteHomeInterface); // F743-17630

        // -----------------------------------------------------------------------
        // Get the constructor for entity beans
        // -----------------------------------------------------------------------
        // Must obtain the entity bean constructor after loading the generated
        // implementation classes, as the concrete bean class may be generated.
        if (bmd.isEntityBean()) {
            initializeEntityConstructor(bmd);
        }

        // -----------------------------------------------------------------------
        // Build the Message Destination Link Map if this is an MDB.       d510405
        // -----------------------------------------------------------------------
        // For an annotations only configuration, there will be no Enterprise
        // Bean in WCCM.  In this case there are no resource refs in xml to retrieve.
        if (eb != null && eb.getKindValue() == EnterpriseBean.KIND_MESSAGE_DRIVEN) {
            MessageDriven mdb = (MessageDriven) eb;
            String link = mdb.getLink();

            if (link != null) {
                if (isTraceOn && tc.isDebugEnabled())
                    Tr.debug(tc, "processing message-destination-link : " + link +
                                 " : " + bmd.j2eeName);

                String moduleName = null;
                String destJndiName = null;
                String appName = bmd.j2eeName.getApplication();

                Map<String, Map<String, String>> appMap = InjectionEngineAccessor.getMessageDestinationLinkInstance().getMessageDestinationLinks().get(appName); //d493167

                // create a new application map if one is not present
                if (appMap == null) {
                    appMap = new HashMap<String, Map<String, String>>();
                    InjectionEngineAccessor.getMessageDestinationLinkInstance().getMessageDestinationLinks().put(appName, appMap); //493167
                }

                // Get the JNDIname of the MessageDestination from BMD
                destJndiName = bmd.ivMessageDestinationJndiName;

                // parse the link if the link name is in the format of moduleName#linkName
                int lindex = link.indexOf('#');
                if (lindex != -1) {
                    // Module name may have path information... remove it.    d510405
                    int mindex = link.lastIndexOf('/');
                    if (mindex > -1 && mindex < lindex) {
                        moduleName = link.substring(mindex + 1, lindex);
                    } else {
                        // If no path was specified, then the referenced module
                        // is in the same location. Use first half of the link.
                        moduleName = link.substring(0, lindex);
                    }
                    link = link.substring(lindex + 1);
                } else {
                    moduleName = bmd.j2eeName.getModule();
                }

                Map<String, String> moduleMap = appMap.get(moduleName);
                if (moduleMap == null) {
                    moduleMap = new HashMap<String, String>();
                    appMap.put(moduleName, moduleMap);
                }

                if (isTraceOn && tc.isDebugEnabled())
                    Tr.debug(tc, "adding destination: " + link + " -> destinationJndiName:" +
                                 destJndiName + " for module: " + moduleName);

                moduleMap.put(link, destJndiName);
            }
        }

        //------------------------------------------------------------------------
        // Finish up a few last odds & ends
        //------------------------------------------------------------------------

        // Z/OS specific metadata and trace
        processZOSMetadata(bmd);

        // F743-609CodRev
        // If this bean has any asynchronous methods, make sure the container has a work manager
        // setup to execute runable objects for those methods
        if (bmd.ivHasAsynchMethod) {
            bmd.container.getEJBRuntime().setupAsync();
        }

        // Finally, run some checks to make sure everything we have initialized
        // is legal.
        bmd.validate();//d133681

        // Metadata for this bean type is now fully ready to use.  This flag must only be
        // set at the very end of BMD initialization.
        bmd.fullyInitialized = true;
        bmd.wccm = null;
        bmd.ivInitData = null;
        removeTemporaryMethodData(bmd); // F743-17630
        if (bmd._moduleMetaData.ivInterceptorBindingMap != null) {
            bmd._moduleMetaData.removeEJBInterceptorBindings(bmd.enterpriseBeanName); // d695226
        }

        // Write out bean metadata into the trace file in a format that the trace
        // explorer tool can read.
        if (isTraceOn && TEBeanMetaDataInfo.isTraceEnabled()) // d527372
            TEBeanMetaDataInfo.writeTraceBeanMetaData(bmd, bmd.ivModuleVersion); // d161864

        // TODO: MLS - this was an old comment.  Check if ActivationConfig could go
        // in the new bmd.wccm object now and be nulled out.
        // Note, do not null out ivActivationConfig at this time since
        // we must defer the destruction of reference until endpoint is
        // activated. See MessageEndpointFactoryImpl.activateEndpoint method.
        //ivActivationConfig = null;   //LI2110.41

        if (isTraceOn && tc.isEntryEnabled()) //367834.5
            Tr.exit(tc, "finishBMDInitWithReferenceContext"); //367834.5 d640935.1

    }
public void finishBMDInitWithReferenceContext ( BeanMetaData bmd ) throws ContainerException , EJBConfigurationException { final boolean isTraceOn = TraceComponent . isAnyTracingEnabled ( ) ; if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . entry ( tc , "finishBMDInitWithReferenceContext" , bmd . j2eeName ) ; try { processReferenceContext ( bmd ) ; } catch ( InjectionException ex ) { for ( Throwable cause = ex . getCause ( ) ; cause != null ; cause = cause . getCause ( ) ) { if ( cause instanceof EJBConfigurationException ) { throw ( EJBConfigurationException ) cause ; } if ( cause instanceof ContainerException ) { throw ( ContainerException ) cause ; } } throw new EJBConfigurationException ( ex ) ; } EnterpriseBean eb = bmd . wccm . enterpriseBean ; if ( bmd . isStatefulSessionBean ( ) && ! bmd . usesBeanManagedTx ) { processSessionSynchronizationMD ( bmd , ( Session ) eb ) ; } if ( ! bmd . isEntityBean ( ) ) { initializeManagedObjectFactoryOrConstructor ( bmd ) ; } loadGeneratedImplementationClasses ( bmd , bmd . methodsExposedOnLocalInterface , bmd . methodsExposedOnRemoteInterface , bmd . methodsExposedOnLocalHomeInterface , bmd . methodsExposedOnRemoteHomeInterface ) ; if ( bmd . isEntityBean ( ) ) { initializeEntityConstructor ( bmd ) ; } if ( eb != null && eb . getKindValue ( ) == EnterpriseBean . KIND_MESSAGE_DRIVEN ) { MessageDriven mdb = ( MessageDriven ) eb ; String link = mdb . getLink ( ) ; if ( link != null ) { if ( isTraceOn && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "processing message-destination-link : " + link + " : " + bmd . j2eeName ) ; String moduleName = null ; String destJndiName = null ; String appName = bmd . j2eeName . getApplication ( ) ; Map < String , Map < String , String > > appMap = InjectionEngineAccessor . getMessageDestinationLinkInstance ( ) . getMessageDestinationLinks ( ) . get ( appName ) ; if ( appMap == null ) { appMap = new HashMap < String , Map < String , String > > ( ) ; InjectionEngineAccessor . getMessageDestinationLinkInstance ( ) . getMessageDestinationLinks ( ) . put ( appName , appMap ) ; } destJndiName = bmd . ivMessageDestinationJndiName ; int lindex = link . indexOf ( '#' ) ; if ( lindex != - 1 ) { int mindex = link . lastIndexOf ( '/' ) ; if ( mindex > - 1 && mindex < lindex ) { moduleName = link . substring ( mindex + 1 , lindex ) ; } else { moduleName = link . substring ( 0 , lindex ) ; } link = link . substring ( lindex + 1 ) ; } else { moduleName = bmd . j2eeName . getModule ( ) ; } Map < String , String > moduleMap = appMap . get ( moduleName ) ; if ( moduleMap == null ) { moduleMap = new HashMap < String , String > ( ) ; appMap . put ( moduleName , moduleMap ) ; } if ( isTraceOn && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "adding destination: " + link + " -> destinationJndiName:" + destJndiName + " for module: " + moduleName ) ; moduleMap . put ( link , destJndiName ) ; } } processZOSMetadata ( bmd ) ; if ( bmd . ivHasAsynchMethod ) { bmd . container . getEJBRuntime ( ) . setupAsync ( ) ; } bmd . validate ( ) ; bmd . fullyInitialized = true ; bmd . wccm = null ; bmd . ivInitData = null ; removeTemporaryMethodData ( bmd ) ; if ( bmd . _moduleMetaData . ivInterceptorBindingMap != null ) { bmd . _moduleMetaData . removeEJBInterceptorBindings ( bmd . enterpriseBeanName ) ; } if ( isTraceOn && TEBeanMetaDataInfo . isTraceEnabled ( ) ) TEBeanMetaDataInfo . writeTraceBeanMetaData ( bmd , bmd . ivModuleVersion ) ; if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "finishBMDInitWithReferenceContext" ) ; }
F743-17630 refactored method F743-17630CodRv