private void processBatchResourceChanges(final SessionInfo sessionInfo, final Map<Path, Collection<ResourceChange>> resourceChanges) { Module module; final Map<Module, Path> pendingNotifications = new HashMap<Module, Path>(); for (final Map.Entry<Path, Collection<ResourceChange>> pathCollectionEntry : resourceChanges.entrySet()) { //Only process Project resources module = projectService.resolveModule(pathCollectionEntry.getKey()); if (module == null) { continue; } if (!pendingNotifications.containsKey(module) && isObservableResource(pathCollectionEntry.getKey())) { pendingNotifications.put(module, 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(module, pathCollectionEntry.getKey()); } } for (final Map.Entry<Module, Path> pendingNotification : pendingNotifications.entrySet()) { invalidateDMOProjectCacheEvent.fire(new InvalidateDMOModuleCacheEvent(sessionInfo, pendingNotification.getKey(), pendingNotification.getValue())); } }
private void processBatchResourceChanges(final SessionInfo sessionInfo, final Map<Path, Collection<ResourceChange>> resourceChanges) { Module module; final Map<Module, Path> pendingNotifications = new HashMap<Module, Path>(); for (final Map.Entry<Path, Collection<ResourceChange>> pathCollectionEntry : resourceChanges.entrySet()) { //Only process Project resources module = projectService.resolveModule(pathCollectionEntry.getKey()); if (module == null) { continue; } if (!pendingNotifications.containsKey(module) && isObservableResource(pathCollectionEntry.getKey())) { pendingNotifications.put(module, 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(module, pathCollectionEntry.getKey()); } } for (final Map.Entry<Module, Path> pendingNotification : pendingNotifications.entrySet()) { invalidateDMOProjectCacheEvent.fire(new InvalidateDMOModuleCacheEvent(sessionInfo, pendingNotification.getKey(), pendingNotification.getValue())); } }
private void processResourceChange(final SessionInfo sessionInfo, final Path path, final ResourceChangeType changeType) { //Only process Project resources final Module module = projectService.resolveModule(path); if (module == null) { return; } if (logger.isDebugEnabled()) { logger.debug("Processing resource change for sessionInfo: " + sessionInfo + ", project: " + module + ", path: " + path + ", changeType: " + changeType); } if (isObservableResource(path)) { invalidateDMOProjectCacheEvent.fire(new InvalidateDMOModuleCacheEvent(sessionInfo, module, path)); } }
private void processResourceChange(final SessionInfo sessionInfo, final Path path, final ResourceChangeType changeType) { //Only process Project resources final Module module = projectService.resolveModule(path); if (module == null) { return; } if (logger.isDebugEnabled()) { logger.debug("Processing resource change for sessionInfo: " + sessionInfo + ", project: " + module + ", path: " + path + ", changeType: " + changeType); } if (isObservableResource(path)) { invalidateDMOProjectCacheEvent.fire(new InvalidateDMOModuleCacheEvent(sessionInfo, module, 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 Module module = resourceResolver.resolveModule(path); invalidateDMOCache.fire(new InvalidateDMOModuleCacheEvent(sessionInfo, module, path)); } catch (final Exception e) { throw ExceptionUtilities.handleException(e); } } }
@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 Module module = resourceResolver.resolveModule(path); invalidateDMOCache.fire(new InvalidateDMOModuleCacheEvent(sessionInfo, module, path)); } catch (final Exception e) { throw ExceptionUtilities.handleException(e); } } }
@Test public void testCacheIsInvalidatedWhenResourceThatMapsToProject() { final InvalidateDMOModuleCacheEvent event = new InvalidateDMOModuleCacheEvent(sessionInfo, module, resourcePath); doReturn(module).when(moduleService).resolveModule(resourcePath); cache.invalidateProjectCache(event); verify(cache).invalidateCache(eq(module)); verify(cache, never()).invalidateCache(eq(otherModule)); } }
invalidateDMOCache.fire(new InvalidateDMOModuleCacheEvent(sessionInfo, oldModule, oldModuleDir));
invalidateDMOCache.fire(new InvalidateDMOModuleCacheEvent(sessionInfo, oldModule, oldModuleDir));