Package org.mule.context.notification

Examples of org.mule.context.notification.ServerNotificationManager


    }

    @Test
    public void testAdhocNotificationListenerRegistrations() throws InterruptedException
    {
        ServerNotificationManager manager = muleContext.getNotificationManager();

        // Not registered asad-hoc listener with null subscription as this is defined
        // explicitly.
        assertFalse(manager.getListeners().contains(
            new ListenerSubscriptionPair((ServerNotificationListener) muleContext.getRegistry().lookupObject(
                "listener3"), null)));

        // Registered as configured
        assertTrue(manager.getListeners().contains(
            new ListenerSubscriptionPair((ServerNotificationListener) muleContext.getRegistry().lookupObject(
                "listener4"), null)));
    }
View Full Code Here


    }

    @Test
    public void testDisabledNotification() throws Exception
    {
        ServerNotificationManager manager = muleContext.getNotificationManager();
        Collection listeners = manager.getListeners();
        //Now all transformers are registered as listeners in order to get a context disposing notification
        assertTrue(listeners.size() > 5);
        TestListener2 listener2 = (TestListener2) muleContext.getRegistry().lookupObject("listener2");
        assertNotNull(listener2);
        assertFalse(listener2.isCalled());
        TestSecurityListener adminListener = (TestSecurityListener) muleContext.getRegistry().lookupObject(
            "securityListener");
        assertNotNull(adminListener);
        assertFalse(adminListener.isCalled());
        manager.fireNotification(new TestSecurityEvent(muleContext));
        Thread.sleep(1000); // asynch events
        assertTrue(listener2.isCalled());
        assertFalse(adminListener.isCalled());
    }
View Full Code Here

        registerListener(l, null);
    }

    public void registerListener(ServerNotificationListener l, String resourceIdentifier) throws NotificationException
    {
        ServerNotificationManager notificationManager = getNotificationManager();
        if (notificationManager == null)
        {
            throw new MuleRuntimeException(CoreMessages.serverNotificationManagerNotEnabled());
        }
        notificationManager.addListenerSubscription(l, resourceIdentifier);
    }
View Full Code Here

        notificationManager.addListenerSubscription(l, resourceIdentifier);
    }

    public void unregisterListener(ServerNotificationListener l)
    {
        ServerNotificationManager notificationManager = getNotificationManager();
        if (notificationManager != null)
        {
            notificationManager.removeListener(l);
        }
    }
View Full Code Here

     * @throws UnsupportedOperationException if the notification fired is not a
     *                                       {@link org.mule.context.notification.CustomNotification}
     */
    public void fireNotification(ServerNotification notification)
    {
        ServerNotificationManager notificationManager = getNotificationManager();
        if (notificationManager != null)
        {
            notificationManager.fireNotification(notification);
        }
        else if (logger.isDebugEnabled())
        {
            logger.debug("MuleEvent Manager is not enabled, ignoring notification: " + notification);
        }
View Full Code Here

    }

    @Override
    protected ServerNotificationManager createNotificationManager()
    {
        ServerNotificationManager manager = new ServerNotificationManager();
        manager.addInterfaceToType(MuleContextNotificationListener.class,
                                   MuleContextNotification.class);
        manager.addInterfaceToType(SecurityNotificationListener.class,
                                   SecurityNotification.class);
        manager.addInterfaceToType(ManagementNotificationListener.class,
                                   ManagementNotification.class);
        manager.addInterfaceToType(CustomNotificationListener.class, CustomNotification.class);
        manager.addInterfaceToType(ConnectionNotificationListener.class,
                                   ConnectionNotification.class);
        manager.addInterfaceToType(ExceptionNotificationListener.class,
                                   ExceptionNotification.class);
        manager.addInterfaceToType(ClusterNodeNotificationListener.class, ClusterNodeNotification.class);
        return manager;
    }
View Full Code Here

TOP

Related Classes of org.mule.context.notification.ServerNotificationManager

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.