Java Code Examples for org.springframework.context.ApplicationContext.publishEvent()

The following are Jave code examples for showing how to use publishEvent() of the org.springframework.context.ApplicationContext class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: alfresco-core   File:   Source Code and License Vote up 6 votes
public void testBootstrapAndShutdown() throws Exception
    // now bring up the bootstrap
    ApplicationContext ctx = new ClassPathXmlApplicationContext(APP_CONTEXT_XML);
    // the folder should be gone
    assertFalse("Folder was not deleted by bootstrap", dir.exists());
    // now create the folder again
    assertTrue("Directory not created", dir.exists());
    // announce that the context is closing
    ctx.publishEvent(new ContextClosedEvent(ctx));
    // the folder should be gone
    assertFalse("Folder was not deleted by shutdown", dir.exists());
Example 2
Project: alfresco-object-storage-connectors   File:   Source Code and License Vote up 5 votes
public void onApplicationEvent(ApplicationEvent event) {
	// Once the context has been refreshed, we tell other interested beans
	// about the existence of this content store
	// (e.g. for monitoring purposes)
	if (event instanceof ContextRefreshedEvent && event.getSource() == this.applicationContext) {
		ApplicationContext context = ((ContextRefreshedEvent) event).getApplicationContext();
		context.publishEvent(new ContentStoreCreatedEvent(this, Collections.<String, Serializable>emptyMap()));
Example 3
Project: lemon   File:   Source Code and License Vote up 5 votes
public void sessionDestroyed(HttpSessionEvent se) {
    ApplicationContext ctx = WebApplicationContextUtils

    if (ctx == null) {
        logger.warn("cannot find applicationContext");


    HttpSession session = se.getSession();
    UserAuthDTO userAuthDto = this.internalUserAuthConnector

    String tenantId = null;

    if (userAuthDto != null) {
        tenantId = userAuthDto.getTenantId();

    LogoutEvent logoutEvent = new LogoutEvent(session, null,
            session.getId(), tenantId);
Example 4
Project: alfresco-repository   File:   Source Code and License Vote up 2 votes
 * Publishes an event to the application context that will notify any interested parties of the existence of this
 * content store.
 * @param context
 *            the application context
 * @param extendedEventParams 
private void publishEvent(ApplicationContext context, Map<String, Serializable> extendedEventParams)
    context.publishEvent(new ContentStoreCreatedEvent(this, extendedEventParams));