private String buildFilePath(NexusArtifactEvent event) { return event.getNexusItemInfo().getPath(); }
protected String buildLink(NexusArtifactEvent event) { return "content/repositories/" + event.getNexusItemInfo().getRepositoryId() + event.getNexusItemInfo().getPath(); }
private String getGAVString(NexusArtifactEvent event) { if (event.getNexusItemInfo() == null) { return "unknown:unknown:unknown"; } Gav gav = buildGAV(event); if (gav == null) { return event.getNexusItemInfo().getPath(); } StringBuilder result = new StringBuilder(gav.getGroupId()) .append(":").append(gav.getArtifactId()).append(":").append( gav.getVersion() != null ? gav.getVersion() : "unknown"); if (gav.getClassifier() != null) { result.append(":").append(gav.getClassifier()); } return result.toString(); }
@Override public boolean shouldBuildEntry(final NexusArtifactEvent event) { if (!super.shouldBuildEntry(event)) { return false; } final Gav gav = buildGAV(event); if (gav != null) { if (gav.isHash() || gav.isSignature()) { return false; } } final String path = event.getNexusItemInfo().getPath(); if (path.contains("maven-metadata.xml")) { return false; } return true; }
public void addNexusArtifactEvent(NexusArtifactEvent nae) { Map<String, String> map = new HashMap<String, String>(); map.put(REPOSITORY, nae.getNexusItemInfo().getRepositoryId()); map.put(REPOSITORY_PATH, nae.getNexusItemInfo().getPath()); if (nae.getNexusItemInfo().getRemoteUrl() != null) { map.put(REMOTE_URL, nae.getNexusItemInfo().getRemoteUrl()); } putContext(map, CTX_PREFIX, nae.getEventContext()); putContext(map, ATR_PREFIX, nae.getItemAttributes()); if (nae.getMessage() != null) { map.put(MESSAGE, nae.getMessage()); } map.put(DATE, getDateFormat().format(nae.getEventDate())); map.put(ACTION, nae.getAction()); addToTimeline(map, REPO_EVENT_TYPE, nae.getAction()); }
protected Gav buildGAV(final NexusArtifactEvent event) { if (event.getNexusItemInfo() == null) { return null; } try { final Repository repo = getRepositoryRegistry().getRepository(event.getNexusItemInfo().getRepositoryId()); if (MavenRepository.class.isAssignableFrom(repo.getClass())) { return ((MavenRepository) repo).getGavCalculator().pathToGav(event.getNexusItemInfo().getPath()); } return null; } catch (NoSuchRepositoryException e) { log.debug( "Feed entry contained invalid repository id " + event.getNexusItemInfo().getRepositoryId(), e); return null; } }
private boolean filterEvent(NexusArtifactEvent event) { try { Repository repo = this.repositoryRegistry.getRepository(event.getNexusItemInfo().getRepositoryId()); ResourceStoreRequest req = new ResourceStoreRequest(event.getNexusItemInfo().getPath()); if (!this.nexusItemAuthorizer.authorizePath(repo, req, Action.read)) { return false; } } catch (NoSuchRepositoryException e) { // Can't get repository for artifact, therefore we can't authorize access, therefore you don't see it log.debug( "Feed entry contained invalid repository id " + event.getNexusItemInfo().getRepositoryId(), e); return false; } return true; }