Package com.sun.enterprise.container.common.spi.util

Examples of com.sun.enterprise.container.common.spi.util.ComponentEnvManager


    }

    public <T> void aroundInject(InjectionContext<T> injectionContext) {
        try {
            ServiceLocator serviceLocator = Globals.getDefaultHabitat();
            ComponentEnvManager compEnvManager = serviceLocator.getService(ComponentEnvManager.class);
            EjbContainerServices containerServices = serviceLocator.getService(EjbContainerServices.class);

            JndiNameEnvironment componentEnv = compEnvManager.getCurrentJndiNameEnvironment();

            ManagedBeanDescriptor mbDesc = null;

            JndiNameEnvironment injectionEnv = (JndiNameEnvironment) bundleContext;
           
            Object target = injectionContext.getTarget();
            String targetClass = target.getClass().getName();

            if( componentEnv == null ) {
                //throw new IllegalStateException("No valid EE environment for injection of " + targetClass);
                System.err.println("No valid EE environment for injection of " + targetClass);
                injectionContext.proceed();
                return;
            }

            // Perform EE-style injection on the target.  Skip PostConstruct since
            // in this case 299 impl is responsible for calling it.

            if( componentEnv instanceof EjbDescriptor ) {

                EjbDescriptor ejbDesc = (EjbDescriptor) componentEnv;

                if( containerServices.isEjbManagedObject(ejbDesc, target.getClass())) {
                    injectionEnv = componentEnv;
                } else {

                    if( bundleContext instanceof EjbBundleDescriptor ) {

                        // Check if it's a @ManagedBean class within an ejb-jar.  In that case,
                        // special handling is needed to locate the EE env dependencies
                        mbDesc = bundleContext.getManagedBeanByBeanClass(targetClass);
                    }                   
                }
            }

            if( mbDesc != null ) {
                injectionManager.injectInstance(target, mbDesc.getGlobalJndiName(), false);
            } else {
                if( injectionEnv instanceof EjbBundleDescriptor ) {

                    // CDI-style managed bean that doesn't have @ManagedBean annotation but
                    // is injected within the context of an ejb.  Need to explicitly
                    // set the environment of the ejb bundle.
                    injectionManager.injectInstance(target, compEnvManager.getComponentEnvId(injectionEnv)
                        ,false);

                } else {
                    injectionManager.injectInstance(target, injectionEnv, false);
                }
View Full Code Here


    }

    public <T> void aroundInject(InjectionContext<T> injectionContext) {
        try {
            ServiceLocator serviceLocator = Globals.getDefaultHabitat();
            ComponentEnvManager compEnvManager = serviceLocator.getService(ComponentEnvManager.class);
            EjbContainerServices containerServices = serviceLocator.getService(EjbContainerServices.class);

            JndiNameEnvironment componentEnv = compEnvManager.getCurrentJndiNameEnvironment();

            ManagedBeanDescriptor mbDesc = null;

            JndiNameEnvironment injectionEnv = (JndiNameEnvironment) bundleContext;
           
            Object target = injectionContext.getTarget();
            String targetClass = target.getClass().getName();

            if( componentEnv == null ) {
                //throw new IllegalStateException("No valid EE environment for injection of " + targetClass);
                System.err.println("No valid EE environment for injection of " + targetClass);
                injectionContext.proceed();
                return;
            }

            // Perform EE-style injection on the target.  Skip PostConstruct since
            // in this case 299 impl is responsible for calling it.

            if( componentEnv instanceof EjbDescriptor ) {

                EjbDescriptor ejbDesc = (EjbDescriptor) componentEnv;

                if( containerServices.isEjbManagedObject(ejbDesc, target.getClass())) {
                    injectionEnv = componentEnv;
                } else {

                    if( bundleContext instanceof EjbBundleDescriptor ) {

                        // Check if it's a @ManagedBean class within an ejb-jar.  In that case,
                        // special handling is needed to locate the EE env dependencies
                        mbDesc = bundleContext.getManagedBeanByBeanClass(targetClass);
                    }                   
                }
            }

            if( mbDesc != null ) {
                injectionManager.injectInstance(target, mbDesc.getGlobalJndiName(), false);
            } else {
                if( injectionEnv instanceof EjbBundleDescriptor ) {

                    // CDI-style managed bean that doesn't have @ManagedBean annotation but
                    // is injected within the context of an ejb.  Need to explicitly
                    // set the environment of the ejb bundle.
                    injectionManager.injectInstance(target, compEnvManager.getComponentEnvId(injectionEnv)
                        ,false);

                } else {
                    injectionManager.injectInstance(target, injectionEnv, false);
                }
View Full Code Here

        Class annotatedClass = annotatedType.getJavaClass();
        JndiNameEnvironment jndiNameEnvironment = (JndiNameEnvironment) bundleContext;
        ServiceLocator serviceLocator = Globals.getDefaultHabitat();
        InvocationManager invocationManager = serviceLocator.getService(InvocationManager.class);
        ComponentEnvManager compEnvManager = serviceLocator.getService(ComponentEnvManager.class);
        String componentId = compEnvManager.getComponentEnvId(jndiNameEnvironment);
        String appName = bundleContext.getApplication().getAppName();
        String moduleName = bundleContext.getModuleName();

        ComponentInvocation componentInvocation = null;
View Full Code Here

        return returnValue;
    }

    private String getAppName() throws NamingException {

        ComponentEnvManager namingMgr =
                habitat.getComponent(ComponentEnvManager.class);

        String appName = null;

        if( namingMgr != null ) {
            JndiNameEnvironment env = namingMgr.getCurrentJndiNameEnvironment();

            BundleDescriptor bd = null;

            if( env instanceof EjbDescriptor ) {
                bd = (BundleDescriptor) ((EjbDescriptor)env).getEjbBundleDescriptor();
View Full Code Here

    }

    private String getModuleName() throws NamingException {

        ComponentEnvManager namingMgr =
                habitat.getComponent(ComponentEnvManager.class);

        String moduleName = null;

        if( namingMgr != null ) {
            JndiNameEnvironment env = namingMgr.getCurrentJndiNameEnvironment();

            BundleDescriptor bd = null;

            if( env instanceof EjbDescriptor ) {
                bd = (BundleDescriptor) ((EjbDescriptor)env).getEjbBundleDescriptor();
View Full Code Here

        String newName = null;
        Object returnValue = null;

        if( habitat != null ) {
            ComponentEnvManager namingMgr =
                habitat.getComponent(ComponentEnvManager.class);

            if( namingMgr != null ) {
                JndiNameEnvironment env = namingMgr.getCurrentJndiNameEnvironment();

                BundleDescriptor bd = null;

                if( env instanceof EjbDescriptor ) {
                    bd = (BundleDescriptor) ((EjbDescriptor)env).getEjbBundleDescriptor();
View Full Code Here

        }                     

    }

    private BundleDescriptor getBundle() {
        ComponentEnvManager compEnvManager = habitat.getByContract(ComponentEnvManager.class);

        JndiNameEnvironment env = compEnvManager.getCurrentJndiNameEnvironment();

        BundleDescriptor bundle = null;

        if( env instanceof BundleDescriptor) {
View Full Code Here

    }

    public <T> void aroundInject(InjectionContext<T> injectionContext) {
        try {
            ServiceLocator serviceLocator = Globals.getDefaultHabitat();
            ComponentEnvManager compEnvManager = serviceLocator.getService(ComponentEnvManager.class);
            EjbContainerServices containerServices = serviceLocator.getService(EjbContainerServices.class);

            JndiNameEnvironment componentEnv = compEnvManager.getCurrentJndiNameEnvironment();

            ManagedBeanDescriptor mbDesc = null;

            JndiNameEnvironment injectionEnv = (JndiNameEnvironment) bundleContext;

            AnnotatedType annotatedType = injectionContext.getAnnotatedType();
            Class targetClass = annotatedType.getJavaClass();
            String targetClassName = targetClass.getName();
            Object target = injectionContext.getTarget();

            if( componentEnv == null ) {
                //throw new IllegalStateException("No valid EE environment for injection of " + targetClassName);
                System.err.println("No valid EE environment for injection of " + targetClassName);
                injectionContext.proceed();
                return;
            }

            // Perform EE-style injection on the target.  Skip PostConstruct since
            // in this case 299 impl is responsible for calling it.

            if( componentEnv instanceof EjbDescriptor ) {

                EjbDescriptor ejbDesc = (EjbDescriptor) componentEnv;

                if( containerServices.isEjbManagedObject(ejbDesc, targetClass)) {
                    injectionEnv = componentEnv;
                } else {

                    if( bundleContext instanceof EjbBundleDescriptor ) {

                        // Check if it's a @ManagedBean class within an ejb-jar.  In that case,
                        // special handling is needed to locate the EE env dependencies
                        mbDesc = bundleContext.getManagedBeanByBeanClass(targetClassName);
                    }                   
                }
            }

            if( mbDesc != null ) {
                injectionManager.injectInstance(target, mbDesc.getGlobalJndiName(), false);
            } else {
                if( injectionEnv instanceof EjbBundleDescriptor ) {

                    // CDI-style managed bean that doesn't have @ManagedBean annotation but
                    // is injected within the context of an ejb.  Need to explicitly
                    // set the environment of the ejb bundle.
                    if ( target == null ) {
                        injectionManager.injectClass(targetClass, compEnvManager.getComponentEnvId(injectionEnv),false);
                    } else {
                        injectionManager.injectInstance(target, compEnvManager.getComponentEnvId(injectionEnv),false);
                    }
                } else {
                    if ( target == null ) {
                      injectionManager.injectClass(targetClass, injectionEnv, false);
                    } else {
View Full Code Here

        try {


            ServiceLocator h = Globals.getDefaultHabitat();
            ComponentEnvManager compEnvManager = (ComponentEnvManager) h.getService(ComponentEnvManager.class);

            EjbContainerServices containerServices = h.getService(EjbContainerServices.class);

            JndiNameEnvironment componentEnv = compEnvManager.getCurrentJndiNameEnvironment();

            ManagedBeanDescriptor mbDesc = null;

            JndiNameEnvironment injectionEnv = (JndiNameEnvironment) bundleContext;
           
            Object target = injectionContext.getTarget();
            String targetClass = target.getClass().getName();

            if( componentEnv == null ) {
                //throw new IllegalStateException("No valid EE environment for injection of " + targetClass);
                System.err.println("No valid EE environment for injection of " + targetClass);
                injectionContext.proceed();
                return;
            }

            // Perform EE-style injection on the target.  Skip PostConstruct since
            // in this case 299 impl is responsible for calling it.

            if( componentEnv instanceof EjbDescriptor ) {

                EjbDescriptor ejbDesc = (EjbDescriptor) componentEnv;

                if( containerServices.isEjbManagedObject(ejbDesc, target.getClass())) {
                    injectionEnv = componentEnv;
                } else {

                    if( bundleContext instanceof EjbBundleDescriptor ) {

                        // Check if it's a @ManagedBean class within an ejb-jar.  In that case,
                        // special handling is needed to locate the EE env dependencies
                        mbDesc = bundleContext.getManagedBeanByBeanClass(targetClass);
                    }                   
                }
            }

            if( mbDesc != null ) {
                injectionManager.injectInstance(target, mbDesc.getGlobalJndiName(), false);
            } else {
                if( injectionEnv instanceof EjbBundleDescriptor ) {

                    // CDI-style managed bean that doesn't have @ManagedBean annotation but
                    // is injected within the context of an ejb.  Need to explicitly
                    // set the environment of the ejb bundle.
                    injectionManager.injectInstance(target, compEnvManager.getComponentEnvId(injectionEnv)
                        ,false);

                } else {
                    injectionManager.injectInstance(target, injectionEnv, false);
                }
View Full Code Here

    @Override
    public void contextInitialized(ServletContextEvent sce) {

        WebServiceContractImpl wscImpl = WebServiceContractImpl.getInstance();
        ComponentEnvManager compEnvManager = wscImpl.getComponentEnvManager();
        JndiNameEnvironment jndiNameEnv = compEnvManager.getCurrentJndiNameEnvironment();
        WebBundleDescriptor webBundle = null;
        if (jndiNameEnv != null && jndiNameEnv instanceof WebBundleDescriptor) {
            webBundle = ((WebBundleDescriptor) jndiNameEnv);
        } else {
            throw new WebServiceException("Cannot intialize the JAXWSServlet for " + jndiNameEnv);
View Full Code Here

TOP

Related Classes of com.sun.enterprise.container.common.spi.util.ComponentEnvManager

Copyright © 2018 www.massapicom. 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.