@Override public void repositoryEvent(RepositoryEvent event) { LOG.debug("Repository: {} {}", event.getType(), event.getRepository()); }
public JmxRepositoryEvent(RepositoryEvent event) { try { String[] itemNames = FeaturesServiceMBean.REPOSITORY_EVENT; Object[] itemValues = new Object[itemNames.length]; itemValues[0] = event.getRepository().getURI().toString(); switch (event.getType()) { case RepositoryAdded: itemValues[1] = FeaturesServiceMBean.REPOSITORY_EVENT_EVENT_TYPE_ADDED; break; case RepositoryRemoved: itemValues[1] = FeaturesServiceMBean.REPOSITORY_EVENT_EVENT_TYPE_REMOVED; break; default: throw new IllegalStateException("Unsupported event type: " + event.getType()); } data = new CompositeDataSupport(REPOSITORY_EVENT, itemNames, itemValues); } catch (OpenDataException e) { throw new IllegalStateException("Cannot form repository event open data", e); } }
public void repositoryEvent(RepositoryEvent event) { try { EventAdmin eventAdmin = tracker.getService(); if (eventAdmin == null) { return; } Dictionary<String, Object> props = new Hashtable<>(); props.put(EventConstants.TYPE, event.getType()); props.put(EventConstants.EVENT, event); props.put(EventConstants.TIMESTAMP, System.currentTimeMillis()); props.put(EventConstants.REPOSITORY_URI, event.getRepository().getURI().toString()); String topic; switch (event.getType()) { case RepositoryAdded: topic = EventConstants.TOPIC_REPOSITORY_ADDED; break; case RepositoryRemoved: topic = EventConstants.TOPIC_REPOSITORY_REMOVED; break; default: throw new IllegalStateException("Unknown repository event type: " + event.getType()); } eventAdmin.postEvent(new Event(topic, props)); } catch (IllegalStateException e) { LOGGER.warn("Unable to post event to EventAdmin", e); } } }
ClusterRepositoryEvent clusterRepositoryEvent = new ClusterRepositoryEvent(event.getRepository().getURI().toString(), event.getType()); clusterRepositoryEvent.setSourceGroup(group); clusterRepositoryEvent.setSourceNode(clusterManager.getNode()); clusterRepositoryEvent.setUninstall(false); clusterRepositoryEvent.setRefresh(false); RepositoryEvent.EventType type = event.getType();
ClusterRepositoryEvent clusterRepositoryEvent = new ClusterRepositoryEvent(event.getRepository().getURI().toString(), event.getType()); clusterRepositoryEvent.setSourceGroup(group); clusterRepositoryEvent.setSourceNode(clusterManager.getNode()); clusterRepositoryEvent.setUninstall(false); clusterRepositoryEvent.setRefresh(false); RepositoryEvent.EventType type = event.getType();