Package org.springframework.context

Examples of org.springframework.context.ApplicationEvent


    public Producer<Exchange> createProducer() throws Exception {
        ObjectHelper.notNull(getApplicationContext(), "applicationContext");
        return new DefaultProducer<Exchange>(this) {
            public void process(Exchange exchange) throws Exception {
                ApplicationEvent event = toApplicationEvent(exchange);
                getApplicationContext().publishEvent(event);
            }
        };
    }
View Full Code Here


        return new TopicLoadBalancer();
    }

    protected ApplicationEvent toApplicationEvent(Exchange exchange) {
        try {
            ApplicationEvent event = exchange.getIn().getBody(ApplicationEvent.class);
            if (event != null) {
                return event;
            }
        } catch (NoTypeConversionAvailableException ex) {
            // ignore, handled below
View Full Code Here

    }

    public Producer<Exchange> createProducer() throws Exception {
        return new DefaultProducer<Exchange>(this) {
            public void process(Exchange exchange) throws Exception {
                ApplicationEvent event = toApplicationEvent(exchange);
                getApplicationContext().publishEvent(event);
            }
        };
    }
View Full Code Here

    protected LoadBalancer createLoadBalancer() {
        return new TopicLoadBalancer();
    }

    protected ApplicationEvent toApplicationEvent(Exchange exchange) {
        ApplicationEvent event = exchange.getIn().getBody(ApplicationEvent.class);
        if (event == null) {
            event = new CamelEvent(this, exchange);
        }
        return event;
    }
View Full Code Here


  public Object invoke(MethodInvocation invocation) throws Throwable {
    Object retVal = invocation.proceed();

    ApplicationEvent event = (ApplicationEvent)
        this.applicationEventClassConstructor.newInstance(new Object[] {invocation.getThis()});
    this.applicationEventPublisher.publishEvent(event);

    return retVal;
  }
View Full Code Here

  public void testSimpleApplicationEventMulticaster() {
    MockControl ctrl = MockControl.createControl(ApplicationListener.class);
    ApplicationListener listener = (ApplicationListener) ctrl.getMock();

    ApplicationEvent evt = new ContextClosedEvent(new StaticApplicationContext());
    listener.onApplicationEvent(evt);
    ctrl.setMatcher(new EqualsMatcher());

    SimpleApplicationEventMulticaster smc = new SimpleApplicationEventMulticaster();
    smc.addApplicationListener(listener);
View Full Code Here

        advisor.testInit();

        TestCommand cmd = (TestCommand)advisor.getBeanFactory().getBean("testCommand");
        assertEquals("Command must be notified of refresh", 1, cmd.getCount());

        advisor.onApplicationEvent(new ApplicationEvent(this) {});
        assertEquals("Command must be notified", 2, cmd.getCount());
    }
View Full Code Here

    public Producer createProducer() throws Exception {
        ObjectHelper.notNull(applicationContext, "applicationContext");
        return new DefaultProducer(this) {
            public void process(Exchange exchange) throws Exception {
                ApplicationEvent event = toApplicationEvent(exchange);
                applicationContext.publishEvent(event);
            }
        };
    }
View Full Code Here

    protected LoadBalancer createLoadBalancer() {
        return new TopicLoadBalancer();
    }

    protected ApplicationEvent toApplicationEvent(Exchange exchange) {
        ApplicationEvent event = exchange.getIn().getBody(ApplicationEvent.class);
        if (event != null) {
            return event;
        }
        return new CamelEvent(this, exchange);
    }
View Full Code Here

    public Producer createProducer() throws Exception {
        ObjectHelper.notNull(applicationContext, "applicationContext");
        return new DefaultProducer(this) {
            public void process(Exchange exchange) throws Exception {
                ApplicationEvent event = toApplicationEvent(exchange);
                applicationContext.publishEvent(event);
            }
        };
    }
View Full Code Here

TOP

Related Classes of org.springframework.context.ApplicationEvent

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.