/** * Returns the URL that represents this repository. The meaning of the URL returned here is implementation specific * and is probably not suitable to resolve names to global objects. * * @return the repository's URL. * @throws MalformedURLException if the URL could not be computed. */ public URL getURL() throws MalformedURLException { try { return root.getBackend().getURL(); } catch ( FileSystemException e ) { throw new RuntimeException( e ); } } }
public AnnotationDB getAnnotationDB( FileObject fileObject ) throws IOException { AnnotationDB result = annotationMap.get( fileObject ); if ( result == null ) { result = new AnnotationDB(); result.scanArchives( fileObject.getURL() ); annotationMap.put( fileObject, result ); } return result; }
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 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 URL[] prepareJarFiles( FileObject zipFile ) throws Exception { // zip:file:///tmp/foo.zip FileInputList fileList = FileInputList.createFileList( this, new String[] { "zip:" + zipFile.toString(), }, new String[] { ".*\\.jar$", }, // Include mask: only jar files new String[] { ".*classpath\\.jar$", }, // Exclude mask: only jar files new String[] { "Y", }, // File required new boolean[] { true, } ); // Search sub-directories List<URL> files = new ArrayList<URL>(); // Copy the jar files in the temp folder... // for ( FileObject file : fileList.getFiles() ) { FileObject jarfilecopy = KettleVFS.createTempFile( file.getName().getBaseName(), ".jar", environmentSubstitute( "${java.io.tmpdir}" ) ); jarfilecopy.copyFrom( file, new AllFileSelector() ); files.add( jarfilecopy.getURL() ); } return files.toArray( new URL[files.size()] ); }
/** * Initialize for processing specified file. */ protected void initByFile( String file ) throws Exception { initByURL( getFile( file ).getURL().getFile() ); }
@Test public void testPDI12424ParametersFromMetaAreCopiedToTrans() throws KettleException, URISyntaxException, IOException { String testParam = "testParam"; String testParamValue = "testParamValue"; TransMeta mockTransMeta = mock( TransMeta.class ); when( mockTransMeta.listVariables() ).thenReturn( new String[] {} ); when( mockTransMeta.listParameters() ).thenReturn( new String[] { testParam } ); when( mockTransMeta.getParameterValue( testParam ) ).thenReturn( testParamValue ); FileObject ktr = KettleVFS.createTempFile( "parameters", ".ktr", "ram://" ); try ( OutputStream outputStream = ktr.getContent().getOutputStream( true ) ) { InputStream inputStream = new ByteArrayInputStream( "<transformation></transformation>".getBytes() ); IOUtils.copy( inputStream, outputStream ); } Trans trans = new Trans( mockTransMeta, null, null, null, ktr.getURL().toURI().toString() ); assertEquals( testParamValue, trans.getParameterValue( testParam ) ); }
private void addAttachedFilePart( FileObject file ) throws Exception { // create a data source MimeBodyPart files = new MimeBodyPart(); // create a data source URLDataSource fds = new URLDataSource( file.getURL() ); // get a data Handler to manipulate this file type; files.setDataHandler( new DataHandler( fds ) ); // include the file in the data source files.setFileName( file.getName().getBaseName() ); // insist on base64 to preserve line endings files.addHeader( "Content-Transfer-Encoding", "base64" ); // add the part with the file in the BodyPart(); data.parts.addBodyPart( files ); if ( isDetailed() ) { logDetailed( BaseMessages.getString( PKG, "Mail.Log.AttachedFile", fds.getName() ) ); } }
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 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" ); 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, "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 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 ); } } } } }
/** * Initialize for processing specified file. */ protected void init( String file ) throws Exception { meta.setFilename( getFile( file ).getURL().getFile() ); step = new FixedInput( stepMeta, null, 1, transMeta, trans ); step.init( meta, data ); step.addRowListener( rowListener ); }
/** * Initialize for processing specified file. */ protected void init( String file ) throws Exception { meta.setFilename( getFile( file ).getURL().getFile() ); step = new CsvInput( stepMeta, null, 1, transMeta, trans ); step.init( meta, data ); step.addRowListener( rowListener ); }
/** * Initialize for processing specified file. */ protected void init( String file ) throws Exception { meta.setFilename( getFile( file ).getURL().getFile() ); step = new CubeInput( stepMeta, null, 1, transMeta, trans ); step.init( meta, data ); step.addRowListener( rowListener ); }
/** * Initialize for processing specified file. */ protected void init( String file ) throws Exception { meta.setFileName( new String[] { getFile( file ).getURL().getFile() } ); meta.setFileMask( new String[1] ); meta.setExcludeFileMask( new String[1] ); step = new PropertyInput( stepMeta, null, 1, transMeta, trans ); step.init( meta, data ); step.addRowListener( rowListener ); }
/** * Initialize for processing specified file. */ protected void init( String file ) throws Exception { meta.setFileName( new String[] { getFile( file ).getURL().getFile() } ); meta.setFileMask( new String[] { "" } ); meta.setExcludeFileMask( new String[] { "" } ); meta.setFileRequired( new String[] { "Y" } ); meta.setIncludeSubFolders( new String[] { "N" } ); step = new ExcelInput( stepMeta, null, 1, transMeta, trans ); step.init( meta, data ); step.addRowListener( rowListener ); }