Package org.aopalliance.intercept

Examples of org.aopalliance.intercept.MethodInvocation


            }
        };

        final Switch methodCalledSwitch = new Switch();

        MethodInvocation invocation = new MethodInvocation() {
            public Method getMethod() {
                return null;
            }

            public Object[] getArguments() {
View Full Code Here


                // Fault message
                } else if (exchange.getFault() != null) {
                    // TODO: find a way to send it back to the bean before setting the DONE status
                    done(exchange);
                } else {
                    MethodInvocation invocation = getMethodInvocationStrategy().createInvocation(
                            req.getBean(), getBeanInfo(), exchange, this);
                    if (invocation == null) {
                        throw new UnknownMessageExchangeTypeException(exchange, this);
                    }
                    try {
                        invocation.proceed();
                    } catch (Exception e) {
                        throw e;
                    } catch (Throwable throwable) {
                        throw new MethodInvocationFailedException(req.getBean(), invocation, exchange, this, throwable);
                    }
View Full Code Here

    public MethodInvocation createMethodInvocation(final Object pojo,
            final MessageExchange messageExchange) throws MessagingException {
        final Object[] arguments = (Object[]) parametersExpression.evaluate(
                messageExchange, messageExchange.getMessage("in"));
        return new MethodInvocation() {
            public Method getMethod() {
                return method;
            }
            public Object[] getArguments() {
                return arguments;
View Full Code Here

    @Test
    public void shouldReadFromMethodWithAnnotation()
        throws Exception
    {
        final MethodInvocation invocation = methodInvocation( new WithMethodAnnotations(), "withAnno" );
        final Transactional result = sut.readAnnotationFrom( invocation );

        Assert.assertThat( result, TransactionalAnnotationMatcher.transactionalAnnotation(
            new Class[]{ OtherPersistenceUnit.class }, new Class[]{ NullPointerException.class }, new Class[]{ } ) );
    }
View Full Code Here

    @Test
    public void shouldReadFromClassWithAnnotation()
        throws Exception
    {
        final MethodInvocation invocation = methodInvocation( new WithClassAnnotations(), "noAnno" );
        final Transactional result = sut.readAnnotationFrom( invocation );

        Assert.assertThat( result, TransactionalAnnotationMatcher.transactionalAnnotation(
            new Class[]{ TestPersistenceUnit.class }, new Class[]{ IllegalArgumentException.class }, new Class[]{ } ) );
    }
View Full Code Here

    @Test
    public void shouldReadFromDefaultsClassAndMethodWithoutAnnotation()
        throws Exception
    {
        final MethodInvocation invocation = methodInvocation( new WithoutAnyAnnotations(), "noAnno" );
        final Transactional result = sut.readAnnotationFrom( invocation );

        Assert.assertThat( result, TransactionalAnnotationMatcher.transactionalAnnotation( new Class[]{ }, new Class[]{
            RuntimeException.class }, new Class[]{ } ) );
    }
View Full Code Here

    @Test
    public void shouldReadFromMethodWithAnnotationWhenBothClassAndMethodAnnotationAreGiven()
        throws Exception
    {
        final MethodInvocation invocation = methodInvocation( new WithClassAndMethodAnnotations(), "withAnno" );
        final Transactional result = sut.readAnnotationFrom( invocation );

        Assert.assertThat( result, TransactionalAnnotationMatcher.transactionalAnnotation(
            new Class[]{ OtherPersistenceUnit.class }, new Class[]{ NullPointerException.class }, new Class[]{ } ) );
    }
View Full Code Here

    private static MethodInvocation methodInvocation( final Object instance, String name )
    {
        try
        {
            final Method method = instance.getClass().getDeclaredMethod( name );
            return new MethodInvocation()
            {
                public Method getMethod()
                {
                    return method;
                }
View Full Code Here

    public boolean supports(Class<?> clazz) {
        return MethodInvocation.class.isAssignableFrom(clazz);
    }

    public int vote(Authentication authentication, Object object, Collection<ConfigAttribute> config) {
        MethodInvocation mi = (MethodInvocation) object;

        mi.getMethod().getParameterAnnotations();


        return ACCESS_GRANTED;
    }
View Full Code Here

     * @param methodName the name of the method to find
     *
     * @return a <code>MethodInvocation</code>, or <code>null</code> if there was a problem
     */
    public static MethodInvocation createFromClass(Class<?> clazz, String methodName) {
        MethodInvocation mi = createFromClass(null, clazz, methodName, null, null);

        if (mi == null) {
            for (Method m : clazz.getDeclaredMethods()) {
                if (m.getName().equals(methodName)) {
                    if (mi != null) {
View Full Code Here

TOP

Related Classes of org.aopalliance.intercept.MethodInvocation

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.