private String getRelativePath( String filePath ) { String parentFolder = null; try { parentFolder = KettleVFS.getFileObject( transMeta.environmentSubstitute( transMeta.getFilename() ) ).getParent().toString(); } catch ( Exception e ) { // Take no action } if ( filePath != null ) { if ( parentFolder != null && filePath.startsWith( parentFolder ) ) { filePath = filePath.replace( parentFolder, "${" + Const.INTERNAL_VARIABLE_ENTRY_CURRENT_DIRECTORY + "}" ); } } return filePath; }
protected String getRelativePath( String filePath ) { String parentFolder = null; try { parentFolder = KettleVFS.getFileObject( transMeta.environmentSubstitute( transMeta.getFilename() ) ).getParent().toString(); } catch ( Exception e ) { // Take no action } if ( filePath != null ) { if ( parentFolder != null && filePath.startsWith( parentFolder ) ) { filePath = filePath.replace( parentFolder, "${" + Const.INTERNAL_VARIABLE_ENTRY_CURRENT_DIRECTORY + "}" ); } } return filePath; } }
private String calcRepositoryDirectory( KettleFileRepository fileRep, FileObject fileObject ) throws FileSystemException { String path = fileObject.getParent().getName().getPath(); String baseDirectory = fileRep.getRepositoryMeta().getBaseDirectory(); // Double check! // if ( path.startsWith( baseDirectory ) ) { return path.substring( baseDirectory.length() ); } else { return path; } }
private String calcRepositoryDirectory( KettleFileRepository fileRep, FileObject fileObject ) throws FileSystemException { String path = fileObject.getParent().getName().getPath(); String baseDirectory = fileRep.getRepositoryMeta().getBaseDirectory(); // Double check! // if ( path.startsWith( baseDirectory ) ) { return path.substring( baseDirectory.length() ); } else { return path; } } }
public String nameResource( FileObject fileObject, VariableSpace space, boolean includeFileName ) throws FileSystemException { if ( includeFileName ) { return handleDataFile( fileObject.getName().getBaseName(), fileObject.getParent().getURL().toString(), "" ); } else { return handleDataFile( "", fileObject.getURL().toString(), "" ); } }
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; }
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 job entry 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 logging 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 logging 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 ); } } } } }
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, "partitioner-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 partitioning 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 ); } } } } }
@Override protected void execute() throws Exception { FileObject targetDirectory = targetFile.getParent(); FileObjectRepository targetRepository = new FileObjectRepository( targetDirectory ); targetRoot = targetRepository.getRoot(); suffix = getSuffix( targetPath ); Path p = Paths.get( targetFile.getName().getPath() ); filename = IOUtils.getInstance().stripFileExtension( p.getFileName().toString() ); ReportProcessor reportProcessor = createReportProcessor( null ); try { reportProcessor.processReport(); } finally { reportProcessor.close(); } }
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; }
private Optional<String> promptForLocalFile() { String curFile = transMeta.environmentSubstitute( wFileName.getText() ); FileObject root; try { root = KettleVFS.getFileObject( curFile != null ? curFile : Const.getUserHomeDirectory() ); VfsFileChooserDialog vfsFileChooser = Spoon.getInstance().getVfsFileChooserDialog( root.getParent(), root ); FileObject file = vfsFileChooser.open( getShell(), null, fileFilters, fileFilterNames, VfsFileChooserDialog.VFS_DIALOG_OPEN_FILE ); if ( file == null ) { return Optional.empty(); } String filePath = getRelativePath( file.getName().toString() ); return Optional.ofNullable( filePath ); } catch ( IOException | KettleException e ) { new ErrorDialog( getShell(), BaseMessages.getString( PKG, "VFSFileSelection.ErrorLoadingFile.DialogTitle" ), BaseMessages.getString( PKG, "VFSFileSelection.ErrorLoadingFile.DialogMessage" ), e ); } return Optional.empty(); }
@Override protected void execute() throws Exception { FileObject targetDirectory = targetFile.getParent(); FileObjectRepository targetRepository = new FileObjectRepository( targetDirectory ); targetRoot = targetRepository.getRoot(); suffix = getSuffix( targetPath ); filename = IOUtils.getInstance().stripFileExtension( targetFile.getName().toString() ); ReportProcessor reportProcessor = createReportProcessor( null ); try { reportProcessor.processReport(); } finally { reportProcessor.close(); } }
/** * 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; } } }