Package com.sun.ejb

Examples of com.sun.ejb.InvocationInfo


       
    {
        MethodDescriptor md = new MethodDescriptor(method, methodIntf);
        boolean flushEnabled = findFlushEnabledAttr(md);
        int txAttr = containerTransactionManager.findTxAttr(md);
        InvocationInfo info = createInvocationInfo
            (method, txAttr, flushEnabled, methodIntf, originalIntf);
        boolean isHomeIntf = (methodIntf.equals(MethodDescriptor.EJB_HOME)
                || methodIntf.equals(MethodDescriptor.EJB_LOCALHOME));
        if (! isHomeIntf) {
            Method beanMethod = null;
            if (!isEjbTimeout) {
                try {
                    beanMethod = getEJBClass().getMethod(
                            method.getName(), method.getParameterTypes());
                } catch (NoSuchMethodException nsmEx) {
                    //TODO
                }
            } else {
                // For a timeout it is the method
                beanMethod = method;
            }

            if( beanMethod != null ) {
                // Can't set AroundInvoke/AroundTimeout chains here, but set up some
                // state on info object so it can be done right after InterceptorManager
                // is initialized.
                info.aroundMethod = beanMethod;
                info.isEjbTimeout = isEjbTimeout;
            }


            // Asynchronous method initialization       
            if ( isEligibleForAsync(originalIntf, methodIntf) ) {

                Method targetMethod = optionalLocalBusView ? beanMethod : method;

                boolean isAsync = ((EjbSessionDescriptor) ejbDescriptor).
                        isAsynchronousMethod(targetMethod);

                if( isAsync ) {

                    // Check return type
                    if( optionalLocalBusView ) {

                        boolean beanMethodReturnTypeVoid = beanMethod.getReturnType().equals(Void.TYPE);
                        boolean beanMethodReturnTypeFuture = beanMethod.getReturnType().equals(Future.class);

                        if ( !beanMethodReturnTypeVoid && !beanMethodReturnTypeFuture ){
                            throw new RuntimeException("Invalid no-interface view asynchronous method '"
                                    + beanMethod + "' for bean " + ejbDescriptor.getName() +
                                    ". Async method exposed through no-interface view must " +
                                    " have return type void or java.lang.concurrent.Future<V>");
                        }

                    } else {

                        // Use actual interface method instead of method from generated interface
                        Method intfMethod = null;
                        try {
                            intfMethod = originalIntf.getMethod(
                                method.getName(), method.getParameterTypes());
                        } catch (NoSuchMethodException nsmEx) {
                            throw new RuntimeException("No matching async intf method for method '" +
                                beanMethod + "' on bean " + ejbDescriptor.getName());
                        }

                        if( beanMethod == null ) {

                            throw new RuntimeException("No matching bean class method for async method '" +
                                intfMethod + "' on bean " + ejbDescriptor.getName());
                        }

                        boolean beanMethodReturnTypeVoid = beanMethod.getReturnType().equals(Void.TYPE);
                        boolean beanMethodReturnTypeFuture = beanMethod.getReturnType().equals(Future.class);

                        boolean intfMethodReturnTypeVoid = intfMethod.getReturnType().equals(Void.TYPE);
                        boolean intfMethodReturnTypeFuture = intfMethod.getReturnType().equals(Future.class);

                        boolean bothVoid = intfMethodReturnTypeVoid && beanMethodReturnTypeVoid;
                        boolean bothFuture = intfMethodReturnTypeFuture && beanMethodReturnTypeFuture;

                        boolean valid = false;

                        if( bothVoid ) {
                            valid = true;
                        } else if( bothFuture ) {
                            valid = true;
                        }

                        if( !valid ) {
                            throw new RuntimeException("Invalid asynchronous bean class / interface " +
                                    "method signatures for bean " + ejbDescriptor.getName() +
                                    ". beanMethod = '" + beanMethod + "' , interface method = '"
                                        +  intfMethod + "'");
                        }
                    }

                    info.setIsAsynchronous(true);

                }
            }
        }
       
View Full Code Here


                                                boolean flushEnabled,
                                                String methodIntf,
                                                Class originalIntf)
        throws EJBException {

        InvocationInfo invInfo = new InvocationInfo(method);

        invInfo.ejbName = ejbDescriptor.getName();
        invInfo.txAttr = txAttr;
        invInfo.methodIntf = methodIntf;

        invInfo.isBusinessMethod = isBusinessMethod(method);
        invInfo.isCreateHomeFinder = isCreateHomeFinder(method);

        invInfo.startsWithCreate = method.getName().startsWith("create");
        invInfo.startsWithFind = method.getName().startsWith("find");
        invInfo.startsWithRemove = method.getName().startsWith("remove");
        invInfo.startsWithFindByPrimaryKey =
            method.getName().startsWith("findByPrimaryKey");
        invInfo.flushEnabled = flushEnabled;

        if( methodIntf.equals(MethodDescriptor.EJB_LOCALHOME) ) {
            if( method.getDeclaringClass() != EJBLocalHome.class ) {
                setHomeTargetMethodInfo(invInfo, true);
            }
        } else if( methodIntf.equals(MethodDescriptor.EJB_HOME) ) {
            if( method.getDeclaringClass() != EJBHome.class ) {
                setHomeTargetMethodInfo(invInfo, false);
            }
        } else if( methodIntf.equals(MethodDescriptor.EJB_LOCAL) ) {
            if( method.getDeclaringClass() != EJBLocalObject.class ) {
                setEJBObjectTargetMethodInfo(invInfo, true, originalIntf);
            }
        } else if( methodIntf.equals(MethodDescriptor.EJB_REMOTE) ) {
            if( method.getDeclaringClass() != EJBObject.class ) {
                setEJBObjectTargetMethodInfo(invInfo, false, originalIntf);
            }
        }

        setConcurrencyInvInfo(method, methodIntf, invInfo);

        if( _logger.isLoggable(Level.FINE) ) {
            _logger.log(Level.FINE, invInfo.toString());
        }

        adjustInvocationInfo(invInfo, method, txAttr, flushEnabled, methodIntf, originalIntf);

        return invInfo;
View Full Code Here

            if( hasLocalHomeView ) {
                // Process Local interface
                Method[] methods = localIntf.getMethods();
                for ( int i=0; i<methods.length; i++ ) {
                    Method method = methods[i];                   
                    InvocationInfo info = addInvocationInfo(method, MethodDescriptor.EJB_LOCAL,
                                      localIntf);
                    postProcessInvocationInfo(info);
                }

                // Process LocalHome interface
View Full Code Here

        return isPassivationCapable;
    }
   
    private InvocationInfo getLifecycleCallbackInvInfo(
            Set<LifecycleCallbackDescriptor> lifecycleCallbackDescriptors) throws Exception {
        InvocationInfo inv = new InvocationInfo();
        inv.ejbName = ejbDescriptor.getName();
        inv.methodIntf = MethodDescriptor.LIFECYCLE_CALLBACK;
        inv.txAttr = getTxAttrForLifecycleCallback(lifecycleCallbackDescriptors,
                -1, Container.TX_NOT_SUPPORTED, Container.TX_REQUIRES_NEW);
View Full Code Here

    protected void loadCheckpointInfo() {
        try {
            if (isHAEnabled) {
                Iterator iter = invocationInfoMap.values().iterator();
                while (iter.hasNext()) {
                    InvocationInfo info = (InvocationInfo) iter.next();
                    info.checkpointEnabled = false;
                    MethodDescriptor md = new MethodDescriptor(
                            info.method, info.methodIntf);
                    IASEjbExtraDescriptors extraDesc =
                            ejbDescriptor.getIASEjbExtraDescriptors();
View Full Code Here

        // be called.

        // If this was an invocation of a remove-method
        if (inv.invocationInfo.removalInfo != null) {

            InvocationInfo invInfo = inv.invocationInfo;
            EjbRemovalInfo removeInfo = invInfo.removalInfo;

            if (retainAfterRemoveMethod(inv, removeInfo)) {
                // Do nothing
            } else {
View Full Code Here


            // If this was an invocation of a remove-method
            if (inv.invocationInfo.removalInfo != null) {

                InvocationInfo invInfo = inv.invocationInfo;
                EjbRemovalInfo removeInfo = invInfo.removalInfo;

                if (retainAfterRemoveMethod(inv, removeInfo)) {
                    _logger.log(Level.FINE, "Skipping destruction of SFSB "
                            + invInfo.ejbName + " after @Remove method "
View Full Code Here

                return null;
            }

            // Use optimized version of get that takes param count as an
            // argument.
            InvocationInfo invInfo = (InvocationInfo)
                invocationInfoMap_.get(method,
                                       ((args != null) ? args.length : 0) );
           
            if( invInfo == null ) {
View Full Code Here

        prePassivateInvInfo = getLifecycleCallbackInvInfo(sfulDesc.getPrePassivateDescriptors());
    }

    private InvocationInfo getLifecycleCallbackInvInfo(
            Set<LifecycleCallbackDescriptor> lifecycleCallbackDescriptors) throws Exception {
        InvocationInfo inv = new InvocationInfo();
        inv.ejbName = ejbDescriptor.getName();
        inv.methodIntf = MethodDescriptor.EJB_BEAN;
        inv.txAttr = getTxAttrForLifecycleCallback(lifecycleCallbackDescriptors,
                -1, Container.TX_NOT_SUPPORTED, Container.TX_REQUIRES_NEW);
View Full Code Here

    protected void loadCheckpointInfo() {
        try {
            if (checkpointPolicy.isHAEnabled()) {
                Iterator iter = invocationInfoMap.values().iterator();
                while (iter.hasNext()) {
                    InvocationInfo info = (InvocationInfo) iter.next();
                    info.checkpointEnabled = false;
                    MethodDescriptor md = new MethodDescriptor(
                            info.method, info.methodIntf);
                    IASEjbExtraDescriptors extraDesc =
                            ejbDescriptor.getIASEjbExtraDescriptors();
View Full Code Here

TOP

Related Classes of com.sun.ejb.InvocationInfo

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.