19 package org.sleuthkit.autopsy.events;
21 import java.beans.PropertyChangeListener;
22 import java.net.URISyntaxException;
24 import java.util.logging.Level;
25 import javax.jms.JMSException;
55 localPublisher =
new LocalEventPublisher();
67 currentChannelName = channelName;
68 if (null != remotePublisher) {
73 }
catch (URISyntaxException | JMSException ex) {
74 String message =
"Failed to open remote event channel";
75 logger.log(Level.SEVERE, message, ex);
78 String message =
"Error accessing messaging service connection info";
79 logger.log(Level.SEVERE, message, ex);
90 currentChannelName = null;
99 public void addSubscriber(Set<String> eventNames, PropertyChangeListener subscriber) {
100 localPublisher.addSubscriber(eventNames, subscriber);
109 public void addSubscriber(String eventName, PropertyChangeListener subscriber) {
110 localPublisher.addSubscriber(eventName, subscriber);
120 localPublisher.removeSubscriber(eventNames, subscriber);
130 localPublisher.removeSubscriber(eventName, subscriber);
149 localPublisher.publish(event);
158 if (null != currentChannelName) {
159 boolean published =
false;
162 while (
false == published && tryCount <= MAX_REMOTE_EVENT_PUBLISH_TRIES) {
164 if (null == remotePublisher) {
167 remotePublisher.publish(event);
170 logger.log(Level.SEVERE, String.format(
"Failed to publish %s using channel %s (tryCount = %s)", event.getPropertyName(),
currentChannelName, tryCount), ex);
183 if (null != remotePublisher) {
185 remotePublisher.stop();
186 }
catch (JMSException ex) {
187 logger.log(Level.SEVERE, String.format(
"Error closing remote event publisher for channel %s", currentChannelName), ex);
189 remotePublisher = null;
void stopRemotePublisher()
void publishLocally(AutopsyEvent event)
void publishRemotely(AutopsyEvent event)
void publish(AutopsyEvent event)
void addSubscriber(Set< String > eventNames, PropertyChangeListener subscriber)
RemoteEventPublisher remotePublisher
final LocalEventPublisher localPublisher
static final Logger logger
void openRemoteEventChannel(String channelName)
static final int MAX_REMOTE_EVENT_PUBLISH_TRIES
void addSubscriber(String eventName, PropertyChangeListener subscriber)
void closeRemoteEventChannel()
void removeSubscriber(Set< String > eventNames, PropertyChangeListener subscriber)
String currentChannelName
synchronized static Logger getLogger(String name)
void removeSubscriber(String eventName, PropertyChangeListener subscriber)
static MessageServiceConnectionInfo getMessageServiceConnectionInfo()