1
14
15 package com.liferay.portal.kernel.messaging;
16
17 import com.liferay.portal.kernel.util.SetUtil;
18
19 import java.util.List;
20 import java.util.Set;
21
22
28 public class GlobalDestinationEventListener
29 extends BaseDestinationEventListener {
30
31 public GlobalDestinationEventListener() {
32 }
33
34
37 public GlobalDestinationEventListener(
38 MessageListener messageListener, List<String> ignoredDestinations) {
39
40 _messageListener = messageListener;
41 _ignoredDestinations = SetUtil.fromList(ignoredDestinations);
42 }
43
44 public void destinationAdded(Destination destination) {
45 if (!_ignoredDestinations.contains(destination.getName())) {
46 destination.register(_messageListener);
47 }
48 }
49
50 public void destinationRemoved(Destination destination) {
51 if (!_ignoredDestinations.contains(destination.getName())) {
52 destination.unregister(_messageListener);
53 }
54 }
55
56 public void setIgnoredDestinations(List<String> ignoredDestinations) {
57 _ignoredDestinations = SetUtil.fromList(ignoredDestinations);
58 }
59
60 public void setMessageListener(MessageListener messageListener) {
61 _messageListener = messageListener;
62 }
63
64 private Set<String> _ignoredDestinations;
65 private MessageListener _messageListener;
66
67 }