@Override public int compare( FileObject o1, FileObject o2 ) { String filename1 = getFilename( o1 ); String filename2 = getFilename( o2 ); return filename1.compareTo( filename2 ); } };
public String[] getFileStrings() { String[] fileStrings = new String[ files.size() ]; for ( int i = 0; i < fileStrings.length; i++ ) { fileStrings[ i ] = KettleVFS.getFilename( files.get( i ) ); } return fileStrings; }
/** * Verify a signature for detached file * * @param signatureFile * filename * @param originalFile * fill this value in case of detached signature * @throws KettleException */ public void verifyDetachedSignature( FileObject signatureFile, FileObject originalFile ) throws KettleException { verifyDetachedSignature( KettleVFS.getFilename( signatureFile ), KettleVFS.getFilename( originalFile ) ); }
/** * Decrypt a file * * @param cryptedFilename * crypted filename * @param passPhrase * passphrase for the personal private key to sign with * @param decryptedFilename * decrypted filename * @throws KettleException */ public void decryptFile( FileObject cryptedFilename, String passPhrase, FileObject decryptedFilename ) throws KettleException { decryptFile( KettleVFS.getFilename( cryptedFilename ), passPhrase, KettleVFS.getFilename( decryptedFilename ) ); }
/** * Sign and encrypt a file * * @param file * file to encrypt * @param userID * specific user id key * @param cryptedFile * crypted filename * @param asciiMode * output ASCII file * @throws KettleException */ public void signAndEncryptFile( FileObject file, String userID, FileObject cryptedFile, boolean asciiMode ) throws KettleException { signAndEncryptFile( KettleVFS.getFilename( file ), userID, KettleVFS.getFilename( cryptedFile ), asciiMode ); }
/** * Encrypt a file * * @param filename * file to encrypt * @param userID * specific user id key * @param cryptedFilename * crypted filename * @param asciiMode * output ASCII file * @throws KettleException */ public void encryptFile( FileObject filename, String userID, FileObject cryptedFilename, boolean asciiMode ) throws KettleException { encryptFile( KettleVFS.getFilename( filename ), userID, KettleVFS.getFilename( cryptedFilename ), asciiMode ); }
public void loadFile( FileObject file ) throws Exception { this.file = file; this.filename = KettleVFS.getFilename( file ); loadFile( filename ); }
/** * Verify a signature * * @param filename * filename * @throws KettleException */ public void verifySignature( FileObject filename ) throws KettleException { verifySignature( KettleVFS.getFilename( filename ) ); }
/** * Sign a file * * @param file * file to encrypt * @param userID * specific user id key * @param signedFile * crypted filename * @param asciiMode * output ASCII file * @throws KettleException */ public void signFile( FileObject file, String userID, FileObject signedFile, boolean asciiMode ) throws KettleException { try { signFile( KettleVFS.getFilename( file ), userID, KettleVFS.getFilename( signedFile ), asciiMode ); } catch ( Exception e ) { throw new KettleException( e ); } }
/** * @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 ); } }
@Override protected void fillFileAdditionalFields( JsonInputData data, FileObject file ) throws FileSystemException { super.fillFileAdditionalFields( data, file ); data.filename = KettleVFS.getFilename( file ); data.filenr++; if ( log.isDetailed() ) { logDetailed( BaseMessages.getString( PKG, "JsonInput.Log.OpeningFile", file.toString() ) ); } addFileToResultFilesname( file ); }
private void checkFilesLocked( FileObject[] files ) throws KettleException { for ( int i = 0; i < files.length && !oneFileLocked; i++ ) { FileObject file = files[i]; String filename = KettleVFS.getFilename( file ); LockFile locked = new LockFile( filename ); if ( locked.isLocked() ) { oneFileLocked = true; logError( BaseMessages.getString( PKG, "JobCheckFilesLocked.Log.FileLocked", filename ) ); } else { if ( isDetailed() ) { logDetailed( BaseMessages.getString( PKG, "JobCheckFilesLocked.Log.FileNotLocked", filename ) ); } } } }
protected void registerXmlPlugins() throws KettlePluginException { for ( PluginFolderInterface folder : pluginFolders ) { if ( folder.isPluginXmlFolder() ) { List<FileObject> pluginXmlFiles = findPluginXmlFiles( folder.getFolder() ); for ( FileObject file : pluginXmlFiles ) { try { Document document = XMLHandler.loadXMLFile( file ); Node pluginNode = XMLHandler.getSubNode( document, "plugin" ); if ( pluginNode != null ) { registerPluginFromXmlResource( pluginNode, KettleVFS.getFilename( file.getParent() ), this .getClass(), false, file.getParent().getURL() ); } } catch ( Exception e ) { // We want to report this plugin.xml error, perhaps an XML typo or something like that... // log.logError( "Error found while reading logging plugin.xml file: " + file.getName().toString(), e ); } } } } }
protected void registerXmlPlugins() throws KettlePluginException { for ( PluginFolderInterface folder : pluginFolders ) { if ( folder.isPluginXmlFolder() ) { List<FileObject> pluginXmlFiles = findPluginXmlFiles( folder.getFolder() ); for ( FileObject file : pluginXmlFiles ) { try { Document document = XMLHandler.loadXMLFile( file ); Node pluginNode = XMLHandler.getSubNode( document, "plugin" ); registerPluginFromXmlResource( pluginNode, KettleVFS.getFilename( file.getParent() ), this.getClass(), false, file .getParent().getURL() ); } catch ( Exception e ) { // We want to report this plugin.xml error, perhaps an XML typo or something like that... // log.logError( "Error found while reading repository plugin.xml file: " + file.getName().toString(), e ); } } } } }
protected void registerXmlPlugins() throws KettlePluginException { for ( PluginFolderInterface folder : pluginFolders ) { if ( folder.isPluginXmlFolder() ) { List<FileObject> pluginXmlFiles = findPluginXmlFiles( folder.getFolder() ); for ( FileObject file : pluginXmlFiles ) { try { Document document = XMLHandler.loadXMLFile( file ); Node pluginNode = XMLHandler.getSubNode( document, "plugin" ); if ( pluginNode != null ) { registerPluginFromXmlResource( pluginNode, KettleVFS.getFilename( file.getParent() ), this .getClass(), false, file.getParent().getURL() ); } } catch ( Exception e ) { // We want to report this plugin.xml error, perhaps an XML typo or something like that... // log.logError( "Error found while reading step plugin.xml file: " + file.getName().toString(), e ); } } } } }
protected void registerXmlPlugins() throws KettlePluginException { for ( PluginFolderInterface folder : pluginFolders ) { if ( folder.isPluginXmlFolder() ) { List<FileObject> pluginXmlFiles = findPluginXmlFiles( folder.getFolder() ); for ( FileObject file : pluginXmlFiles ) { try { Document document = XMLHandler.loadXMLFile( file ); Node pluginNode = XMLHandler.getSubNode( document, "plugin" ); if ( pluginNode != null ) { registerPluginFromXmlResource( pluginNode, KettleVFS.getFilename( file.getParent() ), this .getClass(), false, file.getParent().getURL() ); } } catch ( Exception e ) { // We want to report this plugin.xml error, perhaps an XML typo or something like that... // log.logError( "Error found while reading job entry plugin.xml file: " + file.getName().toString(), e ); } } } } }
@Override protected void registerXmlPlugins() throws KettlePluginException { for ( PluginFolderInterface folder : pluginFolders ) { if ( folder.isPluginXmlFolder() ) { List<FileObject> pluginXmlFiles = findPluginXmlFiles( folder.getFolder() ); for ( FileObject file : pluginXmlFiles ) { try { Document document = XMLHandler.loadXMLFile( file ); Node pluginNode = XMLHandler.getSubNode( document, "plugin" ); if ( pluginNode != null ) { registerPluginFromXmlResource( pluginNode, KettleVFS.getFilename( file.getParent() ), this .getClass(), false, file.getParent().getURL() ); } } catch ( Exception e ) { // We want to report this plugin.xml error, perhaps an XML typo or something like that... // log.logError( "Error found while reading step plugin.xml file: " + file.getName().toString(), e ); } } } } }
@Override protected void registerXmlPlugins() throws KettlePluginException { for ( PluginFolderInterface folder : pluginFolders ) { if ( folder.isPluginXmlFolder() ) { List<FileObject> pluginXmlFiles = findPluginXmlFiles( folder.getFolder() ); for ( FileObject file : pluginXmlFiles ) { try { Document document = XMLHandler.loadXMLFile( file ); Node pluginNode = XMLHandler.getSubNode( document, "plugin" ); if ( pluginNode != null ) { registerPluginFromXmlResource( pluginNode, KettleVFS.getFilename( file.getParent() ), this .getClass(), false, file.getParent().getURL() ); } } catch ( Exception e ) { // We want to report this plugin.xml error, perhaps an XML typo or something like that... // log.logError( "Error found while reading password encoder plugin.xml file: " + file.getName().toString(), e ); } } } } }
private String getFilename( VariableSpace space ) throws KettleStepException { FileObject file = null; try { file = KettleVFS.getFileObject( space.environmentSubstitute( getFileName() ) ); return KettleVFS.getFilename( file ); } catch ( Exception e ) { throw new KettleStepException( BaseMessages .getString( PKG, "RssOutput.Meta.ErrorGettingFile", getFileName() ), e ); } finally { if ( file != null ) { try { file.close(); } catch ( Exception e ) { /* Ignore */ } } } }
/** * Prepare file-dependent data for fill additional fields. */ protected void fillFileAdditionalFields( D data, FileObject file ) throws FileSystemException { data.shortFilename = file.getName().getBaseName(); data.path = KettleVFS.getFilename( file.getParent() ); data.hidden = file.isHidden(); data.extension = file.getName().getExtension(); data.uriName = file.getName().getURI(); data.rootUriName = file.getName().getRootURI(); if ( file.getType().hasContent() ) { data.lastModificationDateTime = new Date( file.getContent().getLastModifiedTime() ); data.size = file.getContent().getSize(); } else { data.lastModificationDateTime = null; data.size = null; } } }