Method for calling AroundConstruct interceptors and setting the enterprise bean instance. <p>
494283
private InvocationContextImpl<?> callAroundConstructInterceptors(InterceptorProxy[] proxies, CallbackContextHelper contextHelper) {
        final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
        if (isTraceOn && tc.isEntryEnabled())
            Tr.entry(tc, "callAroundConstructInterceptors");
        InvocationContextImpl invCtx = createInvocationContext();
        try {
            BeanMetaData bmd = home.beanMetaData;
            ManagedObjectFactory<?> managedObjectFactory = bmd.ivEnterpriseBeanFactory;
            invCtx.initializeForAroundConstruct(ivEjbManagedObjectContext, ivInterceptors, proxies);

            if (managedObjectFactory == null) {
                setEnterpriseBean(invCtx.aroundConstruct(this, new Object[0], null));
            } else {
                ivManagedObject = managedObjectFactory.createManagedObject(invCtx);
                setEnterpriseBean(ivManagedObject.getObject());
            }

            return invCtx;
        } catch (Throwable t) {
            if (! (t instanceof ManagedObjectException)) {
                FFDCFilter.processException(t, CLASS_NAME + ".callAroundConstructInterceptors", "377", this);
                // If a root cause exception was captured, then return the context and let the caller
                // properly report the failure and cause; otherwise throw generic EJBException.
                if (invCtx.ivAroundConstructException != null) {
                    return invCtx;
                }
                throw ExceptionUtil.EJBException("AroundConstruct interceptor failure", t);
            } else {
                Throwable cause = t.getCause();
                FFDCFilter.processException(cause, CLASS_NAME + ".callAroundConstructInterceptors", "386", this);
                // If a root cause exception was captured, then return the context and let the caller
                // properly report the failure and cause; otherwise throw generic EJBException.
                if (invCtx.ivAroundConstructException != null) {
                    return invCtx;
                }
                throw ExceptionUtil.EJBException("AroundConstruct interceptor failure", cause);
            }
        } finally {
            if (contextHelper != null) {
                contextHelper.resetContextData();
            }
            if (isTraceOn && tc.isEntryEnabled())
                Tr.exit(tc, "callAroundConstructInterceptors");
        }
    }
417106
public AbstractEndpointBuilder<T> applicationContext(ApplicationContext applicationContext) {
        if (getEndpoint() instanceof ApplicationContextAware) {
            ((ApplicationContextAware) getEndpoint()).setApplicationContext(applicationContext);
        }

        if (getEndpoint() instanceof BeanFactoryAware) {
            ((BeanFactoryAware) getEndpoint()).setBeanFactory(applicationContext);
        }

        return this;
    }
447805
private void createInstanceUsingConstructor() throws InvocationTargetException {
        final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
        if (isTraceOn && tc.isEntryEnabled())
            Tr.entry(tc, "createInstanceUsingConstructor");

        try {
            if (isTraceOn && tc.isDebugEnabled())
                Tr.debug(tc, "calling Constructor.newInstance");
            Constructor<?> con = home.beanMetaData.getEnterpriseBeanClassConstructor();
            setEnterpriseBean(con.newInstance());
        } catch (InvocationTargetException e) {
            FFDCFilter.processException(e, CLASS_NAME + ".createInstanceUsingConstructor", "360", this);
            throw e;
        } catch (Exception e) {
            // Reflection exceptions are unexpected.
            FFDCFilter.processException(e, CLASS_NAME + ".createInstanceUsingConstructor", "364", this);
            throw new EJBException(home.beanMetaData.enterpriseBeanClassName, e);
        }

        if (isTraceOn && tc.isEntryEnabled())
            Tr.exit(tc, "createInstanceUsingConstructor");
    }
989238
public synchronized void setBeanContext(BeanContext beanContext)
        throws PropertyVetoException
    {
        ControlBeanContext cbcs = null;

        if (beanContext != null)
        {
            //
            // ControlBeans can only be nested in context service instances that derive
            // from ControlBeanContext.
            //
            if (!(beanContext instanceof ControlBeanContext))
            {
                PropertyChangeEvent pce = new PropertyChangeEvent(_bean, "beanContext", getBeanContext(), beanContext);
                throw new PropertyVetoException("Context does not support nesting controls: " +
                                                beanContext.getClass(), pce);
            }

            cbcs = (ControlBeanContext)beanContext;
        }


        _beanContextServicesDelegate.setBeanContext(beanContext);

        resetControlID();

        _hasSingleThreadedParent = cbcs != null ? cbcs.isSingleThreadedContainer() : false;

        //
        // Notify the bean that its context (container) has been set.
        //
        if (_bean != null)
            _bean.setBeanContext(beanContext);
    }
427459
private static void buildComponents(ExecutionContext context) throws ClassNotFoundException, NoSuchMethodException,
            IllegalAccessException, InvocationTargetException, InstantiationException {
        Collection<BeanDef> cDefs = context.getTopologyDef().getComponents();
        if (cDefs != null) {
            for (BeanDef bean : cDefs) {
                Object obj = buildObject(bean, context);
                context.addComponent(bean.getId(), obj);
            }
        }
    }
