private void processBatchResourceChanges(final SessionInfo sessionInfo, final Map<Path, Collection<ResourceChange>> resourceChanges) { Project project; final Map<Project, Path> pendingNotifications = new HashMap<Project, Path>(); for (final Map.Entry<Path, Collection<ResourceChange>> pathCollectionEntry : resourceChanges.entrySet()) { //Only process Project resources project = projectService.resolveProject(pathCollectionEntry.getKey()); if (project == null) { continue; } if (!pendingNotifications.containsKey(project) && isObservableResource(pathCollectionEntry.getKey())) { pendingNotifications.put(project, pathCollectionEntry.getKey()); } else if (isPomFile(pathCollectionEntry.getKey())) { //if the pom.xml comes in the batch events set then use the pom.xml path for the cache invalidation event pendingNotifications.put(project, pathCollectionEntry.getKey()); } } for (final Map.Entry<Project, Path> pendingNotification : pendingNotifications.entrySet()) { invalidateDMOProjectCacheEvent.fire(new InvalidateDMOProjectCacheEvent(sessionInfo, pendingNotification.getKey(), pendingNotification.getValue())); } }
private void processResourceChange(final SessionInfo sessionInfo, final Path path, final ResourceChangeType changeType) { //Only process Project resources final Project project = projectService.resolveProject(path); if (project == null) { return; } if (logger.isDebugEnabled()) { logger.debug("Processing resource change for sessionInfo: " + sessionInfo + ", project: " + project + ", path: " + path + ", changeType: " + changeType); } if (isObservableResource(path)) { invalidateDMOProjectCacheEvent.fire(new InvalidateDMOProjectCacheEvent(sessionInfo, project, path)); } }
@Override public void reImport(final Path pathToPomXML) { try { final org.uberfire.java.nio.file.Path projectDirectory = Paths.convert(pathToPomXML).getParent(); final Path path = Paths.convert(projectDirectory); final Project project = resourceResolver.resolveProject(path); invalidateDMOCache.fire(new InvalidateDMOProjectCacheEvent(sessionInfo, project, path)); } catch (final Exception e) { throw ExceptionUtilities.handleException(e); } } }
invalidateDMOCache.fire(new InvalidateDMOProjectCacheEvent(sessionInfo, oldProject, oldProjectDir));