Examples of JCDIService


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);
            JCDIService.JCDIInjectionContext context =
                    bundleNonManagedObjs.remove(managedBean)
View Full Code Here

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

    protected EJBContextImpl createEjbInstanceAndContext() throws Exception {

  Habitat h = ejbContainerUtilImpl.getDefaultHabitat();

        JCDIService jcdiService = h.getByContract(JCDIService.class);

        EjbBundleDescriptor 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 {
       
        Habitat h = ejbContainerUtilImpl.getDefaultHabitat();

        JCDIService jcdiService = h.getByContract(JCDIService.class);

        EjbBundleDescriptor 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

        int i = ejbClassName.lastIndexOf('.');
        if (i > -1) {
            shortClassName = ejbClassName.substring(i + 1);
        }

        JCDIService jcdiService = (sl == null)? null : sl.getService(JCDIService.class);
        if (jcdiService != null && jcdiService.isJCDIEnabled(getEjbBundleDescriptor())) {
            try {
                Class beanClass = classLoader.loadClass(getEjbClassName());
                Constructor<?>[] ctors = beanClass.getDeclaredConstructors();

                String[] parameterClassNames = null;
View Full Code Here

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

        int i = ejbClassName.lastIndexOf('.');
        if (i > -1) {
            shortClassName = ejbClassName.substring(i + 1);
        }

        JCDIService jcdiService = (sl == null)? null : sl.getService(JCDIService.class);
        if (jcdiService != null && jcdiService.isJCDIEnabled(getEjbBundleDescriptor())) {
            try {
                Class beanClass = classLoader.loadClass(getEjbClassName());
                Constructor<?>[] ctors = beanClass.getDeclaredConstructors();

                String[] parameterClassNames = null;
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 {

  Habitat h = ejbContainerUtilImpl.getDefaultHabitat();

        JCDIService jcdiService = h.getByContract(JCDIService.class);

        EjbBundleDescriptor 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 {
       
        Habitat h = ejbContainerUtilImpl.getDefaultHabitat();

        JCDIService jcdiService = h.getByContract(JCDIService.class);

        EjbBundleDescriptor 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

        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
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.