Package org.springframework.context

Examples of org.springframework.context.ApplicationContext.publishEvent()


        SecurityContextHolder.getContext().setAuthentication( result );
        setAuthentication( result );

        // Fire application events to advise of new login
        appCtx.publishEvent( new AuthenticationEvent( result ) );
        appCtx.publishEvent( new LoginEvent( result ) );

        return result;
    }

    /**
 
View Full Code Here


        SecurityContextHolder.getContext().setAuthentication( null );
        setAuthentication( null );

        // Fire application event to advise of logout
        ApplicationContext appCtx = Application.instance().getApplicationContext();
        appCtx.publishEvent( new AuthenticationEvent( null ) );
        appCtx.publishEvent( new LogoutEvent( existing ) );

        return existing;
    }
View Full Code Here

        setAuthentication( null );

        // Fire application event to advise of logout
        ApplicationContext appCtx = Application.instance().getApplicationContext();
        appCtx.publishEvent( new AuthenticationEvent( null ) );
        appCtx.publishEvent( new LogoutEvent( existing ) );

        return existing;
    }

    /**
 
View Full Code Here

     */
    public void onApplicationEvent(ApplicationEvent event) {
        // Dispatch the event to all the child command contexts
        for( Iterator iter = getChildCommandContexts().iterator(); iter.hasNext(); ) {
            ApplicationContext ctx = (ApplicationContext) iter.next();
            ctx.publishEvent(event);
        }
    }

    /**
     * Get all the child command contexts that have been created.
View Full Code Here

        bean.setEventCallback(callback);

        ApplicationContext context = ((MuleEventMulticaster) muleContext.getRegistry().lookupObject(
            "applicationEventMulticaster")).applicationContext;
        context.publishEvent(new TestApplicationEvent(context));

        whenFinished.await(DEFAULT_LATCH_TIMEOUT, TimeUnit.MILLISECONDS);
        assertEquals(1, eventCounter1.get());
    }
View Full Code Here

        MuleClient client = muleContext.getClient();
        client.send("vm://event.multicaster", "Test Spring MuleEvent", null);
        ApplicationContext context = ((MuleEventMulticaster) muleContext.getRegistry().lookupObject(
            "applicationEventMulticaster")).applicationContext;
        context.publishEvent(new TestApplicationEvent(context));

        whenFinished.await(DEFAULT_LATCH_TIMEOUT, TimeUnit.MILLISECONDS);
        assertEquals(2, eventCounter1.get());
    }
View Full Code Here

                    ApplicationContext context = null;
                    try
                    {
                        context = ((MuleEventMulticaster) muleContext.getRegistry().lookupObject(
                            "applicationEventMulticaster")).applicationContext;
                        context.publishEvent(event);
                    }
                    catch (Exception e)
                    {
                        fail(e.getMessage());
                    }
View Full Code Here

            if (isInitialised()) {
                initializeArtefacts(artefactType);
                ApplicationContext context = getMainContext();
                if(context != null && ((ConfigurableApplicationContext)context).isActive()) {
                    context.publishEvent(new ArtefactAdditionEvent(artefactGrailsClass));
                }
            }

            return artefactGrailsClass;
        }
View Full Code Here

  public static void main(String[] args) {
    DOMConfigurator.configure(ServerMain.class.getClassLoader().getResource("logging/log4j.xml"));

    ApplicationContext appCtx = new ClassPathXmlApplicationContext("classpath*:spring/spring-*.xml");
    appCtx.publishEvent(new ContextStartedEvent(appCtx));
  }

  @Override
  public void onApplicationEvent(ContextStartedEvent event) {
    // JMonkey-Messages f�r Netzwerkkommunikation registrieren
View Full Code Here

  }

  public void testApplicationEventListener() throws Exception {
    ApplicationContext ctx = new ClassPathXmlApplicationContext("bsh-with-xsd.xml", getClass());
    Messenger eventListener = (Messenger) ctx.getBean("eventListener");
    ctx.publishEvent(new MyEvent(ctx));
    assertEquals("count=2", eventListener.getMessage());
  }


  @SuppressWarnings("serial")
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.