997685
@Override
	public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
		logger.debug("Inject ApplicationContext: {} into SpringContextsUtil", applicationContext);
		SpringContextsUtil.applicationContext = applicationContext;
	}
1372627
protected void initialize() {
        _bcMembershipListeners = new ArrayList<BeanContextMembershipListener>();
        _children = Collections.synchronizedMap(new HashMap<Object, BCChild>());

        _childPcl = new PropertyChangeListener() {
            public void propertyChange(PropertyChangeEvent pce) {
                ControlBeanContextSupport.this.propertyChange(pce);
            }
        };

        _childVcl = new VetoableChangeListener() {
            public void vetoableChange(PropertyChangeEvent pce) throws PropertyVetoException {
                ControlBeanContextSupport.this.vetoableChange(pce);
            }
        };
    }
277319
private void updateNamesToClassMap(Collection<String> classInterceptorNames) throws EJBConfigurationException
    {
        String classNameToLoad = null;
        try
        {
            // for each interceptor class name.
            for (String name : classInterceptorNames)
            {
                // Get class object from the name to class map.
                Class<?> interceptorClass = ivInterceptorNameToClassMap.get(name);

                // Class already in the map?
                if (interceptorClass == null)
                {
                    // Nope, then load it and put it in the map.
                    classNameToLoad = name;
                    interceptorClass = ivClassLoader.loadClass(name);
                    ivInterceptorNameToClassMap.put(name, interceptorClass);
                }
            }
        } catch (ClassNotFoundException ex)
        {
            //FFDCFilter.processException(ex, CLASS_NAME + ".addClassLevelInterceptors", "376");

            // CNTR0075E: The user-provided class "{0}" needed by the EnterpriseBean could not be found or loaded.
            Tr.error(tc, "BEANCLASS_NOT_FOUND_CNTR0075E", classNameToLoad);

            EJBConfigurationException cex;
            cex = new EJBConfigurationException(classNameToLoad + " could not be found or loaded", ex);
            throw cex;
        }
    }
94107
@Override
    public void internalInitialize(BeanDeployerEnvironment environment) {
        preInitialize();
        BeanLogger.LOG.creatingBean(getType());
        if (getScope() != null) {
            proxyRequired = isNormalScoped();
        } else {
            proxyRequired = false;
        }
        BeanLogger.LOG.qualifiersUsed(getQualifiers(), this);
        BeanLogger.LOG.usingName(getName(), this);
        BeanLogger.LOG.usingScope(getScope(), this);
    }
1287435
private void initEjbInterceptors() {
        initClassDeclaredEjbInterceptors();
        if (constructor != null) {
            initConstructorDeclaredEjbInterceptors();
        }
        for (AnnotatedMethod<?> method : businessMethods) {
            initMethodDeclaredEjbInterceptors(method);
        }
    }
1055177
private Context createContext() throws Exception
   {
      Properties properties = new Properties();
      properties.setProperty("java.naming.factory.initial", "org.jnp.interfaces.LocalOnlyContextFactory");
      properties.setProperty("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");
      return new InitialContext(properties);
   }
126751
protected void addConstructors(ClassFile proxyClassType, List<DeferredBytecode> initialValueBytecode) {
        try {
            if (getBeanType().isInterface()) {
                ConstructorUtils.addDefaultConstructor(proxyClassType, initialValueBytecode, !useConstructedFlag());
            } else {
                boolean constructorFound = false;
                for (Constructor<?> constructor : AccessController.doPrivileged(new GetDeclaredConstructorsAction(getBeanType()))) {
                    if ((constructor.getModifiers() & Modifier.PRIVATE) == 0) {
                        constructorFound = true;
                        String[] exceptions = new String[constructor.getExceptionTypes().length];
                        for (int i = 0; i < exceptions.length; ++i) {
                            exceptions[i] = constructor.getExceptionTypes()[i].getName();
                        }
                        ConstructorUtils.addConstructor(BytecodeUtils.VOID_CLASS_DESCRIPTOR, DescriptorUtils.parameterDescriptors(constructor.getParameterTypes()), exceptions, proxyClassType, initialValueBytecode, !useConstructedFlag());
                    }
                }
                if (!constructorFound) {
                    // the bean only has private constructors, we need to generate
                    // two fake constructors that call each other
                    addConstructorsForBeanWithPrivateConstructors(proxyClassType);
                }
            }
        } catch (Exception e) {
            throw new WeldException(e);
        }
    }
