Examples of JCDIService


Examples of com.sun.enterprise.container.common.spi.JCDIService

                // Create , inject, and call PostConstruct (if necessary) via managed bean manager
                managedObject = managedBeanMgr.createManagedBean(clazz, invokePostConstruct);

            } else {

                JCDIService jcdiService = habitat.getService(JCDIService.class);

                if( (jcdiService != null) && jcdiService.isCurrentModuleJCDIEnabled() ) {

                    // Create , inject, and call PostConstruct (if necessary)  via managed bean manager
                    managedObject = managedBeanMgr.createManagedBean(clazz, invokePostConstruct);

                } else {
View Full Code Here

Examples of com.sun.enterprise.container.common.spi.JCDIService

        ManagedBean managedBeanAnn = (ManagedBean) managedObjectClass.getAnnotation(ManagedBean.class);

        ManagedBeanManager managedBeanMgr = habitat.getService(ManagedBeanManager.class);

        JCDIService jcdiService = habitat.getService(JCDIService.class);

        if( (jcdiService != null) && jcdiService.isCurrentModuleJCDIEnabled() ) {

            // If 299-enabled always delegate to managed bean manager
            managedBeanMgr.destroyManagedBean(managedObject, validate);

        } else {
View Full Code Here

Examples of com.sun.enterprise.container.common.spi.JCDIService

        InvocationManager invocationMgr =
            webContainer.getInvocationManager();
        WebComponentInvocation inv = new WebComponentInvocation(webModule);
        try {
            invocationMgr.preInvoke(inv);
            JCDIService jcdiService = defaultServices.getService(JCDIService.class);
            // JCDIService can be absent if weld integration is missing in the runtime, so check for null is needed.
            if (jcdiService != null && jcdiService.isCurrentModuleJCDIEnabled()) {
                jcdiService.setELResolver(servletContext);
            }
        } catch (NamingException e) {
            // Ignore
        } finally {
            invocationMgr.postInvoke(inv);
View Full Code Here

Examples of com.sun.enterprise.container.common.spi.JCDIService

    protected EJBContextImpl createEjbInstanceAndContext() throws Exception {

        ServiceLocator services = ejbContainerUtilImpl.getServices();

        JCDIService jcdiService = services.getService(JCDIService.class);

        EjbBundleDescriptorImpl ejbBundle = ejbDescriptor.getEjbBundleDescriptor();

  Object instance = null;
  JCDIService.JCDIInjectionContext jcdiCtx = null;

        if( (jcdiService != null) && jcdiService.isJCDIEnabled(ejbBundle)) {

    
      Constructor[] ctors = ejbClass.getConstructors();
      boolean hasCtorWithArgs = false;
      for(Constructor ctor : ctors) {
    if( ctor.getParameterTypes().length > 0 ) {
        hasCtorWithArgs = true;
        break;
    }
      }

      // If constructor injection is being used, let CDI create the instance.
      // Either way, instance will be part of JCDI injection context.
      jcdiCtx = hasCtorWithArgs ?
    jcdiService.createJCDIInjectionContext(ejbDescriptor) :
    jcdiService.createJCDIInjectionContext(ejbDescriptor, _constructEJBInstance());

      instance = jcdiCtx.getInstance();

  } else {
      instance = _constructEJBInstance();
View Full Code Here

Examples of com.sun.enterprise.container.common.spi.JCDIService

    protected void injectEjbInstance(EJBContextImpl context) throws Exception {
       
        ServiceLocator services = ejbContainerUtilImpl.getServices();

        JCDIService jcdiService = services.getService(JCDIService.class);

        EjbBundleDescriptorImpl ejbBundle = ejbDescriptor.getEjbBundleDescriptor();

        Object[] interceptorInstances = null;

        if( (jcdiService != null) && jcdiService.isJCDIEnabled(ejbBundle)) {

      jcdiService.injectEJBInstance(context.getJCDIInjectionContext());

            Class[] interceptorClasses = interceptorManager.getInterceptorClasses();

            interceptorInstances = new Object[interceptorClasses.length];

            for(int i = 0; i < interceptorClasses.length; i++) {
                // 299 impl will instantiate and inject the instance, but PostConstruct
                // is still our responsibility
                interceptorInstances[i] = jcdiService.createManagedObject(interceptorClasses[i],
                        ejbBundle, false).getInstance();
            }

            interceptorManager.initializeInterceptorInstances(interceptorInstances);
View Full Code Here

Examples of com.sun.enterprise.container.common.spi.JCDIService

        loadManagedBeans(app);
    }
   
    public void loadManagedBeans(Application app) {

        JCDIService jcdiService = habitat.getService(JCDIService.class);

        for(BundleDescriptor bundle : app.getBundleDescriptors()) {

            if (!bundleEligible(bundle)) {
                continue;
            }

            boolean validationRequired  = (bundle instanceof EjbBundleDescriptor)
                    || (bundle instanceof ApplicationClientDescriptor);

            boolean isCDIBundle = (jcdiService != null && jcdiService.isJCDIEnabled(bundle));

            for(ManagedBeanDescriptor next : bundle.getManagedBeans()) {

                try {
View Full Code Here

Examples of com.sun.enterprise.container.common.spi.JCDIService

     * @return
     * @throws Exception
     */
    public <T> T createManagedBean(ManagedBeanDescriptor desc, Class<T> managedBeanClass) throws Exception {

        JCDIService jcdiService = habitat.getService(JCDIService.class);

        BundleDescriptor bundleDescriptor = null;

        if( desc == null ) {
            bundleDescriptor = getBundle();
        } else {
            bundleDescriptor = desc.getBundleDescriptor();
        }

        if( bundleDescriptor == null ) {
            throw new IllegalStateException
                ("Class " + managedBeanClass + " is not a valid EE ManagedBean class");
        }

        T callerObject = null;
       
        if( (jcdiService != null) && jcdiService.isJCDIEnabled(bundleDescriptor)) {

            // Have 299 create, inject, and call PostConstruct on managed bean

            JCDIService.JCDIInjectionContext jcdiContext =
                jcdiService.createManagedObject(managedBeanClass, bundleDescriptor);
            callerObject = (T) jcdiContext.getInstance();

            // Need to keep track of context in order to destroy properly
            Map<Object, JCDIService.JCDIInjectionContext> bundleNonManagedObjs =
                jcdiManagedBeanInstanceMap.get(bundleDescriptor);
View Full Code Here

Examples of com.sun.enterprise.container.common.spi.JCDIService

     * @throws Exception
     */
    public <T> T createManagedBean(ManagedBeanDescriptor desc, Class<T> managedBeanClass,
        boolean invokePostConstruct) throws Exception {

        JCDIService jcdiService = habitat.getService(JCDIService.class);

        BundleDescriptor bundleDescriptor = null;

        if( desc == null ) {
            bundleDescriptor = getBundle();
        } else {
            bundleDescriptor = desc.getBundleDescriptor();
        }

        if( bundleDescriptor == null ) {
            throw new IllegalStateException
                ("Class " + managedBeanClass + " is not a valid EE ManagedBean class");
        }

        T callerObject = null;

        if( (jcdiService != null) && jcdiService.isJCDIEnabled(bundleDescriptor)) {

            // Have 299 create, inject, and call PostConstruct (if desired) on managed bean

            JCDIService.JCDIInjectionContext jcdiContext =
                jcdiService.createManagedObject(managedBeanClass, bundleDescriptor, invokePostConstruct);
            callerObject = (T) jcdiContext.getInstance();
            // Need to keep track of context in order to destroy properly
            Map<Object, JCDIService.JCDIInjectionContext> bundleNonManagedObjs =
                jcdiManagedBeanInstanceMap.get(bundleDescriptor);
            bundleNonManagedObjs.put(callerObject, jcdiContext);
View Full Code Here

Examples of com.sun.enterprise.container.common.spi.JCDIService

    public void destroyManagedBean(Object managedBean, boolean validate)  {

        BundleDescriptor bundle = getBundle();

        JCDIService jcdiService = habitat.getService(JCDIService.class);

        if( (jcdiService != null) && jcdiService.isJCDIEnabled(bundle)) {
            Map<Object, JCDIService.JCDIInjectionContext> bundleNonManagedObjs = jcdiManagedBeanInstanceMap.get(bundle);
            // in a failure scenario it's possible that bundleNonManagedObjs is null
            if ( bundleNonManagedObjs == null ) {
                if (validate) {
                    throw new IllegalStateException("Unknown JCDI-enabled managed bean " +
View Full Code Here

Examples of com.sun.enterprise.container.common.spi.JCDIService

     * @return
     * @throws Exception
     */
    public <T> T createManagedBean(ManagedBeanDescriptor desc, Class<T> managedBeanClass) throws Exception {

        JCDIService jcdiService = habitat.getService(JCDIService.class);

        BundleDescriptor bundleDescriptor = null;

        if( desc == null ) {
            bundleDescriptor = getBundle();
        } else {
            bundleDescriptor = desc.getBundleDescriptor();
        }

        if( bundleDescriptor == null ) {
            throw new IllegalStateException
                ("Class " + managedBeanClass + " is not a valid EE ManagedBean class");
        }

        T callerObject = null;
       
        if( (jcdiService != null) && jcdiService.isJCDIEnabled(bundleDescriptor)) {

            // Have 299 create, inject, and call PostConstruct on managed bean

            JCDIService.JCDIInjectionContext jcdiContext =
                jcdiService.createManagedObject(managedBeanClass, bundleDescriptor);
            callerObject = (T) jcdiContext.getInstance();

            // Need to keep track of context in order to destroy properly
            Map<Object, JCDIService.JCDIInjectionContext> bundleNonManagedObjs =
                jcdiManagedBeanInstanceMap.get(bundleDescriptor);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.