Package org.apache.openejb

Examples of org.apache.openejb.MethodContext


    }

    public static CalendarTimerData timerData() throws Exception {
        final BeanContext context = SystemInstance.get().getComponent(ContainerSystem.class).getBeanContext("EJBWithTimer");
        final EjbTimerService timer = context.getEjbTimerService();
        final MethodContext ctx = context.getMethodContext(EJBWithTimer.class.getMethod("doSthg"));
        final ScheduleData sd = ctx.getSchedules().iterator().next();
        return new CalendarTimerData(1, (EjbTimerServiceImpl) timer, context.getDeploymentID().toString(), null, ctx.getBeanMethod(), sd.getConfig(), sd.getExpression());
    }
View Full Code Here


        }

        final String mtd = in.readUTF();
        final BeanContext beanContext = SystemInstance.get().getComponent(ContainerSystem.class).getBeanContext(deploymentId);
        for (Iterator<Map.Entry<Method, MethodContext>> it = beanContext.iteratorMethodContext(); it.hasNext(); ) {
            final MethodContext methodContext = it.next().getValue();
            if (methodContext.getSchedules().isEmpty()) {
                continue;
            }

            final Method method = methodContext.getBeanMethod();
            if (method.getName().equals(mtd)) {
                timeoutMethod = method;
                break;
            }
View Full Code Here

    }

    public static CalendarTimerData timerData() throws Exception {
        final BeanContext context = SystemInstance.get().getComponent(ContainerSystem.class).getBeanContext("EJBWithTimer");
        final EjbTimerService timer = context.getEjbTimerService();
        final MethodContext ctx = context.getMethodContext(EJBWithTimer.class.getMethod("doSthg"));
        final ScheduleData sd = ctx.getSchedules().iterator().next();
        return new CalendarTimerData(1, (EjbTimerServiceImpl) timer, context.getDeploymentID().toString(), null, ctx.getBeanMethod(), sd.getConfig(), sd.getExpression());
    }
View Full Code Here

                            }
                            timerServiceRequired = true;
                        }
                        for (Iterator<Map.Entry<Method, MethodContext>> it = beanContext.iteratorMethodContext(); it.hasNext(); ) {
                            Map.Entry<Method, MethodContext> entry = it.next();
                            MethodContext methodContext = entry.getValue();
                            if (methodContext.getSchedules().size() > 0) {
                                timerServiceRequired = true;
                                Method method = entry.getKey();
                                //TODO Need ?
                                if (beanContext.getTransactionType(method) == TransactionType.RequiresNew) {
                                    beanContext.setMethodTransactionAttribute(method, TransactionType.Required);
                                }
                            }
                        }
                        if (timerServiceRequired) {
                            // Create the timer
                            EjbTimerServiceImpl timerService = new EjbTimerServiceImpl(beanContext);
                            //Load auto-start timers
                            TimerStore timerStore = timerService.getTimerStore();
                            for (Iterator<Map.Entry<Method, MethodContext>> it = beanContext.iteratorMethodContext(); it.hasNext(); ) {
                                Map.Entry<Method, MethodContext> entry = it.next();
                                MethodContext methodContext = entry.getValue();
                                for (ScheduleData scheduleData : methodContext.getSchedules()) {
                                    timerStore.createCalendarTimer(timerService, (String) beanContext.getDeploymentID(), null, entry.getKey(), scheduleData.getExpression(), scheduleData.getConfig());
                                }
                            }
                            beanContext.setEjbTimerService(timerService);
                        } else {
View Full Code Here

            }
        }

        for (Map.Entry<Method, MethodAttributeInfo> entry : attributes.entrySet()) {
            MethodConcurrencyInfo value = (MethodConcurrencyInfo) entry.getValue();
            MethodContext methodContext = beanContext.getMethodContext(entry.getKey());
            String s = value.concurrencyAttribute.toUpperCase();
            methodContext.setLockType(LockType.valueOf(s));
        }
       
        // handle @AccessTimeout
        attributes = MethodInfoUtil.resolveAttributes(accessTimeoutInfos, beanContext);
           
        if (log.isDebugEnabled()) {
            for (Map.Entry<Method, MethodAttributeInfo> entry : attributes.entrySet()) {
                Method method = entry.getKey();
                MethodConcurrencyInfo value = (MethodConcurrencyInfo) entry.getValue();
                log.debug("AccessTimeout: " + method + " -- " + MethodInfoUtil.toString(value.methods.get(0)) + " " +
                      " " + value.accessTimeout.time + " " + value.accessTimeout.unit);
            }
        }
       
        for (Map.Entry<Method, MethodAttributeInfo> entry : attributes.entrySet()) {
            MethodConcurrencyInfo value = (MethodConcurrencyInfo) entry.getValue();
            MethodContext methodContext = beanContext.getMethodContext(entry.getKey());
            Duration accessTimeout = new Duration(value.accessTimeout.time, TimeUnit.valueOf(value.accessTimeout.unit));
            methodContext.setAccessTimeout(accessTimeout);
        }
    }
View Full Code Here

                            }
                            timerServiceRequired = true;
                        }
                        for (Iterator<Map.Entry<Method, MethodContext>> it = beanContext.iteratorMethodContext(); it.hasNext(); ) {
                            Map.Entry<Method, MethodContext> entry = it.next();
                            MethodContext methodContext = entry.getValue();
                            if (methodContext.getSchedules().size() > 0) {
                                timerServiceRequired = true;
                                Method method = entry.getKey();
                                //TODO Need ?
                                if (beanContext.getTransactionType(method) == TransactionType.RequiresNew) {
                                    beanContext.setMethodTransactionAttribute(method, TransactionType.Required);
                                }
                            }
                        }
                        if (timerServiceRequired) {
                            // Create the timer
                            EjbTimerServiceImpl timerService = new EjbTimerServiceImpl(beanContext);
                            //Load auto-start timers
                            TimerStore timerStore = timerService.getTimerStore();
                            for (Iterator<Map.Entry<Method, MethodContext>> it = beanContext.iteratorMethodContext(); it.hasNext(); ) {
                                Map.Entry<Method, MethodContext> entry = it.next();
                                MethodContext methodContext = entry.getValue();
                                for (ScheduleData scheduleData : methodContext.getSchedules()) {
                                    timerStore.createCalendarTimer(timerService, (String) beanContext.getDeploymentID(), null, entry.getKey(), scheduleData.getExpression(), scheduleData.getConfig());
                                }
                            }
                            beanContext.setEjbTimerService(timerService);
                        } else {
View Full Code Here

    }

    public static CalendarTimerData timerData() throws Exception {
        final BeanContext context = SystemInstance.get().getComponent(ContainerSystem.class).getBeanContext("EJBWithTimer");
        final EjbTimerService timer = context.getEjbTimerService();
        final MethodContext ctx = context.getMethodContext(EJBWithTimer.class.getMethod("doSthg"));
        final ScheduleData sd = ctx.getSchedules().iterator().next();
        return new CalendarTimerData(1, (EjbTimerServiceImpl) timer, context.getDeploymentID().toString(), null, ctx.getBeanMethod(), sd.getConfig(), sd.getExpression());
    }
View Full Code Here

TOP

Related Classes of org.apache.openejb.MethodContext

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.