153513
protected EJSHome initializeDeferredEJBImpl(HomeRecord hr) throws ContainerException, EJBConfigurationException {
        BeanMetaData bmd = hr.getBeanMetaData();
        Object originalLoader = ThreadContextAccessor.UNCHANGED;

        try {
            if (!bmd.fullyInitialized) // d664917.1
            {
                // The server class loader must be used during metadata processing
                // for XML parsing classes.                         d200714, PM57099
                originalLoader = svThreadContextAccessor.pushContextClassLoader(getServerClassLoader()); // d278756, d334557, PK83186, d640395.1

                //------------------------------------------------------------------------
                // WARNING: We MUST reload WCCM object pointers here in case the module was
                //          unloaded.  The WAS runtime code has an alarm thread which unloads
                //          the module after a fixed time.  In the case of deferred EJB init
                //          processing it is up to us to "touch" the DeployedModule which will
                //          cause WCCM to completely reload a new set of WCCM objects for us.
                //------------------------------------------------------------------------
                bmd.wccm.reload(); // F743-18775

                finishBMDInit(bmd); //497153
            }

            //d200714 start
            // We must ensure that the application classloader is in force prior to starting
            // the home.
            originalLoader = svThreadContextAccessor.repushContextClassLoader(originalLoader, hr.getClassLoader());
            //d200714 end

            return fireMetaDataCreatedAndStartBean(bmd); // d648522, d739043
        } finally {
            svThreadContextAccessor.popContextClassLoader(originalLoader);

            // d659020 - If an error occurs while initializing, then the wccm
            // field will not be cleared, so we need to unload its references.
            // The next attempt to initialize the bean will reload them again.
            if (bmd.wccm != null) {
                bmd.wccm.unload();
            }
        }
    }
62532
protected static void addInterceptors( org.apache.beehive.netui.util.config.bean.InterceptorConfig[] configBeans,
                                           List/*< Interceptor >*/ interceptorsList,
                                           Class baseClassOrInterface )
    {
        if ( configBeans != null )
        {
            for ( int i = 0; i < configBeans.length; i++ )
            {
                org.apache.beehive.netui.util.config.bean.InterceptorConfig configBean = configBeans[i];
                String className = configBean.getInterceptorClass();
                InterceptorConfig config = new InterceptorConfig( className );
                CustomPropertyConfig[] customProps = configBean.getCustomProperties();

                if ( customProps != null )
                {
                    for ( int j = 0; j < customProps.length; j++ )
                    {
                        CustomPropertyConfig customProp = customProps[j];
                        config.addCustomProperty( customProp.getName(), customProp.getValue() );
                    }
                }
                
                addInterceptor( config, baseClassOrInterface, interceptorsList );
            }
        }
    }
169688
protected void configureAop() {
        final RepositoryMethodInterceptor proxy = new RepositoryMethodInterceptor();
        requestInjection(proxy);
        // repository specific method annotations (query, function, delegate, etc.)
        bindInterceptor(Matchers.any(), new AbstractMatcher<Method>() {
            @Override
            public boolean matches(final Method method) {
                // this will throw error if two or more annotations specified (fail fast)
                try {
                    return ExtUtils.findMethodAnnotation(method) != null;
                } catch (Exception ex) {
                    throw new MethodDefinitionException(String.format("Error declaration on method %s",
                            RepositoryUtils.methodToString(method)), ex);
                }
            }
        }, proxy);
    }
825796
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
		this.applicationContext = applicationContext;

		if (servletContext == null)
			if (applicationContext instanceof WebApplicationContext) {
				servletContext = ((WebApplicationContext) applicationContext).getServletContext();
				if (servletContext == null) {
					System.err.print("this class only fit for Spring Web Application");
					return;
				}

			}

		// start up jdon
		AppContextWrapper acw = new ServletContextWrapper(servletContext);
		ContainerFinder containerFinder = new ContainerFinderImp();
		containerWrapper = containerFinder.findContainer(acw);

	}
471627
private void setExcludeDefaultInterceptors()
    {
        EJBInterceptorBinding binding = ivClassInterceptorBinding;
        boolean useAnnotation = false;
        if (binding == null)
        {
            // Use annotation provided metadata-complete is false.
            useAnnotation = !ivMetadataComplete;
        }
        else
        {
            // Assumption is xml overrides annotation, although EJB spec implies
            // interceptor-binding is used to augment annotation.  Not clear what
            // is intended, but we are going to assume xml overrides annotation.
            Boolean exclude = binding.ivExcludeDefaultLevelInterceptors;
            if (exclude == null)
            {
                // exclude is not set in ejb-jar.xml for class level binding,
                // Use annotation provided metadata-complete is false.
                useAnnotation = !ivMetadataComplete;
            }
            else if (exclude == Boolean.TRUE)
            {
                ivExcludeDefaultFromClassLevel = true;
            }
            else
            {
                ivExcludeDefaultFromClassLevel = false;
            }
        }

        // If xml did not have a exclude-default-interceptor setting for
        // class level binding, then see if annotation indicates to exclude
        // default level interceptors.
        if (useAnnotation)
        {
            ExcludeDefaultInterceptors a = ivEjbClass.getAnnotation(ExcludeDefaultInterceptors.class);
            if (a != null)
            {
                ivExcludeDefaultFromClassLevel = true;
            }
            else
            {
                ivExcludeDefaultFromClassLevel = false;
            }
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
        {
            Tr.debug(tc, "setExcludeDefaultInterceptors: " + ivExcludeDefaultFromClassLevel);
        }
    }