@Override public boolean includeFile( FileSelectInfo fileSelectInfo ) throws Exception { return fileSelectInfo.getFile().toString().matches( regex ); } } );
public boolean includeFile( FileSelectInfo info ) { // Never return the parent directory of a file list. if ( info.getDepth() == 0 ) { return false; } FileObject fileObject = info.getFile(); return fileObject != null; } } );
@Override public boolean includeFile( FileSelectInfo fileSelectInfo ) throws Exception { FileObject file = fileSelectInfo.getFile(); return file.isFile() && file.toString().endsWith( ".jar" ); } } );
public boolean includeFile( FileSelectInfo info ) { FileObject fileObject = info.getFile(); try { if ( fileObject == null ) { return false; } } catch ( Exception ex ) { // Upon error don't process the file. return false; } finally { if ( fileObject != null ) { try { fileObject.close(); fileObject = null; } catch ( IOException ex ) { /* Ignore */ } } } return true; } } );
public boolean includeFile( FileSelectInfo info ) { FileObject fileObject = info.getFile(); try { if ( fileObject == null ) { return false; } } catch ( Exception ex ) { // Upon error don't process the file. return false; } finally { if ( fileObject != null ) { try { fileObject.close(); } catch ( IOException ex ) { /* Ignore */ } } } return true; } } );
public boolean includeFile( FileSelectInfo info ) { FileObject fileObject = info.getFile(); try { if ( fileObject == null ) { return false; } } catch ( Exception ex ) { // Upon error don't process the file. return false; } finally { if ( fileObject != null ) { try { fileObject.close(); fileObject = null; } catch ( IOException ex ) { /* Ignore */ } } } return true; } } );
@Override public boolean includeFile( FileSelectInfo info ) throws Exception { return info.getFile().getName().getExtension().equals( "java" ); } } );
public boolean includeFile( FileSelectInfo info ) { boolean returncode = false; try { if ( !info.getFile().toString().equals( sourceFolder ) ) { // Pass over the Base folder itself String short_filename = info.getFile().getName().getBaseName(); if ( info.getFile().getParent().equals( info.getBaseFolder() ) || ( !info.getFile().getParent().equals( info.getBaseFolder() ) && includeSubfolders ) ) { if ( ( info.getFile().getType() == FileType.FILE && fileWildcard == null ) || ( info.getFile().getType() == FileType.FILE && fileWildcard != null && GetFileWildcard( short_filename, fileWildcard ) ) ) { returncode = true; } } } } catch ( Exception e ) { logError( "Error while finding files ... in [" + info.getFile().toString() + "]. Exception :" + e.getMessage() ); returncode = false; } return returncode; }
public boolean includeFile( FileSelectInfo info ) { boolean returncode = false; try { if ( !info.getFile().toString().equals( source_folder ) ) { String short_filename = info.getFile().getName().getBaseName(); if ( info.getFile().getParent().equals( info.getBaseFolder() ) ) { if ( ( info.getFile().getType() == FileType.FILE && compareonly.equals( "only_files" ) ) || ( info.getFile().getType() == FileType.FOLDER && compareonly.equals( "only_folders" ) ) || ( GetFileWildcard( short_filename ) && compareonly.equals( "specify" ) ) || ( compareonly.equals( "all" ) ) ) { if ( ( info.getFile().getType() == FileType.FILE && compareonly.equals( "only_files" ) ) || ( info.getFile().getType() == FileType.FOLDER && compareonly.equals( "only_folders" ) ) || ( GetFileWildcard( short_filename ) && compareonly.equals( "specify" ) ) || ( compareonly.equals( "all" ) ) ) { + info.getFile().toString() + "]. Exception :" + e.getMessage() ); returncode = false;
public boolean includeFile( FileSelectInfo info ) { boolean returncode = false; try { if ( !info.getFile().toString().equals( sourceFolder ) ) { // Pass over the Base folder itself String short_filename = info.getFile().getName().getBaseName(); if ( info.getFile().getParent().equals( info.getBaseFolder() ) || ( ( !info.getFile().getParent().equals( info.getBaseFolder() ) && meta.isIncludeSubFolders() ) ) ) { if ( ( info.getFile().getType() == FileType.FILE && fileWildcard == null ) || ( info.getFile().getType() == FileType.FILE && fileWildcard != null && GetFileWildcard( short_filename, fileWildcard ) ) ) { returncode = true; } } } } catch ( Exception e ) { logError( BaseMessages.getString( PKG, "Mail.Error.FindingFiles", info.getFile().toString(), e .getMessage() ) ); returncode = false; } return returncode; }
public boolean includeFile( FileSelectInfo fileInfo ) throws Exception { boolean include; // Only include files in the sub-folders... // When we include sub-folders we match the whole filename, not just the base-name // if ( fileInfo.getFile().getType().equals( FileType.FILE ) ) { include = true; if ( pattern != null ) { String name = fileInfo.getFile().getName().getBaseName(); include = pattern.matcher( name ).matches(); } if ( include && patternExclude != null ) { String name = fileInfo.getFile().getName().getBaseName(); include = !patternExclude.matcher( name ).matches(); } } else { include = false; } return include; } }
@Override public boolean traverseDescendents( FileSelectInfo fileSelectInfo ) throws Exception { FileObject fileObject = fileSelectInfo.getFile(); String folder = fileObject.getName().getBaseName(); FileObject kettleIgnore = fileObject.getChild( ".kettle-ignore" ); return includeLibJars || ( kettleIgnore == null && !"lib".equals( folder ) ); }
public boolean includeFile( FileSelectInfo info ) { FileObject fileObject = info.getFile(); try { if ( fileObject == null ) { return false; } if ( fileObject.getType() != FileType.FILE ) { return false; } } catch ( Exception ex ) { // Upon error don't process the file. return false; } finally { if ( fileObject != null ) { try { fileObject.close(); } catch ( IOException ex ) { /* Ignore */ } } } return true; } } );
public boolean includeFile( FileSelectInfo info ) { FileObject fileObject = info.getFile(); try { if ( fileObject == null ) { return false; } if ( fileObject.getType() != FileType.FILE ) { return false; } } catch ( Exception ex ) { // Upon error don't process the file. return false; } finally { if ( fileObject != null ) { try { fileObject.close(); } catch ( IOException ex ) { /* Ignore */ } } } return true; } } );
public boolean includeFile( FileSelectInfo info ) { FileObject fileObject = info.getFile(); try { if ( fileObject == null ) { return false; } if ( fileObject.getType() != FileType.FILE ) { return false; } } catch ( Exception ex ) { // Upon error don't process the file. return false; } finally { if ( fileObject != null ) { try { fileObject.close(); } catch ( IOException ex ) { /* Ignore */ } } } return true; } } );
try { if ( !info.getFile().toString().equals( sourceFolder ) && !parentjob.isStopped() ) { String shortFilename = info.getFile().getName().getBaseName(); if ( !info.getFile().getParent().equals( info.getBaseFolder() ) ) { && ( info.getFile().getType() == FileType.FILE ) && GetFileWildcard( shortFilename, fileWildcard ) ) { if ( log.isDetailed() ) { logDetailed( BaseMessages.getString( PKG, "JobEntryDeleteFiles.DeletingFile", info .getFile().toString() ) ); if ( ( info.getFile().getType() == FileType.FILE ) && GetFileWildcard( shortFilename, fileWildcard ) ) { if ( log.isDetailed() ) { logDetailed( BaseMessages.getString( PKG, "JobEntryDeleteFiles.DeletingFile", info .getFile().toString() ) ); log.logError( BaseMessages.getString( PKG, "JobDeleteFiles.Error.Exception.DeleteProcessError" ), BaseMessages .getString( PKG, "JobDeleteFiles.Error.Exception.DeleteProcess", info.getFile().toString(), e .getMessage() ) );
try { if ( !info.getFile().toString().equals( sourceFolder ) ) { String short_filename = info.getFile().getName().getBaseName(); if ( !info.getFile().getParent().equals( info.getBaseFolder() ) ) { && ( info.getFile().getType() == FileType.FILE ) && GetFileWildcard( short_filename, fileWildcard ) ) { if ( isDetailed() ) { logDetailed( BaseMessages.getString( PKG, "JobEntryCheckFilesLocked.CheckingFile", info .getFile().toString() ) ); if ( ( info.getFile().getType() == FileType.FILE ) && GetFileWildcard( short_filename, fileWildcard ) ) { if ( isDetailed() ) { logDetailed( BaseMessages.getString( PKG, "JobEntryCheckFilesLocked.CheckingFile", info .getFile().toString() ) ); .getString( PKG, "JobCheckFilesLocked.Error.Exception.Process", info.getFile().toString(), e .getMessage() ) ); returncode = false;
@Override public boolean includeFile( FileSelectInfo info ) { // Never return the parent directory of a file list. if ( info.getDepth() == 0 ) { return false; } FileObject fileObject = info.getFile(); try { if ( fileObject != null && filter.isFileTypeAllowed( fileObject.getType() ) ) { return true; } return false; } catch ( IOException ex ) { // Upon error don't process the file. return false; } } } );
@Before public void init() throws FileSystemException { fileSelectInfoMock = Mockito.mock( FileSelectInfo.class ); fileSelector = new JobEntryZipFile .ZipJobEntryPatternFileSelector( Pattern.compile( PATTERN ), Pattern.compile( EXCLUDE_PATTERN ) ); fileObjectMock = Mockito.mock( FileObject.class ); fileNameMock = Mockito.mock( FileName.class ); Mockito.when( fileSelectInfoMock.getFile() ).thenReturn( fileObjectMock ); Mockito.when( fileObjectMock.getType() ).thenReturn( FileType.FILE ); Mockito.when( fileObjectMock.getName() ).thenReturn( fileNameMock ); Mockito.when( fileNameMock.getBaseName() ).thenReturn( PATTERN_FILE_NAME ); }
@Override public boolean includeFile( FileSelectInfo info ) { // Never return the parent directory of a file list. if ( info.getDepth() == 0 ) { return false; } FileObject fileObject = info.getFile(); try { if ( fileObject != null && filter.isFileTypeAllowed( fileObject.getType() ) ) { String name = info.getFile().getName().getBaseName(); boolean matches = true; if ( !Utils.isEmpty( onemask ) ) { matches = Pattern.matches( onemask, name ); } boolean excludematches = false; if ( !Utils.isEmpty( excludeonemask ) ) { excludematches = Pattern.matches( excludeonemask, name ); } return ( matches && !excludematches ); } return false; } catch ( IOException ex ) { // Upon error don't process the file. return false; } } } );