Skip to content

Notification service

calltl edited this page Feb 25, 2013 · 3 revisions

The notification service provides an API for developers to send messages externally. For example, you can send alert to users online via email or twitter. You can also send balloon help information to Windows status bar, or as a dialog message in the workbench. New way of notification can be included in Gumtree via contributing the INotificationProvider in the system.

import org.gumtree.service.notification.INotificationService;
import org.gumtree.service.notification.support.EmailNotification;

// Create an email notification
EmailNotification notification = new EmailNotification();
notification.setFrom("[email protected]");
notification.setTo("[email protected]");
notification.setSubject("Email Notification Service");
notification.setText("You have been notified by this service.");

// Send the notification
INotificationService service = ServiceUtil.getService(INotificationService.class);
service.send(notification);

Available notification:

  • EmailNotification
  • LogNotification
  • TwitterNotification

Multiple notifications can be combined as a single notification via NotificationUtils.createCompositeNotification(INotification... notifications).

Clone this wiki locally