@Override public boolean accept( final org.kie.commons.java.nio.file.Path path ) { boolean accept = super.accept( path ); if ( !accept ) { return accept; } if ( !Files.isRegularFile( path ) ) { return false; } final String uri = path.toUri().toString(); if ( uri.substring( uri.length() - extension.length() ).equals( extension ) ) { return true; } return false; }
@Override public boolean accept( final org.kie.commons.java.nio.file.Path path ) { //Check with super class first boolean accept = super.accept( path ); if ( !accept ) { return accept; } //Only match files if ( !Files.isRegularFile( path ) ) { return false; } //Assume the Path does not match by default accept = false; final String uri = path.toUri().toString(); for ( String extension : extensions ) { if ( uri.substring( uri.length() - extension.length() ).equals( extension ) ) { accept = true; break; } } return accept; }
public static String probeContentType( final Path path ) throws UnsupportedOperationException, IOException, SecurityException { checkNotNull( "path", path ); if ( notExists( path ) ) { throw new NoSuchFileException( path.toString() ); } if ( !isRegularFile( path ) ) { throw new NoSuchFileException( path.toString() ); } throw new UnsupportedOperationException( "feature not available" ); }
if ( !Files.isRegularFile( paths.convert( resource ) ) ) { return;
if ( !Files.isRegularFile( paths.convert( resource ) ) ) { return;
if ( Files.isRegularFile( pathToSearch ) ) { if ( filter.accept( pathToSearch ) ) { discoveredFiles.add( pathToSearch ); if ( Files.isRegularFile( path ) ) { if ( filter.accept( path ) ) { discoveredFiles.add( path );
public void updateResource( @Observes final ResourceUpdatedEvent resourceUpdatedEvent ) { //Do nothing if incremental builds are disabled if ( !isIncrementalEnabled ) { return; } //Perform incremental build PortablePreconditions.checkNotNull( "resourceUpdatedEvent", resourceUpdatedEvent ); final Path resource = resourceUpdatedEvent.getPath(); //Incremental builds only operate on files if ( !Files.isRegularFile( paths.convert( resource ) ) ) { return; } //If resource is not within a Project it cannot be used for an incremental build final Path projectPath = projectService.resolveProject( resource ); if ( projectPath == null ) { return; } //The pom.xml or kmodule.xml cannot be processed incrementally final boolean isPomFile = projectService.isPom( resource ); final boolean isKModuleFile = projectService.isKModule( resource ); if ( isPomFile || isKModuleFile ) { scheduleProjectResourceUpdate( resource ); } else { schedulePackageResourceUpdate( resource ); } }
@Override public List<Item> load( final Path path, final Path projectRoot ) { //Check Path exists final List<Item> items = new ArrayList<Item>(); if ( !Files.exists( paths.convert( path ) ) ) { return items; } //Ensure Path represents a Folder org.kie.commons.java.nio.file.Path pPath = paths.convert( path ); if ( !Files.isDirectory( pPath ) ) { pPath = pPath.getParent(); } //Get list of immediate children final DirectoryStream<org.kie.commons.java.nio.file.Path> directoryStream = ioService.newDirectoryStream( pPath ); for ( final org.kie.commons.java.nio.file.Path p : directoryStream ) { if ( filter.accept( p ) ) { if ( Files.isRegularFile( p ) ) { items.add( new FileItem( paths.convert( p ) ) ); } else if ( Files.isDirectory( p ) ) { items.add( new PackageItem( paths.convert( p ) ) ); } } } //Add ability to move up one level in the hierarchy items.add( new ParentPackageItem( paths.convert( pPath.getParent() ), ".." ) ); return items; }
public List<Path> loadScenarioPaths(final Path path) { // Check Path exists final List<Path> items = new ArrayList<Path>(); if (!Files.exists(paths.convert(path))) { return items; } // Ensure Path represents a Folder org.kie.commons.java.nio.file.Path pPath = paths.convert(path); if (!Files.isDirectory(pPath)) { pPath = pPath.getParent(); } LinkedFilter filter = new LinkedDotFileFilter(); filter.setNextFilter( new LinkedMetaInfFolderFilter() ); // Get list of immediate children final DirectoryStream<org.kie.commons.java.nio.file.Path> directoryStream = ioService .newDirectoryStream(pPath); for (final org.kie.commons.java.nio.file.Path p : directoryStream) { if (filter.accept(p)) { if (Files.isRegularFile(p)) { items.add(paths.convert(p)); } else if (Files.isDirectory(p)) { items.add(paths.convert(p)); } } } // Add ability to move up one level in the hierarchy //items.add(new ParentPackageItem(paths.convert(pPath.getParent()), "..")); return items; }
for ( final org.kie.commons.java.nio.file.Path pChild : directoryStream ) { if ( Files.isRegularFile( pChild ) ) { items.add( new FileItem( paths.convert( pChild ) ) );
if ( Files.isRegularFile( path ) ) { path = path.getParent();
if ( Files.isRegularFile( path ) ) { path = path.getParent();
if ( Files.isRegularFile( nioResource ) ) { nioResource = nioResource.getParent();