@Override public List<NexusArtifactEvent> getEventList(Integer from, Integer count, Map<String, String> params) { final Set<String> repositoryIds = getRepoIdsFromParams(params); final Predicate<Entry> filter = (repositoryIds == null || repositoryIds.isEmpty()) ? null : new RepositoryIdTimelineFilter(repositoryIds); return getFeedRecorder().getNexusArtifectEvents( new HashSet<String>(Arrays.asList(NexusArtifactEvent.ACTION_DEPLOYED)), from, count, filter); }
public List<SystemEvent> getEventList(Integer from, Integer count, Map<String, String> params) { return getFeedRecorder().getSystemEvents( new HashSet<String>(Arrays.asList(FeedRecorder.SYSTEM_REPO_LSTATUS_CHANGES_ACTION, FeedRecorder.SYSTEM_REPO_PSTATUS_CHANGES_ACTION, FeedRecorder.SYSTEM_REPO_PSTATUS_AUTO_CHANGES_ACTION)), from, count, null); }
@Subscribe @AllowConcurrentEvents public void inspect(final NexusTaskEvent evt) { if (evt instanceof NexusTaskEventStarted<?>) { final String action = getActionFromTask(((NexusTaskEventStarted<?>) evt).getNexusTask()); final String message = getMessageFromTask(((NexusTaskEventStarted<?>) evt).getNexusTask()); final SystemProcess prc = getFeedRecorder().systemProcessStarted(action, message); putSystemProcessFromEventContext((NexusTaskEventStarted<?>) evt, prc); } else if (evt instanceof NexusTaskEventStoppedDone<?>) { final SystemProcess prc = getSystemProcessFromEventContext(((NexusTaskEventStoppedDone<?>) evt).getStartedEvent()); final String message = getMessageFromTask(((NexusTaskEventStoppedDone<?>) evt).getNexusTask()); getFeedRecorder().systemProcessFinished(prc, message); } else if (evt instanceof NexusTaskEventStoppedCanceled<?>) { final SystemProcess prc = getSystemProcessFromEventContext(((NexusTaskEventStoppedCanceled<?>) evt).getStartedEvent()); final String message = getMessageFromTask(((NexusTaskEventStoppedCanceled<?>) evt).getNexusTask()); getFeedRecorder().systemProcessCanceled(prc, message); } else if (evt instanceof NexusTaskEventStoppedFailed<?>) { final SystemProcess prc = getSystemProcessFromEventContext(((NexusTaskEventStoppedFailed<?>) evt).getStartedEvent()); getFeedRecorder().systemProcessBroken(prc, ((NexusTaskEventStoppedFailed<?>) evt).getFailureCause()); } }
protected void inspect(Event<?> evt) { if (evt instanceof NexusStartedEvent) { getFeedRecorder().addSystemEvent( FeedRecorder.SYSTEM_BOOT_ACTION, "Started Nexus (version " + getApplicationStatusSource().getSystemStatus().getVersion() + " " + getApplicationStatusSource().getSystemStatus().getEditionShort() + ")"); } else if (evt instanceof NexusStoppedEvent) { getFeedRecorder().addSystemEvent( FeedRecorder.SYSTEM_BOOT_ACTION, "Stopping Nexus (version " + getApplicationStatusSource().getSystemStatus().getVersion() + " " + getApplicationStatusSource().getSystemStatus().getEditionShort() + ")"); getFeedRecorder().shutdown(); } }
@Subscribe @AllowConcurrentEvents public void inspectForNexus(final ConfigurationChangeEvent event) { if (event.getChanges().isEmpty()) { return; } StringBuilder msg = new StringBuilder(); msg.append("Nexus server configuration was changed: "); // keep list unique, one component might be reported multiple times final HashSet<String> changes = new HashSet<String>(); for (Configurable changed : event.getChanges()) { changes.add(changed.getName()); } msg.append(changes.toString()); if (event.getUserId() != null) { msg.append(", change was made by [" + event.getUserId() + "]"); } getFeedRecorder().addSystemEvent(FeedRecorder.SYSTEM_CONFIG_ACTION, msg.toString()); } }
@Subscribe @AllowConcurrentEvents public void inspect(final RepositoryItemValidationEventFailed ievt) { final NexusItemInfo ai = new NexusItemInfo(); ai.setRepositoryId(ievt.getItem().getRepositoryId()); ai.setPath(ievt.getItem().getPath()); ai.setRemoteUrl(ievt.getItem().getRemoteUrl()); String action = NexusArtifactEvent.ACTION_BROKEN; if (ievt instanceof RepositoryItemValidationEventFailedChecksum) { action = NexusArtifactEvent.ACTION_BROKEN_WRONG_REMOTE_CHECKSUM; } else if (ievt instanceof RepositoryItemValidationEventFailedFileType) { action = NexusArtifactEvent.ACTION_BROKEN_INVALID_CONTENT; } final NexusArtifactEvent nae = new NexusArtifactEvent(ievt.getEventDate(), action, ievt.getMessage(), ai); getFeedRecorder().addNexusArtifactEvent(nae); } }
@Subscribe @AllowConcurrentEvents public void inspect(final NexusAuthenticationEvent nae) { if (!isRecordedEvent(nae)) { // do nothing return; } lastNexusAuthenticationEvent = nae; final ClientInfo ai = nae.getClientInfo(); final String msg = String.format("%s user [%s] from IP address %s", (nae.isSuccessful() ? "Successfully authenticated" : "Unable to authenticate"), ai.getUserid(), StringUtils.defaultString(ai.getRemoteIP(), "[unknown]")); log.debug(msg); final AuthcAuthzEvent aae = new AuthcAuthzEvent(nae.getEventDate(), FeedRecorder.SYSTEM_AUTHC, msg); final String ip = ai.getRemoteIP(); if (ip != null) { nae.getEventContext().put(AccessManager.REQUEST_REMOTE_ADDRESS, ip); } getFeedRecorder().addAuthcAuthzEvent(aae); }
public SyndFeed getFeed(Integer from, Integer count, Map<String, String> params) throws IOException List<AuthcAuthzEvent> items = getFeedRecorder().getAuthcAuthzEvents(null, from, count, null);
@Subscribe @AllowConcurrentEvents public void inspect(final RepositoryEventLocalStatusChanged revt) { StringBuilder sb = new StringBuilder("The repository '"); sb.append(revt.getRepository().getName()); sb.append("' (ID='").append(revt.getRepository().getId()).append("') was put "); LocalStatus newStatus = revt.getNewLocalStatus(); if (LocalStatus.IN_SERVICE.equals(newStatus)) { sb.append("IN SERVICE."); } else if (LocalStatus.OUT_OF_SERVICE.equals(newStatus)) { sb.append("OUT OF SERVICE."); } else { sb.append(revt.getRepository().getLocalStatus().toString()).append("."); } sb.append(" The previous state was "); if (LocalStatus.IN_SERVICE.equals(revt.getOldLocalStatus())) { sb.append("IN SERVICE."); } else if (LocalStatus.OUT_OF_SERVICE.equals(revt.getOldLocalStatus())) { sb.append("OUT OF SERVICE."); } else { sb.append(revt.getOldLocalStatus().toString()).append("."); } getFeedRecorder().addSystemEvent(FeedRecorder.SYSTEM_REPO_LSTATUS_CHANGES_ACTION, sb.toString()); }
getFeedRecorder().addNexusArtifactEvent(nae);
@Subscribe @AllowConcurrentEvents public void inspect(NexusAuthorizationEvent nae) { if (!isRecordedEvent(nae)) { // do nothing return; } lastNexusAuthorizationEvent = nae; final ClientInfo ai = nae.getClientInfo(); final ResourceInfo ri = nae.getResourceInfo(); final String msg = "Unable to authorize user [" + ai.getUserid() + "] for " + ri.getAction() + "(" + ri.getAccessProtocol() + " method \"" + ri.getAccessMethod() + "\") to " + ri.getAccessedUri() + " from IP Address " + ai.getRemoteIP() + ", user agent:\"" + ai.getUserAgent() + "\""; log.debug(msg); final AuthcAuthzEvent aae = new AuthcAuthzEvent(nae.getEventDate(), FeedRecorder.SYSTEM_AUTHZ, msg); final String ip = ai.getRemoteIP(); if (ip != null) { nae.getEventContext().put(AccessManager.REQUEST_REMOTE_ADDRESS, ip); } getFeedRecorder().addAuthcAuthzEvent(aae); }
@Override public List<NexusArtifactEvent> getEventList(Integer from, Integer count, Map<String, String> params) { final Set<String> repositoryIds = getRepoIdsFromParams(params); Predicate<Entry> filter = (repositoryIds == null || repositoryIds.isEmpty()) ? null : new RepositoryIdTimelineFilter(repositoryIds); return getFeedRecorder().getNexusArtifectEvents( new HashSet<String>(Arrays.asList(NexusArtifactEvent.ACTION_CACHED)), from, count, filter); }
getFeedRecorder().addSystemEvent(FeedRecorder.SYSTEM_CONFIG_ACTION, sb.toString());
public List<SystemEvent> getEventList(Integer from, Integer count, Map<String, String> params) { return getFeedRecorder().getSystemEvents(null, from, count, null); }
@Override public List<NexusArtifactEvent> getEventList(Integer from, Integer count, Map<String, String> params) { final Set<String> repositoryIds = getRepoIdsFromParams(params); final Predicate<Entry> filter = (repositoryIds == null || repositoryIds.isEmpty()) ? null : new RepositoryIdTimelineFilter(repositoryIds); return getFeedRecorder().getNexusArtifectEvents( new HashSet<String>(Arrays.asList(NexusArtifactEvent.ACTION_BROKEN, NexusArtifactEvent.ACTION_BROKEN_WRONG_REMOTE_CHECKSUM, NexusArtifactEvent.ACTION_BROKEN_INVALID_CONTENT)), from, count, filter); }
getFeedRecorder().addSystemEvent(FeedRecorder.SYSTEM_REPO_PSTATUS_CHANGES_ACTION, sb.toString());
@Override public List<NexusArtifactEvent> getEventList(Integer from, Integer count, Map<String, String> params) { final Set<String> repositoryIds = getRepoIdsFromParams(params); final Predicate<Entry> filter = (repositoryIds == null || repositoryIds.isEmpty()) ? null : new RepositoryIdTimelineFilter(repositoryIds); return getFeedRecorder().getNexusArtifectEvents( new HashSet<String>(Arrays.asList(NexusArtifactEvent.ACTION_CACHED)), from, count, filter); }
@Override public List<NexusArtifactEvent> getEventList(Integer from, Integer count, Map<String, String> params) { final Set<String> repositoryIds = getRepoIdsFromParams(params); final Predicate<Entry> filter = (repositoryIds == null || repositoryIds.isEmpty()) ? null : new RepositoryIdTimelineFilter(repositoryIds); return getFeedRecorder().getNexusArtifectEvents( new HashSet<String>(Arrays.asList(NexusArtifactEvent.ACTION_CACHED, NexusArtifactEvent.ACTION_DEPLOYED, NexusArtifactEvent.ACTION_DELETED)), from, count, filter); }
@Override public List<NexusArtifactEvent> getEventList(Integer from, Integer count, Map<String, String> params) { final Set<String> repositoryIds = getRepoIdsFromParams(params); final Predicate<Entry> filter = (repositoryIds == null || repositoryIds.isEmpty()) ? null : new RepositoryIdTimelineFilter(repositoryIds); return getFeedRecorder().getNexusArtifectEvents( new HashSet<String>(Arrays.asList(NexusArtifactEvent.ACTION_CACHED, NexusArtifactEvent.ACTION_DEPLOYED)), from, count, filter); }
@Override public List<NexusArtifactEvent> getEventList(Integer from, Integer count, Map<String, String> params) { final Set<String> repositoryIds = getRepoIdsFromParams(params); final Predicate<Entry> filter = (repositoryIds == null || repositoryIds.isEmpty()) ? null : new RepositoryIdTimelineFilter(repositoryIds); return getFeedRecorder().getNexusArtifectEvents( new HashSet<String>(Arrays.asList(NexusArtifactEvent.ACTION_CACHED, NexusArtifactEvent.ACTION_DEPLOYED)), from, count, filter); }