public synchronized void invalidateProjectCache( @Observes final InvalidateDMOProjectCacheEvent event ) { PortablePreconditions.checkNotNull( "event", event ); final Path resourcePath = event.getResourcePath(); final Path pathToPom = projectService.resolvePathToPom( resourcePath ); //If resource was not within a Project there's nothing to invalidate if ( pathToPom != null ) { invalidateCache( pathToPom ); } }
@Override public Path save( final Path resource, final PackageConfiguration packageConfiguration, final Metadata metadata, final String comment ) { ioService.write( paths.convert( resource ), packageConfigurationContentHandler.toString( packageConfiguration ), metadataService.setUpAttributes( resource, metadata ), makeCommentedOption( comment ) ); //Invalidate Project-level DMO cache as project.imports has changed. invalidateDMOProjectCache.fire( new InvalidateDMOProjectCacheEvent( resource ) ); //Signal update to interested parties resourceUpdatedEvent.fire( new ResourceUpdatedEvent( resource ) ); return resource; }
@Override public Path save( final Path resource, final String content, final Metadata metadata, final String comment ) { final String drl = assertPackageName( content, resource ); ioService.write( paths.convert( resource ), drl, metadataService.setUpAttributes( resource, metadata ), makeCommentedOption( comment ) ); //Invalidate Project-level DMO cache in case user added a Declarative Type to their DRL. Tssk, Tssk. invalidateDMOProjectCache.fire( new InvalidateDMOProjectCacheEvent( resource ) ); //Signal update to interested parties resourceUpdatedEvent.fire( new ResourceUpdatedEvent( resource ) ); return resource; }
@Override public Path save( final Path resource, final FactModels content, final Metadata metadata, final String comment ) { content.setPackageName( projectService.resolvePackageName( resource ) ); ioService.write( paths.convert( resource ), FactModelPersistence.marshal( content ), metadataService.setUpAttributes( resource, metadata ), makeCommentedOption( comment ) ); //Invalidate Project-level DMO cache as Model has changed. invalidateDMOProjectCache.fire( new InvalidateDMOProjectCacheEvent( resource ) ); //Signal update to interested parties resourceUpdatedEvent.fire( new ResourceUpdatedEvent( resource ) ); return resource; }
public synchronized void invalidateProjectCache( @Observes final InvalidateDMOProjectCacheEvent event ) { PortablePreconditions.checkNotNull( "event", event ); final Path resourcePath = event.getResourcePath(); final Path projectPath = projectService.resolveProject( resourcePath ); //If resource was not within a Project there's nothing to invalidate if ( projectPath != null ) { invalidateCache( projectPath ); } }
@Override public Path save( final Path path, final POM content, final Metadata metadata, final String comment ) { try { if ( metadata == null ) { ioService.write( paths.convert( path ), pomContentHandler.toString( content ), makeCommentedOption( comment ) ); } else { ioService.write( paths.convert( path ), pomContentHandler.toString( content ), metadataService.setUpAttributes( path, metadata ), makeCommentedOption( comment ) ); } //Invalidate Project-level DMO cache as POM has changed. invalidateDMOProjectCache.fire( new InvalidateDMOProjectCacheEvent( path ) ); //Signal update to interested parties resourceUpdatedEvent.fire( new ResourceUpdatedEvent( path ) ); return path; } catch ( IOException e ) { throw new org.kie.commons.java.nio.IOException( e.getMessage() ); } }
public synchronized void invalidateProjectPackagesCache( @Observes final InvalidateDMOProjectCacheEvent event ) { PortablePreconditions.checkNotNull( "event", event ); final Path resourcePath = event.getResourcePath(); final Path projectPath = projectService.resolveProject( resourcePath ); //If resource was not within a Project there's nothing to invalidate if ( projectPath == null ) { return; } final String projectUri = projectPath.toURI(); final List<Path> cacheEntriesToInvalidate = new ArrayList<Path>(); for ( final Path packagePath : getKeys() ) { final String packageUri = packagePath.toURI(); if ( packageUri.startsWith( projectUri ) ) { cacheEntriesToInvalidate.add( packagePath ); } } for ( final Path packagePath : cacheEntriesToInvalidate ) { invalidateCache( packagePath ); } }