@Override public FileObject resolveFile( String vfsUrl, FileSystemOptions fsOptions ) { try { return KettleVFS.getFileObject( vfsUrl, fsOptions ); } catch ( KettleFileException e ) { throw new RuntimeException( e ); } } }
@Override public FileObject resolveFile( String vfsUrl ) { try { return KettleVFS.getFileObject( vfsUrl ); } catch ( KettleFileException e ) { throw new RuntimeException( e ); } }
@Override public FileObject tryNext() throws KettleFileException { String fileName = step.environmentSubstitute( inner.next() ); return fileName == null ? null : KettleVFS.getFileObject( fileName, vars ); } }
/** * @param fileName * the filename to resolve. may contain Kettle Environment variables. * @return the data file name. * @throws IOException * ... */ private String resolveFileName( final String fileName ) throws KettleException { final FileObject fileObject = KettleVFS.getFileObject( environmentSubstitute( fileName ) ); return KettleVFS.getFilename( fileObject ); } }
public void deleteFile( String filename ) throws KettleException { try { FileObject fileObject = KettleVFS.getFileObject( filename ); fileObject.delete(); } catch ( Exception e ) { throw new KettleException( "Unable to delete file with name [" + filename + "]", e ); } }
public static InputStream getInputStream( String vfsFilename, VariableSpace space ) throws KettleFileException { try { FileObject fileObject = getFileObject( vfsFilename, space ); return getInputStream( fileObject ); } catch ( IOException e ) { throw new KettleFileException( e ); } }
public static OutputStream getOutputStream( String vfsFilename, VariableSpace space, FileSystemOptions fsOptions, boolean append ) throws KettleFileException { try { FileObject fileObject = getFileObject( vfsFilename, space, fsOptions ); return getOutputStream( fileObject, append ); } catch ( IOException e ) { throw new KettleFileException( e ); } }
@Override public FileObject getHeaderFileObject( final TransMeta transMeta ) { final String filename = transMeta.environmentSubstitute( getFilename() ); try { return KettleVFS.getFileObject( filename ); } catch ( final KettleFileException e ) { return null; } }
public String retrieveVfsPath( String pathToTmp ) throws KettleFileException { FileObject vfsFile = KettleVFS.getFileObject( pathToTmp ); String path = vfsFile.getName().getPath(); return path; }
public static OutputStream getOutputStream( String vfsFilename, VariableSpace space, boolean append ) throws KettleFileException { try { FileObject fileObject = getFileObject( vfsFilename, space ); return getOutputStream( fileObject, append ); } catch ( IOException e ) { throw new KettleFileException( e ); } }
public static GoogleAnalyticsApiFacade createFor( String application, String oauthServiceAccount, String oauthKeyFile ) throws GeneralSecurityException, IOException, KettleFileException { return new GoogleAnalyticsApiFacade( GoogleNetHttpTransport.newTrustedTransport(), JacksonFactory.getDefaultInstance(), application, oauthServiceAccount, new File( KettleVFS.getFileObject( oauthKeyFile ).getURL().getPath() ) ); }
private File getFile( final String filename ) { try { String uri = KettleVFS.getFileObject( environmentSubstitute( filename ), this ).getName().getPath(); return new File( uri ); } catch ( KettleFileException ex ) { logError( "Error in Fetching URI for File: " + filename, ex ); } return new File( filename ); }
public FileObject resolveFile( String fileUri ) throws FileSystemException { try { return KettleVFS.getFileObject( fileUri, getVariableSpace(), getFileSystemOptions() ); } catch ( KettleFileException e ) { throw new FileSystemException( e ); } }
public void deleteRootObject( String name, String extension ) throws KettleException { try { String filename = calcDirectoryName( null ) + name + extension; FileObject fileObject = KettleVFS.getFileObject( filename ); fileObject.delete(); } catch ( Exception e ) { throw new KettleException( "Unable to delete database with name [" + name + "] and extension [" + extension + "]", e ); } }
@After public void tearDown() throws Exception { try { KettleVFS.getFileObject( virtualFolder ).deleteAll(); // remove residual files FileUtils.deleteDirectory( Paths.get( virtualFolder ).getParent().getParent().toFile() ); } catch ( Exception ignored ) { // } } }
@Override public boolean exists( final String name, final RepositoryDirectoryInterface repositoryDirectory, final RepositoryObjectType objectType ) throws KettleException { try { FileObject fileObject = KettleVFS.getFileObject( calcFilename( repositoryDirectory, name, objectType.getExtension() ) ); return fileObject.exists(); } catch ( Exception e ) { throw new KettleException( e ); } }
public static MasterReport loadMasterReport( String sourceFilename ) throws Exception { ResourceManager manager = new ResourceManager(); manager.registerDefaults(); FileObject fileObject = KettleVFS.getFileObject( sourceFilename ); URL url = new URL( fileObject.getName().getURI() ); Resource resource = manager.createDirectly( url, MasterReport.class ); MasterReport report = (MasterReport) resource.getResource(); return report; }
@Before public void setup() throws Exception { PowerMockito.mockStatic( SSHData.class ); PowerMockito.mockStatic( KettleVFS.class ); when( SSHData.createConnection( server, port ) ).thenReturn( connection ); when( SSHData.OpenConnection( any(), anyInt(), any(), any(), anyBoolean(), any(), any(), anyInt(), anyObject(), any(), anyInt(), any(), any() ) ).thenCallRealMethod(); when( KettleVFS.getFileObject( keyFilePath ) ).thenReturn( fileObject ); }
private void doTest( String content, boolean toUnix, String expected ) throws Exception { try ( OutputStream os = new FileOutputStream( tmpFile ) ) { IOUtils.write( content.getBytes(), os ); } entry.convert( KettleVFS.getFileObject( tmpFilePath ), toUnix ); String converted = KettleVFS.getTextFileContent( tmpFilePath, "UTF-8" ); assertEquals( expected, converted ); } }
public ResultFile( Node node ) throws KettleFileException { try { type = getType( XMLHandler.getTagValue( node, "type" ) ); file = KettleVFS.getFileObject( XMLHandler.getTagValue( node, "file" ) ); originParent = XMLHandler.getTagValue( node, "parentorigin" ); origin = XMLHandler.getTagValue( node, "origin" ); comment = XMLHandler.getTagValue( node, "comment" ); timestamp = XMLHandler.stringToDate( XMLHandler.getTagValue( node, "timestamp" ) ); } catch ( Exception e ) { throw new KettleFileException( e ); } }