congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
org.guvnor.common.services.project.builder.events
Code IndexAdd Tabnine to your IDE (free)

How to use org.guvnor.common.services.project.builder.events

Best Java code snippets using org.guvnor.common.services.project.builder.events (Showing top 20 results out of 315)

origin: org.kie.workbench.services/kie-wb-common-services-backend

@Override
public void postProcess( final Path path ) {
  if ( supports( path ) ) {
    invalidateDMOPackageCache.fire( new InvalidateDMOPackageCacheEvent( path ) );
  }
}
origin: org.kie.workbench.services/kie-wb-common-services-backend

public void invalidateProjectCache(@Observes final InvalidateDMOModuleCacheEvent event) {
  PortablePreconditions.checkNotNull("event",
                    event);
  final Module project = event.getModule();
  //If resource was not within a Module there's nothing to invalidate
  if (project != null) {
    invalidateCache(project);
  }
}
origin: org.guvnor/guvnor-project-builder

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));
  }
}
origin: org.uberfire/uberfire-project-builder

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));
  }
}
origin: org.kie.workbench.services/kie-wb-common-datamodel-backend

public void invalidateModuleCache(@Observes final InvalidateDMOModuleCacheEvent event) {
  PortablePreconditions.checkNotNull("event",
                    event);
  final Path resourcePath = event.getResourcePath();
  final KieModule module = moduleService.resolveModule(resourcePath);
  //If resource was not within a Module there's nothing to invalidate
  if (module != null) {
    invalidateCache(module);
  }
}
origin: org.kie.workbench.services/kie-wb-common-datamodel-backend

public void invalidatePackageCache(@Observes final InvalidateDMOPackageCacheEvent event) {
  PortablePreconditions.checkNotNull("event",
                    event);
  final Path resourcePath = event.getResourcePath();
  final Package pkg = moduleService.resolvePackage(resourcePath);
  //If resource was not within a Package there's nothing to invalidate
  if (pkg != null) {
    invalidateCache(pkg);
  }
}
origin: org.drools/drools-wb-dsl-text-editor-backend

@Override
public Path save( final Path resource,
         final String content,
         final Metadata metadata,
         final String comment ) {
  try {
    Metadata currentMetadata = metadataService.getMetadata( resource );
    ioService.write( Paths.convert( resource ),
             content,
             metadataService.setUpAttributes( resource,
                             metadata ),
             commentedOptionFactory.makeCommentedOption( comment ) );
    //Invalidate Package-level DMO cache as a DSL has been altered
    invalidateDMOPackageCache.fire( new InvalidateDMOPackageCacheEvent( resource ) );
    fireMetadataSocialEvents( resource, currentMetadata, metadata );
    return resource;
  } catch ( Exception e ) {
    throw ExceptionUtilities.handleException( e );
  }
}
origin: kiegroup/appformer

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));
  }
}
origin: org.guvnor/guvnor-project-builder

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()));
  }
}
origin: org.kie.workbench.services/kie-wb-common-services-backend

  public void invalidateProjectCache(@Observes final InvalidateDMOModuleCacheEvent event) {
    PortablePreconditions.checkNotNull("event",
                      event);
    final Path resourcePath = event.getResourcePath();
    final KieModule module = moduleService.resolveModule(resourcePath);
    if (module != null) {
      invalidateCache(module);
    }
  }
}
origin: kiegroup/drools-wb

@Override
public Path save( final Path resource,
         final String content,
         final Metadata metadata,
         final String comment ) {
  try {
    Metadata currentMetadata = metadataService.getMetadata( resource );
    ioService.write( Paths.convert( resource ),
             content,
             metadataService.setUpAttributes( resource,
                             metadata ),
             commentedOptionFactory.makeCommentedOption( comment ) );
    //Invalidate Package-level DMO cache as a DSL has been altered
    invalidateDMOPackageCache.fire( new InvalidateDMOPackageCacheEvent( resource ) );
    fireMetadataSocialEvents( resource, currentMetadata, metadata );
    return resource;
  } catch ( Exception e ) {
    throw ExceptionUtilities.handleException( e );
  }
}
origin: org.uberfire/uberfire-project-builder

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()));
  }
}
origin: org.guvnor/guvnor-project-backend

  @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);
    }
  }
}
origin: org.drools/drools-wb-enum-editor-backend

@Override
public Path save(final Path resource,
         final String content,
         final Metadata metadata,
         final String comment) {
  try {
    Metadata currentMetadata = metadataService.getMetadata(resource);
    ioService.write(Paths.convert(resource),
            content,
            metadataService.setUpAttributes(resource,
                            metadata),
            commentedOptionFactory.makeCommentedOption(comment));
    //Invalidate Package-level DMO cache as Enums have changed.
    invalidateDMOPackageCache.fire(new InvalidateDMOPackageCacheEvent(resource));
    fireMetadataSocialEvents(resource,
                 currentMetadata,
                 metadata);
    return resource;
  } catch (Exception e) {
    throw ExceptionUtilities.handleException(e);
  }
}
origin: kiegroup/appformer

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()));
  }
}
origin: kiegroup/drools-wb

@Override
public Path save(final Path resource,
         final String content,
         final Metadata metadata,
         final String comment) {
  try {
    Metadata currentMetadata = metadataService.getMetadata(resource);
    ioService.write(Paths.convert(resource),
            content,
            metadataService.setUpAttributes(resource,
                            metadata),
            commentedOptionFactory.makeCommentedOption(comment));
    //Invalidate Package-level DMO cache as Enums have changed.
    invalidateDMOPackageCache.fire(new InvalidateDMOPackageCacheEvent(resource));
    fireMetadataSocialEvents(resource,
                 currentMetadata,
                 metadata);
    return resource;
  } catch (Exception e) {
    throw ExceptionUtilities.handleException(e);
  }
}
origin: kiegroup/appformer

  @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);
    }
  }
}
origin: kiegroup/drools-wb

@Override
public Path save(final Path resource,
         final GlobalsModel content,
         final Metadata metadata,
         final String comment) {
  try {
    final Package pkg = moduleService.resolvePackage(resource);
    final String packageName = (pkg == null ? null : pkg.getPackageName());
    content.setPackageName(packageName);
    Metadata currentMetadata = metadataService.getMetadata(resource);
    ioService.write(Paths.convert(resource),
            GlobalsPersistence.getInstance().marshal(content),
            metadataService.setUpAttributes(resource,
                            metadata),
            commentedOptionFactory.makeCommentedOption(comment));
    //Invalidate Package-level DMO cache as Globals have changed.
    invalidatePackageDMOEvent.fire(new InvalidateDMOPackageCacheEvent(resource));
    fireMetadataSocialEvents(resource, currentMetadata, metadata);
    return resource;
  } catch (Exception e) {
    throw ExceptionUtilities.handleException(e);
  }
}
origin: org.uberfire/uberfire-project-backend

  @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);
    }
  }
}
origin: org.kie.workbench.services/kie-wb-common-services-backend

  @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));
  }
}
org.guvnor.common.services.project.builder.events

Most used classes

  • InvalidateDMOModuleCacheEvent
    Event to invalidate all entries in a DataModelOracleCache for the Project containing the given resou
  • InvalidateDMOPackageCacheEvent
    Event to invalidate an entry in a DataModelOracleCache. The resource path is used within the Event a
  • InvalidateDMOProjectCacheEvent
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now