001
014
015 package com.liferay.portal.kernel.messaging;
016
017 import com.liferay.portal.kernel.util.SetUtil;
018
019 import java.util.List;
020 import java.util.Set;
021
022
025 public class GlobalDestinationEventListener
026 extends BaseDestinationEventListener {
027
028 public GlobalDestinationEventListener() {
029 }
030
031
034 @Deprecated
035 public GlobalDestinationEventListener(
036 MessageListener messageListener, List<String> ignoredDestinations) {
037
038 _messageListener = messageListener;
039 _ignoredDestinations = SetUtil.fromList(ignoredDestinations);
040 }
041
042 @Override
043 public void destinationAdded(Destination destination) {
044 if (!_ignoredDestinations.contains(destination.getName())) {
045 destination.register(_messageListener);
046 }
047 }
048
049 @Override
050 public void destinationRemoved(Destination destination) {
051 if (!_ignoredDestinations.contains(destination.getName())) {
052 destination.unregister(_messageListener);
053 }
054 }
055
056 public void setIgnoredDestinations(List<String> ignoredDestinations) {
057 _ignoredDestinations = SetUtil.fromList(ignoredDestinations);
058 }
059
060 public void setMessageListener(MessageListener messageListener) {
061 _messageListener = messageListener;
062 }
063
064 private Set<String> _ignoredDestinations;
065 private MessageListener _messageListener;
066
067 }