From c9f1e71b9879395e695dbc8ee09463ff330d5550 Mon Sep 17 00:00:00 2001 From: Alan Bryant Date: Wed, 11 Sep 2024 09:41:26 -0400 Subject: [PATCH] [BACKLOG-41094] - changes to use a Bowl for all VFS operations --- .../java/org/pentaho/di/core/ResultFile.java | 5 +- .../pentaho/di/core/database/Database.java | 8 +- .../logging/FileLoggingEventListener.java | 7 +- .../core/logging/log4j/Log4jFileAppender.java | 7 +- .../di/core/plugins/BasePluginType.java | 5 +- .../pentaho/di/core/plugins/PluginFolder.java | 5 +- .../pentaho/di/core/row/ValueDataUtil.java | 56 +++--- .../pentaho/di/shared/VfsSharedObjectsIO.java | 34 ++-- .../org/pentaho/di/core/ResultFileTest.java | 6 +- .../di/core/fileinput/FileInputListTest.java | 11 +- .../di/core/plugins/BasePluginTypeTest.java | 7 +- .../di/shared/VfsSharedObjectsIOTest.java | 5 +- .../entries/zipfile/JobEntryZipFileIT.java | 4 +- .../org/pentaho/di/base/IMetaFileLoader.java | 9 +- .../pentaho/di/base/MetaFileLoaderImpl.java | 46 ++--- .../org/pentaho/di/cluster/SlaveServer.java | 6 +- .../di/core/logging/LogChannelFileWriter.java | 5 +- .../org/pentaho/di/core/util/FileUtil.java | 6 +- .../di/core/util/SwingSvgImageUtil.java | 5 +- .../main/java/org/pentaho/di/imp/Import.java | 5 +- .../src/main/java/org/pentaho/di/job/Job.java | 20 ++- .../JobEntryCheckFilesLocked.java | 11 +- .../job/entries/checkfilelocked/LockFile.java | 12 +- .../columnsexist/JobEntryColumnsExist.java | 6 +- .../entries/copyfiles/JobEntryCopyFiles.java | 74 ++++---- .../JobEntryCopyMoveResultFilenames.java | 13 +- .../createfile/JobEntryCreateFile.java | 2 +- .../createfolder/JobEntryCreateFolder.java | 7 +- .../di/job/entries/delay/JobEntryDelay.java | 6 +- .../deletefile/JobEntryDeleteFile.java | 2 +- .../deletefiles/JobEntryDeleteFiles.java | 11 +- .../deletefolders/JobEntryDeleteFolders.java | 9 +- .../JobEntryDeleteResultFilenames.java | 4 +- .../entries/dostounix/JobEntryDosToUnix.java | 4 +- .../di/job/entries/eval/JobEntryEval.java | 5 +- .../JobEntryEvalFilesMetrics.java | 8 +- .../JobEntryEvalTableContent.java | 4 +- .../filecompare/JobEntryFileCompare.java | 14 +- .../fileexists/JobEntryFileExists.java | 13 +- .../filesexist/JobEntryFilesExist.java | 4 +- .../folderisempty/JobEntryFolderIsEmpty.java | 6 +- .../JobEntryFoldersCompare.java | 21 ++- .../di/job/entries/http/JobEntryHTTP.java | 16 +- .../di/job/entries/job/JobEntryJob.java | 28 +-- .../entries/movefiles/JobEntryMoveFiles.java | 34 ++-- .../mssqlbulkload/JobEntryMssqlBulkLoad.java | 13 +- .../mysqlbulkfile/JobEntryMysqlBulkFile.java | 10 +- .../mysqlbulkload/JobEntryMysqlBulkLoad.java | 11 +- .../JobEntryPGPDecryptFiles.java | 38 ++-- .../di/job/entries/pgpencryptfiles/GPG.java | 7 +- .../JobEntryPGPEncryptFiles.java | 37 ++-- .../entries/pgpverify/JobEntryPGPVerify.java | 17 +- .../di/job/entries/ping/JobEntryPing.java | 4 +- .../JobEntrySendNagiosPassiveCheck.java | 4 +- .../setvariables/JobEntrySetVariables.java | 8 +- .../di/job/entries/sftp/SFTPClient.java | 32 ++-- .../di/job/entries/shell/JobEntryShell.java | 23 +-- .../di/job/entries/sql/JobEntrySQL.java | 6 +- .../tableexists/JobEntryTableExists.java | 4 +- .../talendjobexec/JobEntryTalendJobExec.java | 18 +- .../di/job/entries/telnet/JobEntryTelnet.java | 4 +- .../di/job/entries/trans/JobEntryTrans.java | 24 +-- .../JobEntryTruncateTables.java | 6 +- .../di/job/entries/unzip/JobEntryUnZip.java | 29 +-- .../waitforfile/JobEntryWaitForFile.java | 12 +- .../waitforsql/JobEntryWaitForSQL.java | 4 +- .../writetofile/JobEntryWriteToFile.java | 8 +- .../job/entries/zipfile/JobEntryZipFile.java | 34 ++-- .../di/job/entry/JobEntryInterface.java | 8 +- .../di/job/entry/validator/AndValidator.java | 7 +- .../job/entry/validator/EmailValidator.java | 5 +- .../validator/FileDoesNotExistValidator.java | 7 +- .../entry/validator/FileExistsValidator.java | 7 +- .../job/entry/validator/IntegerValidator.java | 5 +- .../di/job/entry/validator/LongValidator.java | 5 +- .../entry/validator/NotBlankValidator.java | 5 +- .../job/entry/validator/NotNullValidator.java | 5 +- .../di/kitchen/KitchenCommandExecutor.java | 14 +- .../pentaho/di/pan/PanCommandExecutor.java | 12 +- .../di/repository/RepositoryExporter.java | 17 +- .../filerep/KettleFileRepository.java | 57 +++--- .../org/pentaho/di/resource/ResourceUtil.java | 17 +- .../org/pentaho/di/shared/SharedObjects.java | 9 +- .../pentaho/di/trans/StepWithMappingMeta.java | 12 +- .../pentaho/di/trans/step/BaseStepMeta.java | 18 +- .../org/pentaho/di/trans/step/StepMeta.java | 9 +- .../AbstractFileErrorHandler.java | 11 +- .../di/trans/steps/calculator/Calculator.java | 26 ++- .../steps/calculator/CalculatorMeta.java | 5 +- .../di/trans/steps/constant/Constant.java | 5 +- .../di/trans/steps/constant/ConstantMeta.java | 6 +- .../di/trans/steps/csvinput/CsvInput.java | 14 +- .../di/trans/steps/csvinput/CsvInputMeta.java | 15 +- .../steps/databasejoin/DatabaseJoin.java | 4 +- .../steps/databasejoin/DatabaseJoinMeta.java | 8 +- .../steps/databaselookup/DatabaseLookup.java | 5 +- .../databaselookup/DatabaseLookupMeta.java | 5 +- .../di/trans/steps/datagrid/DataGrid.java | 5 +- .../di/trans/steps/datagrid/DataGridMeta.java | 5 +- .../pentaho/di/trans/steps/dbproc/DBProc.java | 5 +- .../di/trans/steps/dbproc/DBProcMeta.java | 5 +- .../pentaho/di/trans/steps/delete/Delete.java | 5 +- .../di/trans/steps/delete/DeleteMeta.java | 6 +- .../steps/denormaliser/Denormaliser.java | 5 +- .../steps/denormaliser/DenormaliserMeta.java | 5 +- .../steps/detectlastrow/DetectLastRow.java | 5 +- .../detectlastrow/DetectLastRowMeta.java | 6 +- .../dimensionlookup/DimensionLookup.java | 5 +- .../dimensionlookup/DimensionLookupMeta.java | 5 +- .../steps/dummytrans/DummyTransMeta.java | 6 +- .../steps/dynamicsqlrow/DynamicSQLRow.java | 7 +- .../dynamicsqlrow/DynamicSQLRowMeta.java | 9 +- .../trans/steps/execprocess/ExecProcess.java | 5 +- .../steps/execprocess/ExecProcessMeta.java | 7 +- .../di/trans/steps/execsqlrow/ExecSQLRow.java | 7 +- .../steps/execsqlrow/ExecSQLRowMeta.java | 6 +- .../FieldsChangeSequence.java | 5 +- .../FieldsChangeSequenceMeta.java | 5 +- .../steps/fieldsplitter/FieldSplitter.java | 5 +- .../fieldsplitter/FieldSplitterMeta.java | 6 +- .../trans/steps/file/BaseFileInputStep.java | 3 +- .../di/trans/steps/fileexists/FileExists.java | 7 +- .../steps/fileexists/FileExistsMeta.java | 6 +- .../fileinput/text/TextFileInputMeta.java | 17 +- .../di/trans/steps/filelocked/FileLocked.java | 11 +- .../steps/filelocked/FileLockedMeta.java | 8 +- .../filesfromresult/FilesFromResult.java | 5 +- .../filesfromresult/FilesFromResultMeta.java | 9 +- .../steps/filestoresult/FilesToResult.java | 8 +- .../filestoresult/FilesToResultMeta.java | 6 +- .../di/trans/steps/filterrows/FilterRows.java | 5 +- .../steps/filterrows/FilterRowsMeta.java | 6 +- .../di/trans/steps/fixedinput/FixedInput.java | 8 +- .../steps/fixedinput/FixedInputMeta.java | 15 +- .../di/trans/steps/flattener/Flattener.java | 5 +- .../trans/steps/flattener/FlattenerMeta.java | 5 +- .../di/trans/steps/formula/Formula.java | 5 +- .../di/trans/steps/formula/FormulaMeta.java | 5 +- .../di/trans/steps/fuzzymatch/FuzzyMatch.java | 6 +- .../steps/fuzzymatch/FuzzyMatchMeta.java | 6 +- .../steps/getfilenames/GetFileNames.java | 12 +- .../steps/getfilenames/GetFileNamesMeta.java | 13 +- .../getfilesrowscount/GetFilesRowsCount.java | 14 +- .../GetFilesRowsCountMeta.java | 21 ++- .../getslavesequence/GetSlaveSequence.java | 5 +- .../GetSlaveSequenceMeta.java | 5 +- .../steps/getsubfolders/GetSubFolders.java | 14 +- .../getsubfolders/GetSubFoldersMeta.java | 23 ++- .../steps/gettablenames/GetTableNames.java | 8 +- .../gettablenames/GetTableNamesMeta.java | 6 +- .../trans/steps/getvariable/GetVariable.java | 5 +- .../steps/getvariable/GetVariableMeta.java | 7 +- .../di/trans/steps/groupby/GroupBy.java | 7 +- .../di/trans/steps/groupby/GroupByMeta.java | 5 +- .../org/pentaho/di/trans/steps/http/HTTP.java | 5 +- .../pentaho/di/trans/steps/http/HTTPMeta.java | 6 +- .../di/trans/steps/httppost/HTTPPOST.java | 5 +- .../di/trans/steps/httppost/HTTPPOSTMeta.java | 6 +- .../pentaho/di/trans/steps/ifnull/IfNull.java | 5 +- .../di/trans/steps/injector/InjectorMeta.java | 12 +- .../steps/insertupdate/InsertUpdate.java | 5 +- .../steps/insertupdate/InsertUpdateMeta.java | 6 +- .../pentaho/di/trans/steps/janino/Janino.java | 5 +- .../di/trans/steps/janino/JaninoMeta.java | 5 +- .../di/trans/steps/javafilter/JavaFilter.java | 5 +- .../trans/steps/jobexecutor/JobExecutor.java | 10 +- .../steps/jobexecutor/JobExecutorMeta.java | 32 ++-- .../di/trans/steps/joinrows/JoinRowsMeta.java | 5 +- .../di/trans/steps/ldifinput/LDIFInput.java | 12 +- .../trans/steps/ldifinput/LDIFInputMeta.java | 18 +- .../steps/loadfileinput/LoadFileInput.java | 21 +-- .../loadfileinput/LoadFileInputMeta.java | 18 +- .../di/trans/steps/mapping/Mapping.java | 4 +- .../di/trans/steps/mapping/MappingMeta.java | 22 ++- .../steps/mappinginput/MappingInput.java | 5 +- .../steps/mappinginput/MappingInputMeta.java | 6 +- .../steps/mappingoutput/MappingOutput.java | 5 +- .../mappingoutput/MappingOutputMeta.java | 6 +- .../trans/steps/memgroupby/MemoryGroupBy.java | 5 +- .../steps/memgroupby/MemoryGroupByMeta.java | 5 +- .../trans/steps/mergejoin/MergeJoinMeta.java | 6 +- .../di/trans/steps/mergerows/MergeRows.java | 6 +- .../trans/steps/mergerows/MergeRowsMeta.java | 5 +- .../steps/multimerge/MultiMergeJoinMeta.java | 5 +- .../di/trans/steps/normaliser/Normaliser.java | 5 +- .../steps/normaliser/NormaliserMeta.java | 5 +- .../di/trans/steps/nullif/NullIfMeta.java | 6 +- .../trans/steps/numberrange/NumberRange.java | 5 +- .../steps/numberrange/NumberRangeMeta.java | 5 +- .../trans/steps/olapinput/OlapInputMeta.java | 5 +- .../parallelgzipcsv/ParGzipCsvInput.java | 8 +- .../parallelgzipcsv/ParGzipCsvInputMeta.java | 10 +- .../pgpdecryptstream/PGPDecryptStream.java | 7 +- .../PGPDecryptStreamMeta.java | 7 +- .../pgpencryptstream/PGPEncryptStream.java | 7 +- .../PGPEncryptStreamMeta.java | 7 +- .../PrioritizeStreamsMeta.java | 6 +- .../steps/processfiles/ProcessFiles.java | 9 +- .../steps/propertyinput/PropertyInput.java | 13 +- .../propertyinput/PropertyInputMeta.java | 18 +- .../steps/propertyoutput/PropertyOutput.java | 11 +- .../propertyoutput/PropertyOutputMeta.java | 8 +- .../trans/steps/randomvalue/RandomValue.java | 8 +- .../steps/randomvalue/RandomValueMeta.java | 5 +- .../di/trans/steps/regexeval/RegexEval.java | 5 +- .../trans/steps/regexeval/RegexEvalMeta.java | 9 +- .../steps/replacestring/ReplaceString.java | 5 +- .../replacestring/ReplaceStringMeta.java | 6 +- .../ReservoirSamplingMeta.java | 6 +- .../steps/rowgenerator/RowGeneratorMeta.java | 6 +- .../rowsfromresult/RowsFromResultMeta.java | 6 +- .../steps/rowstoresult/RowsToResult.java | 5 +- .../steps/rowstoresult/RowsToResultMeta.java | 6 +- .../di/trans/steps/samplerows/SampleRows.java | 6 +- .../steps/samplerows/SampleRowsMeta.java | 6 +- .../di/trans/steps/sasinput/SasInput.java | 11 +- .../di/trans/steps/sasinput/SasInputMeta.java | 5 +- .../pentaho/di/trans/steps/script/Script.java | 5 +- .../steps/script/ScriptAddedFunctions.java | 61 ++++--- .../di/trans/steps/script/ScriptMeta.java | 11 +- .../ScriptValuesAddedFunctions.java | 45 +++-- .../scriptvalues_mod/ScriptValuesMetaMod.java | 11 +- .../scriptvalues_mod/ScriptValuesMod.java | 5 +- .../steps/selectvalues/SelectValuesMeta.java | 7 +- .../setvalueconstant/SetValueConstant.java | 5 +- .../steps/setvaluefield/SetValueField.java | 5 +- .../steps/setvariable/SetVariableMeta.java | 3 +- .../steps/simplemapping/SimpleMapping.java | 5 +- .../simplemapping/SimpleMappingMeta.java | 17 +- .../steps/singlethreader/SingleThreader.java | 5 +- .../singlethreader/SingleThreaderMeta.java | 25 +-- .../steps/socketreader/SocketReaderMeta.java | 6 +- .../steps/socketwriter/SocketWriterMeta.java | 6 +- .../pentaho/di/trans/steps/sort/SortRows.java | 12 +- .../di/trans/steps/sort/SortRowsMeta.java | 7 +- .../steps/sortedmerge/SortedMergeMeta.java | 6 +- .../splitfieldtorows/SplitFieldToRows.java | 5 +- .../SplitFieldToRowsMeta.java | 6 +- .../pentaho/di/trans/steps/sql/ExecSQL.java | 5 +- .../di/trans/steps/sql/ExecSQLMeta.java | 6 +- .../steps/sqlfileoutput/SQLFileOutput.java | 15 +- .../sqlfileoutput/SQLFileOutputMeta.java | 9 +- .../org/pentaho/di/trans/steps/ssh/SSH.java | 12 +- .../pentaho/di/trans/steps/ssh/SSHData.java | 7 +- .../pentaho/di/trans/steps/ssh/SSHMeta.java | 14 +- .../steps/stepmeta/StepMetastructure.java | 5 +- .../steps/stepmeta/StepMetastructureMeta.java | 5 +- .../steps/stepsmetrics/StepsMetrics.java | 5 +- .../steps/stepsmetrics/StepsMetricsMeta.java | 6 +- .../steps/streamlookup/StreamLookup.java | 4 +- .../steps/streamlookup/StreamLookupMeta.java | 5 +- .../di/trans/steps/stringcut/StringCut.java | 6 +- .../trans/steps/stringcut/StringCutMeta.java | 6 +- .../stringoperations/StringOperations.java | 5 +- .../StringOperationsMeta.java | 7 +- .../di/trans/steps/switchcase/SwitchCase.java | 5 +- .../steps/switchcase/SwitchCaseMeta.java | 6 +- .../SecretKeyGenerator.java | 8 +- .../SecretKeyGeneratorMeta.java | 5 +- .../symmetricalgorithm/SymmetricCrypto.java | 7 +- .../SymmetricCryptoTrans.java | 5 +- .../SymmetricCryptoTransMeta.java | 6 +- .../SynchronizeAfterMerge.java | 5 +- .../di/trans/steps/systemdata/SystemData.java | 8 +- .../steps/systemdata/SystemDataMeta.java | 5 +- .../steps/tablecompare/TableCompare.java | 5 +- .../steps/tablecompare/TableCompareMeta.java | 7 +- .../trans/steps/tableexists/TableExists.java | 5 +- .../steps/tableexists/TableExistsMeta.java | 6 +- .../steps/tableinput/TableInputMeta.java | 9 +- .../trans/steps/tableoutput/TableOutput.java | 5 +- .../steps/tableoutput/TableOutputMeta.java | 6 +- .../steps/textfileinput/TextFileInput.java | 6 +- .../textfileinput/TextFileInputMeta.java | 13 +- .../steps/textfileoutput/TextFileOutput.java | 3 +- .../textfileoutput/TextFileOutputMeta.java | 6 +- .../steps/transexecutor/TransExecutor.java | 5 +- .../transexecutor/TransExecutorMeta.java | 17 +- .../di/trans/steps/uniquerows/UniqueRows.java | 5 +- .../steps/uniquerows/UniqueRowsMeta.java | 5 +- .../UniqueRowsByHashSet.java | 5 +- .../UniqueRowsByHashSetMeta.java | 6 +- .../univariatestats/UnivariateStats.java | 5 +- .../univariatestats/UnivariateStatsMeta.java | 5 +- .../pentaho/di/trans/steps/update/Update.java | 5 +- .../di/trans/steps/update/UpdateMeta.java | 5 +- .../UserDefinedJavaClassMeta.java | 6 +- .../trans/steps/valuemapper/ValueMapper.java | 4 +- .../steps/valuemapper/ValueMapperMeta.java | 5 +- .../WebServiceAvailable.java | 5 +- .../WebServiceAvailableMeta.java | 6 +- .../trans/steps/webservices/WebService.java | 5 +- .../steps/webservices/WebServiceMeta.java | 5 +- .../di/trans/steps/xbaseinput/XBaseInput.java | 7 +- .../steps/xbaseinput/XBaseInputMeta.java | 22 +-- .../di/trans/steps/zipfile/ZipFile.java | 17 +- .../streaming/common/BaseStreamStep.java | 6 +- .../streaming/common/BaseStreamStepMeta.java | 21 +-- .../org/pentaho/di/www/AddExportServlet.java | 20 ++- .../org/pentaho/di/www/AddTransServlet.java | 5 +- .../org/pentaho/di/www/BaseJobServlet.java | 6 +- .../main/java/org/pentaho/di/www/Carte.java | 5 +- .../org/pentaho/di/www/ExecuteJobServlet.java | 8 +- .../pentaho/di/www/ExecuteTransServlet.java | 8 +- .../di/www/RegisterPackageServlet.java | 18 +- .../di/base/MetaFileLoaderImplTest.java | 35 ++-- .../di/core/row/ValueDataUtilTest.java | 122 +++++++------ .../java/org/pentaho/di/job/JobMetaTest.java | 5 +- .../copyfiles/JobEntryCopyFilesTest.java | 2 + .../deletefiles/JobEntryDeleteFilesTest.java | 2 + ...yDosToUnix_ConversionIdempotency_Test.java | 7 +- .../filesexist/JobEntryFilesExistTest.java | 5 +- .../JobEntryFolderIsEmptyTest.java | 5 +- .../di/job/entries/http/JobEntryHTTPTest.java | 6 +- .../http/JobEntryHTTP_PDI208_Test.java | 5 +- .../http/JobEntryHTTP_PDI_18044_Test.java | 4 +- .../http/JobEntryHTTP_PDI_19104_Test.java | 4 +- .../di/job/entries/job/JobEntryJobTest.java | 167 +++++++++++------- .../di/job/entries/sftp/SFTPClientTest.java | 23 +-- .../job/entries/trans/JobEntryTransTest.java | 8 +- .../job/entries/unzip/JobEntryUnZipTest.java | 8 + .../zipfile/JobEntryZipFileMoveFilesTest.java | 12 +- .../kitchen/KitchenCommandExecutorTest.java | 9 +- .../di/pan/PanCommandExecutorTest.java | 18 +- .../filerep/KettleFileRepositoryTestBase.java | 7 +- .../pentaho/di/shared/SharedObjectsTest.java | 9 +- .../di/trans/StepWithMappingMetaTest.java | 21 ++- .../di/trans/SubtransExecutorTest.java | 25 ++- .../org/pentaho/di/trans/TransMetaTest.java | 25 ++- .../java/org/pentaho/di/trans/TransTest.java | 8 +- .../AbstractFileErrorHandlerTest.java | 4 +- .../steps/csvinput/BaseCsvParsingTest.java | 6 +- .../DatabaseLookupMetaTest.java | 5 +- .../databaselookup/DatabaseLookupUTest.java | 3 + .../steps/databaselookup/PDI5436Test.java | 3 +- .../denormaliser/DenormalizerMetaTest.java | 5 +- .../detectlastrow/DetectLastRowMetaTest.java | 5 +- .../DimensionLookupMetaTest.java | 4 +- .../fieldsplitter/FieldSplitterTest.java | 3 +- .../fileinput/text/BaseTextParsingTest.java | 6 +- .../fileinput/text/TextFileInputMetaTest.java | 14 +- .../fileinput/text/TextFileInputTest.java | 7 +- .../fixedinput/BaseFixedParsingTest.java | 6 +- .../getsubfolders/GetSubFoldersMetaTest.java | 9 +- .../getvariable/GetVariableMetaTest.java | 5 +- .../groupby/GroupByMetaGetFieldsTest.java | 10 +- .../di/trans/steps/groupby/GroupByTest.java | 3 +- .../di/trans/steps/ifnull/IfNullTest.java | 9 +- .../jobexecutor/JobExecutorMetaTest.java | 17 +- .../loadfileinput/LoadFileInputTest.java | 4 +- .../steps/loadfileinput/PDI_6976_Test.java | 8 +- .../steps/mapping/MappingOutputMetaTest.java | 5 +- .../MappingInputMeta_GetFields_Test.java | 5 +- .../MemoryGroupByMetaGetFieldsTest.java | 11 +- .../memgroupby/MemoryGroupByMetaTest.java | 7 +- .../steps/mergejoin/MergeJoinMetaTest.java | 5 +- .../di/trans/steps/mock/StepMockHelper.java | 5 + .../di/trans/steps/nullif/NullIfTest.java | 5 +- .../BasePropertyParsingTest.java | 6 +- .../steps/regexeval/RegexEvalMetaTest.java | 13 +- .../replacestring/ReplaceStringMetaTest.java | 5 +- .../rowgenerator/RowGeneratorUnitTest.java | 6 +- .../di/trans/steps/ssh/SSHDataTest.java | 21 ++- .../steps/streamlookup/StreamLookupTest.java | 8 +- .../StringOperationsMetaTest.java | 4 +- .../steps/tableinput/TableInputMetaTest.java | 3 +- .../textfileinput/TextFileInputTest.java | 9 +- .../transexecutor/TransExecutorMetaTest.java | 12 +- .../TransExecutorMeta_GetFields_Test.java | 3 +- .../UnivariateStatsMetaTest.java | 3 +- .../steps/webservices/WebServiceMetaTest.java | 4 +- .../common/BaseStreamStepMetaTest.java | 33 ++-- .../streaming/common/BaseStreamStepTest.java | 4 + .../java/org/pentaho/di/utils/TestUtils.java | 7 +- .../di/www/RegisterPackageServletTest.java | 9 +- .../pentaho/di/cluster/PartitioningIT.java | 8 +- .../org/pentaho/di/core/vfs/VfsCoreTest.java | 5 +- .../KettleDatabaseRepositoryIT.java | 4 +- .../di/repository/KettleFileRepositoryIT.java | 4 +- .../pentaho/di/resource/NameResourceIT.java | 4 +- .../pentaho/di/resource/ResourceExportIT.java | 6 +- .../TextFileOutputSplittingIT.java | 4 +- .../steps/aggregaterows/AggregateRows.java | 5 +- .../aggregaterows/AggregateRowsMeta.java | 5 +- .../di/trans/steps/avro/input/AvroInput.java | 12 +- .../steps/avro/input/AvroInputDialog.java | 2 +- .../steps/avro/input/AvroInputMetaBase.java | 27 +-- .../steps/avro/input/AvroNestedReader.java | 60 ++++--- .../avro/input/AvroNestedRecordReader.java | 10 +- .../avro/input/IPentahoAvroInputFormat.java | 5 +- .../avro/input/PentahoAvroInputFormat.java | 27 ++- .../trans/steps/avro/output/AvroOutput.java | 3 +- .../steps/avro/output/AvroOutputMetaBase.java | 9 +- .../avro/output/IPentahoAvroOutputFormat.java | 5 +- .../avro/output/PentahoAvroOutputFormat.java | 17 +- .../steps/avro/input/AvroInputMetaTest.java | 13 +- .../input/PentahoAvroInputFormatTest.java | 4 +- .../avro/input/PentahoAvroReadWriteTest.java | 9 +- .../JobEntryCheckDbConnectionsIT.java | 4 +- .../JobEntryAddResultFilenames.java | 16 +- .../JobEntryCheckDbConnections.java | 8 +- .../di/trans/steps/abort/AbortMeta.java | 6 +- .../trans/steps/addsequence/AddSequence.java | 5 +- .../steps/addsequence/AddSequenceMeta.java | 5 +- .../steps/analyticquery/AnalyticQuery.java | 5 +- .../analyticquery/AnalyticQueryMeta.java | 6 +- .../di/trans/steps/append/AppendMeta.java | 6 +- .../di/trans/steps/autodoc/AutoDoc.java | 35 ++-- .../di/trans/steps/autodoc/AutoDocMeta.java | 5 +- .../trans/steps/autodoc/JobInformation.java | 31 ++-- .../steps/autodoc/KettleFileTableModel.java | 105 +++++------ .../steps/autodoc/KettleReportBuilder.java | 10 +- .../trans/steps/autodoc/TransJobDrawable.java | 11 +- .../autodoc/TransformationInformation.java | 33 ++-- .../steps/blockingstep/BlockingStep.java | 8 +- .../steps/blockingstep/BlockingStepMeta.java | 8 +- .../BlockUntilStepsFinishMeta.java | 6 +- .../ChangeFileEncoding.java | 7 +- .../di/trans/steps/checksum/CheckSum.java | 5 +- .../di/trans/steps/checksum/CheckSumMeta.java | 7 +- .../di/trans/steps/clonerow/CloneRow.java | 5 +- .../di/trans/steps/clonerow/CloneRowMeta.java | 6 +- .../trans/steps/closure/ClosureGenerator.java | 5 +- .../steps/closure/ClosureGeneratorMeta.java | 5 +- .../steps/columnexists/ColumnExists.java | 5 +- .../steps/columnexists/ColumnExistsMeta.java | 8 +- .../combinationlookup/CombinationLookup.java | 5 +- .../CombinationLookupMeta.java | 5 +- .../steps/concatfields/ConcatFields.java | 8 +- .../steps/concatfields/ConcatFieldsMeta.java | 19 +- .../di/trans/steps/cubeinput/CubeInput.java | 7 +- .../trans/steps/cubeinput/CubeInputMeta.java | 12 +- .../di/trans/steps/cubeoutput/CubeOutput.java | 8 +- .../steps/cubeoutput/CubeOutputMeta.java | 11 +- .../di/trans/steps/delay/DelayMeta.java | 6 +- .../autodoc/KettleReportBuilderTest.java | 6 +- .../concatfields/ConcatFieldsMetaTest.java | 3 +- .../steps/concatfields/ConcatFieldsTest.java | 5 +- .../CreditCardValidator.java | 5 +- .../CreditCardValidatorMeta.java | 8 +- .../CreditCardValidatorMetaTest.java | 5 +- .../trans/steps/rules/RulesAccumulator.java | 5 +- .../steps/rules/RulesAccumulatorMeta.java | 5 +- .../di/trans/steps/rules/RulesExecutor.java | 5 +- .../trans/steps/rules/RulesExecutorMeta.java | 5 +- .../be/ibridge/kettle/dummy/DummyPlugin.java | 4 +- .../ibridge/kettle/dummy/DummyPluginMeta.java | 6 +- .../di/trans/steps/edi2xml/Edi2Xml.java | 5 +- .../di/trans/steps/edi2xml/Edi2XmlMeta.java | 5 +- .../elasticsearchbulk/ElasticSearchBulk.java | 5 +- .../ElasticSearchBulkMeta.java | 6 +- .../di/job/entries/getpop/JobEntryGetPOP.java | 19 +- .../di/job/entries/getpop/MailConnection.java | 23 ++- .../di/trans/steps/mailinput/MailInput.java | 12 +- .../trans/steps/mailinput/MailInputMeta.java | 5 +- .../entries/getpop/JobEntryGetPOPTest.java | 4 +- .../entries/getpop/MailConnectionTest.java | 18 +- .../entries/getpop/JobEntryGetPOPDialog.java | 2 +- .../steps/mailinput/MailInputDialog.java | 4 +- .../di/trans/steps/excelinput/ExcelInput.java | 13 +- .../steps/excelinput/ExcelInputDialog.java | 14 +- .../ExcelInputExternalResourceConsumer.java | 12 +- .../steps/excelinput/ExcelInputMeta.java | 20 ++- .../excelinput/ExcelInputStepAnalyzer.java | 4 +- .../steps/excelinput/WorkbookFactory.java | 16 +- .../steps/excelinput/jxl/XLSWorkbook.java | 7 +- .../steps/excelinput/ods/OdfWorkbook.java | 7 +- .../steps/excelinput/poi/PoiWorkbook.java | 11 +- .../trans/steps/exceloutput/ExcelOutput.java | 14 +- .../ExcelOutputExternalResourceConsumer.java | 9 +- .../steps/exceloutput/ExcelOutputMeta.java | 13 +- .../exceloutput/ExcelOutputStepAnalyzer.java | 4 +- .../steps/excelwriter/ExcelWriterStep.java | 22 ++- .../excelwriter/ExcelWriterStepMeta.java | 11 +- .../excelinput/BaseExcelParsingTest.java | 6 +- .../ExcelInputStepAnalyzerTest.java | 10 +- .../trans/steps/excelinput/OdfSheetTest.java | 11 +- .../ExcelOutputStepAnalyzerTest.java | 16 +- .../excelwriter/ExcelWriterFullTest.java | 17 +- .../JobEntryExportRepository.java | 25 +-- .../entries/ftpdelete/JobEntryFTPDelete.java | 19 +- .../ftpdelete/JobEntryFTPDeleteDialog.java | 5 +- .../entries/ftpsget/JobEntryFTPSGetIT.java | 13 +- .../job/entries/ftpsget/FTPSConnection.java | 17 +- .../job/entries/ftpsget/JobEntryFTPSGet.java | 17 +- .../job/entries/ftpsput/JobEntryFTPSPUT.java | 15 +- .../entries/ftpsget/FTPSConnectionTest.java | 17 +- .../ftpsget/JobEntryFTPSGetDialog.java | 2 +- .../ftpsput/JobEntryFTPSPUTDialog.java | 2 +- .../di/job/entries/sftp/JobEntrySFTPIT.java | 8 +- .../di/job/entries/sftp/SFTPClientIT.java | 8 +- .../di/job/entries/sftp/JobEntrySFTP.java | 31 ++-- .../job/entries/sftp/JobEntrySFTPDialog.java | 2 +- .../di/job/entries/ftp/JobEntryFTP.java | 15 +- .../GetPreviousRowField.java | 5 +- .../GetPreviousRowFieldMeta.java | 7 +- .../GetRepositoryNames.java | 6 +- .../GetRepositoryNamesMeta.java | 6 +- .../steps/googleanalytics/GaInputStep.java | 8 +- .../googleanalytics/GaInputStepMeta.java | 5 +- .../GoogleAnalyticsApiFacade.java | 7 +- .../googleanalytics/GaInputStepDialog.java | 1 + .../GoogleAnalyticsApiFacadeTest.java | 6 +- .../steps/gpbulkloader/GPBulkLoader.java | 17 +- .../steps/gpbulkloader/GPBulkLoaderMeta.java | 5 +- .../pentaho/di/trans/steps/gpload/GPLoad.java | 10 +- .../di/trans/steps/gpload/GPLoadMeta.java | 6 +- .../di/trans/steps/hl7input/HL7Input.java | 5 +- .../di/trans/steps/hl7input/HL7InputMeta.java | 5 +- .../infobrightoutput/InfobrightLoader.java | 5 +- .../ivwloader/IngresVectorwiseLoader.java | 5 +- .../di/trans/steps/jsoninput/JsonInput.java | 5 +- .../trans/steps/jsoninput/JsonInputMeta.java | 16 +- .../jsoninput/analyzer/JsonInputAnalyzer.java | 4 +- .../steps/jsoninput/json/JsonSampler.java | 12 +- .../steps/jsoninput/reader/InputsReader.java | 5 +- .../di/trans/steps/jsonoutput/JsonOutput.java | 14 +- .../steps/jsonoutput/JsonOutputMeta.java | 6 +- .../analyzer/JsonOutputAnalyzer.java | 4 +- .../steps/jsoninput/JsonInputDialog.java | 4 +- .../jsoninput/getfields/GetFieldsDialog.java | 10 +- .../java/org/pentaho/di/TestUtilities.java | 5 +- .../steps/jsoninput/JsonInputMetaTest.java | 3 +- .../trans/steps/jsoninput/JsonInputTest.java | 21 ++- .../analyzer/JsonInputAnalyzerTest.java | 13 +- .../analyzer/JsonOutputAnalyzerTest.java | 8 +- .../jsoninput/getfields/JsonSamplerTest.java | 13 +- .../trans/steps/ldapinput/LDAPConnection.java | 7 +- .../di/trans/steps/ldapinput/LDAPInput.java | 13 +- .../trans/steps/ldapinput/LDAPInputMeta.java | 5 +- .../trans/steps/ldapinput/LdapProtocol.java | 11 +- .../steps/ldapinput/LdapProtocolFactory.java | 8 +- .../steps/ldapinput/LdapSslProtocol.java | 12 +- .../steps/ldapinput/LdapTlsProtocol.java | 7 +- .../ldapinput/store/CustomSocketFactory.java | 7 +- .../ldapinput/store/KettleTrustManager.java | 8 +- .../di/trans/steps/ldapoutput/LDAPOutput.java | 4 +- .../steps/ldapinput/LdapMockProtocol.java | 7 +- .../ldapinput/LdapProtocolFactoryTest.java | 5 +- .../steps/ldapinput/LDAPInputDialog.java | 6 +- .../steps/ldapoutput/LDAPOutputDialog.java | 6 +- .../luciddbbulkloader/LucidDBBulkLoader.java | 5 +- .../LucidDBBulkLoaderMeta.java | 6 +- .../LucidDBStreamingLoaderMeta.java | 6 +- .../di/job/entries/mail/JobEntryMail.java | 16 +- .../mailvalidator/JobEntryMailValidator.java | 8 +- .../steps/mailvalidator/MailValidator.java | 5 +- .../mailvalidator/MailValidatorMeta.java | 6 +- .../org/pentaho/di/trans/steps/mail/Mail.java | 17 +- .../di/trans/steps/metainject/MetaInject.java | 7 +- .../steps/metainject/MetaInjectDialog.java | 4 +- .../steps/metainject/MetaInjectMeta.java | 51 +++--- .../RepositoryExporterExtension.java | 8 +- .../steps/metainject/MetaInjectMetaTest.java | 26 ++- .../steps/metainject/MetaInjectTest.java | 6 +- .../mondrianinput/MondrianInputMeta.java | 12 +- .../MonetDBBulkLoaderMeta.java | 23 +-- .../JobEntryMSAccessBulkLoad.java | 10 +- .../trans/steps/accessinput/AccessInput.java | 14 +- .../steps/accessinput/AccessInputMeta.java | 20 ++- .../steps/accessoutput/AccessOutput.java | 5 +- .../steps/accessoutput/AccessOutputMeta.java | 9 +- .../steps/accessinput/AccessInputDialog.java | 8 +- .../accessoutput/AccessOutputDialog.java | 4 +- .../mysqlbulkloader/MySQLBulkLoaderMeta.java | 6 +- .../orabulkloader/OraBulkDataOutput.java | 22 ++- .../steps/orabulkloader/OraBulkLoader.java | 6 +- .../orabulkloader/OraBulkLoaderMeta.java | 27 +-- .../orabulkloader/OraBulkDataOutputTest.java | 7 +- .../palo/cellinput/PaloCellInputMeta.java | 3 +- .../steps/palo/diminput/PaloDimInputMeta.java | 4 +- .../vfs/ui/GoogleDriveFileChooserDialog.java | 17 +- .../PentahoReportingOutput.java | 47 +++-- .../pentahoreporting/ReportExportTask.java | 8 +- .../PentahoReportingOutputTest.java | 6 +- .../ReportExportTaskTest.java | 12 +- .../PentahoReportingOutputDialog.java | 4 +- .../dialog/RepositoryVfsProviderDialog.java | 6 +- .../steps/pgbulkloader/PGBulkLoaderMeta.java | 25 +-- .../di/repository/pur/PurRepositoryIT.java | 8 +- .../repository/pur/PurRepositoryExporter.java | 6 +- .../di/job/entries/ftpput/JobEntryFTPPUT.java | 12 +- .../job/entries/sftpput/JobEntrySFTPPUT.java | 25 +-- .../sftpput/JobEntrySFTPPUTDialog.java | 2 +- .../RandomCCNumberGenerator.java | 5 +- .../RandomCCNumberGeneratorMeta.java | 6 +- .../org/pentaho/di/trans/steps/rest/Rest.java | 3 +- .../pentaho/di/trans/steps/rest/RestMeta.java | 7 +- .../RestClientExternalResourceConsumer.java | 5 +- ...estClientExternalResourceConsumerTest.java | 4 +- .../di/trans/steps/rssinput/RssInput.java | 8 +- .../di/trans/steps/rssinput/RssInputMeta.java | 6 +- .../di/trans/steps/rssoutput/RssOutput.java | 13 +- .../trans/steps/rssoutput/RssOutputMeta.java | 15 +- .../steps/rssoutput/RssOutputDialog.java | 2 +- .../di/trans/steps/s3csvinput/S3CsvInput.java | 4 +- .../steps/s3csvinput/S3CsvInputMeta.java | 9 +- .../S3CsvInputMeta_GetFields_Test.java | 7 +- .../salesforcedelete/SalesforceDelete.java | 5 +- .../SalesforceDeleteMeta.java | 6 +- .../salesforceinput/SalesforceInput.java | 5 +- .../salesforceinput/SalesforceInputMeta.java | 6 +- .../salesforceinsert/SalesforceInsert.java | 5 +- .../SalesforceInsertMeta.java | 6 +- .../salesforceupdate/SalesforceUpdate.java | 5 +- .../SalesforceUpdateMeta.java | 6 +- .../salesforceupsert/SalesforceUpsert.java | 5 +- .../SalesforceUpsertMeta.java | 6 +- .../SalesforceDeleteMetaTest.java | 7 +- .../SalesforceInputMetaTest.java | 9 +- .../SalesforceInsertMetaTest.java | 7 +- .../SalesforceUpdateMetaTest.java | 7 +- .../SalesforceUpsertMetaTest.java | 7 +- .../di/trans/steps/sapinput/SapInput.java | 5 +- .../di/trans/steps/sapinput/SapInputMeta.java | 6 +- .../di/trans/steps/sftpput/SFTPPut.java | 12 +- .../di/trans/steps/sftpput/SFTPPutMeta.java | 6 +- .../ui/trans/steps/sftpput/SFTPPutDialog.java | 2 +- .../di/shapefilereader/ShapeFileReader.java | 5 +- .../shapefilereader/ShapeFileReaderMeta.java | 6 +- .../job/entries/ssh2get/JobEntrySSH2GET.java | 6 +- .../job/entries/ssh2put/JobEntrySSH2PUT.java | 8 +- .../starmodeler/StarModelerPerspective.java | 6 +- .../trans/step/jms/JmsConsumerMetaTest.java | 5 +- .../di/trans/step/jms/JmsProducerTest.java | 4 +- .../jms/context/ActiveMQProviderTest.java | 7 +- .../trans/step/mqtt/MQTTConsumerMetaTest.java | 8 +- .../di/trans/step/mqtt/MQTTConsumerTest.java | 6 +- .../di/trans/step/mqtt/MQTTProducerTest.java | 7 +- .../steps/terafastbulkloader/TeraFast.java | 11 +- .../terafastbulkloader/TeraFastMeta.java | 8 +- .../trans/steps/xmlinputsax/XMLInputSax.java | 7 +- .../steps/xmlinputsax/XMLInputSaxMeta.java | 24 +-- .../steps/xmlinputsax/XMLInputSaxDialog.java | 6 +- .../di/trans/steps/xmlinput/XMLInput.java | 7 +- .../di/trans/steps/xmlinput/XMLInputMeta.java | 20 ++- .../trans/steps/xmlinput/XMLInputDialog.java | 6 +- .../entries/dtdvalidator/DTDValidator.java | 11 +- .../dtdvalidator/JobEntryDTDValidator.java | 8 +- .../xmlwellformed/JobEntryXMLWellFormed.java | 14 +- .../xsdvalidator/JobEntryXSDValidator.java | 10 +- .../di/job/entries/xslt/JobEntryXSLT.java | 20 ++- .../pentaho/di/trans/steps/addxml/AddXML.java | 5 +- .../di/trans/steps/addxml/AddXMLMeta.java | 6 +- .../di/trans/steps/getxmldata/GetXMLData.java | 15 +- .../GetXMLDataExternalResourceConsumer.java | 10 +- .../steps/getxmldata/GetXMLDataMeta.java | 17 +- .../getxmldata/GetXMLDataStepAnalyzer.java | 4 +- .../steps/xmlinputstream/XMLInputStream.java | 11 +- .../xmlinputstream/XMLInputStreamMeta.java | 5 +- .../di/trans/steps/xmljoin/XMLJoin.java | 6 +- .../di/trans/steps/xmljoin/XMLJoinMeta.java | 6 +- .../di/trans/steps/xmloutput/XMLOutput.java | 12 +- .../XMLOutputExternalResourceConsumer.java | 8 +- .../trans/steps/xmloutput/XMLOutputMeta.java | 12 +- .../xmloutput/XMLOutputStepAnalyzer.java | 4 +- .../steps/xsdvalidator/XsdValidator.java | 11 +- .../steps/xsdvalidator/XsdValidatorMeta.java | 12 +- .../org/pentaho/di/trans/steps/xslt/Xslt.java | 9 +- .../pentaho/di/trans/steps/xslt/XsltData.java | 11 +- .../pentaho/di/trans/steps/xslt/XsltMeta.java | 8 +- .../steps/getxmldata/GetXMLDataDialog.java | 10 +- .../LoopNodesImportProgressDialog.java | 11 +- .../XMLInputFieldsImportProgressDialog.java | 11 +- .../GetXMLDataStepAnalyzerTest.java | 10 +- .../xmljoin/XmlJoinMetaGetFieldsTest.java | 7 +- .../steps/xmloutput/XMLOutputMetaTest.java | 12 +- .../xmloutput/XMLOutputStepAnalyzerTest.java | 4 +- .../trans/steps/xmloutput/XMLOutputTest.java | 4 +- .../xsdvalidator/XsdValidatorIntTest.java | 9 +- .../di/trans/steps/yamlinput/YamlInput.java | 19 +- .../trans/steps/yamlinput/YamlInputMeta.java | 15 +- .../di/trans/steps/yamlinput/YamlReader.java | 9 +- .../steps/yamlinput/YamlInputDialog.java | 6 +- .../core/vfs/KettleVfsDelegatingResolver.java | 14 +- .../dialog/SelectionAdapterFileDialog.java | 5 +- .../di/ui/core/widget/VFSFileSelection.java | 8 +- .../core/widget/VfsFileChooserControls.java | 7 +- .../di/ui/i18n/MessagesSourceCrawler.java | 14 +- .../di/ui/i18n/editor/Translator2.java | 7 +- .../pentaho/di/ui/imp/ImportRulesDialog.java | 8 +- .../copyfiles/JobEntryCopyFilesDialog.java | 11 +- .../job/entries/trans/JobEntryBaseDialog.java | 4 +- .../RepositoryExportProgressDialog.java | 5 +- .../java/org/pentaho/di/ui/spoon/Spoon.java | 16 +- .../ui/spoon/delegates/SpoonTabsDelegate.java | 4 +- .../org/pentaho/di/ui/spoon/job/JobGraph.java | 19 +- .../pentaho/di/ui/spoon/trans/TransGraph.java | 5 +- .../di/ui/trans/step/BaseStreamingDialog.java | 9 +- .../trans/steps/csvinput/CsvInputDialog.java | 8 +- .../text/TextFileCSVImportProgressDialog.java | 15 +- .../GetFilesRowsCountDialog.java | 2 +- .../steps/jobexecutor/JobExecutorDialog.java | 4 +- .../steps/ldifinput/LDIFInputDialog.java | 6 +- .../loadfileinput/LoadFileInputDialog.java | 4 +- .../ui/trans/steps/mapping/MappingDialog.java | 4 +- .../ParGzipCsvInputDialog.java | 4 +- .../propertyinput/PropertyInputDialog.java | 6 +- .../simplemapping/SimpleMappingDialog.java | 4 +- .../singlethreader/SingleThreaderDialog.java | 7 +- .../di/ui/trans/steps/ssh/SSHDialog.java | 2 +- .../TextFileCSVImportProgressDialog.java | 6 +- .../transexecutor/TransExecutorDialog.java | 4 +- .../org/pentaho/di/ui/util/ImageUtil.java | 5 +- .../pentaho/di/ui/util/SwtSvgImageUtil.java | 5 +- .../di/ui/i18n/MessagesSourceCrawlerTest.java | 14 +- .../di/ui/spoon/SharedObjectSyncUtilTest.java | 4 +- .../text/TextFileInputDialogTest.java | 13 +- ...eInputTextCSVImportProgressDialogTest.java | 7 +- ...tFileInputCSVImportProgressDialogTest.java | 2 +- 710 files changed, 4154 insertions(+), 2824 deletions(-) diff --git a/core/src/main/java/org/pentaho/di/core/ResultFile.java b/core/src/main/java/org/pentaho/di/core/ResultFile.java index 9c3017aa4b43..d589d60024a5 100644 --- a/core/src/main/java/org/pentaho/di/core/ResultFile.java +++ b/core/src/main/java/org/pentaho/di/core/ResultFile.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2021 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -25,6 +25,7 @@ import java.util.Date; import org.apache.commons.vfs2.FileObject; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.exception.KettleFileException; import org.pentaho.di.core.row.value.ValueMetaDate; import org.pentaho.di.core.row.value.ValueMetaString; @@ -291,7 +292,7 @@ public String getXML() { public ResultFile( Node node ) throws KettleFileException { try { type = getType( XMLHandler.getTagValue( node, "type" ) ); - file = KettleVFS.getFileObject( XMLHandler.getTagValue( node, "file" ) ); + file = KettleVFS.getInstance( DefaultBowl.getInstance() ).getFileObject( XMLHandler.getTagValue( node, "file" ) ); originParent = XMLHandler.getTagValue( node, "parentorigin" ); origin = XMLHandler.getTagValue( node, "origin" ); comment = XMLHandler.getTagValue( node, "comment" ); diff --git a/core/src/main/java/org/pentaho/di/core/database/Database.java b/core/src/main/java/org/pentaho/di/core/database/Database.java index b46f97f7b67e..2cef7c88bf58 100644 --- a/core/src/main/java/org/pentaho/di/core/database/Database.java +++ b/core/src/main/java/org/pentaho/di/core/database/Database.java @@ -3,7 +3,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2023 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -58,6 +58,7 @@ import org.apache.commons.lang.StringUtils; import org.apache.commons.vfs2.FileObject; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.Const; import org.pentaho.di.core.plugins.PluginTypeListener; import org.pentaho.di.core.row.value.ValueMetaPluginType; @@ -5025,7 +5026,8 @@ public void setNrExecutedCommits( int nrExecutedCommits ) { * @throws KettleDatabaseException in case anything goes wrong. * @sendSinglestatement send one statement */ - public Result execStatementsFromFile( String filename, boolean sendSinglestatement ) throws KettleException { + public Result execStatementsFromFile( Bowl bowl, String filename, boolean sendSinglestatement ) + throws KettleException { FileObject sqlFile = null; InputStream is = null; InputStreamReader bis = null; @@ -5033,7 +5035,7 @@ public Result execStatementsFromFile( String filename, boolean sendSinglestateme if ( Utils.isEmpty( filename ) ) { throw new KettleException( "Filename is missing!" ); } - sqlFile = KettleVFS.getFileObject( filename ); + sqlFile = KettleVFS.getInstance( bowl ).getFileObject( filename ); if ( !sqlFile.exists() ) { throw new KettleException( "We can not find file [" + filename + "]!" ); } diff --git a/core/src/main/java/org/pentaho/di/core/logging/FileLoggingEventListener.java b/core/src/main/java/org/pentaho/di/core/logging/FileLoggingEventListener.java index 80c8667b2380..a15d3bf0a623 100644 --- a/core/src/main/java/org/pentaho/di/core/logging/FileLoggingEventListener.java +++ b/core/src/main/java/org/pentaho/di/core/logging/FileLoggingEventListener.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -26,6 +26,7 @@ import java.util.List; import org.apache.commons.vfs2.FileObject; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.Const; import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.core.vfs.KettleVFS; @@ -71,10 +72,10 @@ public FileLoggingEventListener( String logChannelId, String filename, boolean a this.layout = new KettleLogLayout( true ); this.exception = null; - file = KettleVFS.getFileObject( filename ); + file = KettleVFS.getInstance( DefaultBowl.getInstance() ).getFileObject( filename ); outputStream = null; try { - outputStream = KettleVFS.getOutputStream( file, append ); + outputStream = KettleVFS.getInstance( DefaultBowl.getInstance() ).getOutputStream( file, append ); } catch ( Exception e ) { throw new KettleException( "Unable to create a logging event listener to write to file '" + filename + "'", e ); diff --git a/core/src/main/java/org/pentaho/di/core/logging/log4j/Log4jFileAppender.java b/core/src/main/java/org/pentaho/di/core/logging/log4j/Log4jFileAppender.java index e76e72edf8f7..9b30bff60021 100644 --- a/core/src/main/java/org/pentaho/di/core/logging/log4j/Log4jFileAppender.java +++ b/core/src/main/java/org/pentaho/di/core/logging/log4j/Log4jFileAppender.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2022 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2022-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -29,6 +29,7 @@ import org.apache.logging.log4j.core.Layout; import org.apache.logging.log4j.core.Filter; import org.apache.logging.log4j.core.LogEvent; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.Const; import org.pentaho.di.core.vfs.KettleVFS; @@ -45,13 +46,13 @@ public class Log4jFileAppender implements Appender { public Log4jFileAppender(FileObject file ) throws IOException { this.file = file; - fileOutputStream = KettleVFS.getOutputStream( file, false ); + fileOutputStream = KettleVFS.getInstance( DefaultBowl.getInstance() ).getOutputStream( file, false ); } public Log4jFileAppender(FileObject file, boolean append ) throws IOException { this.file = file; - fileOutputStream = KettleVFS.getOutputStream( file, append ); + fileOutputStream = KettleVFS.getInstance( DefaultBowl.getInstance() ).getOutputStream( file, append ); } public void addFilter( Filter filter ) { diff --git a/core/src/main/java/org/pentaho/di/core/plugins/BasePluginType.java b/core/src/main/java/org/pentaho/di/core/plugins/BasePluginType.java index 64414e325b5b..b2cb32fb18c0 100644 --- a/core/src/main/java/org/pentaho/di/core/plugins/BasePluginType.java +++ b/core/src/main/java/org/pentaho/di/core/plugins/BasePluginType.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2019 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -45,6 +45,7 @@ import org.apache.commons.vfs2.FileObject; import org.apache.commons.vfs2.FileSelectInfo; import org.apache.commons.vfs2.FileSelector; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.Const; import org.pentaho.di.core.exception.KettleXMLException; import org.pentaho.di.core.util.Utils; @@ -432,7 +433,7 @@ protected List findPluginFiles( String folder, final String regex ) List list = new ArrayList<>(); try { - FileObject folderObject = KettleVFS.getFileObject( folder ); + FileObject folderObject = KettleVFS.getInstance( DefaultBowl.getInstance() ).getFileObject( folder ); FileObject[] files = folderObject.findFiles( new FileSelector() { @Override diff --git a/core/src/main/java/org/pentaho/di/core/plugins/PluginFolder.java b/core/src/main/java/org/pentaho/di/core/plugins/PluginFolder.java index 0ede0d5c6251..369588d0627e 100644 --- a/core/src/main/java/org/pentaho/di/core/plugins/PluginFolder.java +++ b/core/src/main/java/org/pentaho/di/core/plugins/PluginFolder.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2018 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -27,6 +27,7 @@ import org.apache.commons.vfs2.FileObject; import org.apache.commons.vfs2.FileSelectInfo; import org.apache.commons.vfs2.FileSelector; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.Const; import org.pentaho.di.core.exception.KettleFileException; import org.pentaho.di.core.util.EnvUtil; @@ -122,7 +123,7 @@ public FileObject[] findJarFiles( final boolean includeLibJars ) throws KettleFi try { // Find all the jar files in this folder... // - FileObject folderObject = KettleVFS.getFileObject( this.getFolder() ); + FileObject folderObject = KettleVFS.getInstance( DefaultBowl.getInstance() ).getFileObject( this.getFolder() ); return folderObject.findFiles( new FileSelector() { @Override diff --git a/core/src/main/java/org/pentaho/di/core/row/ValueDataUtil.java b/core/src/main/java/org/pentaho/di/core/row/ValueDataUtil.java index 242278d3db98..8abfdce94291 100644 --- a/core/src/main/java/org/pentaho/di/core/row/ValueDataUtil.java +++ b/core/src/main/java/org/pentaho/di/core/row/ValueDataUtil.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2022 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -33,6 +33,7 @@ import org.apache.commons.logging.LogFactory; import org.apache.commons.vfs2.FileObject; import org.apache.commons.vfs2.FileSystemException; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.Const; import org.pentaho.di.core.exception.KettleFileNotFoundException; import org.pentaho.di.core.exception.KettleValueException; @@ -377,10 +378,10 @@ public static long stringLen( ValueMetaInterface metaA, Object dataA ) { * @deprecated Use {@link ValueDataUtil#createChecksum(ValueMetaInterface, Object, String, boolean)} instead */ @Deprecated - public static String createChecksum( ValueMetaInterface metaA, Object dataA, String type ) { + public static String createChecksum( Bowl bowl, ValueMetaInterface metaA, Object dataA, String type ) { String checksum = null; try { - checksum = createChecksum( metaA, dataA, type, false ); + checksum = createChecksum( bowl, metaA, dataA, type, false ); } catch ( KettleFileNotFoundException e ) { // Ignore } @@ -400,7 +401,8 @@ public static String createChecksum( ValueMetaInterface metaA, Object dataA, Str * @return File's checksum * @throws KettleFileNotFoundException */ - public static String createChecksum( ValueMetaInterface metaA, Object dataA, String type, boolean failIfNoFile ) + public static String createChecksum( Bowl bowl, ValueMetaInterface metaA, Object dataA, String type, + boolean failIfNoFile ) throws KettleFileNotFoundException { if ( dataA == null ) { return null; @@ -410,7 +412,7 @@ public static String createChecksum( ValueMetaInterface metaA, Object dataA, Str FileObject file = null; InputStream in = null; try { - file = KettleVFS.getFileObject( dataA.toString() ); + file = KettleVFS.getInstance( bowl ).getFileObject( dataA.toString() ); throwsErrorOnFileNotFound( file ); in = KettleVFS.getInputStream( file ); int bytes = in.available(); @@ -444,10 +446,10 @@ public static String createChecksum( ValueMetaInterface metaA, Object dataA, Str * @deprecated Use {@link ValueDataUtil#checksumCRC32(ValueMetaInterface, Object, boolean)} instead */ @Deprecated - public static Long ChecksumCRC32( ValueMetaInterface metaA, Object dataA ) { + public static Long ChecksumCRC32( Bowl bowl, ValueMetaInterface metaA, Object dataA ) { long checksum = 0; try { - checksum = checksumCRC32( metaA, dataA, false ); + checksum = checksumCRC32( bowl, metaA, dataA, false ); } catch ( KettleFileNotFoundException e ) { // Ignore } @@ -465,7 +467,7 @@ public static Long ChecksumCRC32( ValueMetaInterface metaA, Object dataA ) { * @return File's CRC32 checksum * @throws KettleFileNotFoundException */ - public static Long checksumCRC32( ValueMetaInterface metaA, Object dataA, boolean failIfNoFile ) + public static Long checksumCRC32( Bowl bowl, ValueMetaInterface metaA, Object dataA, boolean failIfNoFile ) throws KettleFileNotFoundException { long checksum = 0; @@ -476,7 +478,7 @@ public static Long checksumCRC32( ValueMetaInterface metaA, Object dataA, boolea FileObject file = null; CheckedInputStream cis = null; try { - file = KettleVFS.getFileObject( dataA.toString() ); + file = KettleVFS.getInstance( bowl ).getFileObject( dataA.toString() ); throwsErrorOnFileNotFound( file ); cis = null; @@ -508,10 +510,10 @@ public static Long checksumCRC32( ValueMetaInterface metaA, Object dataA, boolea * @deprecated Use {@link ValueDataUtil#checksumAdler32(ValueMetaInterface, Object, boolean)} instead */ @Deprecated - public static Long ChecksumAdler32( ValueMetaInterface metaA, Object dataA ) { + public static Long ChecksumAdler32( Bowl bowl, ValueMetaInterface metaA, Object dataA ) { long checksum = 0; try { - checksum = checksumAdler32( metaA, dataA, false ); + checksum = checksumAdler32( bowl, metaA, dataA, false ); } catch ( KettleFileNotFoundException e ) { // Ignore } @@ -529,7 +531,7 @@ public static Long ChecksumAdler32( ValueMetaInterface metaA, Object dataA ) { * @return File's Adler32 checksum * @throws KettleFileNotFoundException */ - public static Long checksumAdler32( ValueMetaInterface metaA, Object dataA, boolean failIfNoFile ) + public static Long checksumAdler32( Bowl bowl, ValueMetaInterface metaA, Object dataA, boolean failIfNoFile ) throws KettleFileNotFoundException { long checksum = 0; @@ -540,7 +542,7 @@ public static Long checksumAdler32( ValueMetaInterface metaA, Object dataA, bool FileObject file = null; CheckedInputStream cis = null; try { - file = KettleVFS.getFileObject( dataA.toString() ); + file = KettleVFS.getInstance( bowl ).getFileObject( dataA.toString() ); throwsErrorOnFileNotFound( file ); cis = null; @@ -671,10 +673,11 @@ public static Object sum( ValueMetaInterface metaA, Object dataA, ValueMetaInter * @deprecated Use {@link ValueDataUtil#loadFileContentInBinary(ValueMetaInterface, Object, boolean)} instead */ @Deprecated - public static Object loadFileContentInBinary( ValueMetaInterface metaA, Object dataA ) throws KettleValueException { + public static Object loadFileContentInBinary( Bowl bowl, ValueMetaInterface metaA, Object dataA ) + throws KettleValueException { Object content = null; try { - content = loadFileContentInBinary( metaA, dataA, true ); + content = loadFileContentInBinary( bowl, metaA, dataA, true ); } catch ( KettleFileNotFoundException e ) { throw new KettleValueException(); } @@ -693,8 +696,8 @@ public static Object loadFileContentInBinary( ValueMetaInterface metaA, Object d * @throws KettleValueException * @throws KettleFileNotFoundException */ - public static byte[] loadFileContentInBinary( ValueMetaInterface metaA, Object dataA, boolean failIfNoFile ) - throws KettleValueException, KettleFileNotFoundException { + public static byte[] loadFileContentInBinary( Bowl bowl, ValueMetaInterface metaA, Object dataA, + boolean failIfNoFile ) throws KettleValueException, KettleFileNotFoundException { if ( dataA == null ) { return null; } @@ -704,7 +707,7 @@ public static byte[] loadFileContentInBinary( ValueMetaInterface metaA, Object d InputStream is = null; try { - file = KettleVFS.getFileObject( dataA.toString() ); + file = KettleVFS.getInstance( bowl ).getFileObject( dataA.toString() ); throwsErrorOnFileNotFound( file ); is = KettleVFS.getInputStream( file ); int fileSize = (int) file.getContent().getSize(); @@ -2123,10 +2126,10 @@ public static final boolean onlySpaces( String str ) { * @deprecated Use {@link ValueDataUtil#isXMLFileWellFormed(ValueMetaInterface, Object, boolean)} instead */ @Deprecated - public static boolean isXMLFileWellFormed( ValueMetaInterface metaA, Object dataA ) { + public static boolean isXMLFileWellFormed( Bowl bowl, ValueMetaInterface metaA, Object dataA ) { boolean xmlWellFormed = false; try { - xmlWellFormed = isXMLFileWellFormed( metaA, dataA, false ); + xmlWellFormed = isXMLFileWellFormed( bowl, metaA, dataA, false ); } catch ( KettleFileNotFoundException e ) { // Ignore } @@ -2145,7 +2148,7 @@ public static boolean isXMLFileWellFormed( ValueMetaInterface metaA, Object data * @return true if the file is well formed. * @throws KettleFileNotFoundException */ - public static boolean isXMLFileWellFormed( ValueMetaInterface metaA, Object dataA, boolean failIfNoFile ) + public static boolean isXMLFileWellFormed( Bowl bowl, ValueMetaInterface metaA, Object dataA, boolean failIfNoFile ) throws KettleFileNotFoundException { if ( dataA == null ) { return false; @@ -2154,7 +2157,7 @@ public static boolean isXMLFileWellFormed( ValueMetaInterface metaA, Object data String filename = dataA.toString(); FileObject file = null; try { - file = KettleVFS.getFileObject( filename ); + file = KettleVFS.getInstance( bowl ).getFileObject( filename ); throwsErrorOnFileNotFound( file ); return XMLCheck.isXMLFileWellFormed( file ); } catch ( KettleFileNotFoundException e ) { @@ -2202,10 +2205,11 @@ public static boolean isXMLWellFormed( ValueMetaInterface metaA, Object dataA ) * @deprecated Use {@link ValueDataUtil#getFileEncoding(ValueMetaInterface, Object, boolean)} instead */ @Deprecated - public static String getFileEncoding( ValueMetaInterface metaA, Object dataA ) throws KettleValueException { + public static String getFileEncoding( Bowl bowl, ValueMetaInterface metaA, Object dataA ) + throws KettleValueException { String encoding = null; try { - encoding = getFileEncoding( metaA, dataA, true ); + encoding = getFileEncoding( bowl, metaA, dataA, true ); } catch ( KettleFileNotFoundException e ) { throw new KettleValueException(); } @@ -2225,7 +2229,7 @@ public static String getFileEncoding( ValueMetaInterface metaA, Object dataA ) t * @throws KettleFileNotFoundException * @throws KettleValueException */ - public static String getFileEncoding( ValueMetaInterface metaA, Object dataA, boolean failIfNoFile ) + public static String getFileEncoding( Bowl bowl, ValueMetaInterface metaA, Object dataA, boolean failIfNoFile ) throws KettleValueException, KettleFileNotFoundException { if ( dataA == null ) { return null; @@ -2234,7 +2238,7 @@ public static String getFileEncoding( ValueMetaInterface metaA, Object dataA, bo String encoding = null; FileObject file = null; try { - file = KettleVFS.getFileObject( metaA.getString( dataA ) ); + file = KettleVFS.getInstance( bowl ).getFileObject( metaA.getString( dataA ) ); throwsErrorOnFileNotFound( file ); encoding = CharsetToolkit.guessEncodingName( file ); } catch ( KettleFileNotFoundException e ) { diff --git a/core/src/main/java/org/pentaho/di/shared/VfsSharedObjectsIO.java b/core/src/main/java/org/pentaho/di/shared/VfsSharedObjectsIO.java index e953e8321db3..e0e3f1a6eefe 100644 --- a/core/src/main/java/org/pentaho/di/shared/VfsSharedObjectsIO.java +++ b/core/src/main/java/org/pentaho/di/shared/VfsSharedObjectsIO.java @@ -17,23 +17,17 @@ package org.pentaho.di.shared; -import org.apache.commons.io.IOUtils; -import org.apache.commons.vfs2.FileObject; -import org.apache.commons.vfs2.FileSystemException; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.Const; import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.core.exception.KettleFileException; import org.pentaho.di.core.exception.KettleXMLException; import org.pentaho.di.core.util.Utils; import org.pentaho.di.core.variables.Variables; +import org.pentaho.di.core.vfs.IKettleVFS; import org.pentaho.di.core.vfs.KettleVFS; import org.pentaho.di.core.xml.XMLHandler; import org.pentaho.di.i18n.BaseMessages; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.w3c.dom.Document; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; import java.io.File; import java.io.IOException; @@ -45,6 +39,15 @@ import java.util.Map; import java.util.Optional; +import org.apache.commons.io.IOUtils; +import org.apache.commons.vfs2.FileObject; +import org.apache.commons.vfs2.FileSystemException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.w3c.dom.Document; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; + /** * Provide methods to retrieve and save the shared objects defined in shared.xml that is stored in file system. * @@ -113,7 +116,7 @@ private void loadSharedObjectNodeMap( String pathToSharedObjectFile ) throws Ket try { // Get the FileObject - FileObject file = KettleVFS.getFileObject( pathToSharedObjectFile ); + FileObject file = KettleVFS.getInstance( DefaultBowl.getInstance() ).getFileObject( pathToSharedObjectFile ); // If we have a shared file, load the content, otherwise, just keep this one empty if ( file.exists() ) { @@ -198,7 +201,7 @@ public void saveSharedObject( String type, String name, Node node ) throws Kettl protected void saveToFile() throws KettleException { try { - FileObject fileObject = KettleVFS.getFileObject( sharedObjectFile ); + FileObject fileObject = KettleVFS.getInstance( DefaultBowl.getInstance() ).getFileObject( sharedObjectFile ); Optional backupFileName = createOrGetFileBackup( fileObject ); writeToFile( fileObject, backupFileName ); isInitialized = false; @@ -209,7 +212,7 @@ protected void saveToFile() throws KettleException { protected void writeToFile( FileObject fileObject, Optional backupFileName ) throws IOException, KettleException { - try ( OutputStream outputStream = KettleVFS.getOutputStream( fileObject, false ); + try ( OutputStream outputStream = KettleVFS.getInstance( DefaultBowl.getInstance() ).getOutputStream( fileObject, false ); PrintStream out = new PrintStream( outputStream ) ) { out.print( XMLHandler.getXMLHeader( Const.XML_ENCODING ) ); @@ -253,7 +256,7 @@ protected void restoreFileFromBackup( String backupFileName ) throws IOException } private boolean getBackupFileFromFileSystem( String backupFileName ) throws KettleException { - FileObject fileObject = KettleVFS.getFileObject( backupFileName ); + FileObject fileObject = KettleVFS.getInstance( DefaultBowl.getInstance() ).getFileObject( backupFileName ); try { return fileObject.exists(); } catch ( FileSystemException e ) { @@ -262,10 +265,11 @@ private boolean getBackupFileFromFileSystem( String backupFileName ) throws Kett } private boolean copyFile( String src, String dest ) throws IOException, KettleFileException { - FileObject srcFile = KettleVFS.getFileObject( src ); - FileObject destFile = KettleVFS.getFileObject( dest ); + IKettleVFS vfs = KettleVFS.getInstance( DefaultBowl.getInstance() ); + FileObject srcFile = vfs.getFileObject( src ); + FileObject destFile = vfs.getFileObject( dest ); try ( InputStream in = KettleVFS.getInputStream( srcFile ); - OutputStream out = KettleVFS.getOutputStream( destFile, false ) ) { + OutputStream out = vfs.getOutputStream( destFile, false ) ) { IOUtils.copy( in, out ); } return true; diff --git a/core/src/test/java/org/pentaho/di/core/ResultFileTest.java b/core/src/test/java/org/pentaho/di/core/ResultFileTest.java index 4a8dc0b1fd32..0272db5f4e79 100644 --- a/core/src/test/java/org/pentaho/di/core/ResultFileTest.java +++ b/core/src/test/java/org/pentaho/di/core/ResultFileTest.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2018 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -35,6 +35,7 @@ import org.junit.ClassRule; import org.junit.Test; import org.junit.rules.TemporaryFolder; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.exception.KettleFileException; import org.pentaho.di.core.row.RowMetaInterface; import org.pentaho.di.core.row.ValueMetaInterface; @@ -48,7 +49,8 @@ public class ResultFileTest { @Test public void testGetRow() throws KettleFileException, FileSystemException { File tempDir = new File( new TemporaryFolder().toString() ); - FileObject tempFile = KettleVFS.createTempFile( "prefix", "suffix", tempDir.toString() ); + FileObject tempFile = KettleVFS.getInstance( DefaultBowl.getInstance() ) + .createTempFile( "prefix", "suffix", tempDir.toString() ); Date timeBeforeFile = Calendar.getInstance().getTime(); ResultFile resultFile = new ResultFile( ResultFile.FILE_TYPE_GENERAL, tempFile, "myOriginParent", "myOrigin" ); Date timeAfterFile = Calendar.getInstance().getTime(); diff --git a/core/src/test/java/org/pentaho/di/core/fileinput/FileInputListTest.java b/core/src/test/java/org/pentaho/di/core/fileinput/FileInputListTest.java index e5b32cbe0dee..3d13eca3ab25 100644 --- a/core/src/test/java/org/pentaho/di/core/fileinput/FileInputListTest.java +++ b/core/src/test/java/org/pentaho/di/core/fileinput/FileInputListTest.java @@ -27,6 +27,7 @@ import org.junit.rules.TemporaryFolder; import static org.mockito.ArgumentMatchers.any; import org.mockito.stubbing.Answer; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.Const; import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.core.variables.VariableSpace; @@ -90,8 +91,8 @@ public void testSpecialCharsInFileNamesDefaultBehavior() throws IOException, Ket boolean[] fileRequiredList = { true }; String[] paths = FileInputList - .createFilePathList( spaceMock, folderNameList, emptyStringArray, emptyStringArray, emptyStringArray, - fileRequiredList ); + .createFilePathList( DefaultBowl.getInstance(), spaceMock, folderNameList, emptyStringArray, emptyStringArray, + emptyStringArray, fileRequiredList ); assertTrue( "File with spaces not found", paths[ 0 ].endsWith( fileNameWithSpaces ) ); } @@ -110,8 +111,8 @@ public void testSpecialCharsInFileNamesEscaped() throws IOException, KettleExcep boolean[] fileRequiredList = { true }; String[] paths = FileInputList - .createFilePathList( spaceMock, folderNameList, emptyStringArray, emptyStringArray, emptyStringArray, - fileRequiredList ); + .createFilePathList( DefaultBowl.getInstance(), spaceMock, folderNameList, emptyStringArray, emptyStringArray, + emptyStringArray, fileRequiredList ); assertFalse( "File with spaces not encoded", paths[ 0 ].endsWith( fileNameWithSpaces ) ); System.setProperty( Const.KETTLE_RETURN_ESCAPED_URI_STRINGS, "N" ); } @@ -126,7 +127,7 @@ public void testCreateFolderList() throws Exception { (Answer) invocationOnMock -> (String[]) invocationOnMock.getArguments()[ 0 ] ); FileInputList fileInputList = FileInputList. - createFolderList( spaceMock, folderNameList, folderRequiredList ); + createFolderList( DefaultBowl.getInstance(), spaceMock, folderNameList, folderRequiredList ); assertNotNull( fileInputList ); assertEquals( TOTAL_NUMBER_OF_FOLDERS_NO_ROOT, fileInputList.nrOfFiles() ); diff --git a/core/src/test/java/org/pentaho/di/core/plugins/BasePluginTypeTest.java b/core/src/test/java/org/pentaho/di/core/plugins/BasePluginTypeTest.java index a0dd922c622a..1615feafcda7 100644 --- a/core/src/test/java/org/pentaho/di/core/plugins/BasePluginTypeTest.java +++ b/core/src/test/java/org/pentaho/di/core/plugins/BasePluginTypeTest.java @@ -25,6 +25,7 @@ import org.apache.commons.vfs2.FileObject; import org.junit.Ignore; import org.junit.Test; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.encryption.TwoWayPasswordEncoderPluginType; import org.pentaho.di.core.logging.KettleLogStore; import org.pentaho.di.core.logging.LogChannel; @@ -92,8 +93,10 @@ public void findAnnotatedClassFilesFailTest() throws Exception { KettleLogStore.init(); LogChannel generalLog = mock( LogChannel.class ); - FileObject fileObj1 = KettleVFS.getFileObject( BASE_RAM_DIR + "testJar1.jar" ); - FileObject fileObj2 = KettleVFS.getFileObject( BASE_RAM_DIR + "testJar2.jar" ); + FileObject fileObj1 = KettleVFS.getInstance( DefaultBowl.getInstance() ) + .getFileObject( BASE_RAM_DIR + "testJar1.jar" ); + FileObject fileObj2 = KettleVFS.getInstance( DefaultBowl.getInstance() ) + .getFileObject( BASE_RAM_DIR + "testJar2.jar" ); FileObject[] fileObjects = { fileObj1, fileObj2 }; BasePluginType bpt = spy( DatabasePluginType.getInstance() ); diff --git a/core/src/test/java/org/pentaho/di/shared/VfsSharedObjectsIOTest.java b/core/src/test/java/org/pentaho/di/shared/VfsSharedObjectsIOTest.java index 0ca2f569ca90..996b5812d28e 100644 --- a/core/src/test/java/org/pentaho/di/shared/VfsSharedObjectsIOTest.java +++ b/core/src/test/java/org/pentaho/di/shared/VfsSharedObjectsIOTest.java @@ -19,6 +19,7 @@ import org.apache.commons.vfs2.FileObject; import org.junit.Test; import org.junit.BeforeClass; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.KettleClientEnvironment; import org.pentaho.di.core.database.DatabaseMeta; import org.pentaho.di.core.exception.KettleException; @@ -55,7 +56,7 @@ public static void setUpOnce() throws KettlePluginException, KettleException { @Test public void testGetSharedObjects() throws Exception { // Prepare the test shared.xml - FileObject projectDirectory = KettleVFS.getFileObject( ROOT_FILE_PATH ); + FileObject projectDirectory = KettleVFS.getInstance( DefaultBowl.getInstance() ).getFileObject( ROOT_FILE_PATH ); projectDirectory.createFolder(); FileObject sharedFile = projectDirectory.resolveFile( SHARED_FILE ); @@ -88,7 +89,7 @@ private void validateNode( Node node ) { @Test public void testSaveSharedObject() throws Exception { - FileObject projectDirectory = KettleVFS.getFileObject( ROOT_FILE_PATH ); + FileObject projectDirectory = KettleVFS.getInstance( DefaultBowl.getInstance() ).getFileObject( ROOT_FILE_PATH ); projectDirectory.createFolder(); SharedObjectsIO sharedObjectsIO = new VfsSharedObjectsIO( ROOT_FILE_PATH ); diff --git a/engine/src/it/java/org/pentaho/di/job/entries/zipfile/JobEntryZipFileIT.java b/engine/src/it/java/org/pentaho/di/job/entries/zipfile/JobEntryZipFileIT.java index 8ee13b91b98b..d74aeff1afbf 100644 --- a/engine/src/it/java/org/pentaho/di/job/entries/zipfile/JobEntryZipFileIT.java +++ b/engine/src/it/java/org/pentaho/di/job/entries/zipfile/JobEntryZipFileIT.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -71,7 +71,7 @@ public void processFile_ReturnsTrue_OnSuccess() throws Exception { entry.processRowFile(new Job(), result, zipPath, null, null, tempFile.getAbsolutePath(), null, false)); boolean isTrue = true; - FileObject zip = KettleVFS.getFileObject(zipPath); + FileObject zip = KettleVFS.getInstance( DefaultBowl.getInstance() ).getFileObject(zipPath); assertTrue("Zip archive should be created", zip.exists()); ByteArrayOutputStream os = new ByteArrayOutputStream(); diff --git a/engine/src/main/java/org/pentaho/di/base/IMetaFileLoader.java b/engine/src/main/java/org/pentaho/di/base/IMetaFileLoader.java index bbd6e54c7c9f..d5cc7326af02 100644 --- a/engine/src/main/java/org/pentaho/di/base/IMetaFileLoader.java +++ b/engine/src/main/java/org/pentaho/di/base/IMetaFileLoader.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2021 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -21,6 +21,7 @@ ******************************************************************************/ package org.pentaho.di.base; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.core.variables.VariableSpace; import org.pentaho.di.repository.Repository; @@ -30,23 +31,25 @@ public interface IMetaFileLoader { /** * Get a JobMeta or TransMeta object for a job entry that needs it. The entry will be cached and further * loads will come from the cache, instead. + * @param bowl context for file operations * @param rep The repo in play if not using the filesystem * @param metaStore The metastore * @param space The variables for substitution * @return A JobMeta or TransMeta (T) * @throws KettleException */ - T getMetaForEntry( Repository rep, IMetaStore metaStore, VariableSpace space ) throws KettleException; + T getMetaForEntry( Bowl bowl, Repository rep, IMetaStore metaStore, VariableSpace space ) throws KettleException; /** * Get a JobMeta or TransMeta object for a transformation step for a Transformation that needs it. The entry will be * cached and further loads will come from the cache, instead. + * @param bowl context for file operations * @param rep The repo in play if not using the filesystem * @param metaStore The metastore * @param space The variables for substitution * @return A JobMeta or TransMeta (T) * @throws KettleException */ - T getMetaForStep( Repository rep, IMetaStore metaStore, VariableSpace space ) + T getMetaForStep( Bowl bowl, Repository rep, IMetaStore metaStore, VariableSpace space ) throws KettleException; } diff --git a/engine/src/main/java/org/pentaho/di/base/MetaFileLoaderImpl.java b/engine/src/main/java/org/pentaho/di/base/MetaFileLoaderImpl.java index 29abf51fe427..aaebe9c2308a 100644 --- a/engine/src/main/java/org/pentaho/di/base/MetaFileLoaderImpl.java +++ b/engine/src/main/java/org/pentaho/di/base/MetaFileLoaderImpl.java @@ -22,6 +22,7 @@ package org.pentaho.di.base; import org.apache.commons.lang.StringUtils; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.Const; import org.pentaho.di.core.ObjectLocationSpecificationMethod; import org.pentaho.di.core.exception.KettleException; @@ -148,29 +149,32 @@ public MetaFileLoaderImpl( BaseStepMeta baseStepMeta, ObjectLocationSpecificatio useCache = "Y".equalsIgnoreCase( System.getProperty( Const.KETTLE_USE_META_FILE_CACHE, Const.KETTLE_USE_META_FILE_CACHE_DEFAULT ) ); } - public T getMetaForEntry( Repository rep, IMetaStore metaStore, VariableSpace space ) throws KettleException { + @Override + public T getMetaForEntry( Bowl bowl, Repository rep, IMetaStore metaStore, VariableSpace space ) throws KettleException { try { T theMeta = null; if ( jobEntryBase.getParentJob() != null ) { metaFileCache = jobEntryBase.getParentJobMeta().getMetaFileCache(); //Get the cache from the parent or create it } CurrentDirectoryResolver r = new CurrentDirectoryResolver(); - VariableSpace tmpSpace = r.resolveCurrentDirectory( - specificationMethod, space, rep, jobEntryBase.getParentJob(), filename ); + VariableSpace tmpSpace = r.resolveCurrentDirectory( bowl, specificationMethod, space, rep, + jobEntryBase.getParentJob(), filename ); final String[] idContainer = new String[ 1 ]; //unigue portion of cache key passed though argument switch ( specificationMethod ) { case FILENAME: String realFilename = tmpSpace.environmentSubstitute( filename ); try { - theMeta = attemptLoadMeta( realFilename, rep, metaStore, tmpSpace, null, idContainer ); + theMeta = attemptLoadMeta( bowl, realFilename, rep, metaStore, tmpSpace, null, idContainer ); } catch ( KettleException e ) { // try to load from repository, this trans may have been developed locally and later uploaded to the // repository if ( rep == null ) { theMeta = isTransMeta() - ? (T) new TransMeta( realFilename, metaStore, null, true, jobEntryBase.getParentVariableSpace(), null ) - : (T) new JobMeta( jobEntryBase.getParentVariableSpace(), realFilename, rep, metaStore, null ); + ? (T) new TransMeta( bowl, realFilename, metaStore, null, true, + jobEntryBase.getParentVariableSpace(), null ) + : (T) new JobMeta( bowl, jobEntryBase.getParentVariableSpace(), realFilename, rep, metaStore, + null ); } else { theMeta = getMetaFromRepository( rep, r, realFilename, tmpSpace ); } @@ -197,9 +201,10 @@ public T getMetaForEntry( Repository rep, IMetaStore metaStore, VariableSpace sp if ( theMeta == null ) { if ( isTransMeta() ) { theMeta = - (T) new TransMeta( metaPath, metaStore, null, true, jobEntryBase.getParentVariableSpace(), null ); + (T) new TransMeta( bowl, metaPath, metaStore, null, true, jobEntryBase.getParentVariableSpace(), + null ); } else { - theMeta = (T) new JobMeta( tmpSpace, metaPath, rep, metaStore, null ); + theMeta = (T) new JobMeta( bowl, tmpSpace, metaPath, rep, metaStore, null ); } idContainer[ 0 ] = metaPath; } @@ -208,7 +213,8 @@ public T getMetaForEntry( Repository rep, IMetaStore metaStore, VariableSpace sp if ( theMeta == null ) { if ( isTransMeta() ) { theMeta = rep == null - ? (T) new TransMeta( metaPath, metaStore, null, true, jobEntryBase.getParentVariableSpace(), null ) + ? (T) new TransMeta( bowl, metaPath, metaStore, null, true, jobEntryBase.getParentVariableSpace(), + null ) : getMetaFromRepository( rep, r, metaPath, tmpSpace ); } else { theMeta = getMetaFromRepository( rep, r, metaPath, tmpSpace ); @@ -279,8 +285,8 @@ private void cacheMeta( String cacheKey, T theMeta ) { } } - private T attemptLoadMeta( String realFilename, Repository rep, IMetaStore metaStore, VariableSpace jobSpace, - VariableSpace transSpace, String[] idContainer ) + private T attemptLoadMeta( Bowl bowl, String realFilename, Repository rep, IMetaStore metaStore, + VariableSpace jobSpace, VariableSpace transSpace, String[] idContainer ) throws KettleException { T theMeta = null; //try to get from the cache first @@ -288,8 +294,8 @@ private T attemptLoadMeta( String realFilename, Repository rep, IMetaStore metaS if ( theMeta == null ) { theMeta = isTransMeta() - ? (T) new TransMeta( realFilename, metaStore, null, true, transSpace, null ) - : (T) new JobMeta( jobSpace, realFilename, rep, metaStore, null ); + ? (T) new TransMeta( bowl, realFilename, metaStore, null, true, transSpace, null ) + : (T) new JobMeta( bowl, jobSpace, realFilename, rep, metaStore, null ); idContainer[ 0 ] = realFilename; //only pass back the id used in the cache, if a cache entry should be created } return theMeta; @@ -349,7 +355,7 @@ private boolean isTransMeta() { } @Override - public T getMetaForStep( Repository rep, IMetaStore metaStore, VariableSpace space ) + public T getMetaForStep( Bowl bowl, Repository rep, IMetaStore metaStore, VariableSpace space ) throws KettleException { // Note - was a synchronized static method, but as no static variables are manipulated, this is entirely unnecessary @@ -365,11 +371,11 @@ public T getMetaForStep( Repository rep, IMetaStore metaStore, VariableSpace spa // send restricted parentVariables with several important options // Otherwise we destroy child variables and the option "Inherit all variables from the transformation" is enabled // always. - tmpSpace = r.resolveCurrentDirectory( specificationMethod, getVarSpaceOnlyWithRequiredParentVars( space ), - rep, baseStepMeta.getParentStepMeta(), filename ); + tmpSpace = r.resolveCurrentDirectory( bowl, specificationMethod, getVarSpaceOnlyWithRequiredParentVars( space ), + rep, baseStepMeta.getParentStepMeta(), filename ); } else { tmpSpace = - r.resolveCurrentDirectory( specificationMethod, space, rep, baseStepMeta.getParentStepMeta(), filename ); + r.resolveCurrentDirectory( bowl, specificationMethod, space, rep, baseStepMeta.getParentStepMeta(), filename ); } final String[] idContainer = new String[ 1 ]; //unigue portion of cache key passed though argument @@ -390,7 +396,7 @@ public T getMetaForStep( Repository rep, IMetaStore metaStore, VariableSpace spa theMeta = getMetaFromRepository2( realFilename, rep, r, idContainer ); } if ( theMeta == null ) { - theMeta = attemptLoadMeta( realFilename, rep, metaStore, null, tmpSpace, idContainer ); + theMeta = attemptLoadMeta( bowl, realFilename, rep, metaStore, null, tmpSpace, idContainer ); LogChannel.GENERAL.logDetailed( "Loading " + friendlyMetaType + " from repository", friendlyMetaType + " was loaded from XML file [" + realFilename + "]" ); } @@ -453,13 +459,13 @@ public T getMetaForStep( Repository rep, IMetaStore metaStore, VariableSpace spa } else { // rep is null, let's try loading by filename try { - theMeta = attemptLoadMeta( cacheKey, rep, metaStore, null, tmpSpace, idContainer ); + theMeta = attemptLoadMeta( bowl, cacheKey, rep, metaStore, null, tmpSpace, idContainer ); } catch ( KettleException ke ) { try { // add .ktr extension and try again String extension = isTransMeta() ? Const.STRING_TRANS_DEFAULT_EXT : Const.STRING_JOB_DEFAULT_EXT; theMeta = - attemptLoadMeta( cacheKey + "." + extension, rep, metaStore, null, + attemptLoadMeta( bowl, cacheKey + "." + extension, rep, metaStore, null, tmpSpace, idContainer ); if ( idContainer[ 0 ] != null ) { //It successfully read in the meta but we don't want to cache it with the extension so we override diff --git a/engine/src/main/java/org/pentaho/di/cluster/SlaveServer.java b/engine/src/main/java/org/pentaho/di/cluster/SlaveServer.java index e9df623884ba..e5324f89e3de 100644 --- a/engine/src/main/java/org/pentaho/di/cluster/SlaveServer.java +++ b/engine/src/main/java/org/pentaho/di/cluster/SlaveServer.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2023 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -45,6 +45,7 @@ import org.apache.http.impl.client.BasicAuthCache; import org.apache.http.impl.client.BasicCredentialsProvider; import org.apache.http.message.BasicHeader; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.Const; import org.pentaho.di.core.changed.ChangedFlag; import org.pentaho.di.core.encryption.Encr; @@ -679,7 +680,8 @@ HttpPost buildSendExportMethod( String type, String load, InputStream is ) throw */ public String sendExport( String filename, String type, String load ) throws Exception { // Request content will be retrieved directly from the input stream - try ( InputStream is = KettleVFS.getInputStream( KettleVFS.getFileObject( filename ) ) ) { + try ( InputStream is = KettleVFS.getInputStream( KettleVFS.getInstance( DefaultBowl.getInstance() ) + .getFileObject( filename ) ) ) { // Execute request HttpPost method = buildSendExportMethod( type, load, is ); try { diff --git a/engine/src/main/java/org/pentaho/di/core/logging/LogChannelFileWriter.java b/engine/src/main/java/org/pentaho/di/core/logging/LogChannelFileWriter.java index 93d8dc0d4c09..5be18c93fa8d 100644 --- a/engine/src/main/java/org/pentaho/di/core/logging/LogChannelFileWriter.java +++ b/engine/src/main/java/org/pentaho/di/core/logging/LogChannelFileWriter.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2019 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -27,6 +27,7 @@ import java.util.concurrent.atomic.AtomicBoolean; import org.apache.commons.vfs2.FileObject; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.core.vfs.KettleVFS; @@ -76,7 +77,7 @@ public LogChannelFileWriter( String logChannelId, FileObject logFile, boolean ap finished = new AtomicBoolean( false ); try { - logFileOutputStream = KettleVFS.getOutputStream( logFile, appending ); + logFileOutputStream = KettleVFS.getInstance( DefaultBowl.getInstance() ).getOutputStream( logFile, appending ); } catch ( IOException e ) { throw new KettleException( "There was an error while trying to open file '" + logFile + "' for writing", e ); } diff --git a/engine/src/main/java/org/pentaho/di/core/util/FileUtil.java b/engine/src/main/java/org/pentaho/di/core/util/FileUtil.java index 2bf96bb19197..e5cc74ebc9c8 100644 --- a/engine/src/main/java/org/pentaho/di/core/util/FileUtil.java +++ b/engine/src/main/java/org/pentaho/di/core/util/FileUtil.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2020 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -23,6 +23,7 @@ package org.pentaho.di.core.util; import org.apache.commons.vfs2.FileObject; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.logging.LogChannelInterface; import org.pentaho.di.core.variables.VariableSpace; import org.pentaho.di.core.vfs.KettleVFS; @@ -40,7 +41,8 @@ public static boolean createParentFolder( Class pkg, String filename, boolean // Check for parent folder boolean isParentFolderCreated = true; String parentFolderName = null; - try ( FileObject parentFolder = KettleVFS.getFileObject( filename, vs ).getParent() ) { + try ( FileObject parentFolder = KettleVFS.getInstance( DefaultBowl.getInstance() ) + .getFileObject( filename, vs ).getParent() ) { parentFolderName = parentFolder.getName().toString(); // Get parent folder if ( !parentFolder.exists() ) { diff --git a/engine/src/main/java/org/pentaho/di/core/util/SwingSvgImageUtil.java b/engine/src/main/java/org/pentaho/di/core/util/SwingSvgImageUtil.java index b92525e8114b..824116994174 100644 --- a/engine/src/main/java/org/pentaho/di/core/util/SwingSvgImageUtil.java +++ b/engine/src/main/java/org/pentaho/di/core/util/SwingSvgImageUtil.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -30,6 +30,7 @@ import org.apache.commons.lang.StringUtils; import org.apache.commons.vfs2.FileObject; import org.apache.commons.vfs2.FileSystemException; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.SwingUniversalImage; import org.pentaho.di.core.SwingUniversalImageBitmap; import org.pentaho.di.core.SwingUniversalImageSvg; @@ -205,7 +206,7 @@ private static SwingUniversalImage loadFromBasedVFS( String location ) { */ private static SwingUniversalImage loadFromSimpleVFS( String location ) { try { - InputStream s = KettleVFS.getInputStream( location ); + InputStream s = KettleVFS.getInstance( DefaultBowl.getInstance() ).getInputStream( location ); if ( s == null ) { return null; } diff --git a/engine/src/main/java/org/pentaho/di/imp/Import.java b/engine/src/main/java/org/pentaho/di/imp/Import.java index 995bfc07b917..84d21da73e07 100644 --- a/engine/src/main/java/org/pentaho/di/imp/Import.java +++ b/engine/src/main/java/org/pentaho/di/imp/Import.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2018 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -32,6 +32,7 @@ import java.util.Date; import java.util.List; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.Const; import org.pentaho.di.core.util.Utils; import org.pentaho.di.core.KettleEnvironment; @@ -268,7 +269,7 @@ public static void main( String[] a ) throws KettleException { if ( !Utils.isEmpty( rulesFile ) ) { try { - Document document = XMLHandler.loadXMLFile( rulesFile ); + Document document = XMLHandler.loadXMLFile( DefaultBowl.getInstance(), rulesFile ); Node rulesNode = XMLHandler.getSubNode( document, ImportRules.XML_TAG ); importRules.loadXML( rulesNode ); log.logMinimal( BaseMessages.getString( PKG, "Import.Log.RulesLoaded", rulesFile, Integer.toString( diff --git a/engine/src/main/java/org/pentaho/di/job/Job.java b/engine/src/main/java/org/pentaho/di/job/Job.java index 2150d050530e..c440f77eeecc 100644 --- a/engine/src/main/java/org/pentaho/di/job/Job.java +++ b/engine/src/main/java/org/pentaho/di/job/Job.java @@ -47,6 +47,8 @@ import org.apache.commons.vfs2.FileObject; import org.pentaho.di.base.IMetaFileCache; import org.pentaho.di.cluster.SlaveServer; +import org.pentaho.di.core.bowl.Bowl; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.Const; import org.pentaho.di.core.util.ConnectionUtil; import org.pentaho.di.core.util.Utils; @@ -1450,7 +1452,7 @@ public void setInternalKettleVariables( VariableSpace var ) { boolean hasFilename = jobMeta != null && !Utils.isEmpty( jobMeta.getFilename() ); if ( hasFilename ) { // we have a finename that's defined. try { - FileObject fileObject = KettleVFS.getFileObject( jobMeta.getFilename(), this ); + FileObject fileObject = KettleVFS.getInstance( getBowl() ).getFileObject( jobMeta.getFilename(), this ); FileName fileName = fileObject.getName(); // The filename of the transformation @@ -1498,6 +1500,13 @@ public void setInternalKettleVariables( VariableSpace var ) { } + private Bowl getBowl() { + if ( jobMeta != null ) { + return jobMeta.getBowl(); + } + return DefaultBowl.getInstance(); + } + protected void setInternalEntryCurrentDirectory( boolean hasFilename, boolean hasRepoDir ) { variables.setVariable( Const.INTERNAL_VARIABLE_ENTRY_CURRENT_DIRECTORY, variables.getVariable( hasRepoDir ? Const.INTERNAL_VARIABLE_JOB_REPOSITORY_DIRECTORY @@ -1704,12 +1713,13 @@ public static String sendToSlaveServer( JobMeta jobMeta, JobExecutionConfigurati if ( executionConfiguration.isPassingExport() ) { // First export the job... slaveServer.getVariable("MASTER_HOST") // - FileObject tempFile = - KettleVFS.createTempFile( "jobExport", ".zip", System.getProperty( "java.io.tmpdir" ), jobMeta ); + FileObject tempFile = KettleVFS.getInstance( DefaultBowl.getInstance() ) + .createTempFile( "jobExport", ".zip", System.getProperty( "java.io.tmpdir" ), jobMeta ); TopLevelResource topLevelResource = - ResourceUtil.serializeResourceExportInterface( tempFile.getName().toString(), jobMeta, jobMeta, repository, - metaStore, executionConfiguration.getXML(), CONFIGURATION_IN_EXPORT_FILENAME ); + ResourceUtil.serializeResourceExportInterface( jobMeta.getBowl(), tempFile.getName().toString(), + jobMeta, jobMeta, repository, metaStore, executionConfiguration.getXML(), + CONFIGURATION_IN_EXPORT_FILENAME ); // Send the zip file over to the slave server... String result = diff --git a/engine/src/main/java/org/pentaho/di/job/entries/checkfilelocked/JobEntryCheckFilesLocked.java b/engine/src/main/java/org/pentaho/di/job/entries/checkfilelocked/JobEntryCheckFilesLocked.java index b1b9a6d66ec4..488ab4be565d 100644 --- a/engine/src/main/java/org/pentaho/di/job/entries/checkfilelocked/JobEntryCheckFilesLocked.java +++ b/engine/src/main/java/org/pentaho/di/job/entries/checkfilelocked/JobEntryCheckFilesLocked.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2020 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -265,7 +265,8 @@ private void processFile( String filename, String wildcard ) { String realFileFolderName = environmentSubstitute( filename ); String realWildcard = environmentSubstitute( wildcard ); - try ( FileObject fileFolder = KettleVFS.getFileObject( realFileFolderName ) ) { + try ( FileObject fileFolder = KettleVFS.getInstance( parentJobMeta.getBowl() ) + .getFileObject( realFileFolderName ) ) { FileObject[] files = new FileObject[] { fileFolder }; if ( fileFolder.exists() ) { // the file or folder exists @@ -306,7 +307,7 @@ 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 ); + LockFile locked = new LockFile( parentJobMeta.getBowl(), filename ); if ( locked.isLocked() ) { oneFileLocked = true; logError( BaseMessages.getString( PKG, "JobCheckFilesLocked.Log.FileLocked", filename ) ); @@ -430,7 +431,7 @@ public boolean isIncludeSubfolders() { public void check( List remarks, JobMeta jobMeta, VariableSpace space, Repository repository, IMetaStore metaStore ) { - boolean res = JobEntryValidatorUtils.andValidator().validate( this, "arguments", remarks, + boolean res = JobEntryValidatorUtils.andValidator().validate( jobMeta.getBowl(), this, "arguments", remarks, AndValidator.putValidators( JobEntryValidatorUtils.notNullValidator() ) ); if ( res ) { @@ -440,7 +441,7 @@ public void check( List remarks, JobMeta jobMeta, Variable JobEntryValidatorUtils.fileExistsValidator() ); for ( int i = 0; i < arguments.length; i++ ) { - JobEntryValidatorUtils.andValidator().validate( this, "arguments[" + i + "]", remarks, ctx ); + JobEntryValidatorUtils.andValidator().validate( jobMeta.getBowl(), this, "arguments[" + i + "]", remarks, ctx ); } } } diff --git a/engine/src/main/java/org/pentaho/di/job/entries/checkfilelocked/LockFile.java b/engine/src/main/java/org/pentaho/di/job/entries/checkfilelocked/LockFile.java index 74ef639e937d..ca31e0cc6ed4 100644 --- a/engine/src/main/java/org/pentaho/di/job/entries/checkfilelocked/LockFile.java +++ b/engine/src/main/java/org/pentaho/di/job/entries/checkfilelocked/LockFile.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -23,7 +23,9 @@ package org.pentaho.di.job.entries.checkfilelocked; import org.apache.commons.vfs2.FileObject; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.exception.KettleException; +import org.pentaho.di.core.vfs.IKettleVFS; import org.pentaho.di.core.vfs.KettleVFS; public class LockFile { @@ -39,7 +41,7 @@ public class LockFile { * @param filename * @throws KettleException */ - public LockFile( String filename ) throws KettleException { + public LockFile( Bowl bowl, String filename ) throws KettleException { setFilename( filename ); setLocked( false ); @@ -49,10 +51,10 @@ public LockFile( String filename ) throws KettleException { FileObject dummyfile = null; try { - - file = KettleVFS.getFileObject( filename ); + IKettleVFS vfs = KettleVFS.getInstance( bowl ); + file = vfs.getFileObject( filename ); if ( file.exists() ) { - dummyfile = KettleVFS.getFileObject( filename ); + dummyfile = vfs.getFileObject( filename ); // move file to itself! file.moveTo( dummyfile ); } diff --git a/engine/src/main/java/org/pentaho/di/job/entries/columnsexist/JobEntryColumnsExist.java b/engine/src/main/java/org/pentaho/di/job/entries/columnsexist/JobEntryColumnsExist.java index 3bef86b4c2cb..a4c6bbe51e9b 100644 --- a/engine/src/main/java/org/pentaho/di/job/entries/columnsexist/JobEntryColumnsExist.java +++ b/engine/src/main/java/org/pentaho/di/job/entries/columnsexist/JobEntryColumnsExist.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2018 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -317,8 +317,8 @@ public List getResourceDependencies( JobMeta jobMeta ) { @Override public void check( List remarks, JobMeta jobMeta, VariableSpace space, Repository repository, IMetaStore metaStore ) { - JobEntryValidatorUtils.andValidator().validate( this, "tablename", remarks, AndValidator.putValidators( JobEntryValidatorUtils.notBlankValidator() ) ); - JobEntryValidatorUtils.andValidator().validate( this, "columnname", remarks, AndValidator.putValidators( JobEntryValidatorUtils.notBlankValidator() ) ); + JobEntryValidatorUtils.andValidator().validate( jobMeta.getBowl(), this, "tablename", remarks, AndValidator.putValidators( JobEntryValidatorUtils.notBlankValidator() ) ); + JobEntryValidatorUtils.andValidator().validate( jobMeta.getBowl(), this, "columnname", remarks, AndValidator.putValidators( JobEntryValidatorUtils.notBlankValidator() ) ); } } diff --git a/engine/src/main/java/org/pentaho/di/job/entries/copyfiles/JobEntryCopyFiles.java b/engine/src/main/java/org/pentaho/di/job/entries/copyfiles/JobEntryCopyFiles.java index 8a42d5d12b8f..21c9caf66793 100644 --- a/engine/src/main/java/org/pentaho/di/job/entries/copyfiles/JobEntryCopyFiles.java +++ b/engine/src/main/java/org/pentaho/di/job/entries/copyfiles/JobEntryCopyFiles.java @@ -56,6 +56,7 @@ import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.core.exception.KettleXMLException; import org.pentaho.di.core.variables.VariableSpace; +import org.pentaho.di.core.vfs.IKettleVFS; import org.pentaho.di.core.vfs.KettleVFS; import org.pentaho.di.core.xml.XMLHandler; import org.pentaho.di.i18n.BaseMessages; @@ -360,6 +361,7 @@ public Result execute( Result previousResult, int nr ) throws KettleException { .passEmbeddedMetastoreKey( this, parentJobMeta.getEmbeddedMetastoreProviderKey() ); } + IKettleVFS vfs = KettleVFS.getInstance( parentJobMeta.getBowl() ); try { // Get source and destination files, also wildcard String[] vsourcefilefolder = preprocessfilefilder( source_filefolder ); @@ -376,7 +378,6 @@ public Result execute( Result previousResult, int nr ) throws KettleException { + "" ) ); } } - if ( arg_from_previous && rows != null ) { // Copy the input row to the (command line) arguments for ( int iteration = 0; iteration < rows.size() && !parentJob.isStopped(); iteration++ ) { resultRow = rows.get( iteration ); @@ -389,8 +390,8 @@ public Result execute( Result previousResult, int nr ) throws KettleException { if ( !Utils.isEmpty( vsourcefilefolder_previous ) && !Utils.isEmpty( vdestinationfilefolder_previous ) ) { if ( isDetailed() ) { logDetailed( BaseMessages.getString( PKG, "JobCopyFiles.Log.ProcessingRow", - KettleVFS.getFriendlyURI( environmentSubstitute( vsourcefilefolder_previous ), variables ), - KettleVFS.getFriendlyURI( environmentSubstitute( vdestinationfilefolder_previous ), variables ), + vfs.getFriendlyURI( environmentSubstitute( vsourcefilefolder_previous ), variables ), + vfs.getFriendlyURI( environmentSubstitute( vdestinationfilefolder_previous ), variables ), environmentSubstitute( vwildcard_previous ) ) ); } @@ -402,8 +403,8 @@ public Result execute( Result previousResult, int nr ) throws KettleException { } else { if ( isDetailed() ) { logDetailed( BaseMessages.getString( PKG, "JobCopyFiles.Log.IgnoringRow", - KettleVFS.getFriendlyURI( environmentSubstitute( vsourcefilefolder[ iteration ] ), variables ), - KettleVFS.getFriendlyURI( environmentSubstitute( vdestinationfilefolder[ iteration ] ), variables ), + vfs.getFriendlyURI( environmentSubstitute( vsourcefilefolder[ iteration ] ), variables ), + vfs.getFriendlyURI( environmentSubstitute( vdestinationfilefolder[ iteration ] ), variables ), vwildcard[ iteration ] ) ); } } @@ -416,8 +417,8 @@ public Result execute( Result previousResult, int nr ) throws KettleException { if ( isBasic() ) { logBasic( BaseMessages.getString( PKG, "JobCopyFiles.Log.ProcessingRow", - KettleVFS.getFriendlyURI( environmentSubstitute( vsourcefilefolder[ i ] ), variables ), - KettleVFS.getFriendlyURI( environmentSubstitute( vdestinationfilefolder[ i ] ), variables ), + vfs.getFriendlyURI( environmentSubstitute( vsourcefilefolder[ i ] ), variables ), + vfs.getFriendlyURI( environmentSubstitute( vdestinationfilefolder[ i ] ), variables ), environmentSubstitute( vwildcard[ i ] ) ) ); } @@ -428,8 +429,8 @@ public Result execute( Result previousResult, int nr ) throws KettleException { } else { if ( isDetailed() ) { logDetailed( BaseMessages.getString( PKG, "JobCopyFiles.Log.IgnoringRow", - KettleVFS.getFriendlyURI( environmentSubstitute( vsourcefilefolder[ i ] ), variables ), - KettleVFS.getFriendlyURI( environmentSubstitute( vdestinationfilefolder[ i ] ), variables ), vwildcard[ i ] ) ); + vfs.getFriendlyURI( environmentSubstitute( vsourcefilefolder[ i ] ), variables ), + vfs.getFriendlyURI( environmentSubstitute( vdestinationfilefolder[ i ] ), variables ), vwildcard[ i ] ) ); } } } @@ -467,8 +468,10 @@ boolean processFileFolder( String sourcefilefoldername, String destinationfilefo String realWildcard = environmentSubstitute( wildcard ); try { - sourcefilefolder = KettleVFS.getFileObject( realSourceFilefoldername, this ); - destinationfilefolder = KettleVFS.getFileObject( realDestinationFilefoldername, this ); + IKettleVFS vfs = KettleVFS.getInstance( parentJobMeta.getBowl() ); + + sourcefilefolder = vfs.getFileObject( realSourceFilefoldername, this ); + destinationfilefolder = vfs.getFileObject( realDestinationFilefoldername, this ); if ( sourcefilefolder.exists() ) { @@ -483,8 +486,8 @@ boolean processFileFolder( String sourcefilefoldername, String destinationfilefo // WARNING !!! CAN NOT COPY FOLDER TO FILE !!! logError( BaseMessages.getString( - PKG, "JobCopyFiles.Log.CanNotCopyFolderToFile", KettleVFS.getFriendlyURI( realSourceFilefoldername, variables ), - KettleVFS.getFriendlyURI( realDestinationFilefoldername, variables ) ) ); + PKG, "JobCopyFiles.Log.CanNotCopyFolderToFile", vfs.getFriendlyURI( realSourceFilefoldername, variables ), + vfs.getFriendlyURI( realDestinationFilefoldername, variables ) ) ); NbrFail++; @@ -543,7 +546,7 @@ boolean processFileFolder( String sourcefilefoldername, String destinationfilefo // Unable to retrieve file through existing connection; Get the file through a new VFS connection if ( removeFile == null ) { - removeFile = KettleVFS.getFileObject( fileremoventry, this ); + removeFile = vfs.getFileObject( fileremoventry, this ); } // Remove ONLY Files @@ -553,11 +556,11 @@ boolean processFileFolder( String sourcefilefoldername, String destinationfilefo if ( !deletefile ) { logError( " " + BaseMessages.getString( - PKG, "JobCopyFiles.Error.Exception.CanRemoveFileFolder", KettleVFS.getFriendlyURI( fileremoventry, variables ) ) ); + PKG, "JobCopyFiles.Error.Exception.CanRemoveFileFolder", vfs.getFriendlyURI( fileremoventry, variables ) ) ); } else { if ( isDetailed() ) { logDetailed( " " - + BaseMessages.getString( PKG, "JobCopyFiles.Log.FileFolderRemoved", KettleVFS.getFriendlyURI( fileremoventry, variables ) ) ); + + BaseMessages.getString( PKG, "JobCopyFiles.Log.FileFolderRemoved", vfs.getFriendlyURI( fileremoventry, variables ) ) ); } } } @@ -583,7 +586,7 @@ boolean processFileFolder( String sourcefilefoldername, String destinationfilefo // Unable to retrieve file through existing connection; Get the file through a new VFS connection if ( addFile == null ) { - addFile = KettleVFS.getFileObject( fileaddentry, this ); + addFile = vfs.getFileObject( fileaddentry, this ); } // Add ONLY Files @@ -595,7 +598,7 @@ boolean processFileFolder( String sourcefilefoldername, String destinationfilefo logDetailed( " ------ " ); logDetailed( " " + BaseMessages - .getString( PKG, "JobCopyFiles.Log.FileAddedToResultFilesName", KettleVFS.getFriendlyURI( fileaddentry, variables ) ) ); + .getString( PKG, "JobCopyFiles.Log.FileAddedToResultFilesName", vfs.getFriendlyURI( fileaddentry, variables ) ) ); } } } @@ -605,10 +608,10 @@ boolean processFileFolder( String sourcefilefoldername, String destinationfilefo } else { // Destination Folder or Parent folder is missing logError( BaseMessages.getString( - PKG, "JobCopyFiles.Error.DestinationFolderNotFound", KettleVFS.getFriendlyURI( realDestinationFilefoldername, variables ) ) ); + PKG, "JobCopyFiles.Error.DestinationFolderNotFound", vfs.getFriendlyURI( realDestinationFilefoldername, variables ) ) ); } } else { - logError( BaseMessages.getString( PKG, "JobCopyFiles.Error.SourceFileNotExists", KettleVFS.getFriendlyURI( realSourceFilefoldername, variables ) ) ); + logError( BaseMessages.getString( PKG, "JobCopyFiles.Error.SourceFileNotExists", vfs.getFriendlyURI( realSourceFilefoldername, variables ) ) ); } } catch ( FileSystemException fse ) { @@ -621,8 +624,10 @@ boolean processFileFolder( String sourcefilefoldername, String destinationfilefo } } catch ( Exception e ) { logError( BaseMessages.getString( - PKG, "JobCopyFiles.Error.Exception.CopyProcess", KettleVFS.getFriendlyURI( realSourceFilefoldername, variables ), - KettleVFS.getFriendlyURI( realDestinationFilefoldername, variables ), e.getMessage() ), e ); + PKG, "JobCopyFiles.Error.Exception.CopyProcess", KettleVFS.getInstance( parentJobMeta.getBowl() ) + .getFriendlyURI( realSourceFilefoldername, variables ), + KettleVFS.getInstance( parentJobMeta.getBowl() ) + .getFriendlyURI( realDestinationFilefoldername, variables ), e.getMessage() ), e ); } finally { if ( sourcefilefolder != null ) { try { @@ -805,7 +810,8 @@ public boolean includeFile( FileSelectInfo info ) { // Built destination filename if ( destinationFolderObject == null ) { // Resolve the destination folder - destinationFolderObject = KettleVFS.getFileObject( destinationFolder, JobEntryCopyFiles.this ); + destinationFolderObject = KettleVFS.getInstance( parentJobMeta.getBowl() ) + .getFileObject( destinationFolder, JobEntryCopyFiles.this ); } String fullName = info.getFile().toString(); @@ -910,7 +916,8 @@ public boolean includeFile( FileSelectInfo info ) { } } else { // file...Check if exists - file_name = KettleVFS.getFileObject( destinationFolder + Const.FILE_SEPARATOR + short_filename, variables ); + file_name = KettleVFS.getInstance( parentJobMeta.getBowl() ) + .getFileObject( destinationFolder + Const.FILE_SEPARATOR + short_filename, variables ); if ( GetFileWildcard( short_filename ) ) { if ( ( file_name == null ) || ( !file_name.exists() ) ) { @@ -1017,22 +1024,23 @@ public boolean includeFile( FileSelectInfo info ) { String fil_name = null; try { + IKettleVFS vfs = KettleVFS.getInstance( parentJobMeta.getBowl() ); if ( info.getFile().getType() == FileType.FILE ) { if ( info.getFile().getName().getBaseName().equals( filename ) && ( info.getFile().getParent().toString().equals( foldername ) ) ) { // check if the file exists fil_name = destfolder + Const.FILE_SEPARATOR + filename; - if ( KettleVFS.getFileObject( fil_name, JobEntryCopyFiles.this ).exists() ) { + if ( vfs.getFileObject( fil_name, JobEntryCopyFiles.this ).exists() ) { if ( isDetailed() ) { - logDetailed( " " + BaseMessages.getString( PKG, "JobCopyFiles.Log.FileExists", KettleVFS.getFriendlyURI( fil_name, variables ) ) ); + logDetailed( " " + BaseMessages.getString( PKG, "JobCopyFiles.Log.FileExists", vfs.getFriendlyURI( fil_name, variables ) ) ); } if ( overwrite_files ) { if ( isDetailed() ) { logDetailed( " " + BaseMessages.getString( - PKG, "JobCopyFiles.Log.FileOverwrite", KettleVFS.getFriendlyURI( info.getFile() ), KettleVFS.getFriendlyURI( fil_name, variables ) ) ); + PKG, "JobCopyFiles.Log.FileOverwrite", KettleVFS.getFriendlyURI( info.getFile() ), vfs.getFriendlyURI( fil_name, variables ) ) ); } resultat = true; @@ -1041,7 +1049,7 @@ public boolean includeFile( FileSelectInfo info ) { if ( isDetailed() ) { logDetailed( " " + BaseMessages.getString( - PKG, "JobCopyFiles.Log.FileCopied", KettleVFS.getFriendlyURI( info.getFile() ), KettleVFS.getFriendlyURI( fil_name, variables ) ) ); + PKG, "JobCopyFiles.Log.FileCopied", KettleVFS.getFriendlyURI( info.getFile() ), vfs.getFriendlyURI( fil_name, variables ) ) ); } resultat = true; @@ -1057,12 +1065,13 @@ public boolean includeFile( FileSelectInfo info ) { if ( resultat && add_result_filesname ) { // add this folder/file to result files name - list_add_result.add( KettleVFS.getFileObject( fil_name, JobEntryCopyFiles.this ).toString() ); + list_add_result.add( vfs.getFileObject( fil_name, JobEntryCopyFiles.this ).toString() ); } } } catch ( Exception e ) { logError( BaseMessages.getString( PKG, "JobCopyFiles.Error.Exception.CopyProcess", KettleVFS.getFriendlyURI( info - .getFile() ), KettleVFS.getFriendlyURI( fil_name, variables ), e.getMessage() ) ); + .getFile() ), KettleVFS.getInstance( parentJobMeta.getBowl() ) + .getFriendlyURI( fil_name, variables ), e.getMessage() ) ); resultat = false; } @@ -1141,7 +1150,8 @@ public boolean isCreateDestinationFolder() { public void check( List remarks, JobMeta jobMeta, VariableSpace space, Repository repository, IMetaStore metaStore ) { - boolean res = JobEntryValidatorUtils.andValidator().validate( this, "arguments", remarks, AndValidator.putValidators( JobEntryValidatorUtils.notNullValidator() ) ); + boolean res = JobEntryValidatorUtils.andValidator().validate( jobMeta.getBowl(), this, "arguments", remarks, + AndValidator.putValidators( JobEntryValidatorUtils.notNullValidator() ) ); if ( !res ) { return; @@ -1152,7 +1162,7 @@ public void check( List remarks, JobMeta jobMeta, Variable AndValidator.putValidators( ctx, JobEntryValidatorUtils.notNullValidator(), JobEntryValidatorUtils.fileExistsValidator() ); for ( int i = 0; i < source_filefolder.length; i++ ) { - JobEntryValidatorUtils.andValidator().validate( this, "arguments[" + i + "]", remarks, ctx ); + JobEntryValidatorUtils.andValidator().validate( jobMeta.getBowl(), this, "arguments[" + i + "]", remarks, ctx ); } } diff --git a/engine/src/main/java/org/pentaho/di/job/entries/copymoveresultfilenames/JobEntryCopyMoveResultFilenames.java b/engine/src/main/java/org/pentaho/di/job/entries/copymoveresultfilenames/JobEntryCopyMoveResultFilenames.java index c1b7892f8716..135bb20ea19c 100644 --- a/engine/src/main/java/org/pentaho/di/job/entries/copymoveresultfilenames/JobEntryCopyMoveResultFilenames.java +++ b/engine/src/main/java/org/pentaho/di/job/entries/copymoveresultfilenames/JobEntryCopyMoveResultFilenames.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2022 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -521,7 +521,7 @@ private boolean getSuccessStatus() { private boolean CreateDestinationFolder( String foldername ) { FileObject folder = null; try { - folder = KettleVFS.getFileObject( foldername, this ); + folder = KettleVFS.getInstance( parentJobMeta.getBowl() ).getFileObject( foldername, this ); if ( !folder.exists() ) { logError( BaseMessages.getString( PKG, "JobEntryCopyMoveResultFilenames.Log.FolderNotExists", foldername ) ); @@ -585,7 +585,8 @@ private boolean processFile( FileObject sourcefile, String destinationFolder, Re String shortfilename = getDestinationFilename( sourcefile.getName().getBaseName() ); // build full destination filename String destinationFilename = destinationFolder + Const.FILE_SEPARATOR + shortfilename; - FileObject destinationfile = KettleVFS.getFileObject( destinationFilename, this ); + FileObject destinationfile = KettleVFS.getInstance( parentJobMeta.getBowl() ) + .getFileObject( destinationFilename, this ); boolean filexists = destinationfile.exists(); if ( filexists ) { if ( log.isDetailed() ) { @@ -620,8 +621,8 @@ private boolean processFile( FileObject sourcefile, String destinationFolder, Re if ( isAddDestinationFilename() ) { // Add destination filename to Resultfilenames ... ResultFile resultFile = - new ResultFile( ResultFile.FILE_TYPE_GENERAL, KettleVFS.getFileObject( - destinationfile.toString(), this ), parentJob.getJobname(), toString() ); + new ResultFile( ResultFile.FILE_TYPE_GENERAL, KettleVFS.getInstance( parentJobMeta.getBowl() ) + .getFileObject( destinationfile.toString(), this ), parentJob.getJobname(), toString() ); result.getResultFiles().put( resultFile.getFile().toString(), resultFile ); if ( log.isDetailed() ) { logDetailed( BaseMessages.getString( @@ -696,7 +697,7 @@ public void check( List remarks, JobMeta jobMeta, Variable ValidatorContext ctx = new ValidatorContext(); AbstractFileValidator.putVariableSpace( ctx, getVariables() ); AndValidator.putValidators( ctx, JobEntryValidatorUtils.notNullValidator(), JobEntryValidatorUtils.fileDoesNotExistValidator() ); - JobEntryValidatorUtils.andValidator().validate( this, "filename", remarks, ctx ); + JobEntryValidatorUtils.andValidator().validate( jobMeta.getBowl(), this, "filename", remarks, ctx ); } } diff --git a/engine/src/main/java/org/pentaho/di/job/entries/createfile/JobEntryCreateFile.java b/engine/src/main/java/org/pentaho/di/job/entries/createfile/JobEntryCreateFile.java index 8f6a4e713f39..b87f77738d62 100644 --- a/engine/src/main/java/org/pentaho/di/job/entries/createfile/JobEntryCreateFile.java +++ b/engine/src/main/java/org/pentaho/di/job/entries/createfile/JobEntryCreateFile.java @@ -267,7 +267,7 @@ public void check( List remarks, JobMeta jobMeta, Variable ValidatorContext ctx = new ValidatorContext(); AbstractFileValidator.putVariableSpace( ctx, getVariables() ); AndValidator.putValidators( ctx, JobEntryValidatorUtils.notNullValidator(), JobEntryValidatorUtils.fileDoesNotExistValidator() ); - JobEntryValidatorUtils.andValidator().validate( this, "filename", remarks, ctx ); + JobEntryValidatorUtils.andValidator().validate( parentJobMeta.getBowl(), this, "filename", remarks, ctx ); } } diff --git a/engine/src/main/java/org/pentaho/di/job/entries/createfolder/JobEntryCreateFolder.java b/engine/src/main/java/org/pentaho/di/job/entries/createfolder/JobEntryCreateFolder.java index 1195b8f594cd..f04ecebd78cc 100644 --- a/engine/src/main/java/org/pentaho/di/job/entries/createfolder/JobEntryCreateFolder.java +++ b/engine/src/main/java/org/pentaho/di/job/entries/createfolder/JobEntryCreateFolder.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -152,7 +152,8 @@ public Result execute( Result previousResult, int nr ) { String realFoldername = getRealFoldername(); FileObject folderObject = null; try { - folderObject = KettleVFS.getFileObject( realFoldername, this ); + folderObject = KettleVFS.getInstance( parentJobMeta.getBowl() ) + .getFileObject( realFoldername, this ); if ( folderObject.exists() ) { boolean isFolder = false; @@ -228,7 +229,7 @@ public void check( List remarks, JobMeta jobMeta, Variable ValidatorContext ctx = new ValidatorContext(); AbstractFileValidator.putVariableSpace( ctx, getVariables() ); AndValidator.putValidators( ctx, JobEntryValidatorUtils.notNullValidator(), JobEntryValidatorUtils.fileDoesNotExistValidator() ); - JobEntryValidatorUtils.andValidator().validate( this, "filename", remarks, ctx ); + JobEntryValidatorUtils.andValidator().validate( jobMeta.getBowl(), this, "filename", remarks, ctx ); } } diff --git a/engine/src/main/java/org/pentaho/di/job/entries/delay/JobEntryDelay.java b/engine/src/main/java/org/pentaho/di/job/entries/delay/JobEntryDelay.java index e11dcf3944f8..75a2b0f9d031 100644 --- a/engine/src/main/java/org/pentaho/di/job/entries/delay/JobEntryDelay.java +++ b/engine/src/main/java/org/pentaho/di/job/entries/delay/JobEntryDelay.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2018 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -254,9 +254,9 @@ public void setMaximumTimeout( String s ) { @Override public void check( List remarks, JobMeta jobMeta, VariableSpace space, Repository repository, IMetaStore metaStore ) { - JobEntryValidatorUtils.andValidator().validate( this, "maximumTimeout", remarks, + JobEntryValidatorUtils.andValidator().validate( jobMeta.getBowl(), this, "maximumTimeout", remarks, AndValidator.putValidators( JobEntryValidatorUtils.longValidator() ) ); - JobEntryValidatorUtils.andValidator().validate( this, "scaleTime", remarks, + JobEntryValidatorUtils.andValidator().validate( jobMeta.getBowl(), this, "scaleTime", remarks, AndValidator.putValidators( JobEntryValidatorUtils.integerValidator() ) ); } diff --git a/engine/src/main/java/org/pentaho/di/job/entries/deletefile/JobEntryDeleteFile.java b/engine/src/main/java/org/pentaho/di/job/entries/deletefile/JobEntryDeleteFile.java index fe97faec8e9f..b9525f63ca12 100644 --- a/engine/src/main/java/org/pentaho/di/job/entries/deletefile/JobEntryDeleteFile.java +++ b/engine/src/main/java/org/pentaho/di/job/entries/deletefile/JobEntryDeleteFile.java @@ -239,7 +239,7 @@ public void check( List remarks, JobMeta jobMeta, Variable if ( isFailIfFileNotExists() ) { FileExistsValidator.putFailIfDoesNotExist( ctx, true ); } - JobEntryValidatorUtils.andValidator().validate( this, "filename", remarks, ctx ); + JobEntryValidatorUtils.andValidator().validate( jobMeta.getBowl(), this, "filename", remarks, ctx ); } public static void main( String[] args ) { diff --git a/engine/src/main/java/org/pentaho/di/job/entries/deletefiles/JobEntryDeleteFiles.java b/engine/src/main/java/org/pentaho/di/job/entries/deletefiles/JobEntryDeleteFiles.java index 400592be03d0..2511aa3c48ad 100644 --- a/engine/src/main/java/org/pentaho/di/job/entries/deletefiles/JobEntryDeleteFiles.java +++ b/engine/src/main/java/org/pentaho/di/job/entries/deletefiles/JobEntryDeleteFiles.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2022 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -300,7 +300,7 @@ boolean processFile( String path, String wildcard, Job parentJob ) { boolean isDeleted = false; FileObject fileFolder = null; try { - fileFolder = KettleVFS.getFileObject(path, this); + fileFolder = KettleVFS.getInstance( parentJobMeta.getBowl() ).getFileObject(path, this); if (fileFolder.exists()) { if (new TextFileSelector(fileFolder.toString(), wildcard, parentJob).hasAccess(fileFolder)) { @@ -467,8 +467,8 @@ public boolean evaluates() { public void check( List remarks, JobMeta jobMeta, VariableSpace space, Repository repository, IMetaStore metaStore ) { - boolean isValid = JobEntryValidatorUtils.andValidator().validate( this, "arguments", remarks, - AndValidator.putValidators( JobEntryValidatorUtils.notNullValidator() ) ); + boolean isValid = JobEntryValidatorUtils.andValidator().validate( parentJobMeta.getBowl(), this, "arguments", + remarks, AndValidator.putValidators( JobEntryValidatorUtils.notNullValidator() ) ); if ( !isValid ) { return; @@ -480,7 +480,8 @@ public void check( List remarks, JobMeta jobMeta, Variable JobEntryValidatorUtils.fileExistsValidator() ); for ( int i = 0; i < arguments.length; i++ ) { - JobEntryValidatorUtils.andValidator().validate( this, "arguments[" + i + "]", remarks, ctx ); + JobEntryValidatorUtils.andValidator().validate( parentJobMeta.getBowl(), this, "arguments[" + i + "]", remarks, + ctx ); } } diff --git a/engine/src/main/java/org/pentaho/di/job/entries/deletefolders/JobEntryDeleteFolders.java b/engine/src/main/java/org/pentaho/di/job/entries/deletefolders/JobEntryDeleteFolders.java index 10b57776426d..ace4af6321f8 100644 --- a/engine/src/main/java/org/pentaho/di/job/entries/deletefolders/JobEntryDeleteFolders.java +++ b/engine/src/main/java/org/pentaho/di/job/entries/deletefolders/JobEntryDeleteFolders.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -324,7 +324,7 @@ private boolean deleteFolder( String foldername ) { FileObject filefolder = null; try { - filefolder = KettleVFS.getFileObject( foldername, this ); + filefolder = KettleVFS.getInstance( parentJobMeta.getBowl() ).getFileObject( foldername, this ); if ( filefolder.exists() ) { // the file or folder exists @@ -388,7 +388,8 @@ public boolean evaluates() { public void check( List remarks, JobMeta jobMeta, VariableSpace space, Repository repository, IMetaStore metaStore ) { - boolean res = JobEntryValidatorUtils.andValidator().validate( this, "arguments", remarks, AndValidator.putValidators( JobEntryValidatorUtils.notNullValidator() ) ); + boolean res = JobEntryValidatorUtils.andValidator().validate( jobMeta.getBowl(), this, "arguments", remarks, + AndValidator.putValidators( JobEntryValidatorUtils.notNullValidator() ) ); if ( !res ) { return; @@ -399,7 +400,7 @@ public void check( List remarks, JobMeta jobMeta, Variable AndValidator.putValidators( ctx, JobEntryValidatorUtils.notNullValidator(), JobEntryValidatorUtils.fileExistsValidator() ); for ( int i = 0; i < arguments.length; i++ ) { - JobEntryValidatorUtils.andValidator().validate( this, "arguments[" + i + "]", remarks, ctx ); + JobEntryValidatorUtils.andValidator().validate( jobMeta.getBowl(), this, "arguments[" + i + "]", remarks, ctx ); } } diff --git a/engine/src/main/java/org/pentaho/di/job/entries/deleteresultfilenames/JobEntryDeleteResultFilenames.java b/engine/src/main/java/org/pentaho/di/job/entries/deleteresultfilenames/JobEntryDeleteResultFilenames.java index 8b98386c1160..149a1fb29da9 100644 --- a/engine/src/main/java/org/pentaho/di/job/entries/deleteresultfilenames/JobEntryDeleteResultFilenames.java +++ b/engine/src/main/java/org/pentaho/di/job/entries/deleteresultfilenames/JobEntryDeleteResultFilenames.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -252,7 +252,7 @@ public void check( List remarks, JobMeta jobMeta, Variable ValidatorContext ctx = new ValidatorContext(); AbstractFileValidator.putVariableSpace( ctx, getVariables() ); AndValidator.putValidators( ctx, JobEntryValidatorUtils.notNullValidator(), JobEntryValidatorUtils.fileDoesNotExistValidator() ); - JobEntryValidatorUtils.andValidator().validate( this, "filename", remarks, ctx ); + JobEntryValidatorUtils.andValidator().validate( jobMeta.getBowl(), this, "filename", remarks, ctx ); } } diff --git a/engine/src/main/java/org/pentaho/di/job/entries/dostounix/JobEntryDosToUnix.java b/engine/src/main/java/org/pentaho/di/job/entries/dostounix/JobEntryDosToUnix.java index 072220402bac..a1bb77f62d87 100644 --- a/engine/src/main/java/org/pentaho/di/job/entries/dostounix/JobEntryDosToUnix.java +++ b/engine/src/main/java/org/pentaho/di/job/entries/dostounix/JobEntryDosToUnix.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -548,7 +548,7 @@ private boolean processFileFolder( String sourcefilefoldername, String wildcard, String realWildcard = environmentSubstitute( wildcard ); try { - sourcefilefolder = KettleVFS.getFileObject( realSourceFilefoldername ); + sourcefilefolder = KettleVFS.getInstance( parentJobMeta.getBowl() ).getFileObject( realSourceFilefoldername ); if ( sourcefilefolder.exists() ) { if ( isDetailed() ) { diff --git a/engine/src/main/java/org/pentaho/di/job/entries/eval/JobEntryEval.java b/engine/src/main/java/org/pentaho/di/job/entries/eval/JobEntryEval.java index f85600275f4e..02655ca63d4a 100644 --- a/engine/src/main/java/org/pentaho/di/job/entries/eval/JobEntryEval.java +++ b/engine/src/main/java/org/pentaho/di/job/entries/eval/JobEntryEval.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -226,7 +226,8 @@ public boolean isUnconditional() { public void check( List remarks, JobMeta jobMeta, VariableSpace space, Repository repository, IMetaStore metaStore ) { - JobEntryValidatorUtils.andValidator().validate( this, "script", remarks, AndValidator.putValidators( JobEntryValidatorUtils.notBlankValidator() ) ); + JobEntryValidatorUtils.andValidator().validate( jobMeta.getBowl(), this, "script", remarks, + AndValidator.putValidators( JobEntryValidatorUtils.notBlankValidator() ) ); } } diff --git a/engine/src/main/java/org/pentaho/di/job/entries/evalfilesmetrics/JobEntryEvalFilesMetrics.java b/engine/src/main/java/org/pentaho/di/job/entries/evalfilesmetrics/JobEntryEvalFilesMetrics.java index 9ad129105922..f81c5358199f 100644 --- a/engine/src/main/java/org/pentaho/di/job/entries/evalfilesmetrics/JobEntryEvalFilesMetrics.java +++ b/engine/src/main/java/org/pentaho/di/job/entries/evalfilesmetrics/JobEntryEvalFilesMetrics.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -737,7 +737,7 @@ private void ProcessFileFolder( String sourcefilefoldername, String wildcard, St final boolean include_subfolders = YES.equalsIgnoreCase( includeSubfolders ); try { - sourcefilefolder = KettleVFS.getFileObject( realSourceFilefoldername, this ); + sourcefilefolder = KettleVFS.getInstance( parentJobMeta.getBowl() ).getFileObject( realSourceFilefoldername, this ); if ( sourcefilefolder.exists() ) { // File exists @@ -1050,7 +1050,7 @@ public int getScale() { public void check( List remarks, JobMeta jobMeta, VariableSpace space, Repository repository, IMetaStore metaStore ) { - boolean res = JobEntryValidatorUtils.andValidator().validate( this, "arguments", remarks, + boolean res = JobEntryValidatorUtils.andValidator().validate( jobMeta.getBowl(), this, "arguments", remarks, AndValidator.putValidators( JobEntryValidatorUtils.notNullValidator() ) ); if ( res == false ) { @@ -1063,7 +1063,7 @@ public void check( List remarks, JobMeta jobMeta, Variable JobEntryValidatorUtils.fileExistsValidator() ); for ( int i = 0; i < sourceFileFolder.length; i++ ) { - JobEntryValidatorUtils.andValidator().validate( this, "arguments[" + i + "]", remarks, ctx ); + JobEntryValidatorUtils.andValidator().validate( jobMeta.getBowl(), this, "arguments[" + i + "]", remarks, ctx ); } } diff --git a/engine/src/main/java/org/pentaho/di/job/entries/evaluatetablecontent/JobEntryEvalTableContent.java b/engine/src/main/java/org/pentaho/di/job/entries/evaluatetablecontent/JobEntryEvalTableContent.java index d0dc070c2026..5a6d488b68db 100644 --- a/engine/src/main/java/org/pentaho/di/job/entries/evaluatetablecontent/JobEntryEvalTableContent.java +++ b/engine/src/main/java/org/pentaho/di/job/entries/evaluatetablecontent/JobEntryEvalTableContent.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -460,7 +460,7 @@ public List getResourceDependencies( JobMeta jobMeta ) { @Override public void check( List remarks, JobMeta jobMeta, VariableSpace space, Repository repository, IMetaStore metaStore ) { - JobEntryValidatorUtils.andValidator().validate( this, "WaitForSQL", remarks, + JobEntryValidatorUtils.andValidator().validate( jobMeta.getBowl(), this, "WaitForSQL", remarks, AndValidator.putValidators( JobEntryValidatorUtils.notBlankValidator() ) ); } diff --git a/engine/src/main/java/org/pentaho/di/job/entries/filecompare/JobEntryFileCompare.java b/engine/src/main/java/org/pentaho/di/job/entries/filecompare/JobEntryFileCompare.java index 127a2901334a..5065eb0d6097 100644 --- a/engine/src/main/java/org/pentaho/di/job/entries/filecompare/JobEntryFileCompare.java +++ b/engine/src/main/java/org/pentaho/di/job/entries/filecompare/JobEntryFileCompare.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -167,10 +167,10 @@ protected boolean equalFileContents( FileObject file1, FileObject file2 ) throws DataInputStream in2 = null; try { in1 = - new DataInputStream( new BufferedInputStream( KettleVFS.getInputStream( + new DataInputStream( new BufferedInputStream( KettleVFS.getInstance( parentJobMeta.getBowl() ).getInputStream( KettleVFS.getFilename( file1 ), this ) ) ); in2 = - new DataInputStream( new BufferedInputStream( KettleVFS.getInputStream( + new DataInputStream( new BufferedInputStream( KettleVFS.getInstance( parentJobMeta.getBowl() ).getInputStream( KettleVFS.getFilename( file2 ), this ) ) ); char ch1, ch2; @@ -223,8 +223,8 @@ public Result execute( Result previousResult, int nr ) { .passEmbeddedMetastoreKey( this, parentJobMeta.getEmbeddedMetastoreProviderKey() ); } - file1 = KettleVFS.getFileObject( realFilename1, this ); - file2 = KettleVFS.getFileObject( realFilename2, this ); + file1 = KettleVFS.getInstance( parentJobMeta.getBowl() ).getFileObject( realFilename1, this ); + file2 = KettleVFS.getInstance( parentJobMeta.getBowl() ).getFileObject( realFilename2, this ); if ( file1.exists() && file2.exists() ) { if ( equalFileContents( file1, file2 ) ) { @@ -329,8 +329,8 @@ public void check( List remarks, JobMeta jobMeta, Variable AbstractFileValidator.putVariableSpace( ctx, getVariables() ); AndValidator.putValidators( ctx, JobEntryValidatorUtils.notNullValidator(), JobEntryValidatorUtils.fileExistsValidator() ); - JobEntryValidatorUtils.andValidator().validate( this, "filename1", remarks, ctx ); - JobEntryValidatorUtils.andValidator().validate( this, "filename2", remarks, ctx ); + JobEntryValidatorUtils.andValidator().validate( jobMeta.getBowl(), this, "filename1", remarks, ctx ); + JobEntryValidatorUtils.andValidator().validate( jobMeta.getBowl(), this, "filename2", remarks, ctx ); } @Override public JobMeta getParentJobMeta() { diff --git a/engine/src/main/java/org/pentaho/di/job/entries/fileexists/JobEntryFileExists.java b/engine/src/main/java/org/pentaho/di/job/entries/fileexists/JobEntryFileExists.java index ff1b0689244e..45ed3d1565cd 100644 --- a/engine/src/main/java/org/pentaho/di/job/entries/fileexists/JobEntryFileExists.java +++ b/engine/src/main/java/org/pentaho/di/job/entries/fileexists/JobEntryFileExists.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -27,6 +27,7 @@ import org.apache.commons.vfs2.FileObject; import org.pentaho.di.cluster.SlaveServer; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.Result; import org.pentaho.di.core.database.DatabaseMeta; @@ -148,7 +149,7 @@ public Result execute( Result previousResult, int nr ) { String realFilename = getRealFilename(); try { - FileObject file = KettleVFS.getFileObject( realFilename, this ); + FileObject file = KettleVFS.getInstance( parentJobMeta.getBowl() ).getFileObject( realFilename, this ); if ( file.exists() && file.isReadable() ) { logDetailed( BaseMessages.getString( PKG, "JobEntryFileExists.File_Exists", realFilename ) ); result.setResult( true ); @@ -185,7 +186,7 @@ public List getResourceDependencies( JobMeta jobMeta ) { @Override public void check( List remarks, JobMeta jobMeta, VariableSpace space, Repository repository, IMetaStore metaStore ) { - JobEntryValidatorUtils.andValidator().validate( this, "filename", remarks, + JobEntryValidatorUtils.andValidator().validate( jobMeta.getBowl(), this, "filename", remarks, AndValidator.putValidators( JobEntryValidatorUtils.notBlankValidator() ) ); } @@ -209,7 +210,8 @@ public void check( List remarks, JobMeta jobMeta, Variable * @throws KettleException * in case something goes wrong during the export */ - public String exportResources( VariableSpace space, Map definitions, + @Override + public String exportResources( Bowl bowl, VariableSpace space, Map definitions, ResourceNamingInterface namingInterface, Repository repository, IMetaStore metaStore ) throws KettleException { try { // The object that we're modifying here is a copy of the original! @@ -220,7 +222,8 @@ public String exportResources( VariableSpace space, Map remarks, JobMeta jobMeta, VariableSpace space, Repository repository, IMetaStore metaStore ) { - JobEntryValidatorUtils.andValidator().validate( this, "filename", remarks, + JobEntryValidatorUtils.andValidator().validate( parentJobMeta.getBowl(), this, "filename", remarks, AndValidator.putValidators( JobEntryValidatorUtils.notBlankValidator() ) ); } } diff --git a/engine/src/main/java/org/pentaho/di/job/entries/folderscompare/JobEntryFoldersCompare.java b/engine/src/main/java/org/pentaho/di/job/entries/folderscompare/JobEntryFoldersCompare.java index 737b7919d944..75b714c03966 100644 --- a/engine/src/main/java/org/pentaho/di/job/entries/folderscompare/JobEntryFoldersCompare.java +++ b/engine/src/main/java/org/pentaho/di/job/entries/folderscompare/JobEntryFoldersCompare.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -47,6 +47,7 @@ import org.pentaho.di.core.exception.KettleXMLException; import org.pentaho.di.core.util.Utils; import org.pentaho.di.core.variables.VariableSpace; +import org.pentaho.di.core.vfs.IKettleVFS; import org.pentaho.di.core.vfs.KettleVFS; import org.pentaho.di.core.xml.XMLHandler; import org.pentaho.di.i18n.BaseMessages; @@ -234,12 +235,13 @@ protected boolean equalFileContents( FileObject file1, FileObject file2 ) throws DataInputStream in2 = null; try { // Really read the contents and do comparisons + IKettleVFS vfs = KettleVFS.getInstance( parentJobMeta.getBowl() ); in1 = - new DataInputStream( new BufferedInputStream( KettleVFS.getInputStream( + new DataInputStream( new BufferedInputStream( vfs.getInputStream( KettleVFS.getFilename( file1 ), this ) ) ); in2 = - new DataInputStream( new BufferedInputStream( KettleVFS.getInputStream( + new DataInputStream( new BufferedInputStream( vfs.getInputStream( KettleVFS.getFilename( file2 ), this ) ) ); char ch1, ch2; @@ -296,8 +298,9 @@ public Result execute( Result previousResult, int nr ) { .passEmbeddedMetastoreKey( this, parentJobMeta.getEmbeddedMetastoreProviderKey() ); } // Get Folders/Files to compare - folder1 = KettleVFS.getFileObject( realFilename1, this ); - folder2 = KettleVFS.getFileObject( realFilename2, this ); + IKettleVFS vfs = KettleVFS.getInstance( parentJobMeta.getBowl() ); + folder1 = vfs.getFileObject( realFilename1, this ); + folder2 = vfs.getFileObject( realFilename2, this ); if ( folder1.exists() && folder2.exists() ) { if ( !folder1.getType().equals( folder2.getType() ) ) { @@ -380,8 +383,8 @@ public Result execute( Result previousResult, int nr ) { .getKey().toString(), realFilename2 ) ); } - filefolder1 = KettleVFS.getFileObject( entree.getValue().toString(), this ); - filefolder2 = KettleVFS.getFileObject( collection2.get( entree.getKey() ).toString(), this ); + filefolder1 = vfs.getFileObject( entree.getValue().toString(), this ); + filefolder2 = vfs.getFileObject( collection2.get( entree.getKey() ).toString(), this ); if ( !filefolder2.getType().equals( filefolder1.getType() ) ) { // The file1 exist in the folder2..but they don't have the same type @@ -622,7 +625,7 @@ public void check( List remarks, JobMeta jobMeta, Variable ValidatorContext ctx = new ValidatorContext(); AbstractFileValidator.putVariableSpace( ctx, getVariables() ); AndValidator.putValidators( ctx, JobEntryValidatorUtils.notNullValidator(), JobEntryValidatorUtils.fileExistsValidator() ); - JobEntryValidatorUtils.andValidator().validate( this, "filename1", remarks, ctx ); - JobEntryValidatorUtils.andValidator().validate( this, "filename2", remarks, ctx ); + JobEntryValidatorUtils.andValidator().validate( jobMeta.getBowl(), this, "filename1", remarks, ctx ); + JobEntryValidatorUtils.andValidator().validate( jobMeta.getBowl(), this, "filename2", remarks, ctx ); } } diff --git a/engine/src/main/java/org/pentaho/di/job/entries/http/JobEntryHTTP.java b/engine/src/main/java/org/pentaho/di/job/entries/http/JobEntryHTTP.java index c0b30982da6d..2d8db34f3024 100644 --- a/engine/src/main/java/org/pentaho/di/job/entries/http/JobEntryHTTP.java +++ b/engine/src/main/java/org/pentaho/di/job/entries/http/JobEntryHTTP.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2021 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -515,7 +515,8 @@ public synchronized Result execute( Result previousResult, int nr ) { } // Create the output File... - outputFile = KettleVFS.getOutputStream( realTargetFile, this, fileAppended ); + outputFile = KettleVFS.getInstance( parentJobMeta.getBowl() ) + .getOutputStream( realTargetFile, this, fileAppended ); URI uri = (new URIBuilder( urlToUse )).build(); @@ -538,7 +539,8 @@ public synchronized Result execute( Result previousResult, int nr ) { // Add to the result files... ResultFile resultFile = new ResultFile( - ResultFile.FILE_TYPE_GENERAL, KettleVFS.getFileObject( realTargetFile, this ), parentJob + ResultFile.FILE_TYPE_GENERAL, KettleVFS.getInstance( parentJobMeta.getBowl() ) + .getFileObject( realTargetFile, this ), parentJob .getJobname(), toString() ); result.getResultFiles().put( resultFile.getFile().toString(), resultFile ); } @@ -847,13 +849,13 @@ public List getResourceDependencies( JobMeta jobMeta ) { @Override public void check( List remarks, JobMeta jobMeta, VariableSpace space, Repository repository, IMetaStore metaStore ) { - JobEntryValidatorUtils.andValidator().validate( this, "targetFilename", remarks, + JobEntryValidatorUtils.andValidator().validate( jobMeta.getBowl(), this, "targetFilename", remarks, AndValidator.putValidators( JobEntryValidatorUtils.notBlankValidator() ) ); - JobEntryValidatorUtils.andValidator().validate( this, "targetFilenameExtention", remarks, + JobEntryValidatorUtils.andValidator().validate( jobMeta.getBowl(), this, "targetFilenameExtention", remarks, AndValidator.putValidators( JobEntryValidatorUtils.notBlankValidator() ) ); - JobEntryValidatorUtils.andValidator().validate( this, "uploadFilename", remarks, + JobEntryValidatorUtils.andValidator().validate( jobMeta.getBowl(), this, "uploadFilename", remarks, AndValidator.putValidators( JobEntryValidatorUtils.notBlankValidator() ) ); - JobEntryValidatorUtils.andValidator().validate( this, "proxyPort", remarks, + JobEntryValidatorUtils.andValidator().validate( jobMeta.getBowl(), this, "proxyPort", remarks, AndValidator.putValidators( JobEntryValidatorUtils.integerValidator() ) ); } diff --git a/engine/src/main/java/org/pentaho/di/job/entries/job/JobEntryJob.java b/engine/src/main/java/org/pentaho/di/job/entries/job/JobEntryJob.java index 581f7dff06e4..f8f93eb3c01d 100644 --- a/engine/src/main/java/org/pentaho/di/job/entries/job/JobEntryJob.java +++ b/engine/src/main/java/org/pentaho/di/job/entries/job/JobEntryJob.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2023 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -26,6 +26,7 @@ import org.pentaho.di.base.IMetaFileLoader; import org.pentaho.di.base.MetaFileLoaderImpl; import org.pentaho.di.cluster.SlaveServer; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.Const; import org.pentaho.di.core.ObjectLocationSpecificationMethod; @@ -648,7 +649,8 @@ public Result execute( Result result, int nr ) throws KettleException { try { logChannelFileWriter = new LogChannelFileWriter( - this.getLogChannelId(), KettleVFS.getFileObject( realLogFilename ), setAppendLogfile ); + this.getLogChannelId(), KettleVFS.getInstance( parentJobMeta.getBowl() ) + .getFileObject( realLogFilename ), setAppendLogfile ); logChannelFileWriter.startLogging(); } catch ( KettleException e ) { logError( "Unable to open file appender for file [" + getLogFilename() + "] : " + e.toString() ); @@ -1137,7 +1139,8 @@ public Result execute( Result result, int nr ) throws KettleException { FileObject logfile = logChannelFileWriter.getLogFile(); OutputStream logFileOutputStream = null; try { - logFileOutputStream = KettleVFS.getOutputStream( logfile, setAppendLogfile ); + logFileOutputStream = KettleVFS.getInstance( parentJobMeta.getBowl() ) + .getOutputStream( logfile, setAppendLogfile ); logFileOutputStream.write( logFromCarte.getBytes() ); logFileOutputStream.flush(); } catch ( Exception e ) { @@ -1257,7 +1260,7 @@ private boolean createParentFolder( String filename ) { boolean resultat = true; try { // Get parent folder - parentfolder = KettleVFS.getFileObject( filename, this ).getParent(); + parentfolder = KettleVFS.getInstance( parentJobMeta.getBowl() ).getFileObject( filename, this ).getParent(); if ( !parentfolder.exists() ) { if ( createParentFolder ) { if ( log.isDebug() ) { @@ -1426,7 +1429,7 @@ protected JobMeta getJobMetaFromRepository( Repository rep, CurrentDirectoryReso public JobMeta getJobMeta( Repository rep, IMetaStore metaStore, VariableSpace space ) throws KettleException { try { IMetaFileLoader metaFileLoader = new MetaFileLoaderImpl<>( this, specificationMethod ); - JobMeta jobMeta = metaFileLoader.getMetaForEntry( rep, metaStore, space ); + JobMeta jobMeta = metaFileLoader.getMetaForEntry( parentJobMeta.getBowl(), rep, metaStore, space ); if ( jobMeta != null ) { jobMeta.setRepository( rep ); @@ -1488,7 +1491,7 @@ public List getResourceDependencies( JobMeta jobMeta ) { * in case something goes wrong during the export */ @Override - public String exportResources( VariableSpace space, Map definitions, + public String exportResources( Bowl bowl, VariableSpace space, Map definitions, ResourceNamingInterface namingInterface, Repository repository, IMetaStore metaStore ) throws KettleException { // Try to load the transformation from repository or file. // Modify this recursively too... @@ -1505,7 +1508,7 @@ public String exportResources( VariableSpace space, Map remarks, JobMeta jobMeta, VariableSpace space, Repository repository, IMetaStore metaStore ) { if ( setLogfile ) { - JobEntryValidatorUtils.andValidator().validate( this, "logfile", remarks, + JobEntryValidatorUtils.andValidator().validate( jobMeta.getBowl(), this, "logfile", remarks, AndValidator.putValidators( JobEntryValidatorUtils.notBlankValidator() ) ); } if ( null != directory ) { // if from repo - JobEntryValidatorUtils.andValidator().validate( this, "directory", remarks, + JobEntryValidatorUtils.andValidator().validate( jobMeta.getBowl(), this, "directory", remarks, AndValidator.putValidators( JobEntryValidatorUtils.notNullValidator() ) ); - JobEntryValidatorUtils.andValidator().validate( this, "jobName", remarks, + JobEntryValidatorUtils.andValidator().validate( jobMeta.getBowl(), this, "jobName", remarks, AndValidator.putValidators( JobEntryValidatorUtils.notBlankValidator() ) ); } else { // else from xml file - JobEntryValidatorUtils.andValidator().validate( this, "filename", remarks, + JobEntryValidatorUtils.andValidator().validate( jobMeta.getBowl(), this, "filename", remarks, AndValidator.putValidators( JobEntryValidatorUtils.notBlankValidator() ) ); } } @@ -1719,7 +1722,8 @@ public String[] getReferencedObjectDescriptions() { * @throws KettleException */ @Override - public Object loadReferencedObject( int index, Repository rep, IMetaStore metaStore, VariableSpace space ) throws KettleException { + public Object loadReferencedObject( Bowl bowl, int index, Repository rep, IMetaStore metaStore, VariableSpace space ) + throws KettleException { return getJobMeta( rep, metaStore, space ); } diff --git a/engine/src/main/java/org/pentaho/di/job/entries/movefiles/JobEntryMoveFiles.java b/engine/src/main/java/org/pentaho/di/job/entries/movefiles/JobEntryMoveFiles.java index 0f8cfce4b99f..07057451d5b5 100644 --- a/engine/src/main/java/org/pentaho/di/job/entries/movefiles/JobEntryMoveFiles.java +++ b/engine/src/main/java/org/pentaho/di/job/entries/movefiles/JobEntryMoveFiles.java @@ -55,6 +55,7 @@ import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.core.exception.KettleXMLException; import org.pentaho.di.core.variables.VariableSpace; +import org.pentaho.di.core.vfs.IKettleVFS; import org.pentaho.di.core.vfs.KettleVFS; import org.pentaho.di.core.xml.XMLHandler; import org.pentaho.di.i18n.BaseMessages; @@ -408,7 +409,7 @@ public Result execute( Result previousResult, int nr ) throws KettleException { } FileObject folder = null; try { - folder = KettleVFS.getFileObject( MoveToFolder, this ); + folder = KettleVFS.getInstance( parentJobMeta.getBowl() ).getFileObject( MoveToFolder, this ); if ( !folder.exists() ) { if ( log.isDetailed() ) { logDetailed( BaseMessages.getString( PKG, "JobMoveFiles.Log.Error.FolderMissing", MoveToFolder ) ); @@ -573,11 +574,12 @@ private boolean ProcessFileFolder( String sourcefilefoldername, String destinati try { realDestinationFilefoldername = fixUpDestinationPath( realSourceFilefoldername, realDestinationFilefoldername ); + IKettleVFS vfs = KettleVFS.getInstance( parentJobMeta.getBowl() ); - sourcefilefolder = KettleVFS.getFileObject( realSourceFilefoldername, this ); - destinationfilefolder = KettleVFS.getFileObject( realDestinationFilefoldername, this ); + sourcefilefolder = vfs.getFileObject( realSourceFilefoldername, this ); + destinationfilefolder = vfs.getFileObject( realDestinationFilefoldername, this ); if ( !Utils.isEmpty( MoveToFolder ) ) { - movetofolderfolder = KettleVFS.getFileObject( MoveToFolder, this ); + movetofolderfolder = vfs.getFileObject( MoveToFolder, this ); } if ( sourcefilefolder.exists() ) { @@ -618,7 +620,7 @@ private boolean ProcessFileFolder( String sourcefilefoldername, String destinati String destinationfilenamefull = KettleVFS.getFilename( destinationfilefolder ) + Const.FILE_SEPARATOR + shortfilename; destinationfilenamefull = fixUpDestinationPath( realSourceFilefoldername, destinationfilenamefull ); - FileObject destinationfile = KettleVFS.getFileObject( destinationfilenamefull, this ); + FileObject destinationfile = vfs.getFileObject( destinationfilenamefull, this ); entrystatus = MoveFile( @@ -627,7 +629,7 @@ private boolean ProcessFileFolder( String sourcefilefoldername, String destinati } else if ( sourcefilefolder.getType().equals( FileType.FILE ) && destination_is_a_file ) { // Source is a file, destination is a file - FileObject destinationfile = KettleVFS.getFileObject( realDestinationFilefoldername, this ); + FileObject destinationfile = vfs.getFileObject( realDestinationFilefoldername, this ); // return destination short filename String shortfilename = destinationfile.getName().getBaseName(); @@ -643,7 +645,7 @@ private boolean ProcessFileFolder( String sourcefilefoldername, String destinati String destinationfilenamefull = KettleVFS.getFilename( destinationfile.getParent() ) + Const.FILE_SEPARATOR + shortfilename; destinationfilenamefull = fixUpDestinationPath( realSourceFilefoldername, destinationfilenamefull ); - destinationfile = KettleVFS.getFileObject( destinationfilenamefull, this ); + destinationfile = vfs.getFileObject( destinationfilenamefull, this ); entrystatus = MoveFile( @@ -813,7 +815,7 @@ private boolean MoveFile( String shortfilename, FileObject sourcefilename, FileO String movetofilenamefull = destinationfilename.getParent().toString() + Const.FILE_SEPARATOR + short_filename; - destinationfile = KettleVFS.getFileObject( movetofilenamefull, this ); + destinationfile = KettleVFS.getInstance( parentJobMeta.getBowl() ).getFileObject( movetofilenamefull, this ); if ( !simulate ) { sourcefilename.moveTo( destinationfile ); @@ -852,7 +854,7 @@ private boolean MoveFile( String shortfilename, FileObject sourcefilename, FileO } String movetofilenamefull = movetofolderfolder.toString() + Const.FILE_SEPARATOR + short_filename; - destinationfile = KettleVFS.getFileObject( movetofilenamefull, this ); + destinationfile = KettleVFS.getInstance( parentJobMeta.getBowl() ).getFileObject( movetofilenamefull, this ); if ( !destinationfile.exists() ) { if ( !simulate ) { sourcefilename.moveTo( destinationfile ); @@ -893,7 +895,7 @@ private boolean MoveFile( String shortfilename, FileObject sourcefilename, FileO String destinationfilenamefull = movetofolderfolder.toString() + Const.FILE_SEPARATOR + short_filename; - destinationfile = KettleVFS.getFileObject( destinationfilenamefull, this ); + destinationfile = KettleVFS.getInstance( parentJobMeta.getBowl() ).getFileObject( destinationfilenamefull, this ); if ( !simulate ) { sourcefilename.moveTo( destinationfile ); @@ -970,7 +972,7 @@ private boolean MoveOneFile( FileObject Currentfile, FileObject sourcefilefolder // Built destination filename file_name = - KettleVFS.getFileObject( realDestinationFilefoldername + KettleVFS.getInstance( parentJobMeta.getBowl() ).getFileObject( realDestinationFilefoldername + Const.FILE_SEPARATOR + short_filename_from_basefolder, this ); if ( !Currentfile.getParent().toString().equals( sourcefilefolder.toString() ) ) { @@ -1053,8 +1055,8 @@ private void updateSuccess() { private void addFileToResultFilenames( String fileaddentry, Result result, Job parentJob ) { try { ResultFile resultFile = - new ResultFile( ResultFile.FILE_TYPE_GENERAL, KettleVFS.getFileObject( fileaddentry, this ), parentJob - .getJobname(), toString() ); + new ResultFile( ResultFile.FILE_TYPE_GENERAL, KettleVFS.getInstance( parentJobMeta.getBowl() ) + .getFileObject( fileaddentry, this ), parentJob.getJobname(), toString() ); result.getResultFiles().put( resultFile.getFile().toString(), resultFile ); if ( log.isDebug() ) { @@ -1433,7 +1435,8 @@ public String getSuccessCondition() { public void check( List remarks, JobMeta jobMeta, VariableSpace space, Repository repository, IMetaStore metaStore ) { - boolean res = JobEntryValidatorUtils.andValidator().validate( this, "arguments", remarks, AndValidator.putValidators( JobEntryValidatorUtils.notNullValidator() ) ); + boolean res = JobEntryValidatorUtils.andValidator().validate( parentJobMeta.getBowl(), this, "arguments", remarks, + AndValidator.putValidators( JobEntryValidatorUtils.notNullValidator() ) ); if ( res == false ) { return; @@ -1444,7 +1447,8 @@ public void check( List remarks, JobMeta jobMeta, Variable AndValidator.putValidators( ctx, JobEntryValidatorUtils.notNullValidator(), JobEntryValidatorUtils.fileExistsValidator() ); for ( int i = 0; i < source_filefolder.length; i++ ) { - JobEntryValidatorUtils.andValidator().validate( this, "arguments[" + i + "]", remarks, ctx ); + JobEntryValidatorUtils.andValidator().validate( parentJobMeta.getBowl(), this, "arguments[" + i + "]", remarks, + ctx ); } } diff --git a/engine/src/main/java/org/pentaho/di/job/entries/mssqlbulkload/JobEntryMssqlBulkLoad.java b/engine/src/main/java/org/pentaho/di/job/entries/mssqlbulkload/JobEntryMssqlBulkLoad.java index b6ec73da6cf0..74f7d760837f 100644 --- a/engine/src/main/java/org/pentaho/di/job/entries/mssqlbulkload/JobEntryMssqlBulkLoad.java +++ b/engine/src/main/java/org/pentaho/di/job/entries/mssqlbulkload/JobEntryMssqlBulkLoad.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -378,7 +378,7 @@ public Result execute( Result previousResult, int nr ) { // As such, we're going to verify that it's a local file... // We're also going to convert VFS FileObject to File // - fileObject = KettleVFS.getFileObject( vfsFilename, this ); + fileObject = KettleVFS.getInstance( parentJobMeta.getBowl() ).getFileObject( vfsFilename, this ); if ( !( fileObject instanceof LocalFile ) ) { // MSSQL BUKL INSERT can only use local files, so that's what we limit ourselves to. // @@ -567,8 +567,8 @@ public Result execute( Result previousResult, int nr ) { // Add filename to output files ResultFile resultFile = new ResultFile( - ResultFile.FILE_TYPE_GENERAL, KettleVFS.getFileObject( realFilename, this ), parentJob - .getJobname(), toString() ); + ResultFile.FILE_TYPE_GENERAL, KettleVFS.getInstance( parentJobMeta.getBowl() ) + .getFileObject( realFilename, this ), parentJob.getJobname(), toString() ); result.getResultFiles().put( resultFile.getFile().toString(), resultFile ); } @@ -830,9 +830,10 @@ public void check( List remarks, JobMeta jobMeta, Variable AbstractFileValidator.putVariableSpace( ctx, getVariables() ); AndValidator.putValidators( ctx, JobEntryValidatorUtils.notBlankValidator(), JobEntryValidatorUtils.fileExistsValidator() ); - JobEntryValidatorUtils.andValidator().validate( this, "filename", remarks, ctx ); + JobEntryValidatorUtils.andValidator().validate( parentJobMeta.getBowl(), this, "filename", remarks, ctx ); - JobEntryValidatorUtils.andValidator().validate( this, "tablename", remarks, AndValidator.putValidators( JobEntryValidatorUtils.notBlankValidator() ) ); + JobEntryValidatorUtils.andValidator().validate( parentJobMeta.getBowl(), this, "tablename", remarks, + AndValidator.putValidators( JobEntryValidatorUtils.notBlankValidator() ) ); } } diff --git a/engine/src/main/java/org/pentaho/di/job/entries/mysqlbulkfile/JobEntryMysqlBulkFile.java b/engine/src/main/java/org/pentaho/di/job/entries/mysqlbulkfile/JobEntryMysqlBulkFile.java index a8e670479686..2e81cd575c8c 100644 --- a/engine/src/main/java/org/pentaho/di/job/entries/mysqlbulkfile/JobEntryMysqlBulkFile.java +++ b/engine/src/main/java/org/pentaho/di/job/entries/mysqlbulkfile/JobEntryMysqlBulkFile.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -393,8 +393,8 @@ public Result execute( Result previousResult, int nr ) { // Add filename to output files ResultFile resultFile = new ResultFile( - ResultFile.FILE_TYPE_GENERAL, KettleVFS.getFileObject( realFilename, this ), parentJob - .getJobname(), toString() ); + ResultFile.FILE_TYPE_GENERAL, KettleVFS.getInstance( parentJobMeta.getBowl() ) + .getFileObject( realFilename, this ), parentJob.getJobname(), toString() ); result.getResultFiles().put( resultFile.getFile().toString(), resultFile ); } @@ -578,9 +578,9 @@ public List getResourceDependencies( JobMeta jobMeta ) { @Override public void check( List remarks, JobMeta jobMeta, VariableSpace space, Repository repository, IMetaStore metaStore ) { - JobEntryValidatorUtils.andValidator().validate( this, "filename", remarks, + JobEntryValidatorUtils.andValidator().validate( jobMeta.getBowl(), this, "filename", remarks, AndValidator.putValidators( JobEntryValidatorUtils.notBlankValidator() ) ); - JobEntryValidatorUtils.andValidator().validate( this, "tablename", remarks, + JobEntryValidatorUtils.andValidator().validate( jobMeta.getBowl(), this, "tablename", remarks, AndValidator.putValidators( JobEntryValidatorUtils.notBlankValidator() ) ); } diff --git a/engine/src/main/java/org/pentaho/di/job/entries/mysqlbulkload/JobEntryMysqlBulkLoad.java b/engine/src/main/java/org/pentaho/di/job/entries/mysqlbulkload/JobEntryMysqlBulkLoad.java index 8c2571bf71ab..fe7f0e37eaf8 100644 --- a/engine/src/main/java/org/pentaho/di/job/entries/mysqlbulkload/JobEntryMysqlBulkLoad.java +++ b/engine/src/main/java/org/pentaho/di/job/entries/mysqlbulkload/JobEntryMysqlBulkLoad.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -273,7 +273,7 @@ public Result execute( Result previousResult, int nr ) { // As such, we're going to verify that it's a local file... // We're also going to convert VFS FileObject to File // - FileObject fileObject = KettleVFS.getFileObject( vfsFilename, this ); + FileObject fileObject = KettleVFS.getInstance( parentJobMeta.getBowl() ).getFileObject( vfsFilename, this ); if ( !( fileObject instanceof LocalFile ) ) { // MySQL LOAD DATA can only use local files, so that's what we limit ourselves to. // @@ -406,7 +406,8 @@ public Result execute( Result previousResult, int nr ) { // Add zip filename to output files ResultFile resultFile = new ResultFile( - ResultFile.FILE_TYPE_GENERAL, KettleVFS.getFileObject( realFilename, this ), parentJob + ResultFile.FILE_TYPE_GENERAL, KettleVFS.getInstance( parentJobMeta.getBowl() ) + .getFileObject( realFilename, this ), parentJob .getJobname(), toString() ); result.getResultFiles().put( resultFile.getFile().toString(), resultFile ); } @@ -620,9 +621,9 @@ public void check( List remarks, JobMeta jobMeta, Variable ValidatorContext ctx = new ValidatorContext(); AbstractFileValidator.putVariableSpace( ctx, getVariables() ); AndValidator.putValidators( ctx, JobEntryValidatorUtils.notBlankValidator(), JobEntryValidatorUtils.fileExistsValidator() ); - JobEntryValidatorUtils.andValidator().validate( this, "filename", remarks, ctx ); + JobEntryValidatorUtils.andValidator().validate( jobMeta.getBowl(), this, "filename", remarks, ctx ); - JobEntryValidatorUtils.andValidator().validate( this, "tablename", remarks, + JobEntryValidatorUtils.andValidator().validate( jobMeta.getBowl(), this, "tablename", remarks, AndValidator.putValidators( JobEntryValidatorUtils.notBlankValidator() ) ); } diff --git a/engine/src/main/java/org/pentaho/di/job/entries/pgpdecryptfiles/JobEntryPGPDecryptFiles.java b/engine/src/main/java/org/pentaho/di/job/entries/pgpdecryptfiles/JobEntryPGPDecryptFiles.java index 36f182b1ede8..ff59eed7b2e1 100644 --- a/engine/src/main/java/org/pentaho/di/job/entries/pgpdecryptfiles/JobEntryPGPDecryptFiles.java +++ b/engine/src/main/java/org/pentaho/di/job/entries/pgpdecryptfiles/JobEntryPGPDecryptFiles.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -50,6 +50,7 @@ import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.core.exception.KettleXMLException; import org.pentaho.di.core.variables.VariableSpace; +import org.pentaho.di.core.vfs.IKettleVFS; import org.pentaho.di.core.vfs.KettleVFS; import org.pentaho.di.core.xml.XMLHandler; import org.pentaho.di.i18n.BaseMessages; @@ -401,7 +402,7 @@ public Result execute( Result previousResult, int nr ) throws KettleException { } FileObject folder = null; try { - folder = KettleVFS.getFileObject( MoveToFolder ); + folder = KettleVFS.getInstance( parentJobMeta.getBowl() ).getFileObject( MoveToFolder ); if ( !folder.exists() ) { if ( isDetailed() ) { logDetailed( BaseMessages @@ -432,7 +433,7 @@ public Result execute( Result previousResult, int nr ) throws KettleException { } } - gpg = new GPG( environmentSubstitute( gpglocation ), log ); + gpg = new GPG( parentJobMeta.getBowl(), environmentSubstitute( gpglocation ), log ); if ( arg_from_previous ) { if ( isDetailed() ) { @@ -580,11 +581,12 @@ private boolean ProcessFileFolder( String sourcefilefoldername, String passPhras String realWildcard = environmentSubstitute( wildcard ); try { + IKettleVFS vfs = KettleVFS.getInstance( parentJobMeta.getBowl() ); - sourcefilefolder = KettleVFS.getFileObject( realSourceFilefoldername ); - destinationfilefolder = KettleVFS.getFileObject( realDestinationFilefoldername ); + sourcefilefolder = vfs.getFileObject( realSourceFilefoldername ); + destinationfilefolder = vfs.getFileObject( realDestinationFilefoldername ); if ( !Utils.isEmpty( MoveToFolder ) ) { - movetofolderfolder = KettleVFS.getFileObject( MoveToFolder ); + movetofolderfolder = vfs.getFileObject( MoveToFolder ); } if ( sourcefilefolder.exists() ) { @@ -624,7 +626,7 @@ private boolean ProcessFileFolder( String sourcefilefoldername, String passPhras String destinationfilenamefull = destinationfilefolder.toString() + Const.FILE_SEPARATOR + shortfilename; - FileObject destinationfile = KettleVFS.getFileObject( destinationfilenamefull ); + FileObject destinationfile = vfs.getFileObject( destinationfilenamefull ); entrystatus = DecryptFile( @@ -634,7 +636,7 @@ private boolean ProcessFileFolder( String sourcefilefoldername, String passPhras } else if ( sourcefilefolder.getType().equals( FileType.FILE ) && destination_is_a_file ) { // Source is a file, destination is a file - FileObject destinationfile = KettleVFS.getFileObject( realDestinationFilefoldername ); + FileObject destinationfile = vfs.getFileObject( realDestinationFilefoldername ); // return destination short filename String shortfilename = destinationfile.getName().getBaseName(); @@ -649,7 +651,7 @@ private boolean ProcessFileFolder( String sourcefilefoldername, String passPhras String destinationfilenamefull = destinationfilefolder.getParent().toString() + Const.FILE_SEPARATOR + shortfilename; - destinationfile = KettleVFS.getFileObject( destinationfilenamefull ); + destinationfile = vfs.getFileObject( destinationfilenamefull ); entrystatus = DecryptFile( @@ -815,7 +817,7 @@ private boolean DecryptFile( String shortfilename, FileObject sourcefilename, St String movetofilenamefull = destinationfilename.getParent().toString() + Const.FILE_SEPARATOR + short_filename; - destinationfile = KettleVFS.getFileObject( movetofilenamefull ); + destinationfile = KettleVFS.getInstance( parentJobMeta.getBowl() ).getFileObject( movetofilenamefull ); gpg.decryptFile( sourcefilename, passPharse, destinationfile ); @@ -847,7 +849,7 @@ private boolean DecryptFile( String shortfilename, FileObject sourcefilename, St } String movetofilenamefull = movetofolderfolder.toString() + Const.FILE_SEPARATOR + short_filename; - destinationfile = KettleVFS.getFileObject( movetofilenamefull ); + destinationfile = KettleVFS.getInstance( parentJobMeta.getBowl() ).getFileObject( movetofilenamefull ); if ( !destinationfile.exists() ) { sourcefilename.moveTo( destinationfile ); if ( isDetailed() ) { @@ -883,7 +885,8 @@ private boolean DecryptFile( String shortfilename, FileObject sourcefilename, St String destinationfilenamefull = movetofolderfolder.toString() + Const.FILE_SEPARATOR + short_filename; - destinationfile = KettleVFS.getFileObject( destinationfilenamefull ); + destinationfile = KettleVFS.getInstance( parentJobMeta.getBowl() ) + .getFileObject( destinationfilenamefull ); sourcefilename.moveTo( destinationfile ); if ( isDetailed() ) { @@ -958,7 +961,7 @@ private boolean DecryptOneFile( FileObject Currentfile, FileObject sourcefilefol // Built destination filename file_name = - KettleVFS.getFileObject( realDestinationFilefoldername + KettleVFS.getInstance( parentJobMeta.getBowl() ).getFileObject( realDestinationFilefoldername + Const.FILE_SEPARATOR + short_filename_from_basefolder ); if ( !Currentfile.getParent().toString().equals( sourcefilefolder.toString() ) ) { @@ -1031,7 +1034,8 @@ private void updateSuccess() { private void addFileToResultFilenames( String fileaddentry, Result result, Job parentJob ) { try { ResultFile resultFile = - new ResultFile( ResultFile.FILE_TYPE_GENERAL, KettleVFS.getFileObject( fileaddentry ), parentJob + new ResultFile( ResultFile.FILE_TYPE_GENERAL, KettleVFS.getInstance( parentJobMeta.getBowl() ) + .getFileObject( fileaddentry ), parentJob .getJobname(), toString() ); result.getResultFiles().put( resultFile.getFile().toString(), resultFile ); @@ -1370,7 +1374,8 @@ public boolean evaluates() { public void check( List remarks, JobMeta jobMeta, VariableSpace space, Repository repository, IMetaStore metaStore ) { - boolean res = JobEntryValidatorUtils.andValidator().validate( this, "arguments", remarks, AndValidator.putValidators( JobEntryValidatorUtils.notNullValidator() ) ); + boolean res = JobEntryValidatorUtils.andValidator().validate( parentJobMeta.getBowl(), this, "arguments", + remarks, AndValidator.putValidators( JobEntryValidatorUtils.notNullValidator() ) ); if ( res == false ) { return; @@ -1381,7 +1386,8 @@ public void check( List remarks, JobMeta jobMeta, Variable AndValidator.putValidators( ctx, JobEntryValidatorUtils.notNullValidator(), JobEntryValidatorUtils.fileExistsValidator() ); for ( int i = 0; i < source_filefolder.length; i++ ) { - JobEntryValidatorUtils.andValidator().validate( this, "arguments[" + i + "]", remarks, ctx ); + JobEntryValidatorUtils.andValidator().validate( parentJobMeta.getBowl(), this, "arguments[" + i + "]", + remarks, ctx ); } } diff --git a/engine/src/main/java/org/pentaho/di/job/entries/pgpencryptfiles/GPG.java b/engine/src/main/java/org/pentaho/di/job/entries/pgpencryptfiles/GPG.java index 61c1866e714e..b6148a69aed6 100644 --- a/engine/src/main/java/org/pentaho/di/job/entries/pgpencryptfiles/GPG.java +++ b/engine/src/main/java/org/pentaho/di/job/entries/pgpencryptfiles/GPG.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -32,6 +32,7 @@ import org.apache.commons.vfs2.FileObject; import org.apache.commons.vfs2.FileType; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.Const; import org.pentaho.di.core.util.Utils; import org.pentaho.di.core.exception.KettleException; @@ -113,7 +114,7 @@ String getString() { * LogChannelInterface * @throws KettleException */ - public GPG( String gpgFilename, LogChannelInterface logInterface ) throws KettleException { + public GPG( Bowl bowl, String gpgFilename, LogChannelInterface logInterface ) throws KettleException { this.log = logInterface; this.gpgexe = gpgFilename; // Let's check GPG filename @@ -124,7 +125,7 @@ public GPG( String gpgFilename, LogChannelInterface logInterface ) throws Kettle // We have a filename, we need to check FileObject file = null; try { - file = KettleVFS.getFileObject( getGpgExeFile() ); + file = KettleVFS.getInstance( bowl ).getFileObject( getGpgExeFile() ); if ( !file.exists() ) { throw new KettleException( BaseMessages.getString( PKG, "GPG.GPGFilenameNotFound" ) ); diff --git a/engine/src/main/java/org/pentaho/di/job/entries/pgpencryptfiles/JobEntryPGPEncryptFiles.java b/engine/src/main/java/org/pentaho/di/job/entries/pgpencryptfiles/JobEntryPGPEncryptFiles.java index d541e5a67c7c..391c5997c8e5 100644 --- a/engine/src/main/java/org/pentaho/di/job/entries/pgpencryptfiles/JobEntryPGPEncryptFiles.java +++ b/engine/src/main/java/org/pentaho/di/job/entries/pgpencryptfiles/JobEntryPGPEncryptFiles.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -49,6 +49,7 @@ import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.core.exception.KettleXMLException; import org.pentaho.di.core.variables.VariableSpace; +import org.pentaho.di.core.vfs.IKettleVFS; import org.pentaho.di.core.vfs.KettleVFS; import org.pentaho.di.core.xml.XMLHandler; import org.pentaho.di.i18n.BaseMessages; @@ -440,7 +441,7 @@ public Result execute( Result previousResult, int nr ) { } FileObject folder = null; try { - folder = KettleVFS.getFileObject( MoveToFolder ); + folder = KettleVFS.getInstance( parentJobMeta.getBowl() ).getFileObject( MoveToFolder ); if ( !folder.exists() ) { if ( isDetailed() ) { logDetailed( BaseMessages @@ -471,7 +472,7 @@ public Result execute( Result previousResult, int nr ) { } } - gpg = new GPG( environmentSubstitute( gpglocation ), log ); + gpg = new GPG( parentJobMeta.getBowl(), environmentSubstitute( gpglocation ), log ); if ( arg_from_previous ) { if ( isDetailed() ) { @@ -644,11 +645,12 @@ private boolean ProcessFileFolder( int actionType, String sourcefilefoldername, String realWildcard = environmentSubstitute( wildcard ); try { + IKettleVFS vfs = KettleVFS.getInstance( parentJobMeta.getBowl() ); - sourcefilefolder = KettleVFS.getFileObject( realSourceFilefoldername ); - destinationfilefolder = KettleVFS.getFileObject( realDestinationFilefoldername ); + sourcefilefolder = vfs.getFileObject( realSourceFilefoldername ); + destinationfilefolder = vfs.getFileObject( realDestinationFilefoldername ); if ( !Utils.isEmpty( MoveToFolder ) ) { - movetofolderfolder = KettleVFS.getFileObject( MoveToFolder ); + movetofolderfolder = vfs.getFileObject( MoveToFolder ); } if ( sourcefilefolder.exists() ) { @@ -688,7 +690,7 @@ private boolean ProcessFileFolder( int actionType, String sourcefilefoldername, String destinationfilenamefull = destinationfilefolder.toString() + Const.FILE_SEPARATOR + shortfilename; - FileObject destinationfile = KettleVFS.getFileObject( destinationfilenamefull ); + FileObject destinationfile = vfs.getFileObject( destinationfilenamefull ); entrystatus = EncryptFile( @@ -699,7 +701,7 @@ private boolean ProcessFileFolder( int actionType, String sourcefilefoldername, // Source is a file, destination is a file - FileObject destinationfile = KettleVFS.getFileObject( realDestinationFilefoldername ); + FileObject destinationfile = vfs.getFileObject( realDestinationFilefoldername ); // return destination short filename String shortfilename = destinationfile.getName().getBaseName(); @@ -714,7 +716,7 @@ private boolean ProcessFileFolder( int actionType, String sourcefilefoldername, String destinationfilenamefull = destinationfilefolder.getParent().toString() + Const.FILE_SEPARATOR + shortfilename; - destinationfile = KettleVFS.getFileObject( destinationfilenamefull ); + destinationfile = vfs.getFileObject( destinationfilenamefull ); entrystatus = EncryptFile( @@ -879,7 +881,7 @@ private boolean EncryptFile( int actionType, String shortfilename, FileObject so String movetofilenamefull = destinationfilename.getParent().toString() + Const.FILE_SEPARATOR + short_filename; - destinationfile = KettleVFS.getFileObject( movetofilenamefull ); + destinationfile = KettleVFS.getInstance( parentJobMeta.getBowl() ).getFileObject( movetofilenamefull ); doJob( actionType, sourcefilename, userID, destinationfilename ); if ( isDetailed() ) { @@ -911,7 +913,7 @@ private boolean EncryptFile( int actionType, String shortfilename, FileObject so } String movetofilenamefull = movetofolderfolder.toString() + Const.FILE_SEPARATOR + short_filename; - destinationfile = KettleVFS.getFileObject( movetofilenamefull ); + destinationfile = KettleVFS.getInstance( parentJobMeta.getBowl() ).getFileObject( movetofilenamefull ); if ( !destinationfile.exists() ) { sourcefilename.moveTo( destinationfile ); if ( isDetailed() ) { @@ -947,7 +949,8 @@ private boolean EncryptFile( int actionType, String shortfilename, FileObject so String destinationfilenamefull = movetofolderfolder.toString() + Const.FILE_SEPARATOR + short_filename; - destinationfile = KettleVFS.getFileObject( destinationfilenamefull ); + destinationfile = KettleVFS.getInstance( parentJobMeta.getBowl() ) + .getFileObject( destinationfilenamefull ); sourcefilename.moveTo( destinationfile ); if ( isDetailed() ) { @@ -1022,7 +1025,7 @@ private boolean EncryptOneFile( int actionType, FileObject Currentfile, FileObje // Built destination filename file_name = - KettleVFS.getFileObject( realDestinationFilefoldername + KettleVFS.getInstance( parentJobMeta.getBowl() ).getFileObject( realDestinationFilefoldername + Const.FILE_SEPARATOR + short_filename_from_basefolder ); if ( !Currentfile.getParent().toString().equals( sourcefilefolder.toString() ) ) { @@ -1098,8 +1101,8 @@ private void updateSuccess() { private void addFileToResultFilenames( String fileaddentry, Result result, Job parentJob ) { try { ResultFile resultFile = - new ResultFile( ResultFile.FILE_TYPE_GENERAL, KettleVFS.getFileObject( fileaddentry ), parentJob - .getJobname(), toString() ); + new ResultFile( ResultFile.FILE_TYPE_GENERAL, KettleVFS.getInstance( parentJobMeta.getBowl() ) + .getFileObject( fileaddentry ), parentJob.getJobname(), toString() ); result.getResultFiles().put( resultFile.getFile().toString(), resultFile ); if ( isDebug() ) { @@ -1460,7 +1463,7 @@ public boolean evaluates() { public void check( List remarks, JobMeta jobMeta, VariableSpace space, Repository repository, IMetaStore metaStore ) { - boolean res = JobEntryValidatorUtils.andValidator().validate( this, "arguments", remarks, + boolean res = JobEntryValidatorUtils.andValidator().validate( jobMeta.getBowl(), this, "arguments", remarks, AndValidator.putValidators( JobEntryValidatorUtils.notNullValidator() ) ); if ( res == false ) { @@ -1473,7 +1476,7 @@ public void check( List remarks, JobMeta jobMeta, Variable JobEntryValidatorUtils.fileExistsValidator() ); for ( int i = 0; i < source_filefolder.length; i++ ) { - JobEntryValidatorUtils.andValidator().validate( this, "arguments[" + i + "]", remarks, ctx ); + JobEntryValidatorUtils.andValidator().validate( jobMeta.getBowl(), this, "arguments[" + i + "]", remarks, ctx ); } } diff --git a/engine/src/main/java/org/pentaho/di/job/entries/pgpverify/JobEntryPGPVerify.java b/engine/src/main/java/org/pentaho/di/job/entries/pgpverify/JobEntryPGPVerify.java index 5f3568a8d796..c7484f49bf3b 100644 --- a/engine/src/main/java/org/pentaho/di/job/entries/pgpverify/JobEntryPGPVerify.java +++ b/engine/src/main/java/org/pentaho/di/job/entries/pgpverify/JobEntryPGPVerify.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -30,6 +30,7 @@ import org.apache.commons.vfs2.FileObject; import org.pentaho.di.cluster.SlaveServer; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.util.Utils; import org.pentaho.di.core.Result; @@ -185,9 +186,9 @@ public Result execute( Result previousResult, int nr ) { logError( BaseMessages.getString( PKG, "JobPGPVerify.FilenameMissing" ) ); return result; } - file = KettleVFS.getFileObject( realFilename ); + file = KettleVFS.getInstance( parentJobMeta.getBowl() ).getFileObject( realFilename ); - GPG gpg = new GPG( environmentSubstitute( getGPGLocation() ), log ); + GPG gpg = new GPG( parentJobMeta.getBowl(), environmentSubstitute( getGPGLocation() ), log ); if ( useDetachedfilename() ) { String signature = environmentSubstitute( getDetachedfilename() ); @@ -196,7 +197,7 @@ public Result execute( Result previousResult, int nr ) { logError( BaseMessages.getString( PKG, "JobPGPVerify.DetachedSignatureMissing" ) ); return result; } - detachedSignature = KettleVFS.getFileObject( signature ); + detachedSignature = KettleVFS.getInstance( parentJobMeta.getBowl() ).getFileObject( signature ); gpg.verifyDetachedSignature( detachedSignature, file ); } else { @@ -241,7 +242,7 @@ public List getResourceDependencies( JobMeta jobMeta ) { @Override public void check( List remarks, JobMeta jobMeta, VariableSpace space, Repository repository, IMetaStore metaStore ) { - JobEntryValidatorUtils.andValidator().validate( this, "gpglocation", remarks, + JobEntryValidatorUtils.andValidator().validate( jobMeta.getBowl(), this, "gpglocation", remarks, AndValidator.putValidators( JobEntryValidatorUtils.notBlankValidator() ) ); } @@ -265,7 +266,8 @@ public void check( List remarks, JobMeta jobMeta, Variable * @throws KettleException * in case something goes wrong during the export */ - public String exportResources( VariableSpace space, Map definitions, + @Override + public String exportResources( Bowl bowl, VariableSpace space, Map definitions, ResourceNamingInterface namingInterface, Repository repository, IMetaStore metaStore ) throws KettleException { try { // The object that we're modifying here is a copy of the original! @@ -276,7 +278,8 @@ public String exportResources( VariableSpace space, Map getResourceDependencies( JobMeta jobMeta ) { @Override public void check( List remarks, JobMeta jobMeta, VariableSpace space, Repository repository, IMetaStore metaStore ) { - JobEntryValidatorUtils.andValidator().validate( this, "hostname", remarks, + JobEntryValidatorUtils.andValidator().validate( jobMeta.getBowl(), this, "hostname", remarks, AndValidator.putValidators( JobEntryValidatorUtils.notBlankValidator() ) ); } diff --git a/engine/src/main/java/org/pentaho/di/job/entries/sendnagiospassivecheck/JobEntrySendNagiosPassiveCheck.java b/engine/src/main/java/org/pentaho/di/job/entries/sendnagiospassivecheck/JobEntrySendNagiosPassiveCheck.java index 40c5f089a712..ec13fea41467 100644 --- a/engine/src/main/java/org/pentaho/di/job/entries/sendnagiospassivecheck/JobEntrySendNagiosPassiveCheck.java +++ b/engine/src/main/java/org/pentaho/di/job/entries/sendnagiospassivecheck/JobEntrySendNagiosPassiveCheck.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -566,7 +566,7 @@ public List getResourceDependencies( JobMeta jobMeta ) { @Override public void check( List remarks, JobMeta jobMeta, VariableSpace space, Repository repository, IMetaStore metaStore ) { - JobEntryValidatorUtils.andValidator().validate( this, "serverName", remarks, + JobEntryValidatorUtils.andValidator().validate( parentJobMeta.getBowl(), this, "serverName", remarks, AndValidator.putValidators( JobEntryValidatorUtils.notBlankValidator() ) ); } diff --git a/engine/src/main/java/org/pentaho/di/job/entries/setvariables/JobEntrySetVariables.java b/engine/src/main/java/org/pentaho/di/job/entries/setvariables/JobEntrySetVariables.java index a95aac0ed4df..30edc4ccb5f8 100644 --- a/engine/src/main/java/org/pentaho/di/job/entries/setvariables/JobEntrySetVariables.java +++ b/engine/src/main/java/org/pentaho/di/job/entries/setvariables/JobEntrySetVariables.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2022 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -235,7 +235,7 @@ public Result execute( Result result, int nr ) throws KettleException { String realFilename = environmentSubstitute( filename ); if ( !Utils.isEmpty( realFilename ) ) { - try ( InputStream is = KettleVFS.getInputStream( realFilename ); + try ( InputStream is = KettleVFS.getInstance( parentJobMeta.getBowl() ).getInputStream( realFilename ); // for UTF8 properties files InputStreamReader isr = new InputStreamReader( is, "UTF-8" ); BufferedReader reader = new BufferedReader( isr ); @@ -457,7 +457,7 @@ public static final String[] getVariableTypeDescriptions() { public void check( List remarks, JobMeta jobMeta, VariableSpace space, Repository repository, IMetaStore metaStore ) { - boolean res = JobEntryValidatorUtils.andValidator().validate( this, "variableName", remarks, + boolean res = JobEntryValidatorUtils.andValidator().validate( jobMeta.getBowl(), this, "variableName", remarks, AndValidator.putValidators( JobEntryValidatorUtils.notNullValidator() ) ); if ( res == false ) { @@ -469,7 +469,7 @@ public void check( List remarks, JobMeta jobMeta, Variable AndValidator.putValidators( ctx, JobEntryValidatorUtils.notNullValidator(), JobEntryValidatorUtils.fileExistsValidator() ); for ( int i = 0; i < variableName.length; i++ ) { - JobEntryValidatorUtils.andValidator().validate( this, "variableName[" + i + "]", remarks, ctx ); + JobEntryValidatorUtils.andValidator().validate( jobMeta.getBowl(), this, "variableName[" + i + "]", remarks, ctx ); } } diff --git a/engine/src/main/java/org/pentaho/di/job/entries/sftp/SFTPClient.java b/engine/src/main/java/org/pentaho/di/job/entries/sftp/SFTPClient.java index e86c878de106..399d5df467d5 100644 --- a/engine/src/main/java/org/pentaho/di/job/entries/sftp/SFTPClient.java +++ b/engine/src/main/java/org/pentaho/di/job/entries/sftp/SFTPClient.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2023 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -34,6 +34,7 @@ import org.apache.commons.vfs2.FileObject; import org.apache.commons.vfs2.FileType; import org.apache.commons.vfs2.util.FileObjectUtils; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.Const; import org.pentaho.di.core.util.Utils; import org.pentaho.di.core.exception.KettleFileException; @@ -78,6 +79,7 @@ public class SFTPClient { private String prvkey = null; // Private key private String passphrase = null; // Empty passphrase for now private String compression = null; + private Bowl bowl; private Session session; private ChannelSftp channel; @@ -85,6 +87,8 @@ public class SFTPClient { /** * Init Helper Class with connection settings * + * @param bowl + * Bowl providing context for File operations * @param serverIP * IP address of remote server * @param serverPort @@ -93,13 +97,15 @@ public class SFTPClient { * username of remote server * @throws KettleJobException */ - public SFTPClient( InetAddress serverIP, int serverPort, String userName ) throws KettleJobException { - this( serverIP, serverPort, userName, null, null ); + public SFTPClient( Bowl bowl, InetAddress serverIP, int serverPort, String userName ) throws KettleJobException { + this( bowl, serverIP, serverPort, userName, null, null ); } /** * Init Helper Class with connection settings * + * @param bowl + * Bowl providing context for File operations * @param serverIP * IP address of remote server * @param serverPort @@ -110,13 +116,16 @@ public SFTPClient( InetAddress serverIP, int serverPort, String userName ) throw * filename of private key * @throws KettleJobException */ - public SFTPClient( InetAddress serverIP, int serverPort, String userName, String privateKeyFilename ) throws KettleJobException { - this( serverIP, serverPort, userName, privateKeyFilename, null ); + public SFTPClient( Bowl bowl, InetAddress serverIP, int serverPort, String userName, String privateKeyFilename ) + throws KettleJobException { + this( bowl, serverIP, serverPort, userName, privateKeyFilename, null ); } /** * Init Helper Class with connection settings * + * @param bowl + * Bowl providing context for File operations * @param serverIP * IP address of remote server * @param serverPort @@ -129,7 +138,7 @@ public SFTPClient( InetAddress serverIP, int serverPort, String userName, String * passphrase * @throws KettleJobException */ - public SFTPClient( InetAddress serverIP, int serverPort, String userName, String privateKeyFilename, + public SFTPClient( Bowl bowl, InetAddress serverIP, int serverPort, String userName, String privateKeyFilename, String passPhrase ) throws KettleJobException { if ( serverIP == null || serverPort <= 0 || userName == null || userName.equals( "" ) ) { @@ -140,6 +149,7 @@ public SFTPClient( InetAddress serverIP, int serverPort, String userName, String this.serverIP = serverIP; this.serverPort = serverPort; this.userName = userName; + this.bowl = bowl; JSch jsch = createJSch(); try { @@ -155,7 +165,7 @@ public SFTPClient( InetAddress serverIP, int serverPort, String userName, String } else { passPhraseBytes = new byte[0]; } - jsch.addIdentity( getUserName(), getFileContent( prvkey ), null, passPhraseBytes ); + jsch.addIdentity( getUserName(), getFileContent( bowl, prvkey ), null, passPhraseBytes ); } session = jsch.getSession( userName, serverIP.getHostAddress(), serverPort ); session.setConfig( PREFERRED_AUTH_CONFIG_NAME, getPreferredAuthentications() ); @@ -168,8 +178,8 @@ public SFTPClient( InetAddress serverIP, int serverPort, String userName, String } } - private static byte[] getFileContent( String vfsFileName ) throws KettleFileException, IOException { - return FileObjectUtils.getContentAsByteArray( KettleVFS.getFileObject( vfsFileName ) ); + private static byte[] getFileContent( Bowl bowl, String vfsFileName ) throws KettleFileException, IOException { + return FileObjectUtils.getContentAsByteArray( KettleVFS.getInstance( bowl ).getFileObject( vfsFileName ) ); } public void login( String password ) throws KettleJobException { @@ -230,10 +240,10 @@ public String[] dir() throws KettleJobException { } } - public void get( FileObject localFile, String remoteFile ) throws KettleJobException { + public void get( Bowl bowl, FileObject localFile, String remoteFile ) throws KettleJobException { OutputStream localStream = null; try { - localStream = KettleVFS.getOutputStream( localFile, false ); + localStream = KettleVFS.getInstance( bowl ).getOutputStream( localFile, false ); channel.get( remoteFile, localStream ); } catch ( SftpException e ) { throw new KettleJobException( e ); diff --git a/engine/src/main/java/org/pentaho/di/job/entries/shell/JobEntryShell.java b/engine/src/main/java/org/pentaho/di/job/entries/shell/JobEntryShell.java index 5b6c2dc839f4..3086fd7c68fd 100644 --- a/engine/src/main/java/org/pentaho/di/job/entries/shell/JobEntryShell.java +++ b/engine/src/main/java/org/pentaho/di/job/entries/shell/JobEntryShell.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2023 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -59,6 +59,7 @@ import org.pentaho.di.core.logging.LogLevel; import org.pentaho.di.core.util.StreamLogger; import org.pentaho.di.core.variables.VariableSpace; +import org.pentaho.di.core.vfs.IKettleVFS; import org.pentaho.di.core.vfs.KettleVFS; import org.pentaho.di.core.xml.XMLHandler; import org.pentaho.di.i18n.BaseMessages; @@ -463,31 +464,33 @@ private void executeShell( Result result, List cmdRows, String[] logBasic( BaseMessages.getString( PKG, "JobShell.RunningOn", Const.getOS() ) ); } + IKettleVFS vfs = KettleVFS.getInstance( parentJobMeta.getBowl() ); + if ( insertScript ) { realScript = environmentSubstitute( script ); } else { String realFilename = environmentSubstitute( getFilename() ); - fileObject = KettleVFS.getFileObject( realFilename, this ); + fileObject = vfs.getFileObject( realFilename, this ); } if ( Const.getOS().equals( "Windows 95" ) ) { base = new String[] { "command.com", "/C" }; if ( insertScript ) { tempFile = - KettleVFS.createTempFile( KETTLE, "shell.bat", System.getProperty( TEMP_DIR ), this ); + vfs.createTempFile( KETTLE, "shell.bat", System.getProperty( TEMP_DIR ), this ); fileObject = createTemporaryShellFile( tempFile, realScript ); } } else if ( Const.getOS().startsWith( "Windows" ) ) { base = new String[] { "cmd.exe", "/C" }; if ( insertScript ) { tempFile = - KettleVFS.createTempFile( KETTLE, "shell.bat", System.getProperty( TEMP_DIR ), this ); + vfs.createTempFile( KETTLE, "shell.bat", System.getProperty( TEMP_DIR ), this ); fileObject = createTemporaryShellFile( tempFile, realScript ); } } else { if ( insertScript ) { realScript = environmentSubstitute( script ); - tempFile = KettleVFS.createTempFile( KETTLE, "shell", System.getProperty( TEMP_DIR ), this ); + tempFile = vfs.createTempFile( KETTLE, "shell", System.getProperty( TEMP_DIR ), this ); } else { String realFilename = environmentSubstitute( getFilename() ); URI uri = new URI( realFilename ); @@ -497,7 +500,7 @@ private void executeShell( Result result, List cmdRows, String[] } // PDI-19676 - creating a temp file in same file location to avoid script failure. String parentDir = Paths.get(realFilename).getParent().toString(); - tempFile = KettleVFS.createTempFile( KETTLE, "shell",parentDir , this ); + tempFile = vfs.createTempFile( KETTLE, "shell",parentDir , this ); } fileObject = createTemporaryShellFile( tempFile, realScript ); base = new String[] { KettleVFS.getFilename( fileObject ) }; @@ -593,7 +596,7 @@ private void executeShell( Result result, List cmdRows, String[] if ( getWorkDirectory() != null && !Utils.isEmpty( Const.rtrim( getWorkDirectory() ) ) ) { String vfsFilename = environmentSubstitute( getWorkDirectory() ); - File file = new File( KettleVFS.getFilename( KettleVFS.getFileObject( vfsFilename, this ) ) ); + File file = new File( KettleVFS.getFilename( vfs.getFileObject( vfsFilename, this ) ) ); procBuilder.directory( file ); } Process proc = procBuilder.start(); @@ -770,12 +773,12 @@ public void check( List remarks, JobMeta jobMeta, Variable AndValidator.putValidators( ctx, JobEntryValidatorUtils.notBlankValidator(), JobEntryValidatorUtils.fileExistsValidator() ); - JobEntryValidatorUtils.andValidator().validate( this, "workDirectory", remarks, ctx ); - JobEntryValidatorUtils.andValidator().validate( this, "filename", remarks, + JobEntryValidatorUtils.andValidator().validate( parentJobMeta.getBowl(), this, "workDirectory", remarks, ctx ); + JobEntryValidatorUtils.andValidator().validate( parentJobMeta.getBowl(), this, "filename", remarks, AndValidator.putValidators( JobEntryValidatorUtils.notBlankValidator() ) ); if ( setLogfile ) { - JobEntryValidatorUtils.andValidator().validate( this, "logfile", remarks, + JobEntryValidatorUtils.andValidator().validate( parentJobMeta.getBowl(), this, "logfile", remarks, AndValidator.putValidators( JobEntryValidatorUtils.notBlankValidator() ) ); } } diff --git a/engine/src/main/java/org/pentaho/di/job/entries/sql/JobEntrySQL.java b/engine/src/main/java/org/pentaho/di/job/entries/sql/JobEntrySQL.java index f313933e4dea..ee1ea2debe57 100644 --- a/engine/src/main/java/org/pentaho/di/job/entries/sql/JobEntrySQL.java +++ b/engine/src/main/java/org/pentaho/di/job/entries/sql/JobEntrySQL.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2019 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -282,7 +282,7 @@ public String buildSqlFromFile() throws KettleDatabaseException { } String realFilename = environmentSubstitute( sqlFilename ); - try ( FileObject sqlFile = KettleVFS.getFileObject( realFilename, this ) ) { + try ( FileObject sqlFile = KettleVFS.getInstance( parentJobMeta.getBowl() ).getFileObject( realFilename, this ) ) { if ( !sqlFile.exists() ) { logError( BaseMessages.getString( PKG, "JobSQL.SQLFileNotExist", realFilename ) ); throw new KettleDatabaseException( BaseMessages.getString( @@ -339,7 +339,7 @@ public List getResourceDependencies( JobMeta jobMeta ) { @Override public void check( List remarks, JobMeta jobMeta, VariableSpace space, Repository repository, IMetaStore metaStore ) { - JobEntryValidatorUtils.andValidator().validate( this, "SQL", remarks, + JobEntryValidatorUtils.andValidator().validate( jobMeta.getBowl(), this, "SQL", remarks, AndValidator.putValidators( JobEntryValidatorUtils.notBlankValidator() ) ); } diff --git a/engine/src/main/java/org/pentaho/di/job/entries/tableexists/JobEntryTableExists.java b/engine/src/main/java/org/pentaho/di/job/entries/tableexists/JobEntryTableExists.java index 83a6a878a919..694d9ef250f2 100644 --- a/engine/src/main/java/org/pentaho/di/job/entries/tableexists/JobEntryTableExists.java +++ b/engine/src/main/java/org/pentaho/di/job/entries/tableexists/JobEntryTableExists.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2018 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -220,7 +220,7 @@ public List getResourceDependencies( JobMeta jobMeta ) { @Override public void check( List remarks, JobMeta jobMeta, VariableSpace space, Repository repository, IMetaStore metaStore ) { - JobEntryValidatorUtils.andValidator().validate( this, "tablename", remarks, + JobEntryValidatorUtils.andValidator().validate( jobMeta.getBowl(), this, "tablename", remarks, AndValidator.putValidators( JobEntryValidatorUtils.notBlankValidator() ) ); } diff --git a/engine/src/main/java/org/pentaho/di/job/entries/talendjobexec/JobEntryTalendJobExec.java b/engine/src/main/java/org/pentaho/di/job/entries/talendjobexec/JobEntryTalendJobExec.java index eb526c59a249..b18acd2863db 100644 --- a/engine/src/main/java/org/pentaho/di/job/entries/talendjobexec/JobEntryTalendJobExec.java +++ b/engine/src/main/java/org/pentaho/di/job/entries/talendjobexec/JobEntryTalendJobExec.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2018 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -36,6 +36,7 @@ import org.apache.commons.vfs2.AllFileSelector; import org.apache.commons.vfs2.FileObject; import org.pentaho.di.cluster.SlaveServer; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.Const; import org.pentaho.di.core.util.Utils; @@ -154,7 +155,7 @@ public Result execute( Result previousResult, int nr ) { if ( filename != null ) { String realFilename = getRealFilename(); try { - FileObject file = KettleVFS.getFileObject( realFilename, this ); + FileObject file = KettleVFS.getInstance( parentJobMeta.getBowl() ).getFileObject( realFilename, this ); if ( file.exists() && file.isReadable() ) { result = executeTalenJob( file, result, nr ); } else { @@ -228,7 +229,8 @@ public void run() { private URL[] prepareJarFiles( FileObject zipFile ) throws Exception { // zip:file:///tmp/foo.zip - FileInputList fileList = FileInputList.createFileList( this, new String[] { "zip:" + zipFile.toString(), }, + FileInputList fileList = FileInputList.createFileList( parentJobMeta.getBowl(), 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 @@ -240,7 +242,7 @@ private URL[] prepareJarFiles( FileObject zipFile ) throws Exception { // for ( FileObject file : fileList.getFiles() ) { FileObject jarfilecopy = - KettleVFS.createTempFile( + KettleVFS.getInstance( parentJobMeta.getBowl() ).createTempFile( file.getName().getBaseName(), ".jar", environmentSubstitute( "${java.io.tmpdir}" ) ); jarfilecopy.copyFrom( file, new AllFileSelector() ); files.add( jarfilecopy.getURL() ); @@ -278,7 +280,7 @@ public List getResourceDependencies( JobMeta jobMeta ) { @Override public void check( List remarks, JobMeta jobMeta, VariableSpace space, Repository repository, IMetaStore metaStore ) { - JobEntryValidatorUtils.andValidator().validate( this, "filename", remarks, + JobEntryValidatorUtils.andValidator().validate( jobMeta.getBowl(), this, "filename", remarks, AndValidator.putValidators( JobEntryValidatorUtils.notBlankValidator() ) ); } @@ -307,7 +309,8 @@ public void check( List remarks, JobMeta jobMeta, Variable * @throws KettleException * in case something goes wrong during the export */ - public String exportResources( VariableSpace space, Map definitions, + @Override + public String exportResources( Bowl bowl, VariableSpace space, Map definitions, ResourceNamingInterface namingInterface, Repository repository, IMetaStore metaStore ) throws KettleException { try { // The object that we're modifying here is a copy of the original! @@ -320,7 +323,8 @@ public String exportResources( VariableSpace space, Map getResourceDependencies( JobMeta jobMeta ) { @Override public void check( List remarks, JobMeta jobMeta, VariableSpace space, Repository repository, IMetaStore metaStore ) { - JobEntryValidatorUtils.andValidator().validate( this, "hostname", remarks, + JobEntryValidatorUtils.andValidator().validate( jobMeta.getBowl(), this, "hostname", remarks, AndValidator.putValidators( JobEntryValidatorUtils.notBlankValidator() ) ); } } diff --git a/engine/src/main/java/org/pentaho/di/job/entries/trans/JobEntryTrans.java b/engine/src/main/java/org/pentaho/di/job/entries/trans/JobEntryTrans.java index 228c24caf5cd..3746769322ed 100644 --- a/engine/src/main/java/org/pentaho/di/job/entries/trans/JobEntryTrans.java +++ b/engine/src/main/java/org/pentaho/di/job/entries/trans/JobEntryTrans.java @@ -26,6 +26,7 @@ import org.pentaho.di.base.IMetaFileLoader; import org.pentaho.di.base.MetaFileLoaderImpl; import org.pentaho.di.cluster.SlaveServer; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.Const; import org.pentaho.di.core.ObjectLocationSpecificationMethod; @@ -667,7 +668,8 @@ public Result execute( Result result, int nr ) throws KettleException { try { logChannelFileWriter = new LogChannelFileWriter( - this.getLogChannelId(), KettleVFS.getFileObject( realLogFilename, this ), setAppendLogfile ); + this.getLogChannelId(), KettleVFS.getInstance( parentJobMeta.getBowl() ) + .getFileObject( realLogFilename, this ), setAppendLogfile ); logChannelFileWriter.startLogging(); } catch ( KettleException e ) { logError( BaseMessages.getString( PKG, "JobTrans.Error.UnableOpenAppender", realLogFilename, e.toString() ) ); @@ -1213,7 +1215,8 @@ public Result execute( Result result, int nr ) throws KettleException { if ( setLogfile ) { ResultFile resultFile = new ResultFile( - ResultFile.FILE_TYPE_LOG, KettleVFS.getFileObject( realLogFilename, this ), parentJob + ResultFile.FILE_TYPE_LOG, KettleVFS.getInstance( parentJobMeta.getBowl() ) + .getFileObject( realLogFilename, this ), parentJob .getJobname(), toString() ); result.getResultFiles().put( resultFile.getFile().toString(), resultFile ); @@ -1301,7 +1304,7 @@ public TransMeta getTransMeta( Repository rep, VariableSpace space ) throws Kett public TransMeta getTransMeta( Repository rep, IMetaStore metaStore, VariableSpace space ) throws KettleException { try { IMetaFileLoader metaFileLoader = new MetaFileLoaderImpl<>( this, specificationMethod ); - TransMeta transMeta = metaFileLoader.getMetaForEntry( rep, metaStore, space ); + TransMeta transMeta = metaFileLoader.getMetaForEntry( parentJobMeta.getBowl(), rep, metaStore, space ); if ( transMeta != null ) { // set Internal.Entry.Current.Directory again because it was changed @@ -1380,16 +1383,16 @@ public void setClustering( boolean clustering ) { public void check( List remarks, JobMeta jobMeta, VariableSpace space, Repository repository, IMetaStore metaStore ) { if ( setLogfile ) { - JobEntryValidatorUtils.andValidator().validate( this, "logfile", remarks, + JobEntryValidatorUtils.andValidator().validate( jobMeta.getBowl(), this, "logfile", remarks, AndValidator.putValidators( JobEntryValidatorUtils.notBlankValidator() ) ); } if ( !Utils.isEmpty( filename ) ) { - JobEntryValidatorUtils.andValidator().validate( this, "filename", remarks, + JobEntryValidatorUtils.andValidator().validate( jobMeta.getBowl(), this, "filename", remarks, AndValidator.putValidators( JobEntryValidatorUtils.notBlankValidator() ) ); } else { - JobEntryValidatorUtils.andValidator().validate( this, "transname", remarks, + JobEntryValidatorUtils.andValidator().validate( jobMeta.getBowl(), this, "transname", remarks, AndValidator.putValidators( JobEntryValidatorUtils.notBlankValidator() ) ); - JobEntryValidatorUtils.andValidator().validate( this, "directory", remarks, + JobEntryValidatorUtils.andValidator().validate( jobMeta.getBowl(), this, "directory", remarks, AndValidator.putValidators( JobEntryValidatorUtils.notNullValidator() ) ); } } @@ -1426,7 +1429,7 @@ public List getResourceDependencies( JobMeta jobMeta ) { * @throws KettleException in case something goes wrong during the export */ @Override - public String exportResources( VariableSpace space, Map definitions, + public String exportResources( Bowl bowl, VariableSpace space, Map definitions, ResourceNamingInterface namingInterface, Repository repository, IMetaStore metaStore ) throws KettleException { // Try to load the transformation from repository or file. // Modify this recursively too... @@ -1441,7 +1444,7 @@ public String exportResources( VariableSpace space, Map remarks, JobMeta jobMeta, VariableSpace space, Repository repository, IMetaStore metaStore ) { - boolean res = JobEntryValidatorUtils.andValidator().validate( this, "arguments", remarks, + boolean res = JobEntryValidatorUtils.andValidator().validate( jobMeta.getBowl(), this, "arguments", remarks, AndValidator.putValidators( JobEntryValidatorUtils.notNullValidator() ) ); if ( res == false ) { @@ -351,7 +351,7 @@ public void check( List remarks, JobMeta jobMeta, Variable JobEntryValidatorUtils.fileExistsValidator() ); for ( int i = 0; i < arguments.length; i++ ) { - JobEntryValidatorUtils.andValidator().validate( this, "arguments[" + i + "]", remarks, ctx ); + JobEntryValidatorUtils.andValidator().validate( jobMeta.getBowl(), this, "arguments[" + i + "]", remarks, ctx ); } } diff --git a/engine/src/main/java/org/pentaho/di/job/entries/unzip/JobEntryUnZip.java b/engine/src/main/java/org/pentaho/di/job/entries/unzip/JobEntryUnZip.java index 73b323e3a435..00e8a481f946 100644 --- a/engine/src/main/java/org/pentaho/di/job/entries/unzip/JobEntryUnZip.java +++ b/engine/src/main/java/org/pentaho/di/job/entries/unzip/JobEntryUnZip.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -372,7 +372,7 @@ public Result execute( Result previousResult, int nr ) { boolean exitjobentry = false; // Target folder - targetdir = KettleVFS.getFileObject( realTargetdirectory, this ); + targetdir = KettleVFS.getInstance( parentJobMeta.getBowl() ).getFileObject( realTargetdirectory, this ); if ( !targetdir.exists() ) { if ( createfolder ) { @@ -403,7 +403,7 @@ public Result execute( Result previousResult, int nr ) { log.logError( BaseMessages.getString( PKG, "JobUnZip.MoveToDirectoryEmpty.Label" ) ); exitjobentry = true; } else { - movetodir = KettleVFS.getFileObject( realMovetodirectory, this ); + movetodir = KettleVFS.getInstance( parentJobMeta.getBowl() ).getFileObject( realMovetodirectory, this ); if ( !( movetodir.exists() ) || !( movetodir.getType() == FileType.FOLDER ) ) { if ( createMoveToDirectory ) { movetodir.createFolder(); @@ -441,7 +441,7 @@ public Result execute( Result previousResult, int nr ) { realFilenameSource = resultRow.getString( 0, null ); realWildcardSource = resultRow.getString( 1, null ); - fileObject = KettleVFS.getFileObject( realFilenameSource, this ); + fileObject = KettleVFS.getInstance( parentJobMeta.getBowl() ).getFileObject( realFilenameSource, this ); if ( fileObject.exists() ) { processOneFile( result, parentJob, fileObject, realTargetdirectory, realWildcard, realWildcardExclude, @@ -453,7 +453,7 @@ public Result execute( Result previousResult, int nr ) { } } } else { - fileObject = KettleVFS.getFileObject( realFilenameSource, this ); + fileObject = KettleVFS.getInstance( parentJobMeta.getBowl() ).getFileObject( realFilenameSource, this ); if ( !fileObject.exists() ) { log.logError( BaseMessages.getString( PKG, "JobUnZip.ZipFile.NotExists.Label", realFilenameSource ) ); return result; @@ -605,7 +605,7 @@ private boolean unzipFile( FileObject sourceFileObject, String realTargetdirecto } String foldername = realTargetdirectory + "/" + shortSourceFilename.substring( 0, lastindexOfDot ); - FileObject rootfolder = KettleVFS.getFileObject( foldername, this ); + FileObject rootfolder = KettleVFS.getInstance( parentJobMeta.getBowl() ).getFileObject( foldername, this ); if ( !rootfolder.exists() ) { try { rootfolder.createFolder(); @@ -623,7 +623,7 @@ private boolean unzipFile( FileObject sourceFileObject, String realTargetdirecto // Try to read the entries from the VFS object... // String zipFilename = "zip:" + sourceFileObject.getName().getFriendlyURI(); - FileObject zipFile = KettleVFS.getFileObject( zipFilename, this ); + FileObject zipFile = KettleVFS.getInstance( parentJobMeta.getBowl() ).getFileObject( zipFilename, this ); FileObject[] items = zipFile.findFiles( new AllFileSelector() { public boolean traverseDescendents( FileSelectInfo info ) { return true; @@ -672,7 +672,7 @@ public boolean includeFile( FileSelectInfo info ) { // get real destination filename // String newFileName = unzipToFolder + Const.FILE_SEPARATOR + getTargetFilename( item ); - newFileObject = KettleVFS.getFileObject( newFileName, this ); + newFileObject = KettleVFS.getInstance( parentJobMeta.getBowl() ).getFileObject( newFileName, this ); if ( item.getType().equals( FileType.FOLDER ) ) { // Directory @@ -741,7 +741,7 @@ public boolean includeFile( FileSelectInfo info ) { try { is = KettleVFS.getInputStream( item ); - os = KettleVFS.getOutputStream( newFileObject, false ); + os = KettleVFS.getInstance( parentJobMeta.getBowl() ).getOutputStream( newFileObject, false ); if ( is != null ) { byte[] buff = new byte[2048]; @@ -832,7 +832,7 @@ private void doUnzipPostProcessing( FileObject sourceFileObject, FileObject move // Move File try { String destinationFilename = movetodir + Const.FILE_SEPARATOR + sourceFileObject.getName().getBaseName(); - destFile = KettleVFS.getFileObject( destinationFilename, this ); + destFile = KettleVFS.getInstance( parentJobMeta.getBowl() ).getFileObject( destinationFilename, this ); sourceFileObject.moveTo( destFile ); @@ -861,7 +861,8 @@ private void addFilenameToResultFilenames( Result result, Job parentJob, String if ( addfiletoresult ) { // Add file to result files name ResultFile resultFile = - new ResultFile( ResultFile.FILE_TYPE_GENERAL, KettleVFS.getFileObject( newfile, this ), parentJob + new ResultFile( ResultFile.FILE_TYPE_GENERAL, KettleVFS.getInstance( parentJobMeta.getBowl() ) + .getFileObject( newfile, this ), parentJob .getJobname(), toString() ); result.getResultFiles().put( resultFile.getFile().toString(), resultFile ); } @@ -1307,15 +1308,15 @@ public void check( List remarks, JobMeta jobMeta, Variable AndValidator.putValidators( ctx1, JobEntryValidatorUtils.notBlankValidator(), JobEntryValidatorUtils.fileDoesNotExistValidator() ); - JobEntryValidatorUtils.andValidator().validate( this, "zipFilename", remarks, ctx1 ); + JobEntryValidatorUtils.andValidator().validate( jobMeta.getBowl(), this, "zipFilename", remarks, ctx1 ); if ( 2 == afterunzip ) { // setting says to move - JobEntryValidatorUtils.andValidator().validate( this, "moveToDirectory", remarks, + JobEntryValidatorUtils.andValidator().validate( jobMeta.getBowl(), this, "moveToDirectory", remarks, AndValidator.putValidators( JobEntryValidatorUtils.notBlankValidator() ) ); } - JobEntryValidatorUtils.andValidator().validate( this, "sourceDirectory", remarks, + JobEntryValidatorUtils.andValidator().validate( jobMeta.getBowl(), this, "sourceDirectory", remarks, AndValidator.putValidators( JobEntryValidatorUtils.notBlankValidator() ) ); } diff --git a/engine/src/main/java/org/pentaho/di/job/entries/waitforfile/JobEntryWaitForFile.java b/engine/src/main/java/org/pentaho/di/job/entries/waitforfile/JobEntryWaitForFile.java index 13effa69ea59..51b914b35d07 100644 --- a/engine/src/main/java/org/pentaho/di/job/entries/waitforfile/JobEntryWaitForFile.java +++ b/engine/src/main/java/org/pentaho/di/job/entries/waitforfile/JobEntryWaitForFile.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -206,7 +206,7 @@ public Result execute( Result previousResult, int nr ) { } try { - fileObject = KettleVFS.getFileObject( realFilename, this ); + fileObject = KettleVFS.getInstance( parentJobMeta.getBowl() ).getFileObject( realFilename, this ); long iMaximumTimeout = Const.toInt( getRealMaximumTimeout(), Const.toInt( DEFAULT_MAXIMUM_TIMEOUT, 0 ) ); long iCycleTime = Const.toInt( getRealCheckCycleTime(), Const.toInt( DEFAULT_CHECK_CYCLE_TIME, 0 ) ); @@ -241,7 +241,7 @@ public Result execute( Result previousResult, int nr ) { boolean continueLoop = true; while ( continueLoop && !parentJob.isStopped() ) { - fileObject = KettleVFS.getFileObject( realFilename, this ); + fileObject = KettleVFS.getInstance( parentJobMeta.getBowl() ).getFileObject( realFilename, this ); if ( fileObject.exists() ) { // file exists, we're happy to exit @@ -427,11 +427,11 @@ public List getResourceDependencies( JobMeta jobMeta ) { @Override public void check( List remarks, JobMeta jobMeta, VariableSpace space, Repository repository, IMetaStore metaStore ) { - JobEntryValidatorUtils.andValidator().validate( this, "filename", remarks, + JobEntryValidatorUtils.andValidator().validate( parentJobMeta.getBowl(), this, "filename", remarks, AndValidator.putValidators( JobEntryValidatorUtils.notBlankValidator() ) ); - JobEntryValidatorUtils.andValidator().validate( this, "maximumTimeout", remarks, + JobEntryValidatorUtils.andValidator().validate( parentJobMeta.getBowl(), this, "maximumTimeout", remarks, AndValidator.putValidators( JobEntryValidatorUtils.integerValidator() ) ); - JobEntryValidatorUtils.andValidator().validate( this, "checkCycleTime", remarks, + JobEntryValidatorUtils.andValidator().validate( parentJobMeta.getBowl(), this, "checkCycleTime", remarks, AndValidator.putValidators( JobEntryValidatorUtils.integerValidator() ) ); } diff --git a/engine/src/main/java/org/pentaho/di/job/entries/waitforsql/JobEntryWaitForSQL.java b/engine/src/main/java/org/pentaho/di/job/entries/waitforsql/JobEntryWaitForSQL.java index 9717a92feaa2..d6928106a4c3 100644 --- a/engine/src/main/java/org/pentaho/di/job/entries/waitforsql/JobEntryWaitForSQL.java +++ b/engine/src/main/java/org/pentaho/di/job/entries/waitforsql/JobEntryWaitForSQL.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -617,7 +617,7 @@ public List getResourceDependencies( JobMeta jobMeta ) { @Override public void check( List remarks, JobMeta jobMeta, VariableSpace space, Repository repository, IMetaStore metaStore ) { - JobEntryValidatorUtils.andValidator().validate( this, "WaitForSQL", remarks, + JobEntryValidatorUtils.andValidator().validate( jobMeta.getBowl(), this, "WaitForSQL", remarks, AndValidator.putValidators( JobEntryValidatorUtils.notBlankValidator() ) ); } diff --git a/engine/src/main/java/org/pentaho/di/job/entries/writetofile/JobEntryWriteToFile.java b/engine/src/main/java/org/pentaho/di/job/entries/writetofile/JobEntryWriteToFile.java index d8488e34ac04..34581131500e 100644 --- a/engine/src/main/java/org/pentaho/di/job/entries/writetofile/JobEntryWriteToFile.java +++ b/engine/src/main/java/org/pentaho/di/job/entries/writetofile/JobEntryWriteToFile.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2022 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -201,7 +201,7 @@ public Result execute( Result previousResult, int nr ) { createParentFolder( realFilename ); // Create / open file for writing - os = KettleVFS.getOutputStream( realFilename, this, isAppendFile() ); + os = KettleVFS.getInstance( parentJobMeta.getBowl() ).getOutputStream( realFilename, this, isAppendFile() ); if ( Utils.isEmpty( encoding ) ) { if ( isDebug() ) { @@ -248,7 +248,7 @@ public Result execute( Result previousResult, int nr ) { private void createParentFolder( String realFilename ) throws KettleException { FileObject parent = null; try { - parent = KettleVFS.getFileObject( realFilename, this ).getParent(); + parent = KettleVFS.getInstance( parentJobMeta.getBowl() ).getFileObject( realFilename, this ).getParent(); if ( !parent.exists() ) { if ( isCreateParentFolder() ) { if ( isDetailed() ) { @@ -312,7 +312,7 @@ public List getResourceDependencies( JobMeta jobMeta ) { @Override public void check( List remarks, JobMeta jobMeta, VariableSpace space, Repository repository, IMetaStore metaStore ) { - JobEntryValidatorUtils.andValidator().validate( this, "filename", remarks, + JobEntryValidatorUtils.andValidator().validate( jobMeta.getBowl(), this, "filename", remarks, AndValidator.putValidators( JobEntryValidatorUtils.notBlankValidator() ) ); } diff --git a/engine/src/main/java/org/pentaho/di/job/entries/zipfile/JobEntryZipFile.java b/engine/src/main/java/org/pentaho/di/job/entries/zipfile/JobEntryZipFile.java index 3c9095158850..6ce8cd0f73f0 100644 --- a/engine/src/main/java/org/pentaho/di/job/entries/zipfile/JobEntryZipFile.java +++ b/engine/src/main/java/org/pentaho/di/job/entries/zipfile/JobEntryZipFile.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2022 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -257,7 +257,7 @@ private boolean createParentFolder( String filename ) { boolean result = false; try { // Get parent folder - parentfolder = KettleVFS.getFileObject( filename, this ).getParent(); + parentfolder = KettleVFS.getInstance( parentJobMeta.getBowl() ).getFileObject( filename, this ).getParent(); if ( !parentfolder.exists() ) { if ( log.isDetailed() ) { @@ -310,7 +310,7 @@ public boolean processRowFile( Job parentJob, Result result, String realZipfilen String localSourceFilename = realSourceDirectoryOrFile; try { - originFile = KettleVFS.getFileObject( realSourceDirectoryOrFile, this ); + originFile = KettleVFS.getInstance( parentJobMeta.getBowl() ).getFileObject( realSourceDirectoryOrFile, this ); localSourceFilename = KettleVFS.getFilename( originFile ); orginExist = originFile.exists(); } catch ( Exception e ) { @@ -330,7 +330,7 @@ public boolean processRowFile( Job parentJob, Result result, String realZipfilen FileObject fileObject = null; try { - fileObject = KettleVFS.getFileObject( localrealZipfilename, this ); + fileObject = KettleVFS.getInstance( parentJobMeta.getBowl() ).getFileObject( localrealZipfilename, this ); localrealZipfilename = KettleVFS.getFilename( fileObject ); // Check if Zip File exists if ( fileObject.exists() ) { @@ -368,7 +368,7 @@ public boolean processRowFile( Job parentJob, Result result, String realZipfilen // Let's see if we deal with file or folder FileObject[] fileList; - FileObject sourceFileOrFolder = KettleVFS.getFileObject( localSourceFilename, this ); + FileObject sourceFileOrFolder = KettleVFS.getInstance( parentJobMeta.getBowl() ).getFileObject( localSourceFilename, this ); boolean isSourceDirectory = sourceFileOrFolder.getType().equals( FileType.FOLDER ); final Pattern pattern; final Pattern patternExclude; @@ -458,7 +458,7 @@ public boolean processRowFile( Job parentJob, Result result, String realZipfilen // Prepare Zip File buffer = new byte[18024]; - dest = KettleVFS.getOutputStream( localrealZipfilename, this, false ); + dest = KettleVFS.getInstance( parentJobMeta.getBowl() ).getOutputStream( localrealZipfilename, this, false ); buff = new BufferedOutputStreamWithCloseDetection( dest ); out = new ZipOutputStream( buff ); @@ -547,7 +547,7 @@ public boolean processRowFile( Job parentJob, Result result, String realZipfilen targetFilename = localSourceFilename; } - FileObject file = KettleVFS.getFileObject( targetFilename, this ); + FileObject file = KettleVFS.getInstance( parentJobMeta.getBowl() ).getFileObject( targetFilename, this ); boolean isTargetDirectory = file.exists() && file.getType().equals( FileType.FOLDER ); if ( getIt && !getItexclude && !isTargetDirectory && !fileSet.contains( targetFilename ) ) { @@ -616,7 +616,7 @@ public boolean processRowFile( Job parentJob, Result result, String realZipfilen // Delete, Move File FileObject fileObjectd = zippedFiles[i]; if ( !isSourceDirectory ) { - fileObjectd = KettleVFS.getFileObject( localSourceFilename, this ); + fileObjectd = KettleVFS.getInstance( parentJobMeta.getBowl() ).getFileObject( localSourceFilename, this ); } // Here we can move, delete files @@ -742,7 +742,7 @@ private String determineZipfilenameForDepth( String filename, int depth ) throws if ( depth == 0 ) { return filename; } - FileObject fileObject = KettleVFS.getFileObject( filename, this ); + FileObject fileObject = KettleVFS.getInstance( parentJobMeta.getBowl() ).getFileObject( filename, this ); FileObject folder = fileObject.getParent(); String baseName = fileObject.getName().getBaseName(); if ( depth == 1 ) { @@ -764,7 +764,7 @@ private String determineZipfilenameForDepth( String filename, int depth ) throws private File getFile( final String filename ) { try { - String uri = KettleVFS.getFileObject( environmentSubstitute( filename ), this ).getName().getPath(); + String uri = KettleVFS.getInstance( parentJobMeta.getBowl() ).getFileObject( environmentSubstitute( filename ), this ).getName().getPath(); return new File( uri ); } catch ( KettleFileException ex ) { logError( "Error in Fetching URI for File: " + filename, ex ); @@ -810,7 +810,7 @@ public Result execute( Result previousResult, int nr ) { } else { FileObject moveToDirectory = null; try { - moveToDirectory = KettleVFS.getFileObject( realMovetodirectory, this ); + moveToDirectory = KettleVFS.getInstance( parentJobMeta.getBowl() ).getFileObject( realMovetodirectory, this ); if ( moveToDirectory.exists() ) { if ( moveToDirectory.getType() == FileType.FOLDER ) { if ( log.isDetailed() ) { @@ -1062,14 +1062,14 @@ public void check( List remarks, JobMeta jobMeta, Variable // execute method fails if the file already exists; we should too FileDoesNotExistValidator.putFailIfExists( ctx1, true ); } - JobEntryValidatorUtils.andValidator().validate( this, "zipFilename", remarks, ctx1 ); + JobEntryValidatorUtils.andValidator().validate( jobMeta.getBowl(), this, "zipFilename", remarks, ctx1 ); if ( 2 == afterZip ) { // setting says to move - JobEntryValidatorUtils.andValidator().validate( this, "moveToDirectory", remarks, AndValidator.putValidators( JobEntryValidatorUtils.notBlankValidator() ) ); + JobEntryValidatorUtils.andValidator().validate( jobMeta.getBowl(), this, "moveToDirectory", remarks, AndValidator.putValidators( JobEntryValidatorUtils.notBlankValidator() ) ); } - JobEntryValidatorUtils.andValidator().validate( this, "sourceDirectory", remarks, AndValidator.putValidators( JobEntryValidatorUtils.notBlankValidator() ) ); + JobEntryValidatorUtils.andValidator().validate( jobMeta.getBowl(), this, "sourceDirectory", remarks, AndValidator.putValidators( JobEntryValidatorUtils.notBlankValidator() ) ); } @@ -1148,7 +1148,7 @@ public boolean moveFilesToDestinationFolder( FileObject sourceFileOrFolder, File try { String fullName = fileObjectd.getName().getPath(); String basePath = sourceFileOrFolder.getName().getPath(); - fileObjectSource = KettleVFS.getFileObject( fullName ).getParent(); + fileObjectSource = KettleVFS.getInstance( parentJobMeta.getBowl() ).getFileObject( fullName ).getParent(); if ( isSourceDirectory ) { if ( fullName.startsWith( basePath ) ) { //to find out the folder structure from defined source @@ -1157,7 +1157,7 @@ public boolean moveFilesToDestinationFolder( FileObject sourceFileOrFolder, File relativeName = fullName; } fileObjectm = - KettleVFS.getFileObject( realMovetodirectory + KettleVFS.getInstance( parentJobMeta.getBowl() ).getFileObject( realMovetodirectory + Const.FILE_SEPARATOR + relativeName, this ); if ( !fileObjectm.getParent().exists() ) { //if at all there is a parent folder structure we need to create, we create one @@ -1171,7 +1171,7 @@ public boolean moveFilesToDestinationFolder( FileObject sourceFileOrFolder, File } } else { fileObjectm = - KettleVFS.getFileObject( realMovetodirectory + KettleVFS.getInstance( parentJobMeta.getBowl() ).getFileObject( realMovetodirectory + Const.FILE_SEPARATOR + fileObjectd.getName().getBaseName(), this ); fileObjectd.moveTo( fileObjectm ); } diff --git a/engine/src/main/java/org/pentaho/di/job/entry/JobEntryInterface.java b/engine/src/main/java/org/pentaho/di/job/entry/JobEntryInterface.java index 78790d2cb76a..d581c065fdf0 100644 --- a/engine/src/main/java/org/pentaho/di/job/entry/JobEntryInterface.java +++ b/engine/src/main/java/org/pentaho/di/job/entry/JobEntryInterface.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2018 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -26,6 +26,7 @@ import java.util.Map; import org.pentaho.di.cluster.SlaveServer; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.Result; import org.pentaho.di.core.SQLStatement; @@ -710,7 +711,7 @@ String exportResources( VariableSpace space, Map def * @deprecated use {@link #loadReferencedObject(int, Repository, IMetaStore, VariableSpace)} */ @Deprecated - Object loadReferencedObject( int index, Repository rep, VariableSpace space ) throws KettleException; + Object loadReferencedObject( Bowl bowl, int index, Repository rep, VariableSpace space ) throws KettleException; /** * Load the referenced object @@ -726,7 +727,8 @@ String exportResources( VariableSpace space, Map def * @return the referenced object once loaded * @throws KettleException */ - Object loadReferencedObject( int index, Repository rep, IMetaStore metaStore, VariableSpace space ) throws KettleException; + Object loadReferencedObject( Bowl bowl, int index, Repository rep, IMetaStore metaStore, VariableSpace space ) + throws KettleException; /** * At save and run time, the system will attempt to set the jobMeta so that it can be accessed by the jobEntries diff --git a/engine/src/main/java/org/pentaho/di/job/entry/validator/AndValidator.java b/engine/src/main/java/org/pentaho/di/job/entry/validator/AndValidator.java index 50d902a60c68..c97a3e3ebe74 100644 --- a/engine/src/main/java/org/pentaho/di/job/entry/validator/AndValidator.java +++ b/engine/src/main/java/org/pentaho/di/job/entry/validator/AndValidator.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -24,6 +24,7 @@ import java.util.List; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.CheckResultSourceInterface; @@ -42,13 +43,13 @@ public class AndValidator implements JobEntryValidator { private static final String VALIDATOR_NAME = "and"; - public boolean validate( CheckResultSourceInterface source, String propertyName, + public boolean validate( Bowl bowl, CheckResultSourceInterface source, String propertyName, List remarks, ValidatorContext context ) { // Object o = context.get(KEY_VALIDATORS); Object[] validators = (Object[]) context.get( KEY_VALIDATORS ); for ( Object validator : validators ) { - if ( !( (JobEntryValidator) validator ).validate( source, propertyName, remarks, context ) ) { + if ( !( (JobEntryValidator) validator ).validate( bowl, source, propertyName, remarks, context ) ) { // failure remarks have already been saved return false; } diff --git a/engine/src/main/java/org/pentaho/di/job/entry/validator/EmailValidator.java b/engine/src/main/java/org/pentaho/di/job/entry/validator/EmailValidator.java index 4b934db83dfe..981ccca4583e 100644 --- a/engine/src/main/java/org/pentaho/di/job/entry/validator/EmailValidator.java +++ b/engine/src/main/java/org/pentaho/di/job/entry/validator/EmailValidator.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -27,6 +27,7 @@ import java.util.List; import org.apache.commons.validator.GenericValidator; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.CheckResultSourceInterface; @@ -40,7 +41,7 @@ public String getName() { return VALIDATOR_NAME; } - public boolean validate( CheckResultSourceInterface source, String propertyName, + public boolean validate( Bowl bowl, CheckResultSourceInterface source, String propertyName, List remarks, ValidatorContext context ) { String value = null; diff --git a/engine/src/main/java/org/pentaho/di/job/entry/validator/FileDoesNotExistValidator.java b/engine/src/main/java/org/pentaho/di/job/entry/validator/FileDoesNotExistValidator.java index ae50820b28c8..a8979f754428 100644 --- a/engine/src/main/java/org/pentaho/di/job/entry/validator/FileDoesNotExistValidator.java +++ b/engine/src/main/java/org/pentaho/di/job/entry/validator/FileDoesNotExistValidator.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -27,6 +27,7 @@ import org.apache.commons.validator.util.ValidatorUtils; import org.apache.commons.vfs2.FileObject; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.CheckResultSourceInterface; import org.pentaho.di.core.variables.VariableSpace; @@ -45,7 +46,7 @@ public class FileDoesNotExistValidator extends AbstractFileValidator { static final String VALIDATOR_NAME = "fileDoesNotExist"; - public boolean validate( CheckResultSourceInterface source, String propertyName, + public boolean validate( Bowl bowl, CheckResultSourceInterface source, String propertyName, List remarks, ValidatorContext context ) { String filename = ValidatorUtils.getValueAsString( source, propertyName ); @@ -59,7 +60,7 @@ public boolean validate( CheckResultSourceInterface source, String propertyName, String realFileName = variableSpace.environmentSubstitute( filename ); FileObject fileObject = null; try { - fileObject = KettleVFS.getFileObject( realFileName, variableSpace ); + fileObject = KettleVFS.getInstance( bowl ).getFileObject( realFileName, variableSpace ); if ( fileObject.exists() && failIfExists ) { JobEntryValidatorUtils.addFailureRemark( diff --git a/engine/src/main/java/org/pentaho/di/job/entry/validator/FileExistsValidator.java b/engine/src/main/java/org/pentaho/di/job/entry/validator/FileExistsValidator.java index 8dd596b5f217..d0493f23f828 100644 --- a/engine/src/main/java/org/pentaho/di/job/entry/validator/FileExistsValidator.java +++ b/engine/src/main/java/org/pentaho/di/job/entry/validator/FileExistsValidator.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -27,6 +27,7 @@ import org.apache.commons.validator.util.ValidatorUtils; import org.apache.commons.vfs2.FileObject; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.CheckResultSourceInterface; import org.pentaho.di.core.variables.VariableSpace; @@ -46,7 +47,7 @@ public class FileExistsValidator extends AbstractFileValidator { private static final String KEY_FAIL_IF_DOES_NOT_EXIST = "org.pentaho.di.job.entries.createfile.failIfDoesNotExist"; - public boolean validate( CheckResultSourceInterface source, String propertyName, + public boolean validate( Bowl bowl, CheckResultSourceInterface source, String propertyName, List remarks, ValidatorContext context ) { String filename = ValidatorUtils.getValueAsString( source, propertyName ); @@ -60,7 +61,7 @@ public boolean validate( CheckResultSourceInterface source, String propertyName, String realFileName = variableSpace.environmentSubstitute( filename ); FileObject fileObject = null; try { - fileObject = KettleVFS.getFileObject( realFileName, variableSpace ); + fileObject = KettleVFS.getInstance( bowl ).getFileObject( realFileName, variableSpace ); if ( fileObject == null || ( fileObject != null && !fileObject.exists() && failIfDoesNotExist ) ) { JobEntryValidatorUtils.addFailureRemark( source, propertyName, VALIDATOR_NAME, remarks, JobEntryValidatorUtils.getLevelOnFail( diff --git a/engine/src/main/java/org/pentaho/di/job/entry/validator/IntegerValidator.java b/engine/src/main/java/org/pentaho/di/job/entry/validator/IntegerValidator.java index 07bf21c56692..74ffb7ace131 100644 --- a/engine/src/main/java/org/pentaho/di/job/entry/validator/IntegerValidator.java +++ b/engine/src/main/java/org/pentaho/di/job/entry/validator/IntegerValidator.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -28,6 +28,7 @@ import org.apache.commons.validator.GenericTypeValidator; import org.apache.commons.validator.GenericValidator; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.CheckResultSourceInterface; @@ -40,7 +41,7 @@ public class IntegerValidator implements JobEntryValidator { private String VALIDATOR_NAME = "integer"; - public boolean validate( CheckResultSourceInterface source, String propertyName, + public boolean validate( Bowl bowl, CheckResultSourceInterface source, String propertyName, List remarks, ValidatorContext context ) { Object result = null; diff --git a/engine/src/main/java/org/pentaho/di/job/entry/validator/LongValidator.java b/engine/src/main/java/org/pentaho/di/job/entry/validator/LongValidator.java index fd6eee4b5a14..1dce46dda26e 100644 --- a/engine/src/main/java/org/pentaho/di/job/entry/validator/LongValidator.java +++ b/engine/src/main/java/org/pentaho/di/job/entry/validator/LongValidator.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -28,6 +28,7 @@ import org.apache.commons.validator.GenericTypeValidator; import org.apache.commons.validator.GenericValidator; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.CheckResultSourceInterface; @@ -41,7 +42,7 @@ public String getName() { return VALIDATOR_NAME; } - public boolean validate( CheckResultSourceInterface source, String propertyName, + public boolean validate( Bowl bowl, CheckResultSourceInterface source, String propertyName, List remarks, ValidatorContext context ) { Object result = null; String value = null; diff --git a/engine/src/main/java/org/pentaho/di/job/entry/validator/NotBlankValidator.java b/engine/src/main/java/org/pentaho/di/job/entry/validator/NotBlankValidator.java index eddd1c343aa8..344325d65e86 100644 --- a/engine/src/main/java/org/pentaho/di/job/entry/validator/NotBlankValidator.java +++ b/engine/src/main/java/org/pentaho/di/job/entry/validator/NotBlankValidator.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -26,6 +26,7 @@ import org.apache.commons.validator.GenericValidator; import org.apache.commons.validator.util.ValidatorUtils; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.CheckResultSourceInterface; @@ -40,7 +41,7 @@ public class NotBlankValidator implements JobEntryValidator { private static final String VALIDATOR_NAME = "notBlank"; - public boolean validate( CheckResultSourceInterface source, String propertyName, + public boolean validate( Bowl bowl, CheckResultSourceInterface source, String propertyName, List remarks, ValidatorContext context ) { String value = ValidatorUtils.getValueAsString( source, propertyName ); if ( GenericValidator.isBlankOrNull( value ) ) { diff --git a/engine/src/main/java/org/pentaho/di/job/entry/validator/NotNullValidator.java b/engine/src/main/java/org/pentaho/di/job/entry/validator/NotNullValidator.java index ba14453c7d99..c597839a57bd 100644 --- a/engine/src/main/java/org/pentaho/di/job/entry/validator/NotNullValidator.java +++ b/engine/src/main/java/org/pentaho/di/job/entry/validator/NotNullValidator.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -26,6 +26,7 @@ import java.util.List; import org.apache.commons.beanutils.PropertyUtils; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.CheckResultSourceInterface; @@ -40,7 +41,7 @@ public class NotNullValidator implements JobEntryValidator { private static final String VALIDATOR_NAME = "notNull"; - public boolean validate( CheckResultSourceInterface source, String propertyName, + public boolean validate( Bowl bowl, CheckResultSourceInterface source, String propertyName, List remarks, ValidatorContext context ) { Object value = null; try { diff --git a/engine/src/main/java/org/pentaho/di/kitchen/KitchenCommandExecutor.java b/engine/src/main/java/org/pentaho/di/kitchen/KitchenCommandExecutor.java index 3e5fd2b3a210..64beb7ff5910 100644 --- a/engine/src/main/java/org/pentaho/di/kitchen/KitchenCommandExecutor.java +++ b/engine/src/main/java/org/pentaho/di/kitchen/KitchenCommandExecutor.java @@ -27,6 +27,8 @@ import org.pentaho.di.base.CommandExecutorCodes; import org.pentaho.di.base.Params; import org.pentaho.di.connections.ConnectionManager; +import org.pentaho.di.core.bowl.Bowl; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.Const; import org.pentaho.di.core.Result; import org.pentaho.di.core.exception.KettleException; @@ -148,7 +150,8 @@ public Result execute( Params params, String[] arguments ) throws Throwable { if ( job == null ) { // Try to load the job from file, even if it failed to load from the repository - job = loadJobFromFilesystem( params.getLocalInitialDir(), params.getLocalFile(), params.getBase64Zip() ); + job = loadJobFromFilesystem( DefaultBowl.getInstance(), params.getLocalInitialDir(), params.getLocalFile(), + params.getBase64Zip() ); } } else if ( isEnabled( params.getListRepos() ) ) { @@ -179,8 +182,8 @@ public Result execute( Params params, String[] arguments ) throws Throwable { try { // Export the resources linked to the currently loaded file... TopLevelResource topLevelResource = - ResourceUtil.serializeResourceExportInterface( params.getExportRepo(), job.getJobMeta(), job, repository, - getMetaStore() ); + ResourceUtil.serializeResourceExportInterface( job.getJobMeta().getBowl(), params.getExportRepo(), + job.getJobMeta(), job, repository, getMetaStore() ); String launchFile = topLevelResource.getResourceName(); String message = ResourceUtil.getExplanation( params.getExportRepo(), launchFile, job.getJobMeta() ); System.out.println(); @@ -329,7 +332,8 @@ public Job loadJobFromRepository( Repository repository, String dirName, String return new Job( repository, jobMeta ); } - public Job loadJobFromFilesystem( String initialDir, String filename, Serializable base64Zip ) throws Exception { + public Job loadJobFromFilesystem( Bowl bowl, String initialDir, String filename, Serializable base64Zip ) + throws Exception { if ( Utils.isEmpty( filename ) ) { System.out.println( BaseMessages.getString( getPkgClazz(), "Kitchen.Error.canNotLoadJob" ) ); @@ -350,7 +354,7 @@ public Job loadJobFromFilesystem( String initialDir, String filename, Serializab fileName = initialDir + fileName; } - JobMeta jobMeta = new JobMeta( fileName, null, null ); + JobMeta jobMeta = new JobMeta( bowl, fileName, null, null ); return new Job( null, jobMeta ); } diff --git a/engine/src/main/java/org/pentaho/di/pan/PanCommandExecutor.java b/engine/src/main/java/org/pentaho/di/pan/PanCommandExecutor.java index d2784f2ea096..c2dcac9d2ef1 100644 --- a/engine/src/main/java/org/pentaho/di/pan/PanCommandExecutor.java +++ b/engine/src/main/java/org/pentaho/di/pan/PanCommandExecutor.java @@ -28,6 +28,8 @@ import org.pentaho.di.base.CommandExecutorCodes; import org.pentaho.di.base.Params; import org.pentaho.di.connections.ConnectionManager; +import org.pentaho.di.core.bowl.Bowl; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.Const; import org.pentaho.di.core.Result; import org.pentaho.di.core.RowMetaAndData; @@ -150,8 +152,8 @@ public Result execute( final Params params, String[] arguments ) throws Throwabl // Try to load the transformation from file, even if it failed to load from the repository // You could implement some fail-over mechanism this way. if ( trans == null ) { - trans = loadTransFromFilesystem( params.getLocalInitialDir(), params.getLocalFile(), params.getLocalJarFile(), - params.getBase64Zip() ); + trans = loadTransFromFilesystem( DefaultBowl.getInstance(), params.getLocalInitialDir(), + params.getLocalFile(), params.getLocalJarFile(), params.getBase64Zip() ); } } @@ -358,8 +360,8 @@ public Trans loadTransFromRepository( Repository repository, String dirName, Str return trans; // return transformation loaded from the repo } - public Trans loadTransFromFilesystem( String initialDir, String filename, String jarFilename, Serializable base64Zip ) - throws Exception { + public Trans loadTransFromFilesystem( Bowl bowl, String initialDir, String filename, String jarFilename, + Serializable base64Zip ) throws Exception { Trans trans = null; @@ -380,7 +382,7 @@ public Trans loadTransFromFilesystem( String initialDir, String filename, String } logDebug( "Pan.Log.LoadingTransXML", "" + filepath ); - TransMeta transMeta = new TransMeta( filepath ); + TransMeta transMeta = new TransMeta( bowl, filepath ); trans = new Trans( transMeta ); } diff --git a/engine/src/main/java/org/pentaho/di/repository/RepositoryExporter.java b/engine/src/main/java/org/pentaho/di/repository/RepositoryExporter.java index 193e85edca54..c7ff0f91e1d0 100644 --- a/engine/src/main/java/org/pentaho/di/repository/RepositoryExporter.java +++ b/engine/src/main/java/org/pentaho/di/repository/RepositoryExporter.java @@ -3,7 +3,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2023 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -33,6 +33,7 @@ import org.apache.commons.vfs2.FileObject; import org.apache.commons.vfs2.FileSystemException; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.Const; import org.pentaho.di.core.ObjectLocationSpecificationMethod; import org.pentaho.di.core.ProgressMonitorListener; @@ -153,7 +154,7 @@ private synchronized List exportAllObjectsInternal( ProgressMoni monitor.beginTask( BaseMessages.getString( PKG, "Repository.Exporter.Monitor.BeginTask" ), 104 ); - FileObject output = KettleVFS.getFileObject( xmlFilename ); + FileObject output = KettleVFS.getInstance( DefaultBowl.getInstance() ).getFileObject( xmlFilename ); ExportFeedback feed = new ExportFeedback(); feed.setItemName( BaseMessages.getString( PKG, "Repository.Exporter.Feedback.CreateExportFile", xmlFilename ) ); @@ -329,7 +330,8 @@ private void convertFromFileRepository( JobMeta jobMeta ) { if ( trans.getSpecificationMethod() == ObjectLocationSpecificationMethod.FILENAME ) { try { TransMeta meta = trans.getTransMeta( repository, MetaStoreConst.getDefaultMetastore(), jobMeta ); - FileObject fileObject = KettleVFS.getFileObject( meta.getFilename() ); + FileObject fileObject = KettleVFS.getInstance( DefaultBowl.getInstance() ) + .getFileObject( meta.getFilename() ); trans.setSpecificationMethod( ObjectLocationSpecificationMethod.REPOSITORY_BY_NAME ); trans.setFileName( null ); trans.setTransname( meta.getName() ); @@ -348,7 +350,8 @@ private void convertFromFileRepository( JobMeta jobMeta ) { if ( jobEntryJob.getSpecificationMethod() == ObjectLocationSpecificationMethod.FILENAME ) { try { JobMeta meta = jobEntryJob.getJobMeta( repository, MetaStoreConst.getDefaultMetastore(), jobMeta ); - FileObject fileObject = KettleVFS.getFileObject( meta.getFilename() ); + FileObject fileObject = KettleVFS.getInstance( DefaultBowl.getInstance() ) + .getFileObject( meta.getFilename() ); jobEntryJob.setSpecificationMethod( ObjectLocationSpecificationMethod.REPOSITORY_BY_NAME ); jobEntryJob.setFileName( null ); jobEntryJob.setJobName( meta.getName() ); @@ -389,8 +392,10 @@ private void convertFromFileRepository( TransMeta transMeta ) { // if ( mappingMeta.getSpecificationMethod() == ObjectLocationSpecificationMethod.FILENAME ) { try { - TransMeta meta = MappingMeta.loadMappingMeta( mappingMeta, fileRep, fileRep.metaStore, transMeta ); - FileObject fileObject = KettleVFS.getFileObject( meta.getFilename() ); + TransMeta meta = MappingMeta.loadMappingMeta( transMeta.getBowl(), mappingMeta, fileRep, + fileRep.metaStore, transMeta ); + FileObject fileObject = KettleVFS.getInstance( transMeta.getBowl() ) + .getFileObject( meta.getFilename() ); mappingMeta.setSpecificationMethod( ObjectLocationSpecificationMethod.REPOSITORY_BY_NAME ); mappingMeta.setFileName( null ); mappingMeta.setTransName( meta.getName() ); diff --git a/engine/src/main/java/org/pentaho/di/repository/filerep/KettleFileRepository.java b/engine/src/main/java/org/pentaho/di/repository/filerep/KettleFileRepository.java index c059d4d328d4..8bcedc74ed9c 100644 --- a/engine/src/main/java/org/pentaho/di/repository/filerep/KettleFileRepository.java +++ b/engine/src/main/java/org/pentaho/di/repository/filerep/KettleFileRepository.java @@ -39,6 +39,7 @@ import org.pentaho.di.base.AbstractMeta; import org.pentaho.di.cluster.ClusterSchema; import org.pentaho.di.cluster.SlaveServer; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.Condition; import org.pentaho.di.core.Const; import org.pentaho.di.core.util.Utils; @@ -271,7 +272,8 @@ public String calcFilename( ObjectId id ) { // package-local visibility for testing purposes FileObject getFileObject( RepositoryElementInterface element ) throws KettleFileException { - return KettleVFS.getFileObject( calcFilename( element.getRepositoryDirectory(), element.getName(), element + return KettleVFS.getInstance( DefaultBowl.getInstance() ) + .getFileObject( calcFilename( element.getRepositoryDirectory(), element.getName(), element .getRepositoryElementType().getExtension() ) ); } @@ -279,8 +281,8 @@ FileObject getFileObject( RepositoryElementInterface element ) throws KettleFile public boolean exists( final String name, final RepositoryDirectoryInterface repositoryDirectory, final RepositoryObjectType objectType ) throws KettleException { try { - FileObject fileObject = - KettleVFS.getFileObject( calcFilename( repositoryDirectory, name, objectType.getExtension() ) ); + FileObject fileObject = KettleVFS.getInstance( DefaultBowl.getInstance() ) + .getFileObject( calcFilename( repositoryDirectory, name, objectType.getExtension() ) ); return fileObject.exists(); } catch ( Exception e ) { throw new KettleException( e ); @@ -326,7 +328,7 @@ public void save( RepositoryElementInterface repositoryElement, String versionCo String xml = ( (XMLInterface) repositoryElement ).getXML(); - OutputStream os = KettleVFS.getOutputStream( fileObject, false ); + OutputStream os = KettleVFS.getInstance( DefaultBowl.getInstance() ).getOutputStream( fileObject, false ); os.write( xml.getBytes( Const.XML_ENCODING ) ); os.close(); @@ -370,7 +372,7 @@ public RepositoryDirectoryInterface createRepositoryDirectory( RepositoryDirecto newFolder += "/" + directoryPath; } - FileObject parent = KettleVFS.getFileObject( newFolder ); + FileObject parent = KettleVFS.getInstance( DefaultBowl.getInstance() ).getFileObject( newFolder ); try { parent.createFolder(); } catch ( FileSystemException e ) { @@ -392,7 +394,7 @@ public void saveRepositoryDirectory( RepositoryDirectoryInterface dir ) throws K String filename = calcDirectoryName( dir ); ObjectId objectId = new StringObjectId( calcRelativeElementDirectory( dir ) ); - FileObject fileObject = KettleVFS.getFileObject( filename ); + FileObject fileObject = KettleVFS.getInstance( DefaultBowl.getInstance() ).getFileObject( filename ); fileObject.createFolder(); // also create parents dir.setObjectId( objectId ); @@ -453,7 +455,7 @@ public void deleteDatabaseMeta( String databaseName ) throws KettleException { public void deleteRootObject( String name, String extension ) throws KettleException { try { String filename = calcDirectoryName( null ) + name + extension; - FileObject fileObject = KettleVFS.getFileObject( filename ); + FileObject fileObject = KettleVFS.getInstance( DefaultBowl.getInstance() ).getFileObject( filename ); fileObject.delete(); } catch ( Exception e ) { throw new KettleException( "Unable to delete database with name [" @@ -463,7 +465,7 @@ public void deleteRootObject( String name, String extension ) throws KettleExcep public void deleteFile( String filename ) throws KettleException { try { - FileObject fileObject = KettleVFS.getFileObject( filename ); + FileObject fileObject = KettleVFS.getInstance( DefaultBowl.getInstance() ).getFileObject( filename ); fileObject.delete(); } catch ( Exception e ) { throw new KettleException( "Unable to delete file with name [" + filename + "]", e ); @@ -511,7 +513,7 @@ public ObjectId[] getDatabaseAttributeIDs( ObjectId id_database ) throws KettleE private ObjectId getObjectId( RepositoryDirectoryInterface repositoryDirectory, String name, String extension ) throws KettleException { try { String filename = calcFilename( repositoryDirectory, name, extension ); - if ( !KettleVFS.getFileObject( filename ).exists() ) { + if ( !KettleVFS.getInstance( DefaultBowl.getInstance() ).getFileObject( filename ).exists() ) { return null; } @@ -583,7 +585,7 @@ public String[] getJobNames( ObjectId id_directory, boolean includeDeleted ) thr RepositoryDirectoryInterface directory = tree.findDirectory( id_directory ); String folderName = calcDirectoryName( directory ); - FileObject folder = KettleVFS.getFileObject( folderName ); + FileObject folder = KettleVFS.getInstance( DefaultBowl.getInstance() ).getFileObject( folderName ); for ( FileObject child : folder.getChildren() ) { if ( child.getType().equals( FileType.FILE ) ) { @@ -665,7 +667,7 @@ private ObjectId[] getRootObjectIDs( String extension ) throws KettleException { List list = new ArrayList(); String folderName = repositoryMeta.getBaseDirectory(); - FileObject folder = KettleVFS.getFileObject( folderName ); + FileObject folder = KettleVFS.getInstance( DefaultBowl.getInstance() ).getFileObject( folderName ); for ( FileObject child : folder.getChildren() ) { if ( child.getType().equals( FileType.FILE ) ) { @@ -775,7 +777,7 @@ public String[] getTransformationNames( ObjectId id_directory, boolean includeDe RepositoryDirectoryInterface directory = tree.findDirectory( id_directory ); String folderName = calcDirectoryName( directory ); - FileObject folder = KettleVFS.getFileObject( folderName ); + FileObject folder = KettleVFS.getInstance( DefaultBowl.getInstance() ).getFileObject( folderName ); for ( FileObject child : folder.getChildren() ) { if ( child.getType().equals( FileType.FILE ) ) { @@ -839,7 +841,7 @@ public void insertJobNote( ObjectId id_job, ObjectId id_note ) throws KettleExce public ObjectId insertLogEntry( String description ) throws KettleException { String logfile = calcDirectoryName( null ) + LOG_FILE; try { - OutputStream outputStream = KettleVFS.getOutputStream( logfile, true ); + OutputStream outputStream = KettleVFS.getInstance( DefaultBowl.getInstance() ).getOutputStream( logfile, true ); outputStream.write( description.getBytes() ); outputStream.write( Const.CR.getBytes() ); outputStream.close(); @@ -904,7 +906,7 @@ public Node loadNodeFromXML( ObjectId id, String tag ) throws KettleException { // The object ID is the base name of the file in the Base directory folder // String filename = calcDirectoryName( null ) + id.getId(); - FileObject fileObject = KettleVFS.getFileObject( filename ); + FileObject fileObject = KettleVFS.getInstance( DefaultBowl.getInstance() ).getFileObject( filename ); Document document = XMLHandler.loadXMLFile( fileObject ); Node node = XMLHandler.getSubNode( document, tag ); @@ -948,7 +950,7 @@ public JobMeta loadJob( String jobname, RepositoryDirectoryInterface repdir, Pro // This is a standard load of a transformation serialized in XML... // String filename = calcDirectoryName( repdir ) + jobname + EXT_JOB; - JobMeta jobMeta = new JobMeta( filename, this ); + JobMeta jobMeta = new JobMeta( DefaultBowl.getInstance(), filename, this ); jobMeta.setFilename( null ); jobMeta.setName( jobname ); jobMeta.setObjectId( new StringObjectId( calcObjectId( repdir, jobname, EXT_JOB ) ) ); @@ -982,7 +984,7 @@ public RepositoryDirectoryInterface loadRepositoryDirectoryTree() throws KettleE public RepositoryDirectoryInterface loadRepositoryDirectoryTree( RepositoryDirectoryInterface dir ) throws KettleException { try { String folderName = calcDirectoryName( dir ); - FileObject folder = KettleVFS.getFileObject( folderName ); + FileObject folder = KettleVFS.getInstance( DefaultBowl.getInstance() ).getFileObject( folderName ); for ( FileObject child : folder.getChildren() ) { if ( child.getType().equals( FileType.FOLDER ) ) { @@ -1025,7 +1027,7 @@ public List getTransformationObjects( ObjectId i RepositoryDirectoryInterface directory = tree.findDirectory( idDirectory ); String folderName = calcDirectoryName( directory ); - FileObject folder = KettleVFS.getFileObject( folderName ); + FileObject folder = KettleVFS.getInstance( DefaultBowl.getInstance() ).getFileObject( folderName ); for ( FileObject child : folder.getChildren() ) { if ( child.getType().equals( FileType.FILE ) ) { @@ -1062,7 +1064,7 @@ public List getJobObjects( ObjectId id_directory RepositoryDirectoryInterface directory = tree.findDirectory( id_directory ); String folderName = calcDirectoryName( directory ); - FileObject folder = KettleVFS.getFileObject( folderName ); + FileObject folder = KettleVFS.getInstance( DefaultBowl.getInstance() ).getFileObject( folderName ); for ( FileObject child : folder.getChildren() ) { if ( child.getType().equals( FileType.FILE ) ) { @@ -1109,7 +1111,7 @@ public TransMeta loadTransformation( String transname, RepositoryDirectoryInterf // This is a standard load of a transformation serialized in XML... // String filename = calcDirectoryName( repdir ) + transname + ".ktr"; - TransMeta transMeta = new TransMeta( filename, this, setInternalVariables ); + TransMeta transMeta = new TransMeta( DefaultBowl.getInstance(), filename, this, setInternalVariables ); transMeta.setRepository( this ); transMeta.setMetaStore( MetaStoreConst.getDefaultMetastore() ); transMeta.setFilename( null ); @@ -1239,7 +1241,8 @@ private ObjectId renameObject( ObjectId id, RepositoryDirectoryInterface newDire try { // In case of a root object, the ID is the same as the relative filename... // - FileObject fileObject = KettleVFS.getFileObject( calcDirectoryName( null ) + id.getId() ); + FileObject fileObject = KettleVFS.getInstance( DefaultBowl.getInstance() ) + .getFileObject( calcDirectoryName( null ) + id.getId() ); // Same name, different folder? if ( Utils.isEmpty( newName ) ) { @@ -1249,7 +1252,7 @@ private ObjectId renameObject( ObjectId id, RepositoryDirectoryInterface newDire // String newFilename = calcDirectoryName( newDirectory ) + newName + extension; - FileObject newObject = KettleVFS.getFileObject( newFilename ); + FileObject newObject = KettleVFS.getInstance( DefaultBowl.getInstance() ).getFileObject( newFilename ); fileObject.moveTo( newObject ); return new StringObjectId( calcObjectId( newDirectory, newName, extension ) ); @@ -1297,19 +1300,20 @@ public ObjectId renameRepositoryDirectory( ObjectId id, RepositoryDirectoryInter // If newName is null, keep the current name newName = ( newName != null ) ? newName : dir.getName(); - FileObject folder = KettleVFS.getFileObject( dir.getPath() ); + FileObject folder = KettleVFS.getInstance( DefaultBowl.getInstance() ).getFileObject( dir.getPath() ); String newFolderName = null; if ( newParentDir != null ) { - FileObject newParentFolder = KettleVFS.getFileObject( newParentDir.getPath() ); + FileObject newParentFolder = KettleVFS.getInstance( DefaultBowl.getInstance() ) + .getFileObject( newParentDir.getPath() ); newFolderName = newParentFolder.toString() + "/" + newName; } else { newFolderName = folder.getParent().toString() + "/" + newName; } - FileObject newFolder = KettleVFS.getFileObject( newFolderName ); + FileObject newFolder = KettleVFS.getInstance( DefaultBowl.getInstance() ).getFileObject( newFolderName ); folder.moveTo( newFolder ); return new StringObjectId( dir.getObjectId() ); @@ -1498,7 +1502,7 @@ public RepositoryObject getObjectInformation( ObjectId objectId, RepositoryObjec } else { filename += objectId.getId(); } - FileObject fileObject = KettleVFS.getFileObject( filename ); + FileObject fileObject = KettleVFS.getInstance( DefaultBowl.getInstance() ).getFileObject( filename ); if ( !fileObject.exists() ) { return null; } @@ -1509,7 +1513,8 @@ public RepositoryObject getObjectInformation( ObjectId objectId, RepositoryObjec } String filePath = fileObject.getParent().getName().getPath(); - final FileObject baseDirObject = KettleVFS.getFileObject( repositoryMeta.getBaseDirectory() ); + final FileObject baseDirObject = KettleVFS.getInstance( DefaultBowl.getInstance() ) + .getFileObject( repositoryMeta.getBaseDirectory() ); final int baseDirObjectPathLength = baseDirObject.getName().getPath().length(); final String dirPath = baseDirObjectPathLength <= filePath.length() ? filePath.substring( baseDirObjectPathLength ) : "/"; diff --git a/engine/src/main/java/org/pentaho/di/resource/ResourceUtil.java b/engine/src/main/java/org/pentaho/di/resource/ResourceUtil.java index 0ca434f59cd7..c7e32cda9269 100644 --- a/engine/src/main/java/org/pentaho/di/resource/ResourceUtil.java +++ b/engine/src/main/java/org/pentaho/di/resource/ResourceUtil.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2019 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -29,6 +29,7 @@ import java.util.zip.ZipOutputStream; import org.apache.commons.vfs2.FileObject; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.Const; import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.core.variables.VariableSpace; @@ -60,11 +61,11 @@ public class ResourceUtil { * @throws KettleException * in case anything goes wrong during serialization */ - public static final TopLevelResource serializeResourceExportInterface( String zipFilename, + public static final TopLevelResource serializeResourceExportInterface( Bowl bowl, String zipFilename, ResourceExportInterface resourceExportInterface, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleException { - return serializeResourceExportInterface( - zipFilename, resourceExportInterface, space, repository, metaStore, null, null ); + return serializeResourceExportInterface( bowl, zipFilename, resourceExportInterface, space, repository, + metaStore, null, null ); } /** @@ -87,7 +88,7 @@ public static final TopLevelResource serializeResourceExportInterface( String zi * @throws KettleException * in case anything goes wrong during serialization */ - public static final TopLevelResource serializeResourceExportInterface( String zipFilename, + public static final TopLevelResource serializeResourceExportInterface( Bowl bowl, String zipFilename, ResourceExportInterface resourceExportInterface, VariableSpace space, Repository repository, IMetaStore metaStore, String injectXML, String injectFilename ) throws KettleException { @@ -106,17 +107,17 @@ public static final TopLevelResource serializeResourceExportInterface( String zi ResourceNamingInterface namingInterface = new SequenceResourceNaming(); String topLevelResource = - resourceExportInterface.exportResources( space, definitions, namingInterface, repository, metaStore ); + resourceExportInterface.exportResources( bowl, space, definitions, namingInterface, repository, metaStore ); if ( topLevelResource != null && !definitions.isEmpty() ) { // Create the ZIP file... // - FileObject fileObject = KettleVFS.getFileObject( zipFilename, space ); + FileObject fileObject = KettleVFS.getInstance( bowl ).getFileObject( zipFilename, space ); // Store the XML in the definitions in a ZIP file... // - out = new ZipOutputStream( KettleVFS.getOutputStream( fileObject, false ) ); + out = new ZipOutputStream( KettleVFS.getInstance( bowl ).getOutputStream( fileObject, false ) ); for ( Map.Entry entry : definitions.entrySet() ) { String filename = entry.getKey(); diff --git a/engine/src/main/java/org/pentaho/di/shared/SharedObjects.java b/engine/src/main/java/org/pentaho/di/shared/SharedObjects.java index fab6ba92b276..99c6be7b6459 100644 --- a/engine/src/main/java/org/pentaho/di/shared/SharedObjects.java +++ b/engine/src/main/java/org/pentaho/di/shared/SharedObjects.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2022 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -37,6 +37,7 @@ import org.apache.commons.io.IOUtils; import org.pentaho.di.cluster.ClusterSchema; import org.pentaho.di.cluster.SlaveServer; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.Const; import org.pentaho.di.core.util.Utils; import org.pentaho.di.core.database.DatabaseMeta; @@ -339,12 +340,12 @@ protected void writeToFile( FileObject fileObject, String backupFileName ) throw } private FileObject getFileObjectFromKettleVFS( String filename ) throws KettleFileException { - return KettleVFS.getFileObject( filename ); + return KettleVFS.getInstance( DefaultBowl.getInstance() ).getFileObject( filename ); } @VisibleForTesting protected OutputStream initOutputStreamUsingKettleVFS( FileObject fileObject ) throws IOException { - return KettleVFS.getOutputStream( fileObject, false ); + return KettleVFS.getInstance( DefaultBowl.getInstance() ).getOutputStream( fileObject, false ); } /** @@ -392,7 +393,7 @@ private boolean copyFile( String src, String dest ) throws KettleFileException, FileObject srcFile = getFileObjectFromKettleVFS( src ); FileObject destFile = getFileObjectFromKettleVFS( dest ); try ( InputStream in = KettleVFS.getInputStream( srcFile ); - OutputStream out = KettleVFS.getOutputStream( destFile, false ) ) { + OutputStream out = KettleVFS.getInstance( DefaultBowl.getInstance() ).getOutputStream( destFile, false ) ) { IOUtils.copy( in, out ); } return true; diff --git a/engine/src/main/java/org/pentaho/di/trans/StepWithMappingMeta.java b/engine/src/main/java/org/pentaho/di/trans/StepWithMappingMeta.java index 04ac388c81f6..c26ceb7f24ff 100644 --- a/engine/src/main/java/org/pentaho/di/trans/StepWithMappingMeta.java +++ b/engine/src/main/java/org/pentaho/di/trans/StepWithMappingMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2021 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -95,7 +95,7 @@ public static TransMeta loadMappingMeta( Bowl bowl, StepWithMappingMeta executor // Note - was a synchronized static method, but as no static variables are manipulated, this is entirely unnecessary IMetaFileLoader metaFileLoader = new MetaFileLoaderImpl<>( executorMeta, executorMeta.getSpecificationMethod() ); - TransMeta mappingTransMeta = metaFileLoader.getMetaForStep( rep, metaStore, space ); + TransMeta mappingTransMeta = metaFileLoader.getMetaForStep( bowl, rep, metaStore, space ); if ( share ) { // When the child parameter does exist in the parent parameters, overwrite the child parameter by the @@ -264,7 +264,7 @@ public void setTransObjectId( ObjectId transObjectId ) { } @Override - public String exportResources( VariableSpace space, Map definitions, + public String exportResources( Bowl bowl, VariableSpace space, Map definitions, ResourceNamingInterface resourceNamingInterface, Repository repository, IMetaStore metaStore ) throws KettleException { try { @@ -276,14 +276,14 @@ public String exportResources( VariableSpace space, Map getResourceDependencies( TransMeta transMeta, Ste * @deprecated use {@link #exportResources(VariableSpace, Map, ResourceNamingInterface, Repository, IMetaStore)} */ @Deprecated - public String exportResources( VariableSpace space, Map definitions, + public String exportResources( Bowl bowl, VariableSpace space, Map definitions, ResourceNamingInterface resourceNamingInterface, Repository repository ) throws KettleException { return null; } - public String exportResources( VariableSpace space, Map definitions, + public String exportResources( Bowl bowl, VariableSpace space, Map definitions, ResourceNamingInterface resourceNamingInterface, Repository repository, IMetaStore metaStore ) throws KettleException { return null; @@ -1055,12 +1057,12 @@ public String getActiveReferencedObjectDescription() { * @deprecated use {@link #loadReferencedObject(int, Repository, IMetaStore, VariableSpace)} */ @Deprecated - public Object loadReferencedObject( int index, Repository rep, VariableSpace space ) throws KettleException { + public Object loadReferencedObject( Bowl bowl, int index, Repository rep, VariableSpace space ) throws KettleException { // Provided for v4 API compatibility return null; } - public Object loadReferencedObject( int index, Repository rep, IMetaStore metaStore, VariableSpace space ) + public Object loadReferencedObject( Bowl bowl, int index, Repository rep, IMetaStore metaStore, VariableSpace space ) throws KettleException { // Provided for v4 API compatibility return null; diff --git a/engine/src/main/java/org/pentaho/di/trans/step/StepMeta.java b/engine/src/main/java/org/pentaho/di/trans/step/StepMeta.java index d2dd11943624..3e99d33fb9f5 100644 --- a/engine/src/main/java/org/pentaho/di/trans/step/StepMeta.java +++ b/engine/src/main/java/org/pentaho/di/trans/step/StepMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2023 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -37,6 +37,7 @@ import org.pentaho.di.core.Const; import org.pentaho.di.core.Counter; import org.pentaho.di.core.attributes.AttributesUtil; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.database.DatabaseMeta; import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.core.exception.KettlePluginLoaderException; @@ -981,13 +982,13 @@ public String exportResources( VariableSpace space, Map definitions, + public String exportResources( Bowl bowl, VariableSpace space, Map definitions, ResourceNamingInterface resourceNamingInterface, Repository repository, IMetaStore metaStore ) throws KettleException { // Compatibility with previous release... // - String resources = stepMetaInterface.exportResources( space, definitions, resourceNamingInterface, repository ); + String resources = stepMetaInterface.exportResources( bowl, space, definitions, resourceNamingInterface, repository ); if ( resources != null ) { return resources; } @@ -996,7 +997,7 @@ public String exportResources( VariableSpace space, Map definitions, - ResourceNamingInterface resourceNamingInterface, Repository repository, IMetaStore metaStore ) throws KettleException { + public String exportResources( Bowl bowl, VariableSpace space, Map definitions, + ResourceNamingInterface resourceNamingInterface, Repository repository, IMetaStore metaStore ) + throws KettleException { try { // The object that we're modifying here is a copy of the original! // So let's change the filename from relative to absolute by grabbing the file object... @@ -773,7 +775,8 @@ public String exportResources( VariableSpace space, Map impact, TransMeta transMeta, Ste // Find the lookupfields... // RowMetaInterface out = prev.clone(); - getFields( out, stepMeta.getName(), new RowMetaInterface[] { info, }, null, transMeta, repository, metaStore ); + getFields( transMeta.getBowl(), out, stepMeta.getName(), new RowMetaInterface[] { info, }, null, transMeta, + repository, metaStore ); if ( out != null ) { for ( int i = 0; i < out.size(); i++ ) { diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/databaselookup/DatabaseLookup.java b/engine/src/main/java/org/pentaho/di/trans/steps/databaselookup/DatabaseLookup.java index 69ea4a14f513..f1389a127bdf 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/databaselookup/DatabaseLookup.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/databaselookup/DatabaseLookup.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2022 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -369,7 +369,8 @@ public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws // create the output metadata data.outputRowMeta = getInputRowMeta().clone(); - meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); + meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository, + metaStore ); data.db.setLookup( environmentSubstitute( meta.getSchemaName() ), environmentSubstitute( meta.getTablename() ), diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/databaselookup/DatabaseLookupMeta.java b/engine/src/main/java/org/pentaho/di/trans/steps/databaselookup/DatabaseLookupMeta.java index 86e3ca74ce55..19faf54ebcb6 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/databaselookup/DatabaseLookupMeta.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/databaselookup/DatabaseLookupMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2019 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -25,6 +25,7 @@ import java.util.Arrays; import java.util.List; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.CheckResult; import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.Const; @@ -480,7 +481,7 @@ public void setDefault() { } @Override - public void getFields( RowMetaInterface row, String name, RowMetaInterface[] info, StepMeta nextStep, + public void getFields( Bowl bowl, RowMetaInterface row, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { if ( Utils.isEmpty( info ) || info[0] == null ) { // null or length 0 : no info from database for ( int i = 0; i < getReturnValueNewName().length; i++ ) { diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/datagrid/DataGrid.java b/engine/src/main/java/org/pentaho/di/trans/steps/datagrid/DataGrid.java index d13c8475fba9..cb8fa49d3607 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/datagrid/DataGrid.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/datagrid/DataGrid.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2020 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -73,7 +73,8 @@ public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws data.linesWritten = 0; data.outputRowMeta = new RowMeta(); - meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); + meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository, + metaStore ); // Use these metadata values to convert data... // diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/datagrid/DataGridMeta.java b/engine/src/main/java/org/pentaho/di/trans/steps/datagrid/DataGridMeta.java index bb1b33df7f67..af623f3a0f7e 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/datagrid/DataGridMeta.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/datagrid/DataGridMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2020 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -26,6 +26,7 @@ import java.util.ArrayList; import java.util.List; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.Const; import org.pentaho.di.core.util.Utils; import org.pentaho.di.core.database.DatabaseMeta; @@ -362,7 +363,7 @@ public void setDefault() { } @Override - public void getFields( RowMetaInterface rowMeta, String name, RowMetaInterface[] info, StepMeta nextStep, + public void getFields( Bowl bowl, RowMetaInterface rowMeta, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { for ( int i = 0; i < fieldName.length; i++ ) { try { diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/dbproc/DBProc.java b/engine/src/main/java/org/pentaho/di/trans/steps/dbproc/DBProc.java index d16564299ff3..1d2f095d9aeb 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/dbproc/DBProc.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/dbproc/DBProc.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -64,7 +64,8 @@ private Object[] runProc( RowMetaInterface rowMeta, Object[] rowData ) throws Ke // get the RowMeta for the output // data.outputMeta = data.inputRowMeta.clone(); - meta.getFields( data.outputMeta, getStepname(), null, null, this, repository, metaStore ); + meta.getFields( getTransMeta().getBowl(), data.outputMeta, getStepname(), null, null, this, repository, + metaStore ); data.argnrs = new int[meta.getArgument().length]; for ( int i = 0; i < meta.getArgument().length; i++ ) { diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/dbproc/DBProcMeta.java b/engine/src/main/java/org/pentaho/di/trans/steps/dbproc/DBProcMeta.java index b99ebe0763ef..7a11640e92be 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/dbproc/DBProcMeta.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/dbproc/DBProcMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -24,6 +24,7 @@ import java.util.List; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.CheckResult; import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.Const; @@ -251,7 +252,7 @@ public void setDefault() { } @Override - public void getFields( RowMetaInterface r, String name, RowMetaInterface[] info, StepMeta nextStep, + public void getFields( Bowl bowl, RowMetaInterface r, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { if ( !Utils.isEmpty( resultName ) ) { diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/delete/Delete.java b/engine/src/main/java/org/pentaho/di/trans/steps/delete/Delete.java index 771419756d97..a37868eb01c8 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/delete/Delete.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/delete/Delete.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2023 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -101,7 +101,8 @@ public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws // What's the output Row format? data.outputRowMeta = getInputRowMeta().clone(); - meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); + meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository, + metaStore ); data.schemaTable = meta.getDatabaseMeta().getQuotedSchemaTableCombination( diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/delete/DeleteMeta.java b/engine/src/main/java/org/pentaho/di/trans/steps/delete/DeleteMeta.java index d631a62d11dd..1d5981cc76f5 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/delete/DeleteMeta.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/delete/DeleteMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2023 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -24,6 +24,7 @@ import java.util.List; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.CheckResult; import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.Const; @@ -345,7 +346,8 @@ public void saveRep( Repository rep, IMetaStore metaStore, ObjectId id_transform } } - public void getFields( RowMetaInterface rowMeta, String origin, RowMetaInterface[] info, StepMeta nextStep, + @Override + public void getFields( Bowl bowl, RowMetaInterface rowMeta, String origin, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { // Default: nothing changes to rowMeta } diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/denormaliser/Denormaliser.java b/engine/src/main/java/org/pentaho/di/trans/steps/denormaliser/Denormaliser.java index 8cd724e13a46..8e14af8f726c 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/denormaliser/Denormaliser.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/denormaliser/Denormaliser.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2021 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -133,7 +133,8 @@ private boolean processFirstRow() throws KettleStepException { this.minNullIsValued = ValueMetaBase.convertStringToBoolean( val ); data.inputRowMeta = getInputRowMeta(); data.outputRowMeta = data.inputRowMeta.clone(); - meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); + meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository, + metaStore ); data.keyFieldNr = data.inputRowMeta.indexOfValue( meta.getKeyField() ); if ( data.keyFieldNr < 0 ) { diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/denormaliser/DenormaliserMeta.java b/engine/src/main/java/org/pentaho/di/trans/steps/denormaliser/DenormaliserMeta.java index 600ca3d61af2..ae3f99e6edf3 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/denormaliser/DenormaliserMeta.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/denormaliser/DenormaliserMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2019 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -24,6 +24,7 @@ import java.util.List; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.CheckResult; import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.Const; @@ -159,7 +160,7 @@ public void setDefault() { } @Override - public void getFields( RowMetaInterface row, String name, RowMetaInterface[] info, StepMeta nextStep, + public void getFields( Bowl bowl, RowMetaInterface row, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { // Remove the key value (there will be different entries for each output row) diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/detectlastrow/DetectLastRow.java b/engine/src/main/java/org/pentaho/di/trans/steps/detectlastrow/DetectLastRow.java index 38970274dde8..9ac8c16555fa 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/detectlastrow/DetectLastRow.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/detectlastrow/DetectLastRow.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -70,7 +70,8 @@ public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws data.previousRowMeta = getInputRowMeta().clone(); data.NrPrevFields = data.previousRowMeta.size(); data.outputRowMeta = data.previousRowMeta; - meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); + meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository, + metaStore ); } Object[] outputRow = null; diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/detectlastrow/DetectLastRowMeta.java b/engine/src/main/java/org/pentaho/di/trans/steps/detectlastrow/DetectLastRowMeta.java index 719989698b81..27e607b83ce8 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/detectlastrow/DetectLastRowMeta.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/detectlastrow/DetectLastRowMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -24,6 +24,7 @@ import java.util.List; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.CheckResult; import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.database.DatabaseMeta; @@ -89,7 +90,8 @@ public void setDefault() { resultfieldname = "result"; } - public void getFields( RowMetaInterface row, String name, RowMetaInterface[] info, StepMeta nextStep, + @Override + public void getFields( Bowl bowl, RowMetaInterface row, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { if ( !Utils.isEmpty( resultfieldname ) ) { diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/dimensionlookup/DimensionLookup.java b/engine/src/main/java/org/pentaho/di/trans/steps/dimensionlookup/DimensionLookup.java index 8cccdf223976..aef7210dc13c 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/dimensionlookup/DimensionLookup.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/dimensionlookup/DimensionLookup.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2018 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -124,7 +124,8 @@ public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws data.inputRowMeta = getInputRowMeta().clone(); data.outputRowMeta = getInputRowMeta().clone(); - meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); + meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository, + metaStore ); // Get the fields that need conversion to normal storage... // Modify the storage type of the input data... diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/dimensionlookup/DimensionLookupMeta.java b/engine/src/main/java/org/pentaho/di/trans/steps/dimensionlookup/DimensionLookupMeta.java index 4433e2df454c..8e4eefa0bf4a 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/dimensionlookup/DimensionLookupMeta.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/dimensionlookup/DimensionLookupMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2018 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -28,6 +28,7 @@ import java.util.Date; import java.util.List; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.CheckResult; import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.Const; @@ -742,7 +743,7 @@ public void setDefault() { } @Override - public void getFields( RowMetaInterface row, String name, RowMetaInterface[] info, StepMeta nextStep, + public void getFields( Bowl bowl, RowMetaInterface row, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { // Change all the fields to normal storage, this is the fastest way to handle lazy conversion. diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/dummytrans/DummyTransMeta.java b/engine/src/main/java/org/pentaho/di/trans/steps/dummytrans/DummyTransMeta.java index c46aefedbb0b..a154965ecc45 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/dummytrans/DummyTransMeta.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/dummytrans/DummyTransMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -24,6 +24,7 @@ import java.util.List; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.CheckResult; import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.database.DatabaseMeta; @@ -78,7 +79,8 @@ public void readRep( Repository rep, IMetaStore metaStore, ObjectId id_step, Lis public void saveRep( Repository rep, IMetaStore metaStore, ObjectId id_transformation, ObjectId id_step ) throws KettleException { } - public void getFields( RowMetaInterface rowMeta, String origin, RowMetaInterface[] info, StepMeta nextStep, + @Override + public void getFields( Bowl bowl, RowMetaInterface rowMeta, String origin, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { // Default: nothing changes to rowMeta } diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/dynamicsqlrow/DynamicSQLRow.java b/engine/src/main/java/org/pentaho/di/trans/steps/dynamicsqlrow/DynamicSQLRow.java index 2310d62853ed..670872825a79 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/dynamicsqlrow/DynamicSQLRow.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/dynamicsqlrow/DynamicSQLRow.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -22,6 +22,7 @@ package org.pentaho.di.trans.steps.dynamicsqlrow; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.Const; import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.core.row.RowDataUtil; @@ -58,8 +59,8 @@ private synchronized void lookupValues( RowMetaInterface rowMeta, Object[] rowDa first = false; data.outputRowMeta = rowMeta.clone(); meta.getFields( - data.outputRowMeta, getStepname(), new RowMetaInterface[] { meta.getTableFields(), }, null, this, - repository, metaStore ); + getTransMeta().getBowl(), data.outputRowMeta, getStepname(), new RowMetaInterface[] { meta.getTableFields(), }, + null, this, repository, metaStore ); loadFromBuffer = false; } diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/dynamicsqlrow/DynamicSQLRowMeta.java b/engine/src/main/java/org/pentaho/di/trans/steps/dynamicsqlrow/DynamicSQLRowMeta.java index 8f8086593712..1987c2a2676b 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/dynamicsqlrow/DynamicSQLRowMeta.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/dynamicsqlrow/DynamicSQLRowMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -24,6 +24,7 @@ import java.util.List; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.CheckResult; import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.Const; @@ -218,7 +219,8 @@ public void setDefault() { queryonlyonchange = false; } - public void getFields( RowMetaInterface row, String name, RowMetaInterface[] info, StepMeta nextStep, + @Override + public void getFields( Bowl bowl, RowMetaInterface row, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { if ( databaseMeta == null ) { @@ -407,7 +409,8 @@ public void analyseImpact( List impact, TransMeta transMeta, Ste IMetaStore metaStore ) throws KettleStepException { RowMetaInterface out = prev.clone(); - getFields( out, stepMeta.getName(), new RowMetaInterface[] { info, }, null, transMeta, repository, metaStore ); + getFields( transMeta.getBowl(), out, stepMeta.getName(), new RowMetaInterface[] { info, }, null, transMeta, + repository, metaStore ); if ( out != null ) { for ( int i = 0; i < out.size(); i++ ) { ValueMetaInterface outvalue = out.getValueMeta( i ); diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/execprocess/ExecProcess.java b/engine/src/main/java/org/pentaho/di/trans/steps/execprocess/ExecProcess.java index 8a30b8f395d0..711eb80390bf 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/execprocess/ExecProcess.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/execprocess/ExecProcess.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2018 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -79,7 +79,8 @@ public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws data.previousRowMeta = getInputRowMeta().clone(); data.NrPrevFields = data.previousRowMeta.size(); data.outputRowMeta = data.previousRowMeta; - meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); + meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository, + metaStore ); // Check is process field is provided if ( Utils.isEmpty( meta.getProcessField() ) ) { diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/execprocess/ExecProcessMeta.java b/engine/src/main/java/org/pentaho/di/trans/steps/execprocess/ExecProcessMeta.java index babd05cdd54f..cfe84562d47a 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/execprocess/ExecProcessMeta.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/execprocess/ExecProcessMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -24,6 +24,7 @@ import java.util.List; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.CheckResult; import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.Const; @@ -199,8 +200,8 @@ public void setDefault() { } @Override - public void getFields( RowMetaInterface inputRowMeta, String name, RowMetaInterface[] info, StepMeta nextStep, - VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { + public void getFields( Bowl bowl, RowMetaInterface inputRowMeta, String name, RowMetaInterface[] info, + StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { // Output fields (String) String realOutputFieldname = space.environmentSubstitute( resultfieldname ); if ( !Utils.isEmpty( realOutputFieldname ) ) { diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/execsqlrow/ExecSQLRow.java b/engine/src/main/java/org/pentaho/di/trans/steps/execsqlrow/ExecSQLRow.java index f11d1fa8e2de..3ce073fc9992 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/execsqlrow/ExecSQLRow.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/execsqlrow/ExecSQLRow.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -103,7 +103,8 @@ public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws first = false; data.outputRowMeta = getInputRowMeta().clone(); - meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); + meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository, + metaStore ); // Check is SQL field is provided if ( Utils.isEmpty( meta.getSqlFieldName() ) ) { @@ -134,7 +135,7 @@ public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws if ( log.isDebug() ) { logDebug( BaseMessages.getString( PKG, "ExecSQLRow.Log.ExecutingSQLFromFile", sql ) ); } - data.result = data.db.execStatementsFromFile( sql, meta.IsSendOneStatement() ); + data.result = data.db.execStatementsFromFile( getTransMeta().getBowl(), sql, meta.IsSendOneStatement() ); } else { if ( log.isDebug() ) { logDebug( BaseMessages.getString( PKG, "ExecSQLRow.Log.ExecutingSQLScript" ) + Const.CR + sql ); diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/execsqlrow/ExecSQLRowMeta.java b/engine/src/main/java/org/pentaho/di/trans/steps/execsqlrow/ExecSQLRowMeta.java index 32858a812219..f5e76013f49b 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/execsqlrow/ExecSQLRowMeta.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/execsqlrow/ExecSQLRowMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2018 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -24,6 +24,7 @@ import java.util.List; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.CheckResult; import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.Const; @@ -283,7 +284,8 @@ public void setDefault() { sendOneStatement = true; } - public void getFields( RowMetaInterface r, String name, RowMetaInterface[] info, StepMeta nextStep, + @Override + public void getFields( Bowl bowl, RowMetaInterface r, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { RowMetaAndData add = ExecSQL.getResultRow( new Result(), getUpdateField(), getInsertField(), getDeleteField(), getReadField() ); diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/fieldschangesequence/FieldsChangeSequence.java b/engine/src/main/java/org/pentaho/di/trans/steps/fieldschangesequence/FieldsChangeSequence.java index c7a04e485863..1c0e2011f474 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/fieldschangesequence/FieldsChangeSequence.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/fieldschangesequence/FieldsChangeSequence.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -70,7 +70,8 @@ public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws data.previousMeta = getInputRowMeta().clone(); data.nextIndexField = data.previousMeta.size(); data.outputRowMeta = getInputRowMeta().clone(); - meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); + meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository, + metaStore ); if ( meta.getFieldName() == null || meta.getFieldName().length > 0 ) { data.fieldnr = meta.getFieldName().length; diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/fieldschangesequence/FieldsChangeSequenceMeta.java b/engine/src/main/java/org/pentaho/di/trans/steps/fieldschangesequence/FieldsChangeSequenceMeta.java index 84dc332d785a..710336d5c142 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/fieldschangesequence/FieldsChangeSequenceMeta.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/fieldschangesequence/FieldsChangeSequenceMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -24,6 +24,7 @@ import java.util.List; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.CheckResult; import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.Const; @@ -222,7 +223,7 @@ public void saveRep( Repository rep, IMetaStore metaStore, ObjectId id_transform } @Override - public void getFields( RowMetaInterface r, String name, RowMetaInterface[] info, StepMeta nextStep, + public void getFields( Bowl bowl, RowMetaInterface r, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) { if ( !Utils.isEmpty( resultfieldName ) ) { ValueMetaInterface v = new ValueMetaInteger( resultfieldName ); diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/fieldsplitter/FieldSplitter.java b/engine/src/main/java/org/pentaho/di/trans/steps/fieldsplitter/FieldSplitter.java index 02322316d10f..81b96892ffad 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/fieldsplitter/FieldSplitter.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/fieldsplitter/FieldSplitter.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -77,7 +77,8 @@ private Object[] splitField( Object[] r ) throws KettleException { // prepare the outputMeta // data.outputMeta = getInputRowMeta().clone(); - meta.getFields( data.outputMeta, getStepname(), null, null, this, repository, metaStore ); + meta.getFields( getTransMeta().getBowl(), data.outputMeta, getStepname(), null, null, this, repository, + metaStore ); // Now create objects to do string to data type conversion... // diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/fieldsplitter/FieldSplitterMeta.java b/engine/src/main/java/org/pentaho/di/trans/steps/fieldsplitter/FieldSplitterMeta.java index da1e450e00da..aa88b64d3b4e 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/fieldsplitter/FieldSplitterMeta.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/fieldsplitter/FieldSplitterMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -25,6 +25,7 @@ import java.util.List; import org.apache.commons.lang.ArrayUtils; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.CheckResult; import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.Const; @@ -408,7 +409,8 @@ public int getFieldsCount() { return count; } - public void getFields( RowMetaInterface r, String name, RowMetaInterface[] info, StepMeta nextStep, + @Override + public void getFields( Bowl bowl, RowMetaInterface r, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { // Remove the field to split int idx = r.indexOfValue( getSplitField() ); diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/file/BaseFileInputStep.java b/engine/src/main/java/org/pentaho/di/trans/steps/file/BaseFileInputStep.java index c5f9f58e9a7a..e45bf0b57101 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/file/BaseFileInputStep.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/file/BaseFileInputStep.java @@ -249,7 +249,8 @@ protected void prepareToRowProcessing() throws KettleException { } // get the metadata populated. Simple and easy. - meta.getFields( data.outputRowMeta, getStepname(), infoStep, null, this, repository, metaStore ); + meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), infoStep, null, this, repository, + metaStore ); // Create convert meta-data objects that will contain Date & Number formatters // data.convertRowMeta = data.outputRowMeta.cloneToType( ValueMetaInterface.TYPE_STRING ); diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/fileexists/FileExists.java b/engine/src/main/java/org/pentaho/di/trans/steps/fileexists/FileExists.java index dc8dcd2570e9..b721445fe5a0 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/fileexists/FileExists.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/fileexists/FileExists.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -80,7 +80,8 @@ public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws data.previousRowMeta = getInputRowMeta().clone(); data.NrPrevFields = data.previousRowMeta.size(); data.outputRowMeta = data.previousRowMeta; - meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); + meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository, + metaStore ); // Check is tablename field is provided if ( Utils.isEmpty( meta.getDynamicFilenameField() ) ) { @@ -108,7 +109,7 @@ public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws // get filename String filename = data.previousRowMeta.getString( r, data.indexOfFileename ); if ( !Utils.isEmpty( filename ) ) { - data.file = KettleVFS.getFileObject( filename, getTransMeta() ); + data.file = KettleVFS.getInstance( getTransMeta().getBowl() ).getFileObject( filename, getTransMeta() ); // Check if file fileexists = data.file.exists(); diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/fileexists/FileExistsMeta.java b/engine/src/main/java/org/pentaho/di/trans/steps/fileexists/FileExistsMeta.java index aa9853a0ae31..bda5ae531bbb 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/fileexists/FileExistsMeta.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/fileexists/FileExistsMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -24,6 +24,7 @@ import java.util.List; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.CheckResult; import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.database.DatabaseMeta; @@ -153,7 +154,8 @@ public void setDefault() { addresultfilenames = false; } - public void getFields( RowMetaInterface inputRowMeta, String name, RowMetaInterface[] info, StepMeta nextStep, + @Override + public void getFields( Bowl bowl, RowMetaInterface inputRowMeta, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { // Output fields (String) if ( !Utils.isEmpty( resultfieldname ) ) { diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/fileinput/text/TextFileInputMeta.java b/engine/src/main/java/org/pentaho/di/trans/steps/fileinput/text/TextFileInputMeta.java index f2012a69e10b..c93fb7f705b1 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/fileinput/text/TextFileInputMeta.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/fileinput/text/TextFileInputMeta.java @@ -537,7 +537,7 @@ public void setDefault() { } @Override - public void getFields( RowMetaInterface row, String name, RowMetaInterface[] info, StepMeta nextStep, + public void getFields( Bowl bowl, RowMetaInterface row, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { if ( !inputFiles.passingThruFields ) { // all incoming fields are not transmitted ! @@ -673,9 +673,9 @@ public void getFields( RowMetaInterface row, String name, RowMetaInterface[] inf @Override @Deprecated - public void getFields( RowMetaInterface inputRowMeta, String name, RowMetaInterface[] info, StepMeta nextStep, - VariableSpace space ) throws KettleStepException { - getFields( inputRowMeta, name, info, nextStep, space, null, null ); + public void getFields( Bowl bowl, RowMetaInterface inputRowMeta, String name, RowMetaInterface[] info, + StepMeta nextStep, VariableSpace space ) throws KettleStepException { + getFields( bowl, inputRowMeta, name, info, nextStep, space, null, null ); } @Override @@ -1241,7 +1241,7 @@ public int getFileTypeNr() { * @return the filename of the exported resource */ @Override - public String exportResources( VariableSpace space, Map definitions, + public String exportResources( Bowl bowl, VariableSpace space, Map definitions, ResourceNamingInterface resourceNamingInterface, Repository repository, IMetaStore metaStore ) throws KettleException { try { @@ -1259,7 +1259,7 @@ public String exportResources( VariableSpace space, Map definitions, - ResourceNamingInterface resourceNamingInterface, Repository repository, IMetaStore metaStore ) throws KettleException { + @Override + public String exportResources( Bowl bowl, VariableSpace space, Map definitions, + ResourceNamingInterface resourceNamingInterface, Repository repository, IMetaStore metaStore ) + throws KettleException { try { // The object that we're modifying here is a copy of the original! // So let's change the filename from relative to absolute by grabbing the file object... @@ -578,7 +582,8 @@ public String exportResources( VariableSpace space, Map definitions, + public String exportResources( Bowl bowl, VariableSpace space, Map definitions, ResourceNamingInterface resourceNamingInterface, Repository repository, IMetaStore metaStore ) throws KettleException { try { // The object that we're modifying here is a copy of the original! @@ -818,7 +818,8 @@ public String exportResources( VariableSpace space, Map remarks, TransMeta transMeta, Step remarks.add( cr ); } - FileInputList fileInputList = getFiles( transMeta ); + FileInputList fileInputList = getFiles( transMeta.getBowl(), transMeta ); if ( fileInputList == null || fileInputList.getFiles().size() == 0 ) { cr = @@ -668,8 +670,10 @@ public StepDataInterface getStepData() { * * @return the filename of the exported resource */ - public String exportResources( VariableSpace space, Map definitions, - ResourceNamingInterface resourceNamingInterface, Repository repository, IMetaStore metaStore ) throws KettleException { + @Override + public String exportResources( Bowl bowl, VariableSpace space, Map definitions, + ResourceNamingInterface resourceNamingInterface, Repository repository, IMetaStore metaStore ) + throws KettleException { try { // The object that we're modifying here is a copy of the original! // So let's change the filename from relative to absolute by grabbing the file object... @@ -677,7 +681,8 @@ public String exportResources( VariableSpace space, Map remarks, TransMeta transMeta, StepMeta stepMeta, @@ -472,7 +475,7 @@ public void check( List remarks, TransMeta transMeta, Step } remarks.add( cr ); // check specified folder names - FileInputList fileList = getFolderList( transMeta ); + FileInputList fileList = getFolderList( transMeta.getBowl(), transMeta ); if ( fileList.nrOfFiles() == 0 ) { cr = new CheckResult( CheckResultInterface.TYPE_RESULT_ERROR, BaseMessages.getString( @@ -514,7 +517,8 @@ public StepDataInterface getStepData() { * * @return the filename of the exported resource */ - public String exportResources( VariableSpace space, Map definitions, + @Override + public String exportResources( Bowl bowl, VariableSpace space, Map definitions, ResourceNamingInterface resourceNamingInterface, Repository repository, IMetaStore metaStore ) throws KettleException { try { // The object that we're modifying here is a copy of the original! @@ -523,7 +527,8 @@ public String exportResources( VariableSpace space, Map remarks, TransMeta transMeta, StepMeta stepMeta, diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/insertupdate/InsertUpdate.java b/engine/src/main/java/org/pentaho/di/trans/steps/insertupdate/InsertUpdate.java index 0e47607f3e0f..c29cf2a0e0c2 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/insertupdate/InsertUpdate.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/insertupdate/InsertUpdate.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -194,7 +194,8 @@ public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws first = false; data.outputRowMeta = getInputRowMeta().clone(); - meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); + meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository, + metaStore ); data.schemaTable = meta.getDatabaseMeta().getQuotedSchemaTableCombination( diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/insertupdate/InsertUpdateMeta.java b/engine/src/main/java/org/pentaho/di/trans/steps/insertupdate/InsertUpdateMeta.java index 0a543dc6d80c..ee3c7f3c0c47 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/insertupdate/InsertUpdateMeta.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/insertupdate/InsertUpdateMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2023 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -25,6 +25,7 @@ import java.util.Arrays; import java.util.List; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.CheckResult; import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.Const; @@ -427,7 +428,8 @@ public void saveRep( Repository rep, IMetaStore metaStore, ObjectId id_transform } } - public void getFields( RowMetaInterface rowMeta, String origin, RowMetaInterface[] info, StepMeta nextStep, + @Override + public void getFields( Bowl bowl, RowMetaInterface rowMeta, String origin, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { // Default: nothing changes to rowMeta } diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/janino/Janino.java b/engine/src/main/java/org/pentaho/di/trans/steps/janino/Janino.java index a038d5d0a2ab..b8fc04caa5f1 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/janino/Janino.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/janino/Janino.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -75,7 +75,8 @@ public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws first = false; data.outputRowMeta = getInputRowMeta().clone(); - meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); + meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository, + metaStore ); // Calculate replace indexes... // diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/janino/JaninoMeta.java b/engine/src/main/java/org/pentaho/di/trans/steps/janino/JaninoMeta.java index a0bf8156f618..f94d1a74cf1a 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/janino/JaninoMeta.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/janino/JaninoMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -22,6 +22,7 @@ package org.pentaho.di.trans.steps.janino; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.CheckResult; import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.Const; @@ -148,7 +149,7 @@ public void saveRep( Repository rep, IMetaStore metaStore, ObjectId id_transform } @Override - public void getFields( RowMetaInterface row, String name, RowMetaInterface[] info, StepMeta nextStep, + public void getFields( Bowl bowl, RowMetaInterface row, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { for ( int i = 0; i < formula.length; i++ ) { JaninoMetaFunction fn = formula[i]; diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/javafilter/JavaFilter.java b/engine/src/main/java/org/pentaho/di/trans/steps/javafilter/JavaFilter.java index 0e560aa0f70e..a829841153a4 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/javafilter/JavaFilter.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/javafilter/JavaFilter.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -74,7 +74,8 @@ public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws first = false; data.outputRowMeta = getInputRowMeta().clone(); - meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); + meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository, + metaStore ); // Cache the position of the RowSet for the output. // diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/jobexecutor/JobExecutor.java b/engine/src/main/java/org/pentaho/di/trans/steps/jobexecutor/JobExecutor.java index 839475071029..3df9aa0f330c 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/jobexecutor/JobExecutor.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/jobexecutor/JobExecutor.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2020 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -110,18 +110,18 @@ public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws data.resultFilesOutputRowMeta = data.inputRowMeta.clone(); if ( meta.getExecutionResultTargetStepMeta() != null ) { - meta.getFields( data.executionResultsOutputRowMeta, getStepname(), null, meta + meta.getFields( getTransMeta().getBowl(), data.executionResultsOutputRowMeta, getStepname(), null, meta .getExecutionResultTargetStepMeta(), this, repository, metaStore ); data.executionResultRowSet = findOutputRowSet( meta.getExecutionResultTargetStepMeta().getName() ); } if ( meta.getResultRowsTargetStepMeta() != null ) { - meta.getFields( + meta.getFields( getTransMeta().getBowl(), data.resultRowsOutputRowMeta, getStepname(), null, meta.getResultRowsTargetStepMeta(), this, repository, metaStore ); data.resultRowsRowSet = findOutputRowSet( meta.getResultRowsTargetStepMeta().getName() ); } if ( meta.getResultFilesTargetStepMeta() != null ) { - meta.getFields( + meta.getFields( getTransMeta().getBowl(), data.resultFilesOutputRowMeta, getStepname(), null, meta.getResultFilesTargetStepMeta(), this, repository, metaStore ); data.resultFilesRowSet = findOutputRowSet( meta.getResultFilesTargetStepMeta().getName() ); @@ -396,7 +396,7 @@ public boolean init( StepMetaInterface smi, StepDataInterface sdi ) { // meta.setRepository( getTransMeta().getRepository() ); - data.executorJobMeta = JobExecutorMeta.loadJobMeta( meta, meta.getRepository(), this ); + data.executorJobMeta = JobExecutorMeta.loadJobMeta( getTransMeta().getBowl(), meta, meta.getRepository(), this ); // Do we have a job at all? // diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/jobexecutor/JobExecutorMeta.java b/engine/src/main/java/org/pentaho/di/trans/steps/jobexecutor/JobExecutorMeta.java index 9b0915f6029d..9a36526473ce 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/jobexecutor/JobExecutorMeta.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/jobexecutor/JobExecutorMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2021 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -24,6 +24,7 @@ import org.pentaho.di.base.IMetaFileLoader; import org.pentaho.di.base.MetaFileLoaderImpl; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.CheckResult; import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.Const; @@ -493,7 +494,7 @@ public void setDefault() { } @Override - public void getFields( RowMetaInterface row, String origin, RowMetaInterface[] info, StepMeta nextStep, + public void getFields( Bowl bowl, RowMetaInterface row, String origin, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { row.clear(); @@ -602,16 +603,16 @@ public String[] getTargetSteps() { return targetSteps.toArray( new String[targetSteps.size()] ); } - public static final synchronized JobMeta loadJobMeta( JobExecutorMeta executorMeta, Repository rep, + public static final synchronized JobMeta loadJobMeta( Bowl bowl, JobExecutorMeta executorMeta, Repository rep, VariableSpace space ) throws KettleException { - return loadJobMeta( executorMeta, rep, null, space ); + return loadJobMeta( bowl, executorMeta, rep, null, space ); } - public static final synchronized JobMeta loadJobMeta( JobExecutorMeta executorMeta, Repository rep, + public static final synchronized JobMeta loadJobMeta( Bowl bowl, JobExecutorMeta executorMeta, Repository rep, IMetaStore metaStore, VariableSpace space ) throws KettleException { IMetaFileLoader metaFileLoader = new MetaFileLoaderImpl<>( executorMeta, executorMeta.specificationMethod ); - JobMeta mappingJobMeta = metaFileLoader.getMetaForStep( rep, metaStore, space ); + JobMeta mappingJobMeta = metaFileLoader.getMetaForStep( bowl, rep, metaStore, space ); // Pass some important information to the mapping transformation metadata: @@ -701,13 +702,13 @@ public List getResourceDependencies( TransMeta transMeta, Ste * @return JobMeta * @throws KettleException */ - JobMeta loadJobMetaProxy( JobExecutorMeta executorMeta, Repository rep, - VariableSpace space ) throws KettleException { - return loadJobMeta( executorMeta, rep, space ); + JobMeta loadJobMetaProxy( Bowl bowl, JobExecutorMeta executorMeta, Repository rep, + VariableSpace space ) throws KettleException { + return loadJobMeta( bowl, executorMeta, rep, space ); } @Override - public String exportResources( VariableSpace space, Map definitions, + public String exportResources( Bowl bowl, VariableSpace space, Map definitions, ResourceNamingInterface resourceNamingInterface, Repository repository, IMetaStore metaStore ) throws KettleException { try { // Try to load the transformation from repository or file. @@ -718,14 +719,14 @@ public String exportResources( VariableSpace space, Map remarks, TransMeta transMeta, Step remarks.add( cr ); } - FileInputList fileInputList = getFiles( transMeta ); + FileInputList fileInputList = getFiles( transMeta.getBowl(), transMeta ); if ( fileInputList == null || fileInputList.getFiles().size() == 0 ) { cr = new CheckResult( CheckResult.TYPE_RESULT_ERROR, BaseMessages.getString( @@ -1107,7 +1109,8 @@ public boolean supportsErrorHandling() { * * @return the filename of the exported resource */ - public String exportResources( VariableSpace space, Map definitions, + @Override + public String exportResources( Bowl bowl, VariableSpace space, Map definitions, ResourceNamingInterface resourceNamingInterface, Repository repository, IMetaStore metaStore ) throws KettleException { try { // The object that we're modifying here is a copy of the original! @@ -1115,7 +1118,8 @@ public String exportResources( VariableSpace space, Map remarks, TransMeta transMeta, Step remarks.add( cr ); } } else { - FileInputList fileInputList = getFiles( transMeta ); + FileInputList fileInputList = getFiles( transMeta.getBowl(), transMeta ); if ( fileInputList == null || fileInputList.getFiles().size() == 0 ) { cr = @@ -1065,7 +1067,8 @@ public void check( List remarks, TransMeta transMeta, Step * * @return the filename of the exported resource */ - public String exportResources( VariableSpace space, Map definitions, + @Override + public String exportResources( Bowl bowl, VariableSpace space, Map definitions, ResourceNamingInterface resourceNamingInterface, Repository repository, IMetaStore metaStore ) throws KettleException { try { // The object that we're modifying here is a copy of the original! @@ -1073,7 +1076,8 @@ public String exportResources( VariableSpace space, Map remarks, TransMeta transMeta, StepMeta stepMeta, @@ -898,8 +900,9 @@ public boolean[] isReferencedObjectEnabled() { } @Deprecated - public Object loadReferencedObject( int index, Repository rep, VariableSpace space ) throws KettleException { - return loadReferencedObject( index, rep, null, space ); + public Object loadReferencedObject( Bowl bowl, int index, Repository rep, VariableSpace space ) + throws KettleException { + return loadReferencedObject( bowl, index, rep, null, space ); } /** @@ -916,8 +919,9 @@ public Object loadReferencedObject( int index, Repository rep, VariableSpace spa * @return the referenced object once loaded * @throws KettleException */ - public Object loadReferencedObject( int index, Repository rep, IMetaStore metaStore, VariableSpace space ) throws KettleException { - return loadMappingMeta( this, rep, metaStore, space ); + public Object loadReferencedObject( Bowl bowl, int index, Repository rep, IMetaStore metaStore, VariableSpace space ) + throws KettleException { + return loadMappingMeta( bowl, this, rep, metaStore, space ); } public IMetaStore getMetaStore() { diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/mappinginput/MappingInput.java b/engine/src/main/java/org/pentaho/di/trans/steps/mappinginput/MappingInput.java index b7966b762ae1..7ac7b8fe19e1 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/mappinginput/MappingInput.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/mappinginput/MappingInput.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2018 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -147,7 +147,8 @@ public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws } // Fill the output row meta with the processed fields - meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); + meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository, + metaStore ); if ( meta.isSelectingAndSortingUnspecifiedFields() ) { // diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/mappinginput/MappingInputMeta.java b/engine/src/main/java/org/pentaho/di/trans/steps/mappinginput/MappingInputMeta.java index 7e541b4d6229..b5ffee61fdae 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/mappinginput/MappingInputMeta.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/mappinginput/MappingInputMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -26,6 +26,7 @@ import java.util.Collections; import java.util.List; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.CheckResult; import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.Const; @@ -232,7 +233,8 @@ public void setDefault() { } } - public void getFields( RowMetaInterface row, String origin, RowMetaInterface[] info, StepMeta nextStep, + @Override + public void getFields( Bowl bowl, RowMetaInterface row, String origin, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { // Row should normally be empty when we get here. // That is because there is no previous step to this mapping input step from the viewpoint of this single diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/mappingoutput/MappingOutput.java b/engine/src/main/java/org/pentaho/di/trans/steps/mappingoutput/MappingOutput.java index 8c31bc570006..f6eef4e11d09 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/mappingoutput/MappingOutput.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/mappingoutput/MappingOutput.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2018 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -71,7 +71,8 @@ public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws data.outputRowMeta = getInputRowMeta().clone(); meta.setOutputValueRenames( data.outputValueRenames ); meta.setInputValueRenames( data.inputValueRenames ); - meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); + meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository, + metaStore ); // // Wait until the parent transformation has started completely. diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/mappingoutput/MappingOutputMeta.java b/engine/src/main/java/org/pentaho/di/trans/steps/mappingoutput/MappingOutputMeta.java index e43b20e814b0..b5ec125507ce 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/mappingoutput/MappingOutputMeta.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/mappingoutput/MappingOutputMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2018 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -25,6 +25,7 @@ import java.util.ArrayList; import java.util.List; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.CheckResult; import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.exception.KettleStepException; @@ -75,7 +76,8 @@ public void setDefault() { allocate( nrfields ); } - public void getFields( RowMetaInterface r, String name, RowMetaInterface[] info, StepMeta nextStep, + @Override + public void getFields( Bowl bowl, RowMetaInterface r, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { // It's best that this method doesn't change anything by itself. // Eventually it's the Mapping step that's going to tell this step how to behave meta-data wise. diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/memgroupby/MemoryGroupBy.java b/engine/src/main/java/org/pentaho/di/trans/steps/memgroupby/MemoryGroupBy.java index 584b4a497594..0d07a3ad13fd 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/memgroupby/MemoryGroupBy.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/memgroupby/MemoryGroupBy.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2019 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -112,7 +112,8 @@ public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws } data.outputRowMeta = data.inputRowMeta.clone(); - meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); + meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository, + metaStore ); // Do all the work we can beforehand // Calculate indexes, loop up fields, etc. diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/memgroupby/MemoryGroupByMeta.java b/engine/src/main/java/org/pentaho/di/trans/steps/memgroupby/MemoryGroupByMeta.java index 4ccb9dcbfb0f..f4ced93d55d4 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/memgroupby/MemoryGroupByMeta.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/memgroupby/MemoryGroupByMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -24,6 +24,7 @@ import java.util.List; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.CheckResult; import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.Const; @@ -332,7 +333,7 @@ public void setDefault() { } @Override - public void getFields( RowMetaInterface r, String origin, RowMetaInterface[] info, StepMeta nextStep, + public void getFields( Bowl bowl, RowMetaInterface r, String origin, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) { // Check compatibility mode boolean compatibilityMode = ValueMetaBase.convertStringToBoolean( diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/mergejoin/MergeJoinMeta.java b/engine/src/main/java/org/pentaho/di/trans/steps/mergejoin/MergeJoinMeta.java index 4c0fee331977..09a05d697423 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/mergejoin/MergeJoinMeta.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/mergejoin/MergeJoinMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2018 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -22,6 +22,7 @@ package org.pentaho.di.trans.steps.mergejoin; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.CheckResult; import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.Const; @@ -286,7 +287,8 @@ public void check( List remarks, TransMeta transMeta, Step remarks.add( cr ); } - public void getFields( RowMetaInterface r, String name, RowMetaInterface[] info, StepMeta nextStep, + @Override + public void getFields( Bowl bowl, RowMetaInterface r, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { // We don't have any input fields here in "r" as they are all info fields. // So we just merge in the info fields. diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/mergerows/MergeRows.java b/engine/src/main/java/org/pentaho/di/trans/steps/mergerows/MergeRows.java index 8cb606c1a646..56ae19513b80 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/mergerows/MergeRows.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/mergerows/MergeRows.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2018 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -144,11 +144,11 @@ public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws if ( data.outputRowMeta == null ) { data.outputRowMeta = new RowMeta(); if ( data.one != null ) { - meta.getFields( + meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), new RowMetaInterface[] { data.oneRowSet.getRowMeta() }, null, this, repository, metaStore ); } else { - meta.getFields( + meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), new RowMetaInterface[] { data.twoRowSet.getRowMeta() }, null, this, repository, metaStore ); } diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/mergerows/MergeRowsMeta.java b/engine/src/main/java/org/pentaho/di/trans/steps/mergerows/MergeRowsMeta.java index 924348def579..77eb382630bd 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/mergerows/MergeRowsMeta.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/mergerows/MergeRowsMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2018 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -22,6 +22,7 @@ package org.pentaho.di.trans.steps.mergerows; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.CheckResult; import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.Const; @@ -286,7 +287,7 @@ public String[] getTargetSteps() { } @Override - public void getFields( RowMetaInterface r, String name, RowMetaInterface[] info, StepMeta nextStep, + public void getFields( Bowl bowl, RowMetaInterface r, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { // We don't have any input fields here in "r" as they are all info fields. // So we just merge in the info fields. diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/multimerge/MultiMergeJoinMeta.java b/engine/src/main/java/org/pentaho/di/trans/steps/multimerge/MultiMergeJoinMeta.java index 4ac93c7c9ae6..427ce2466112 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/multimerge/MultiMergeJoinMeta.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/multimerge/MultiMergeJoinMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -23,6 +23,7 @@ package org.pentaho.di.trans.steps.multimerge; import org.apache.commons.lang.ArrayUtils; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.CheckResult; import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.Const; @@ -293,7 +294,7 @@ public void check( List remarks, TransMeta transMeta, Step } @Override - public void getFields( RowMetaInterface r, String name, RowMetaInterface[] info, StepMeta nextStep, + public void getFields( Bowl bowl, RowMetaInterface r, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { // We don't have any input fields here in "r" as they are all info fields. // So we just merge in the info fields. diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/normaliser/Normaliser.java b/engine/src/main/java/org/pentaho/di/trans/steps/normaliser/Normaliser.java index 29725c54f78d..38515844e64f 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/normaliser/Normaliser.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/normaliser/Normaliser.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -75,7 +75,8 @@ public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws data.inputRowMeta = getInputRowMeta(); data.outputRowMeta = data.inputRowMeta.clone(); - meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); + meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository, + metaStore ); int normFieldsLength = meta.getNormaliserFields().length; data.typeToFieldIndex = new HashMap<>(); String typeValue; diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/normaliser/NormaliserMeta.java b/engine/src/main/java/org/pentaho/di/trans/steps/normaliser/NormaliserMeta.java index 213cf25c4e0b..b8ed4dbeec95 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/normaliser/NormaliserMeta.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/normaliser/NormaliserMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -27,6 +27,7 @@ import java.util.List; import java.util.Set; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.CheckResult; import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.Const; @@ -197,7 +198,7 @@ public void setDefault() { } @Override - public void getFields( RowMetaInterface row, String name, RowMetaInterface[] info, StepMeta nextStep, + public void getFields( Bowl bowl, RowMetaInterface row, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { // Get a unique list of the occurrences of the type diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/nullif/NullIfMeta.java b/engine/src/main/java/org/pentaho/di/trans/steps/nullif/NullIfMeta.java index 53a06dc82cd5..f78e118f246f 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/nullif/NullIfMeta.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/nullif/NullIfMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2019 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -24,6 +24,7 @@ import java.util.List; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.CheckResult; import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.Const; @@ -178,7 +179,8 @@ public void setDefault() { } } - public void getFields( RowMetaInterface r, String name, RowMetaInterface[] info, StepMeta nextStep, + @Override + public void getFields( Bowl bowl, RowMetaInterface r, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) { if ( r == null ) { r = new RowMeta(); // give back values diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/numberrange/NumberRange.java b/engine/src/main/java/org/pentaho/di/trans/steps/numberrange/NumberRange.java index 4bee43a04574..862f4b9585b0 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/numberrange/NumberRange.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/numberrange/NumberRange.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -64,7 +64,8 @@ public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws numberRange = new NumberRangeSet( meta.getRules(), meta.getFallBackValue() ); data.outputRowMeta = getInputRowMeta().clone(); // Prepare output fields - meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); + meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository, + metaStore ); // Find column numbers data.inputColumnNr = data.outputRowMeta.indexOfValue( meta.getInputField() ); diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/numberrange/NumberRangeMeta.java b/engine/src/main/java/org/pentaho/di/trans/steps/numberrange/NumberRangeMeta.java index 650ddccae1fd..38391ffa97ff 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/numberrange/NumberRangeMeta.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/numberrange/NumberRangeMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -25,6 +25,7 @@ import java.util.LinkedList; import java.util.List; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.CheckResult; import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.Const; @@ -105,7 +106,7 @@ public String getXML() { } @Override - public void getFields( RowMetaInterface row, String name, RowMetaInterface[] info, StepMeta nextStep, + public void getFields( Bowl bowl, RowMetaInterface row, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { ValueMetaInterface mcValue = new ValueMetaString( outputField ); mcValue.setOrigin( name ); diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/olapinput/OlapInputMeta.java b/engine/src/main/java/org/pentaho/di/trans/steps/olapinput/OlapInputMeta.java index 1df354bc09ed..fe25397fc4e6 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/olapinput/OlapInputMeta.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/olapinput/OlapInputMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -24,6 +24,7 @@ import java.util.List; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.Const; import org.pentaho.di.core.util.Utils; @@ -133,7 +134,7 @@ public void setDefault() { } @Override - public void getFields( RowMetaInterface row, String origin, RowMetaInterface[] info, StepMeta nextStep, + public void getFields( Bowl bowl, RowMetaInterface row, String origin, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { RowMetaInterface add = null; diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/parallelgzipcsv/ParGzipCsvInput.java b/engine/src/main/java/org/pentaho/di/trans/steps/parallelgzipcsv/ParGzipCsvInput.java index faf91928d070..e25c46904ca2 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/parallelgzipcsv/ParGzipCsvInput.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/parallelgzipcsv/ParGzipCsvInput.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -70,7 +70,8 @@ public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws first = false; data.outputRowMeta = new RowMeta(); - meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); + meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository, + metaStore ); if ( data.filenames == null ) { // We're expecting the list of filenames from the previous step(s)... @@ -279,7 +280,8 @@ private boolean openNextFile() throws KettleException { // Open the next one... // logBasic( "Opening file #" + data.filenr + " : " + data.filenames[data.filenr] ); - FileObject fileObject = KettleVFS.getFileObject( data.filenames[data.filenr], getTransMeta() ); + FileObject fileObject = KettleVFS.getInstance( getTransMeta().getBowl() ) + .getFileObject( data.filenames[data.filenr], getTransMeta() ); data.fis = KettleVFS.getInputStream( fileObject ); if ( meta.isLazyConversionActive() ) { diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/parallelgzipcsv/ParGzipCsvInputMeta.java b/engine/src/main/java/org/pentaho/di/trans/steps/parallelgzipcsv/ParGzipCsvInputMeta.java index f8d0a6f0ed5d..05811bc0ec4a 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/parallelgzipcsv/ParGzipCsvInputMeta.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/parallelgzipcsv/ParGzipCsvInputMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -27,6 +27,7 @@ import java.util.Map; import org.apache.commons.vfs2.FileObject; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.CheckResult; import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.Const; @@ -290,7 +291,7 @@ public void saveRep( Repository rep, IMetaStore metaStore, ObjectId id_transform } @Override - public void getFields( RowMetaInterface rowMeta, String origin, RowMetaInterface[] info, StepMeta nextStep, + public void getFields( Bowl bowl, RowMetaInterface rowMeta, String origin, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { try { rowMeta.clear(); // Start with a clean slate, eats the input @@ -695,7 +696,7 @@ public void setEncoding( String encoding ) { * @return the filename of the exported resource */ @Override - public String exportResources( VariableSpace space, Map definitions, + public String exportResources( Bowl bowl, VariableSpace space, Map definitions, ResourceNamingInterface resourceNamingInterface, Repository repository, IMetaStore metaStore ) throws KettleException { try { // The object that we're modifying here is a copy of the original! @@ -706,7 +707,8 @@ public String exportResources( VariableSpace space, Map remarks, TransMeta transMeta, Step remarks.add( cr ); } - FileInputList fileInputList = getFiles( transMeta ); + FileInputList fileInputList = getFiles( transMeta.getBowl(), transMeta ); if ( fileInputList == null || fileInputList.getFiles().size() == 0 ) { cr = @@ -1203,7 +1205,8 @@ public boolean supportsErrorHandling() { * * @return the filename of the exported resource */ - public String exportResources( VariableSpace space, Map definitions, + @Override + public String exportResources( Bowl bowl, VariableSpace space, Map definitions, ResourceNamingInterface resourceNamingInterface, Repository repository, IMetaStore metaStore ) throws KettleException { try { // The object that we're modifying here is a copy of the original! @@ -1212,7 +1215,8 @@ public String exportResources( VariableSpace space, Map definitions, + public String exportResources( Bowl bowl, VariableSpace space, Map definitions, ResourceNamingInterface resourceNamingInterface, Repository repository, IMetaStore metaStore ) throws KettleException { try { // The object that we're modifying here is a copy of the original! @@ -614,7 +615,8 @@ public String exportResources( VariableSpace space, Map remarks = new ArrayList(); diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/rowsfromresult/RowsFromResultMeta.java b/engine/src/main/java/org/pentaho/di/trans/steps/rowsfromresult/RowsFromResultMeta.java index 3697f4c907c9..ec9e6667d324 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/rowsfromresult/RowsFromResultMeta.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/rowsfromresult/RowsFromResultMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -24,6 +24,7 @@ import java.util.List; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.CheckResult; import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.Const; @@ -219,7 +220,8 @@ public void saveRep( Repository rep, IMetaStore metaStore, ObjectId id_transform } } - public void getFields( RowMetaInterface r, String origin, RowMetaInterface[] info, StepMeta nextStep, + @Override + public void getFields( Bowl bowl, RowMetaInterface r, String origin, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { for ( int i = 0; i < this.fieldname.length; i++ ) { ValueMetaInterface v; diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/rowstoresult/RowsToResult.java b/engine/src/main/java/org/pentaho/di/trans/steps/rowstoresult/RowsToResult.java index c9fd255e071a..7363a9eec10d 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/rowstoresult/RowsToResult.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/rowstoresult/RowsToResult.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2019 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -66,7 +66,8 @@ public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws // Add all rows to rows buffer... data.rows.add( new RowMetaAndData( getInputRowMeta(), r ) ); data.outputRowMeta = getInputRowMeta().clone(); - meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); + meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository, + metaStore ); putRow( data.outputRowMeta, r ); // copy row to possible alternate // rowset(s). diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/rowstoresult/RowsToResultMeta.java b/engine/src/main/java/org/pentaho/di/trans/steps/rowstoresult/RowsToResultMeta.java index 37674ae6485a..8586907f98f1 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/rowstoresult/RowsToResultMeta.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/rowstoresult/RowsToResultMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -24,6 +24,7 @@ import java.util.List; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.CheckResult; import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.database.DatabaseMeta; @@ -78,7 +79,8 @@ public void readRep( Repository rep, IMetaStore metaStore, ObjectId id_step, Lis public void saveRep( Repository rep, IMetaStore metaStore, ObjectId id_transformation, ObjectId id_step ) throws KettleException { } - public void getFields( RowMetaInterface rowMeta, String origin, RowMetaInterface[] info, StepMeta nextStep, + @Override + public void getFields( Bowl bowl, RowMetaInterface rowMeta, String origin, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { // Default: nothing changes to rowMeta } diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/samplerows/SampleRows.java b/engine/src/main/java/org/pentaho/di/trans/steps/samplerows/SampleRows.java index bfc63cb8eb7f..da04460f5873 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/samplerows/SampleRows.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/samplerows/SampleRows.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -22,6 +22,7 @@ package org.pentaho.di.trans.steps.samplerows; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.core.row.RowDataUtil; import org.pentaho.di.core.util.Utils; @@ -76,7 +77,8 @@ public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws data.NrPrevFields = data.previousRowMeta.size(); data.outputRowMeta = data.previousRowMeta; if ( data.addlineField ) { - meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); + meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository, + metaStore ); } String[] rangePart = realRange.split( "," ); diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/samplerows/SampleRowsMeta.java b/engine/src/main/java/org/pentaho/di/trans/steps/samplerows/SampleRowsMeta.java index d8831a500658..27bad8703baf 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/samplerows/SampleRowsMeta.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/samplerows/SampleRowsMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -24,6 +24,7 @@ import java.util.List; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.CheckResult; import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.database.DatabaseMeta; @@ -75,7 +76,8 @@ public Object clone() { return retval; } - public void getFields( RowMetaInterface inputRowMeta, String name, RowMetaInterface[] info, StepMeta nextStep, + @Override + public void getFields( Bowl bowl, RowMetaInterface inputRowMeta, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { if ( !Utils.isEmpty( linenumfield ) ) { diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/sasinput/SasInput.java b/engine/src/main/java/org/pentaho/di/trans/steps/sasinput/SasInput.java index 175a4b5ed9c7..1f2c995f95ed 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/sasinput/SasInput.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/sasinput/SasInput.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -96,11 +96,13 @@ public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws // Determine the output row layout // data.outputRowMeta = getInputRowMeta().clone(); - meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); + meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository, + metaStore ); } String rawFilename = getInputRowMeta().getString( fileRowData, meta.getAcceptingField(), null ); - final String filename = KettleVFS.getFilename( KettleVFS.getFileObject( rawFilename ) ); + final String filename = + KettleVFS.getFilename( KettleVFS.getInstance( getTransMeta().getBowl() ).getFileObject( rawFilename ) ); data.helper = new SasInputHelper( filename ); logBasic( BaseMessages.getString( PKG, "SASInput.Log.OpenedSASFile" ) + " : [" + data.helper + "]" ); @@ -152,7 +154,8 @@ public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws // Add this to the result file names... // ResultFile resultFile = - new ResultFile( ResultFile.FILE_TYPE_GENERAL, KettleVFS.getFileObject( filename ), getTransMeta() + new ResultFile( ResultFile.FILE_TYPE_GENERAL, KettleVFS.getInstance( getTransMeta().getBowl() ) + .getFileObject( filename ), getTransMeta() .getName(), getStepname() ); resultFile.setComment( BaseMessages.getString( PKG, "SASInput.ResultFile.Comment" ) ); addResultFile( resultFile ); diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/sasinput/SasInputMeta.java b/engine/src/main/java/org/pentaho/di/trans/steps/sasinput/SasInputMeta.java index 0e67c2203bf4..f2c374d243ee 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/sasinput/SasInputMeta.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/sasinput/SasInputMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -25,6 +25,7 @@ import java.util.ArrayList; import java.util.List; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.CheckResult; import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.database.DatabaseMeta; @@ -99,7 +100,7 @@ public Object clone() { } @Override - public void getFields( RowMetaInterface row, String name, RowMetaInterface[] info, StepMeta nextStep, + public void getFields( Bowl bowl, RowMetaInterface row, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { for ( SasInputField field : outputFields ) { diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/script/Script.java b/engine/src/main/java/org/pentaho/di/trans/steps/script/Script.java index 5e427d85cf29..5303c032a4ed 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/script/Script.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/script/Script.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -139,7 +139,8 @@ private boolean addValues( RowMetaInterface rowMeta, Object[] row ) throws Kettl // What is the output row looking like? // data.outputRowMeta = getInputRowMeta().clone(); - meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); + meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository, + metaStore ); // Determine the indexes of the fields used! // diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/script/ScriptAddedFunctions.java b/engine/src/main/java/org/pentaho/di/trans/steps/script/ScriptAddedFunctions.java index 266216efb7e6..17d8ef1727f3 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/script/ScriptAddedFunctions.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/script/ScriptAddedFunctions.java @@ -3,7 +3,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2018 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -27,6 +27,7 @@ import org.apache.commons.vfs2.FileObject; import org.apache.commons.vfs2.FileType; import org.apache.commons.vfs2.FileUtil; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.Const; import org.pentaho.di.core.database.Database; import org.pentaho.di.core.database.DatabaseMeta; @@ -1680,10 +1681,10 @@ public static String resolveIP( ScriptEngine actualContext, Bindings actualObjec } // Loading additional JS Files inside the JavaScriptCode - public static void LoadScriptFile( ScriptEngine actualContext, Bindings actualObject, Object[] ArgList, + public static void LoadScriptFile( Bowl bowl, ScriptEngine actualContext, Bindings actualObject, Object[] ArgList, Object FunctionContext ) { for ( int i = 0; i < ArgList.length; i++ ) { // don't worry about "undefined" arguments - checkAndLoadJSFile( actualContext, actualObject, (String) ArgList[i] ); + checkAndLoadJSFile( bowl, actualContext, actualObject, (String) ArgList[i] ); } } @@ -1722,10 +1723,10 @@ public String getClassName() { } // Evaluates the given ScriptFile - private static void checkAndLoadJSFile( ScriptEngine actualContext, Bindings eval_scope, String fileName ) { + private static void checkAndLoadJSFile( Bowl bowl, ScriptEngine actualContext, Bindings eval_scope, String fileName ) { Reader inStream = null; try { - inStream = new InputStreamReader( KettleVFS.getInputStream( fileName ) ); + inStream = new InputStreamReader( KettleVFS.getInstance( bowl ).getInputStream( fileName ) ); actualContext.eval( inStream, eval_scope ); } catch ( KettleFileException Signal ) { /* @@ -1951,7 +1952,7 @@ public static void putRow( ScriptEngine actualContext, Bindings actualObject, Ob } } - public static void deleteFile( ScriptEngine actualContext, Bindings actualObject, Object[] ArgList, + public static void deleteFile( Bowl bowl, ScriptEngine actualContext, Bindings actualObject, Object[] ArgList, Object FunctionContext ) { try { @@ -1962,7 +1963,7 @@ public static void deleteFile( ScriptEngine actualContext, Bindings actualObject FileObject fileObject = null; try { - fileObject = KettleVFS.getFileObject( (String) ArgList[0] ); + fileObject = KettleVFS.getInstance( bowl ).getFileObject( (String) ArgList[0] ); if ( fileObject.exists() ) { if ( fileObject.getType() == FileType.FILE ) { if ( !fileObject.delete() ) { @@ -1993,7 +1994,7 @@ public static void deleteFile( ScriptEngine actualContext, Bindings actualObject } } - public static void createFolder( ScriptEngine actualContext, Bindings actualObject, Object[] ArgList, + public static void createFolder( Bowl bowl, ScriptEngine actualContext, Bindings actualObject, Object[] ArgList, Object FunctionContext ) { try { @@ -2001,7 +2002,7 @@ public static void createFolder( ScriptEngine actualContext, Bindings actualObje FileObject fileObject = null; try { - fileObject = KettleVFS.getFileObject( (String) ArgList[0] ); + fileObject = KettleVFS.getInstance( bowl ).getFileObject( (String) ArgList[0] ); if ( !fileObject.exists() ) { fileObject.createFolder(); } else { @@ -2027,7 +2028,7 @@ public static void createFolder( ScriptEngine actualContext, Bindings actualObje } } - public static void copyFile( ScriptEngine actualContext, Bindings actualObject, Object[] ArgList, + public static void copyFile( Bowl bowl, ScriptEngine actualContext, Bindings actualObject, Object[] ArgList, Object FunctionContext ) { try { @@ -2038,9 +2039,9 @@ public static void copyFile( ScriptEngine actualContext, Bindings actualObject, try { // Source file to copy - fileSource = KettleVFS.getFileObject( (String) ArgList[0] ); + fileSource = KettleVFS.getInstance( bowl ).getFileObject( (String) ArgList[0] ); // Destination filename - fileDestination = KettleVFS.getFileObject( (String) ArgList[1] ); + fileDestination = KettleVFS.getInstance( bowl ).getFileObject( (String) ArgList[1] ); if ( fileSource.exists() ) { // Source file exists... if ( fileSource.getType() == FileType.FILE ) { @@ -2086,7 +2087,7 @@ public static void copyFile( ScriptEngine actualContext, Bindings actualObject, } } - public static double getFileSize( ScriptEngine actualContext, Bindings actualObject, Object[] ArgList, + public static double getFileSize( Bowl bowl, ScriptEngine actualContext, Bindings actualObject, Object[] ArgList, Object FunctionContext ) { try { if ( ArgList.length == 1 && !isNull( ArgList[0] ) && !isUndefined( ArgList[0] ) ) { @@ -2097,7 +2098,7 @@ public static double getFileSize( ScriptEngine actualContext, Bindings actualObj try { // Source file - file = KettleVFS.getFileObject( (String) ArgList[0] ); + file = KettleVFS.getInstance( bowl ).getFileObject( (String) ArgList[0] ); long filesize = 0; if ( file.exists() ) { if ( file.getType().equals( FileType.FILE ) ) { @@ -2129,7 +2130,7 @@ public static double getFileSize( ScriptEngine actualContext, Bindings actualObj } } - public static boolean isFile( ScriptEngine actualContext, Bindings actualObject, Object[] ArgList, + public static boolean isFile( Bowl bowl, ScriptEngine actualContext, Bindings actualObject, Object[] ArgList, Object FunctionContext ) { try { if ( ArgList.length == 1 && !isNull( ArgList[0] ) && !isUndefined( ArgList[0] ) ) { @@ -2140,7 +2141,7 @@ public static boolean isFile( ScriptEngine actualContext, Bindings actualObject, try { // Source file - file = KettleVFS.getFileObject( (String) ArgList[0] ); + file = KettleVFS.getInstance( bowl ).getFileObject( (String) ArgList[0] ); boolean isafile = false; if ( file.exists() ) { if ( file.getType().equals( FileType.FILE ) ) { @@ -2172,7 +2173,7 @@ public static boolean isFile( ScriptEngine actualContext, Bindings actualObject, } } - public static boolean isFolder( ScriptEngine actualContext, Bindings actualObject, Object[] ArgList, + public static boolean isFolder( Bowl bowl, ScriptEngine actualContext, Bindings actualObject, Object[] ArgList, Object FunctionContext ) { try { if ( ArgList.length == 1 && !isNull( ArgList[0] ) && !isUndefined( ArgList[0] ) ) { @@ -2183,7 +2184,7 @@ public static boolean isFolder( ScriptEngine actualContext, Bindings actualObjec try { // Source file - file = KettleVFS.getFileObject( (String) ArgList[0] ); + file = KettleVFS.getInstance( bowl ).getFileObject( (String) ArgList[0] ); boolean isafolder = false; if ( file.exists() ) { if ( file.getType().equals( FileType.FOLDER ) ) { @@ -2215,7 +2216,7 @@ public static boolean isFolder( ScriptEngine actualContext, Bindings actualObjec } } - public static String getShortFilename( ScriptEngine actualContext, Bindings actualObject, Object[] ArgList, + public static String getShortFilename( Bowl bowl, ScriptEngine actualContext, Bindings actualObject, Object[] ArgList, Object FunctionContext ) { try { if ( ArgList.length == 1 && !isNull( ArgList[0] ) && !isUndefined( ArgList[0] ) ) { @@ -2226,7 +2227,7 @@ public static String getShortFilename( ScriptEngine actualContext, Bindings actu try { // Source file - file = KettleVFS.getFileObject( (String) ArgList[0] ); + file = KettleVFS.getInstance( bowl ).getFileObject( (String) ArgList[0] ); String Filename = null; if ( file.exists() ) { Filename = file.getName().getBaseName(); @@ -2256,7 +2257,7 @@ public static String getShortFilename( ScriptEngine actualContext, Bindings actu } } - public static String getFileExtension( ScriptEngine actualContext, Bindings actualObject, Object[] ArgList, + public static String getFileExtension( Bowl bowl, ScriptEngine actualContext, Bindings actualObject, Object[] ArgList, Object FunctionContext ) { try { if ( ArgList.length == 1 && !isNull( ArgList[0] ) && !isUndefined( ArgList[0] ) ) { @@ -2267,7 +2268,7 @@ public static String getFileExtension( ScriptEngine actualContext, Bindings actu try { // Source file - file = KettleVFS.getFileObject( (String) ArgList[0] ); + file = KettleVFS.getInstance( bowl ).getFileObject( (String) ArgList[0] ); String Extension = null; if ( file.exists() ) { Extension = file.getName().getExtension(); @@ -2297,7 +2298,8 @@ public static String getFileExtension( ScriptEngine actualContext, Bindings actu } } - public static String getParentFoldername( ScriptEngine actualContext, Bindings actualObject, Object[] ArgList, + public static String getParentFoldername( Bowl bowl, ScriptEngine actualContext, Bindings actualObject, + Object[] ArgList, Object FunctionContext ) { try { if ( ArgList.length == 1 && !isNull( ArgList[0] ) && !isUndefined( ArgList[0] ) ) { @@ -2308,7 +2310,7 @@ public static String getParentFoldername( ScriptEngine actualContext, Bindings a try { // Source file - file = KettleVFS.getFileObject( (String) ArgList[0] ); + file = KettleVFS.getInstance( bowl ).getFileObject( (String) ArgList[0] ); String foldername = null; if ( file.exists() ) { foldername = KettleVFS.getFilename( file.getParent() ); @@ -2338,7 +2340,8 @@ public static String getParentFoldername( ScriptEngine actualContext, Bindings a } } - public static String getLastModifiedTime( ScriptEngine actualContext, Bindings actualObject, Object[] ArgList, + public static String getLastModifiedTime( Bowl bowl, ScriptEngine actualContext, Bindings actualObject, + Object[] ArgList, Object FunctionContext ) { try { if ( ArgList.length == 2 && !isNull( ArgList[0] ) && !isUndefined( ArgList[0] ) ) { @@ -2349,7 +2352,7 @@ public static String getLastModifiedTime( ScriptEngine actualContext, Bindings a try { // Source file - file = KettleVFS.getFileObject( (String) ArgList[0] ); + file = KettleVFS.getInstance( bowl ).getFileObject( (String) ArgList[0] ); String dateformat = (String) ArgList[1]; if ( isNull( dateformat ) ) { dateformat = "yyyy-MM-dd"; @@ -2470,7 +2473,7 @@ static Date truncDate( Date dArg1, Integer level ) { } - public static void moveFile( ScriptEngine actualContext, Bindings actualObject, Object[] ArgList, + public static void moveFile( Bowl bowl, ScriptEngine actualContext, Bindings actualObject, Object[] ArgList, Object FunctionContext ) { try { @@ -2481,9 +2484,9 @@ public static void moveFile( ScriptEngine actualContext, Bindings actualObject, try { // Source file to move - fileSource = KettleVFS.getFileObject( (String) ArgList[0] ); + fileSource = KettleVFS.getInstance( bowl ).getFileObject( (String) ArgList[0] ); // Destination filename - fileDestination = KettleVFS.getFileObject( (String) ArgList[1] ); + fileDestination = KettleVFS.getInstance( bowl ).getFileObject( (String) ArgList[1] ); if ( fileSource.exists() ) { // Source file exists... if ( fileSource.getType() == FileType.FILE ) { diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/script/ScriptMeta.java b/engine/src/main/java/org/pentaho/di/trans/steps/script/ScriptMeta.java index da66233d5e53..a7c3fa0667f0 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/script/ScriptMeta.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/script/ScriptMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -37,6 +37,8 @@ import javax.script.ScriptException; import org.pentaho.di.compatibility.Value; +import org.pentaho.di.core.bowl.Bowl; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.CheckResult; import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.Const; @@ -278,7 +280,8 @@ public void setDefault() { } } - public void getFields( RowMetaInterface row, String originStepname, RowMetaInterface[] info, StepMeta nextStep, + @Override + public void getFields( Bowl bowl, RowMetaInterface row, String originStepname, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { for ( int i = 0; i < fieldname.length; i++ ) { if ( !Utils.isEmpty( fieldname[i] ) ) { @@ -809,7 +812,9 @@ public void parseXmlForAdditionalClasses() throws KettleException { try { Properties sysprops = System.getProperties(); String strActPath = sysprops.getProperty( "user.dir" ); - Document dom = XMLHandler.loadXMLFile( strActPath + "/plugins/steps/ScriptValues_mod/plugin.xml" ); + // user directory should always be local. Use DefaultBowl + Document dom = XMLHandler.loadXMLFile( DefaultBowl.getInstance(), + strActPath + "/plugins/steps/ScriptValues_mod/plugin.xml" ); Node stepnode = dom.getDocumentElement(); Node libraries = XMLHandler.getSubNode( stepnode, "js_libraries" ); int nbOfLibs = XMLHandler.countNodes( libraries, "js_lib" ); diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/scriptvalues_mod/ScriptValuesAddedFunctions.java b/engine/src/main/java/org/pentaho/di/trans/steps/scriptvalues_mod/ScriptValuesAddedFunctions.java index 446ed20d88f9..391285f3d4c0 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/scriptvalues_mod/ScriptValuesAddedFunctions.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/scriptvalues_mod/ScriptValuesAddedFunctions.java @@ -3,7 +3,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2021 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -34,6 +34,7 @@ import org.mozilla.javascript.Scriptable; import org.mozilla.javascript.ScriptableObject; import org.mozilla.javascript.WrappedException; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.Const; import org.pentaho.di.core.database.Database; import org.pentaho.di.core.database.DatabaseMeta; @@ -1783,7 +1784,7 @@ public String getClassName() { private static void checkAndLoadJSFile( Context actualContext, Scriptable eval_scope, String fileName ) { Reader inStream = null; try { - inStream = new InputStreamReader( KettleVFS.getInputStream( fileName ) ); + inStream = new InputStreamReader( KettleVFS.getInstance( getBowl( eval_scope ) ).getInputStream( fileName ) ); actualContext.evaluateReader( eval_scope, inStream, fileName, 1, null ); } catch ( FileNotFoundException Signal ) { Context.reportError( "Unable to open file \"" + fileName + "\" (reason: \"" + Signal.getMessage() + "\")" ); @@ -1813,6 +1814,12 @@ private static void checkAndLoadJSFile( Context actualContext, Scriptable eval_s } } + private static Bowl getBowl( Scriptable scope ) { + Object scmO = scope.get( "_step_", scope ); + ScriptValuesMod scm = (ScriptValuesMod) Context.jsToJava( scmO, ScriptValuesMod.class ); + return scm.getTransMeta().getBowl(); + } + public static void setVariable( Context actualContext, Scriptable actualObject, Object[] arguments, Function functionContext ) { @@ -2038,7 +2045,7 @@ public static void deleteFile( Context actualContext, Scriptable actualObject, O FileObject fileObject = null; try { - fileObject = KettleVFS.getFileObject( Context.toString( ArgList[0] ) ); + fileObject = KettleVFS.getInstance( getBowl( actualObject ) ).getFileObject( Context.toString( ArgList[0] ) ); if ( fileObject.exists() ) { if ( fileObject.getType() == FileType.FILE ) { if ( !fileObject.delete() ) { @@ -2077,7 +2084,7 @@ public static void createFolder( Context actualContext, Scriptable actualObject, FileObject fileObject = null; try { - fileObject = KettleVFS.getFileObject( Context.toString( ArgList[0] ) ); + fileObject = KettleVFS.getInstance( getBowl( actualObject ) ).getFileObject( Context.toString( ArgList[0] ) ); if ( !fileObject.exists() ) { fileObject.createFolder(); } else { @@ -2114,9 +2121,10 @@ public static void copyFile( Context actualContext, Scriptable actualObject, Obj try { // Source file to copy - fileSource = KettleVFS.getFileObject( Context.toString( ArgList[0] ) ); + Bowl bowl = getBowl( actualObject ); + fileSource = KettleVFS.getInstance( bowl ).getFileObject( Context.toString( ArgList[0] ) ); // Destination filename - fileDestination = KettleVFS.getFileObject( Context.toString( ArgList[1] ) ); + fileDestination = KettleVFS.getInstance( bowl ).getFileObject( Context.toString( ArgList[1] ) ); if ( fileSource.exists() ) { // Source file exists... if ( fileSource.getType() == FileType.FILE ) { @@ -2173,7 +2181,7 @@ public static double getFileSize( Context actualContext, Scriptable actualObject try { // Source file - file = KettleVFS.getFileObject( Context.toString( ArgList[0] ) ); + file = KettleVFS.getInstance( getBowl( actualObject ) ).getFileObject( Context.toString( ArgList[0] ) ); long filesize = 0; if ( file.exists() ) { if ( file.getType().equals( FileType.FILE ) ) { @@ -2216,7 +2224,7 @@ public static boolean isFile( Context actualContext, Scriptable actualObject, Ob try { // Source file - file = KettleVFS.getFileObject( Context.toString( ArgList[0] ) ); + file = KettleVFS.getInstance( getBowl( actualObject ) ).getFileObject( Context.toString( ArgList[0] ) ); boolean isafile = false; if ( file.exists() ) { if ( file.getType().equals( FileType.FILE ) ) { @@ -2259,7 +2267,7 @@ public static boolean isFolder( Context actualContext, Scriptable actualObject, try { // Source file - file = KettleVFS.getFileObject( Context.toString( ArgList[0] ) ); + file = KettleVFS.getInstance( getBowl( actualObject ) ).getFileObject( Context.toString( ArgList[0] ) ); boolean isafolder = false; if ( file.exists() ) { if ( file.getType().equals( FileType.FOLDER ) ) { @@ -2302,7 +2310,7 @@ public static String getShortFilename( Context actualContext, Scriptable actualO try { // Source file - file = KettleVFS.getFileObject( Context.toString( ArgList[0] ) ); + file = KettleVFS.getInstance( getBowl( actualObject ) ).getFileObject( Context.toString( ArgList[0] ) ); String Filename = null; if ( file.exists() ) { Filename = file.getName().getBaseName().toString(); @@ -2343,7 +2351,7 @@ public static String getFileExtension( Context actualContext, Scriptable actualO try { // Source file - file = KettleVFS.getFileObject( Context.toString( ArgList[0] ) ); + file = KettleVFS.getInstance( getBowl( actualObject ) ).getFileObject( Context.toString( ArgList[0] ) ); String Extension = null; if ( file.exists() ) { Extension = file.getName().getExtension().toString(); @@ -2384,7 +2392,7 @@ public static String getParentFoldername( Context actualContext, Scriptable actu try { // Source file - file = KettleVFS.getFileObject( Context.toString( ArgList[0] ) ); + file = KettleVFS.getInstance( getBowl( actualObject ) ).getFileObject( Context.toString( ArgList[0] ) ); String foldername = null; if ( file.exists() ) { foldername = KettleVFS.getFilename( file.getParent() ); @@ -2426,7 +2434,7 @@ public static String getLastModifiedTime( Context actualContext, Scriptable actu try { // Source file - file = KettleVFS.getFileObject( Context.toString( ArgList[0] ) ); + file = KettleVFS.getInstance( getBowl( actualObject ) ).getFileObject( Context.toString( ArgList[0] ) ); String dateformat = Context.toString( ArgList[1] ); if ( isNull( dateformat ) ) { dateformat = "yyyy-MM-dd"; @@ -2559,9 +2567,10 @@ public static void moveFile( Context actualContext, Scriptable actualObject, Obj try { // Source file to move - fileSource = KettleVFS.getFileObject( Context.toString( ArgList[0] ) ); + Bowl bowl = getBowl( actualObject ); + fileSource = KettleVFS.getInstance( bowl ).getFileObject( Context.toString( ArgList[0] ) ); // Destination filename - fileDestination = KettleVFS.getFileObject( Context.toString( ArgList[1] ) ); + fileDestination = KettleVFS.getInstance( bowl ).getFileObject( Context.toString( ArgList[1] ) ); if ( fileSource.exists() ) { // Source file exists... if ( fileSource.getType() == FileType.FILE ) { @@ -2791,7 +2800,8 @@ public static Object loadFileContent( Context actualContext, Scriptable actualOb return Context.getUndefinedValue(); } // Returns file content - oRC = new String( LoadFileInput.getFileBinaryContent( Context.toString( ArgList[0] ) ) ); + oRC = new String( LoadFileInput.getFileBinaryContent( getBowl( actualObject ), + Context.toString( ArgList[0] ) ) ); } catch ( Exception e ) { throw Context .reportRuntimeError( "The function call loadFileContent throw an error : " + e.toString() ); @@ -2809,7 +2819,8 @@ public static Object loadFileContent( Context actualContext, Scriptable actualOb encoding = Context.toString( ArgList[1] ); } // Returns file content - oRC = new String( LoadFileInput.getFileBinaryContent( Context.toString( ArgList[0] ) ), encoding ); + oRC = new String( LoadFileInput.getFileBinaryContent( getBowl( actualObject ), + Context.toString( ArgList[0] ) ), encoding ); } catch ( Exception e ) { throw Context .reportRuntimeError( "The function call loadFileContent throw an error : " + e.toString() ); diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/scriptvalues_mod/ScriptValuesMetaMod.java b/engine/src/main/java/org/pentaho/di/trans/steps/scriptvalues_mod/ScriptValuesMetaMod.java index d6022a0c6423..b143a3410359 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/scriptvalues_mod/ScriptValuesMetaMod.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/scriptvalues_mod/ScriptValuesMetaMod.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2018 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -38,10 +38,12 @@ import org.mozilla.javascript.ScriptableObject; import org.pentaho.di.compatibility.Row; import org.pentaho.di.compatibility.Value; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.CheckResult; import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.Const; import org.pentaho.di.core.annotations.Step; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.injection.AfterInjection; import org.pentaho.di.core.injection.Injection; import org.pentaho.di.core.injection.InjectionDeep; @@ -394,7 +396,8 @@ public void setDefault() { optimizationLevel = OPTIMIZATION_LEVEL_DEFAULT; } - public void getFields( RowMetaInterface row, String originStepname, RowMetaInterface[] info, StepMeta nextStep, + @Override + public void getFields( Bowl bowl, RowMetaInterface row, String originStepname, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { try { for ( int i = 0; i < fieldname.length; i++ ) { @@ -973,7 +976,9 @@ public void parseXmlForAdditionalClasses() throws KettleException { try { Properties sysprops = System.getProperties(); String strActPath = sysprops.getProperty( "user.dir" ); - Document dom = XMLHandler.loadXMLFile( strActPath + "/plugins/steps/ScriptValues_mod/plugin.xml" ); + // user directory should always be local. Use DefaultBowl + Document dom = XMLHandler.loadXMLFile( DefaultBowl.getInstance(), + strActPath + "/plugins/steps/ScriptValues_mod/plugin.xml" ); Node stepnode = dom.getDocumentElement(); Node libraries = XMLHandler.getSubNode( stepnode, "js_libraries" ); int nbOfLibs = XMLHandler.countNodes( libraries, "js_lib" ); diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/scriptvalues_mod/ScriptValuesMod.java b/engine/src/main/java/org/pentaho/di/trans/steps/scriptvalues_mod/ScriptValuesMod.java index 7c290d4a54f7..934b32b91765 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/scriptvalues_mod/ScriptValuesMod.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/scriptvalues_mod/ScriptValuesMod.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2019 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -147,7 +147,8 @@ private boolean addValues( RowMetaInterface rowMeta, Object[] row ) throws Kettl // What is the output row looking like? // data.outputRowMeta = getInputRowMeta().clone(); - meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); + meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository, + metaStore ); // Determine the indexes of the fields used! // diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/selectvalues/SelectValuesMeta.java b/engine/src/main/java/org/pentaho/di/trans/steps/selectvalues/SelectValuesMeta.java index 8dbe2d798b62..22f4bc62c186 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/selectvalues/SelectValuesMeta.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/selectvalues/SelectValuesMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2018 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -27,6 +27,7 @@ import java.util.Collections; import java.util.List; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.CheckResult; import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.Const; @@ -475,8 +476,8 @@ public void getMetadataFields( RowMetaInterface inputRowMeta, String name, Varia } @Override - public void getFields( RowMetaInterface inputRowMeta, String name, RowMetaInterface[] info, StepMeta nextStep, - VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { + public void getFields( Bowl bowl, RowMetaInterface inputRowMeta, String name, RowMetaInterface[] info, + StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { try { RowMetaInterface rowMeta = inputRowMeta.clone(); inputRowMeta.clear(); diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/setvalueconstant/SetValueConstant.java b/engine/src/main/java/org/pentaho/di/trans/steps/setvalueconstant/SetValueConstant.java index a615b784d78f..9792db46c68c 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/setvalueconstant/SetValueConstant.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/setvalueconstant/SetValueConstant.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2018 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -72,7 +72,8 @@ public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws // What's the format of the output row? data.setOutputRowMeta( getInputRowMeta().clone() ); - meta.getFields( data.getOutputRowMeta(), getStepname(), null, null, this, repository, metaStore ); + meta.getFields( getTransMeta().getBowl(), data.getOutputRowMeta(), getStepname(), null, null, this, repository, + metaStore ); // Create convert meta-data objects that will contain Date & Number formatters // data.convertRowMeta = data.outputRowMeta.clone(); diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/setvaluefield/SetValueField.java b/engine/src/main/java/org/pentaho/di/trans/steps/setvaluefield/SetValueField.java index f32b92590e61..98bacae141d1 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/setvaluefield/SetValueField.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/setvaluefield/SetValueField.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2018 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -69,7 +69,8 @@ public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws first = false; // What's the format of the output row? data.outputRowMeta = getInputRowMeta().clone(); - meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); + meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository, + metaStore ); data.indexOfField = new int[meta.getFieldName().length]; data.indexOfReplaceByValue = new int[meta.getFieldName().length]; diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/setvariable/SetVariableMeta.java b/engine/src/main/java/org/pentaho/di/trans/steps/setvariable/SetVariableMeta.java index 7354bafdbe2b..f89b4e26b1ab 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/setvariable/SetVariableMeta.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/setvariable/SetVariableMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -24,6 +24,7 @@ import java.util.List; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.CheckResult; import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.Const; diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/simplemapping/SimpleMapping.java b/engine/src/main/java/org/pentaho/di/trans/steps/simplemapping/SimpleMapping.java index 25c539794bb7..e9f7fa223e40 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/simplemapping/SimpleMapping.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/simplemapping/SimpleMapping.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2019 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -245,7 +245,8 @@ public boolean init( StepMetaInterface smi, StepDataInterface sdi ) { // meta.setRepository( getTransMeta().getRepository() ); simpleMappingData.mappingTransMeta = - SimpleMappingMeta.loadMappingMeta( meta, meta.getRepository(), meta.getMetaStore(), this, meta.getMappingParameters().isInheritingAllVariables() ); + SimpleMappingMeta.loadMappingMeta( getTransMeta().getBowl(), meta, meta.getRepository(), + meta.getMetaStore(), this, meta.getMappingParameters().isInheritingAllVariables() ); if ( simpleMappingData.mappingTransMeta != null ) { // Do we have a mapping at all? // OK, now prepare the execution of the mapping. diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/simplemapping/SimpleMappingMeta.java b/engine/src/main/java/org/pentaho/di/trans/steps/simplemapping/SimpleMappingMeta.java index 798d182eb611..514b9d9fbc18 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/simplemapping/SimpleMappingMeta.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/simplemapping/SimpleMappingMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2019 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -22,6 +22,7 @@ package org.pentaho.di.trans.steps.simplemapping; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.CheckResult; import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.Const; @@ -271,7 +272,8 @@ public void setDefault() { outputMapping = outputDefinition; } - public void getFields( RowMetaInterface row, String origin, RowMetaInterface[] info, StepMeta nextStep, + @Override + public void getFields( Bowl bowl, RowMetaInterface row, String origin, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { // First load some interesting data... @@ -280,7 +282,7 @@ public void getFields( RowMetaInterface row, String origin, RowMetaInterface[] i TransMeta mappingTransMeta = null; try { mappingTransMeta = - loadMappingMeta( this, repository, metaStore, space, mappingParameters.isInheritingAllVariables() ); + loadMappingMeta( bowl, this, repository, metaStore, space, mappingParameters.isInheritingAllVariables() ); } catch ( KettleException e ) { throw new KettleStepException( BaseMessages.getString( PKG, "SimpleMappingMeta.Exception.UnableToLoadMappingTransformation" ), e ); @@ -523,8 +525,9 @@ public boolean[] isReferencedObjectEnabled() { } @Deprecated - public Object loadReferencedObject( int index, Repository rep, VariableSpace space ) throws KettleException { - return loadReferencedObject( index, rep, null, space ); + public Object loadReferencedObject( Bowl bowl, int index, Repository rep, VariableSpace space ) + throws KettleException { + return loadReferencedObject( bowl, index, rep, null, space ); } /** @@ -541,8 +544,8 @@ public Object loadReferencedObject( int index, Repository rep, VariableSpace spa * @return the referenced object once loaded * @throws KettleException */ - public Object loadReferencedObject( int index, Repository rep, IMetaStore metaStore, VariableSpace space ) throws KettleException { - return loadMappingMeta( this, rep, metaStore, space ); + public Object loadReferencedObject( Bowl bowl, int index, Repository rep, IMetaStore metaStore, VariableSpace space ) throws KettleException { + return loadMappingMeta( bowl, this, rep, metaStore, space ); } public IMetaStore getMetaStore() { diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/singlethreader/SingleThreader.java b/engine/src/main/java/org/pentaho/di/trans/steps/singlethreader/SingleThreader.java index 679a98ff9fe8..37dde57fba4b 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/singlethreader/SingleThreader.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/singlethreader/SingleThreader.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2019 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -260,7 +260,8 @@ public boolean init( StepMetaInterface smi, StepDataInterface sdi ) { // Pass the repository down to the metadata object... // meta.setRepository( getTransMeta().getRepository() ); - singleThreaderData.mappingTransMeta = SingleThreaderMeta.loadSingleThreadedTransMeta( meta, meta.getRepository(), this, meta.isPassingAllParameters() ); + singleThreaderData.mappingTransMeta = SingleThreaderMeta.loadSingleThreadedTransMeta( getTransMeta().getBowl(), + meta, meta.getRepository(), this, meta.isPassingAllParameters() ); if ( singleThreaderData.mappingTransMeta != null ) { // Do we have a mapping at all? // Validate the inject and retrieve step names diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/singlethreader/SingleThreaderMeta.java b/engine/src/main/java/org/pentaho/di/trans/steps/singlethreader/SingleThreaderMeta.java index 54e49c791b60..5f688cb00c76 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/singlethreader/SingleThreaderMeta.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/singlethreader/SingleThreaderMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2018 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -25,6 +25,7 @@ import java.util.ArrayList; import java.util.List; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.CheckResult; import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.Const; @@ -264,7 +265,8 @@ public void setDefault() { parameterValues = new String[0]; } - public void getFields( RowMetaInterface row, String origin, RowMetaInterface[] info, StepMeta nextStep, + @Override + public void getFields( Bowl bowl, RowMetaInterface row, String origin, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { // First load some interesting data... @@ -273,7 +275,7 @@ public void getFields( RowMetaInterface row, String origin, RowMetaInterface[] i // TransMeta mappingTransMeta = null; try { - mappingTransMeta = loadSingleThreadedTransMeta( this, repository, space ); + mappingTransMeta = loadSingleThreadedTransMeta( bowl, this, repository, space ); } catch ( KettleException e ) { throw new KettleStepException( BaseMessages.getString( PKG, "SingleThreaderMeta.Exception.UnableToLoadMappingTransformation" ), e ); @@ -290,14 +292,14 @@ public void getFields( RowMetaInterface row, String origin, RowMetaInterface[] i } - public static final synchronized TransMeta loadSingleThreadedTransMeta( SingleThreaderMeta mappingMeta, + public static final synchronized TransMeta loadSingleThreadedTransMeta( Bowl bowl, SingleThreaderMeta mappingMeta, Repository rep, VariableSpace space ) throws KettleException { - return loadMappingMeta( mappingMeta, rep, null, space ); + return loadMappingMeta( bowl, mappingMeta, rep, null, space ); } - public static final synchronized TransMeta loadSingleThreadedTransMeta( SingleThreaderMeta mappingMeta, + public static final synchronized TransMeta loadSingleThreadedTransMeta( Bowl bowl, SingleThreaderMeta mappingMeta, Repository rep, VariableSpace space, boolean passingAllParameters ) throws KettleException { - return loadMappingMeta( mappingMeta, rep, null, space, passingAllParameters ); + return loadMappingMeta( bowl, mappingMeta, rep, null, space, passingAllParameters ); } public void check( List remarks, TransMeta transMeta, StepMeta stepMeta, @@ -530,12 +532,13 @@ public boolean[] isReferencedObjectEnabled() { * @throws KettleException */ @Deprecated - public Object loadReferencedObject( int index, Repository rep, VariableSpace space ) throws KettleException { - return loadSingleThreadedTransMeta( this, rep, space ); + public Object loadReferencedObject( Bowl bowl, int index, Repository rep, VariableSpace space ) + throws KettleException { + return loadSingleThreadedTransMeta( bowl, this, rep, space ); } - public Object loadReferencedObject( int index, Repository rep, IMetaStore metaStore, VariableSpace space ) throws KettleException { - return loadMappingMeta( this, rep, metaStore, space ); + public Object loadReferencedObject( Bowl bowl, int index, Repository rep, IMetaStore metaStore, VariableSpace space ) throws KettleException { + return loadMappingMeta( bowl, this, rep, metaStore, space ); } @Override diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/socketreader/SocketReaderMeta.java b/engine/src/main/java/org/pentaho/di/trans/steps/socketreader/SocketReaderMeta.java index 25af30428b8c..f2d74466e468 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/socketreader/SocketReaderMeta.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/socketreader/SocketReaderMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -24,6 +24,7 @@ import java.util.List; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.CheckResult; import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.database.DatabaseMeta; @@ -109,7 +110,8 @@ public void saveRep( Repository rep, IMetaStore metaStore, ObjectId id_transform rep.saveStepAttribute( id_transformation, id_step, "compressed", compressed ); } - public void getFields( RowMetaInterface rowMeta, String origin, RowMetaInterface[] info, StepMeta nextStep, + @Override + public void getFields( Bowl bowl, RowMetaInterface rowMeta, String origin, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { // Default: nothing changes to rowMeta } diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/socketwriter/SocketWriterMeta.java b/engine/src/main/java/org/pentaho/di/trans/steps/socketwriter/SocketWriterMeta.java index e2f3d6e26d6e..a1fd5eca1aec 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/socketwriter/SocketWriterMeta.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/socketwriter/SocketWriterMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -24,6 +24,7 @@ import java.util.List; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.CheckResult; import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.database.DatabaseMeta; @@ -110,7 +111,8 @@ public void saveRep( Repository rep, IMetaStore metaStore, ObjectId id_transform rep.saveStepAttribute( id_transformation, id_step, "compressed", compressed ); } - public void getFields( RowMetaInterface rowMeta, String origin, RowMetaInterface[] info, StepMeta nextStep, + @Override + public void getFields( Bowl bowl, RowMetaInterface rowMeta, String origin, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { // Default: nothing changes to rowMeta } diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/sort/SortRows.java b/engine/src/main/java/org/pentaho/di/trans/steps/sort/SortRows.java index cceb41b41a6a..ba718c8fc7c5 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/sort/SortRows.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/sort/SortRows.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2018 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -138,11 +138,12 @@ void sortExternalRows() throws KettleException { try { FileObject fileObject = - KettleVFS.createTempFile( meta.getPrefix(), ".tmp", environmentSubstitute( meta.getDirectory() ), - getTransMeta() ); + KettleVFS.getInstance( getTransMeta().getBowl() ) + .createTempFile( meta.getPrefix(), ".tmp", environmentSubstitute( meta.getDirectory() ), getTransMeta() ); data.files.add( fileObject ); // Remember the files! - OutputStream outputStream = KettleVFS.getOutputStream( fileObject, false ); + OutputStream outputStream = KettleVFS.getInstance( getTransMeta().getBowl() ) + .getOutputStream( fileObject, false ); if ( data.compressFiles ) { gzos = new GZIPOutputStream( new BufferedOutputStream( outputStream ) ); dos = new DataOutputStream( gzos ); @@ -417,7 +418,8 @@ public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws // Metadata data.outputRowMeta = inputRowMeta.clone(); - meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); + meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository, + metaStore ); data.comparator = new RowTemapFileComparator( data.outputRowMeta, data.fieldnrs ); for ( int i = 0; i < fieldNames.length; i++ ) { diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/sort/SortRowsMeta.java b/engine/src/main/java/org/pentaho/di/trans/steps/sort/SortRowsMeta.java index 8d1edb1d74a7..9d9c31292a97 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/sort/SortRowsMeta.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/sort/SortRowsMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -30,6 +30,7 @@ import java.util.Locale; import com.google.common.annotations.VisibleForTesting; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.CheckResult; import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.Const; @@ -389,8 +390,8 @@ public void saveRep( Repository rep, IMetaStore metaStore, ObjectId id_transform } @Override - public void getFields( RowMetaInterface inputRowMeta, String name, RowMetaInterface[] info, StepMeta nextStep, - VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { + public void getFields( Bowl bowl, RowMetaInterface inputRowMeta, String name, RowMetaInterface[] info, + StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { // Set the sorted properties: ascending/descending assignSortingCriteria( inputRowMeta ); } diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/sortedmerge/SortedMergeMeta.java b/engine/src/main/java/org/pentaho/di/trans/steps/sortedmerge/SortedMergeMeta.java index caabdb589b8e..6ea60e55fcbd 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/sortedmerge/SortedMergeMeta.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/sortedmerge/SortedMergeMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -24,6 +24,7 @@ import java.util.List; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.CheckResult; import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.Const; @@ -163,7 +164,8 @@ public void saveRep( Repository rep, IMetaStore metaStore, ObjectId id_transform } } - public void getFields( RowMetaInterface inputRowMeta, String name, RowMetaInterface[] info, StepMeta nextStep, + @Override + public void getFields( Bowl bowl, RowMetaInterface inputRowMeta, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { // Set the sorted properties: ascending/descending for ( int i = 0; i < fieldName.length; i++ ) { diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/splitfieldtorows/SplitFieldToRows.java b/engine/src/main/java/org/pentaho/di/trans/steps/splitfieldtorows/SplitFieldToRows.java index c90a920ec4e6..52ae7a5904d9 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/splitfieldtorows/SplitFieldToRows.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/splitfieldtorows/SplitFieldToRows.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -55,7 +55,8 @@ private boolean splitField( RowMetaInterface rowMeta, Object[] rowData ) throws first = false; data.outputRowMeta = getInputRowMeta().clone(); - meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); + meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository, + metaStore ); String realSplitFieldName = environmentSubstitute( meta.getSplitField() ); data.fieldnr = rowMeta.indexOfValue( realSplitFieldName ); diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/splitfieldtorows/SplitFieldToRowsMeta.java b/engine/src/main/java/org/pentaho/di/trans/steps/splitfieldtorows/SplitFieldToRowsMeta.java index dcaee47c8f80..6a35584d8262 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/splitfieldtorows/SplitFieldToRowsMeta.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/splitfieldtorows/SplitFieldToRowsMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2019 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -24,6 +24,7 @@ import java.util.List; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.CheckResult; import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.Const; @@ -156,7 +157,8 @@ public void setDefault() { resetRowNumber = true; } - public void getFields( RowMetaInterface row, String name, RowMetaInterface[] info, StepMeta nextStep, + @Override + public void getFields( Bowl bowl, RowMetaInterface row, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { ValueMetaInterface v = new ValueMetaString( newFieldname ); diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/sql/ExecSQL.java b/engine/src/main/java/org/pentaho/di/trans/steps/sql/ExecSQL.java index 7ec5eed7e937..0e8dd5515b68 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/sql/ExecSQL.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/sql/ExecSQL.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -117,7 +117,8 @@ public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws first = false; data.outputRowMeta = getInputRowMeta().clone(); - meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); + meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository, + metaStore ); // Find the indexes of the arguments data.argumentIndexes = new int[meta.getArguments().length]; diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/sql/ExecSQLMeta.java b/engine/src/main/java/org/pentaho/di/trans/steps/sql/ExecSQLMeta.java index 7266c7ebeda2..e81433219ed2 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/sql/ExecSQLMeta.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/sql/ExecSQLMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2018 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -24,6 +24,7 @@ import java.util.List; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.CheckResult; import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.Const; @@ -296,7 +297,8 @@ public void setDefault() { arguments = new String[0]; } - public void getFields( RowMetaInterface r, String name, RowMetaInterface[] info, StepMeta nextStep, + @Override + public void getFields( Bowl bowl, RowMetaInterface r, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { RowMetaAndData add = ExecSQL.getResultRow( new Result(), getUpdateField(), getInsertField(), getDeleteField(), getReadField() ); diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/sqlfileoutput/SQLFileOutput.java b/engine/src/main/java/org/pentaho/di/trans/steps/sqlfileoutput/SQLFileOutput.java index bb37b6f937f9..0e06b1117271 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/sqlfileoutput/SQLFileOutput.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/sqlfileoutput/SQLFileOutput.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -76,7 +76,8 @@ public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws if ( first ) { first = false; data.outputRowMeta = getInputRowMeta().clone(); - meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); + meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository, + metaStore ); data.insertRowMeta = getInputRowMeta().clone(); if ( meta.isDoNotOpenNewFileInit() ) { @@ -202,8 +203,8 @@ public boolean openNewFile() { // Add this to the result file names... ResultFile resultFile = new ResultFile( - ResultFile.FILE_TYPE_GENERAL, KettleVFS.getFileObject( filename, getTransMeta() ), getTransMeta() - .getName(), getStepname() ); + ResultFile.FILE_TYPE_GENERAL, KettleVFS.getInstance( getTransMeta().getBowl() ) + .getFileObject( filename, getTransMeta() ), getTransMeta().getName(), getStepname() ); resultFile.setComment( "This file was created with a text file output step" ); addResultFile( resultFile ); } @@ -212,7 +213,8 @@ public boolean openNewFile() { if ( log.isDetailed() ) { logDetailed( "Opening output stream in nocompress mode" ); } - OutputStream fos = KettleVFS.getOutputStream( filename, getTransMeta(), meta.isFileAppended() ); + OutputStream fos = KettleVFS.getInstance( getTransMeta().getBowl() ) + .getOutputStream( filename, getTransMeta(), meta.isFileAppended() ); outputStream = fos; if ( log.isDetailed() ) { @@ -306,7 +308,8 @@ public boolean init( StepMetaInterface smi, StepDataInterface sdi ) { try { // Get parent folder String filename = environmentSubstitute( meta.getFileName() ); - parentfolder = KettleVFS.getFileObject( filename, getTransMeta() ).getParent(); + parentfolder = KettleVFS.getInstance( getTransMeta().getBowl() ) + .getFileObject( filename, getTransMeta() ).getParent(); if ( !parentfolder.exists() ) { log.logBasic( "Folder parent", "Folder parent " + parentfolder.getName() + " does not exist !" ); parentfolder.createFolder(); diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/sqlfileoutput/SQLFileOutputMeta.java b/engine/src/main/java/org/pentaho/di/trans/steps/sqlfileoutput/SQLFileOutputMeta.java index df538120fa8a..0735a519a2a6 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/sqlfileoutput/SQLFileOutputMeta.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/sqlfileoutput/SQLFileOutputMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2019 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -28,6 +28,7 @@ import java.util.Map; import org.apache.commons.vfs2.FileObject; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.CheckResult; import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.Const; @@ -870,7 +871,8 @@ public boolean supportsErrorHandling() { * * @return the filename of the exported resource */ - public String exportResources( VariableSpace space, Map definitions, + @Override + public String exportResources( Bowl bowl, VariableSpace space, Map definitions, ResourceNamingInterface resourceNamingInterface, Repository repository, IMetaStore metaStore ) throws KettleException { try { // The object that we're modifying here is a copy of the original! @@ -879,7 +881,8 @@ public String exportResources( VariableSpace space, Map remarks, TransMeta transMeta, Step remarks.add( cr ); boolean keyFileExists = false; try { - keyFileExists = KettleVFS.fileExists( keyfilename ); + keyFileExists = KettleVFS.getInstance( transMeta.getBowl() ).fileExists( keyfilename ); } catch ( Exception e ) { /* Ignore */ } if ( !keyFileExists ) { @@ -552,7 +553,7 @@ public void check( List remarks, TransMeta transMeta, Step } @Override - public void getFields( RowMetaInterface row, String name, RowMetaInterface[] info, StepMeta nextStep, + public void getFields( Bowl bowl, RowMetaInterface row, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { if ( !isDynamicCommand() ) { @@ -589,6 +590,7 @@ public boolean supportsErrorHandling() { /** * + * @param bowl * @param serveur * @param port * @param username @@ -607,11 +609,11 @@ public boolean supportsErrorHandling() { * @deprecated Use {@link SSHData#OpenConnection(String, int, String, String, boolean, String, String, int, VariableSpace, String, int, String, String)} instead */ @Deprecated - public static Connection OpenConnection( String serveur, int port, String username, String password, + public static Connection OpenConnection( Bowl bowl, String serveur, int port, String username, String password, boolean useKey, String keyFilename, String passPhrase, int timeOut, VariableSpace space, String proxyhost, int proxyport, String proxyusername, String proxypassword ) throws KettleException { - return SSHData.OpenConnection( serveur, port, username, password, useKey, keyFilename, passPhrase, timeOut, - space, proxyhost, proxyport, proxyusername, proxypassword ); + return SSHData.OpenConnection( bowl, serveur, port, username, + password, useKey, keyFilename, passPhrase, timeOut, space, proxyhost, proxyport, proxyusername, proxypassword ); } /** diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/stepmeta/StepMetastructure.java b/engine/src/main/java/org/pentaho/di/trans/steps/stepmeta/StepMetastructure.java index 7448d21c4ab6..45b59465eaa3 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/stepmeta/StepMetastructure.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/stepmeta/StepMetastructure.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -81,7 +81,8 @@ public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws // Create the row metadata for the output rows // data.outputRowMeta = new RowMeta(); - meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); + meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository, + metaStore ); } if ( r == null ) { diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/stepmeta/StepMetastructureMeta.java b/engine/src/main/java/org/pentaho/di/trans/steps/stepmeta/StepMetastructureMeta.java index 520dc6d7bc9d..d182ea5f3c6d 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/stepmeta/StepMetastructureMeta.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/stepmeta/StepMetastructureMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -24,6 +24,7 @@ import java.util.List; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.CheckResult; import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.database.DatabaseMeta; @@ -139,7 +140,7 @@ public void check( List remarks, TransMeta transMeta, Step } @Override - public void getFields( RowMetaInterface r, String name, RowMetaInterface[] info, StepMeta nextStep, + public void getFields( Bowl bowl, RowMetaInterface r, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { // we create a new output row structure - clear r r.clear(); diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/stepsmetrics/StepsMetrics.java b/engine/src/main/java/org/pentaho/di/trans/steps/stepsmetrics/StepsMetrics.java index d4e23351ea67..88ffd5d4de06 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/stepsmetrics/StepsMetrics.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/stepsmetrics/StepsMetrics.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -118,7 +118,8 @@ public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws } data.outputRowMeta = new RowMeta(); - meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); + meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository, + metaStore ); } // end if first data.continueLoop = true; diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/stepsmetrics/StepsMetricsMeta.java b/engine/src/main/java/org/pentaho/di/trans/steps/stepsmetrics/StepsMetricsMeta.java index 48fe88d61b27..dc6d7960cf1b 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/stepsmetrics/StepsMetricsMeta.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/stepsmetrics/StepsMetricsMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -24,6 +24,7 @@ import java.util.List; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.CheckResult; import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.Const; @@ -150,7 +151,8 @@ public String getRequiredStepsDesc( String tt ) { } } - public void getFields( RowMetaInterface r, String name, RowMetaInterface[] info, StepMeta nextStep, + @Override + public void getFields( Bowl bowl, RowMetaInterface r, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { r.clear(); String stepname = space.environmentSubstitute( stepnamefield ); diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/streamlookup/StreamLookup.java b/engine/src/main/java/org/pentaho/di/trans/steps/streamlookup/StreamLookup.java index 89aef14523a3..95f6267f0993 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/streamlookup/StreamLookup.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/streamlookup/StreamLookup.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -435,7 +435,7 @@ public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws } data.outputRowMeta = getInputRowMeta().clone(); - meta.getFields( + meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), new RowMetaInterface[] { data.infoMeta }, null, this, repository, metaStore ); diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/streamlookup/StreamLookupMeta.java b/engine/src/main/java/org/pentaho/di/trans/steps/streamlookup/StreamLookupMeta.java index f7a585cb4777..0f5a07404e77 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/streamlookup/StreamLookupMeta.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/streamlookup/StreamLookupMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2018 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -22,6 +22,7 @@ package org.pentaho.di.trans.steps.streamlookup; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.CheckResult; import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.Const; @@ -216,7 +217,7 @@ public void setDefault() { } @Override - public void getFields( RowMetaInterface row, String origin, RowMetaInterface[] info, StepMeta nextStep, + public void getFields( Bowl bowl, RowMetaInterface row, String origin, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { if ( info != null && info.length == 1 && info[0] != null ) { for ( int i = 0; i < getValueName().length; i++ ) { diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/stringcut/StringCut.java b/engine/src/main/java/org/pentaho/di/trans/steps/stringcut/StringCut.java index b9763bc78283..84cea253953a 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/stringcut/StringCut.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/stringcut/StringCut.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -22,6 +22,7 @@ package org.pentaho.di.trans.steps.stringcut; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.Const; import org.pentaho.di.core.util.Utils; import org.pentaho.di.core.exception.KettleException; @@ -131,7 +132,8 @@ public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws // What's the format of the output row? data.outputRowMeta = getInputRowMeta().clone(); data.inputFieldsNr = data.outputRowMeta.size(); - meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); + meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository, + metaStore ); data.inStreamNrs = new int[meta.getFieldInStream().length]; for ( int i = 0; i < meta.getFieldInStream().length; i++ ) { diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/stringcut/StringCutMeta.java b/engine/src/main/java/org/pentaho/di/trans/steps/stringcut/StringCutMeta.java index cfe3fdb7a913..e7b8c828c779 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/stringcut/StringCutMeta.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/stringcut/StringCutMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2019 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -24,6 +24,7 @@ import java.util.List; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.CheckResult; import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.Const; @@ -230,7 +231,8 @@ public void saveRep( Repository rep, IMetaStore metaStore, ObjectId id_transform } } - public void getFields( RowMetaInterface inputRowMeta, String name, RowMetaInterface[] info, StepMeta nextStep, + @Override + public void getFields( Bowl bowl, RowMetaInterface inputRowMeta, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { for ( int i = 0; i < fieldOutStream.length; i++ ) { ValueMetaInterface v; diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/stringoperations/StringOperations.java b/engine/src/main/java/org/pentaho/di/trans/steps/stringoperations/StringOperations.java index 7f944843dc16..969cbbb7bf8b 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/stringoperations/StringOperations.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/stringoperations/StringOperations.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2019 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -231,7 +231,8 @@ public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws // What's the format of the output row? data.outputRowMeta = getInputRowMeta().clone(); data.inputFieldsNr = data.outputRowMeta.size(); - meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); + meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository, + metaStore ); data.nrFieldsInStream = meta.getFieldInStream().length; data.inStreamNrs = new int[data.nrFieldsInStream]; for ( int i = 0; i < meta.getFieldInStream().length; i++ ) { diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/stringoperations/StringOperationsMeta.java b/engine/src/main/java/org/pentaho/di/trans/steps/stringoperations/StringOperationsMeta.java index ea14f7d08979..b940e5311976 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/stringoperations/StringOperationsMeta.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/stringoperations/StringOperationsMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2019 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -24,6 +24,7 @@ import java.util.List; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.CheckResult; import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.Const; @@ -527,8 +528,8 @@ public void saveRep( Repository rep, IMetaStore metaStore, ObjectId id_transform } @Override - public void getFields( RowMetaInterface inputRowMeta, String name, RowMetaInterface[] info, StepMeta nextStep, - VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { + public void getFields( Bowl bowl, RowMetaInterface inputRowMeta, String name, RowMetaInterface[] info, + StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { // Add new field? for ( int i = 0; i < fieldOutStream.length; i++ ) { ValueMetaInterface v; diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/switchcase/SwitchCase.java b/engine/src/main/java/org/pentaho/di/trans/steps/switchcase/SwitchCase.java index 0b5ee54fe508..02981851c57a 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/switchcase/SwitchCase.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/switchcase/SwitchCase.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2018 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -154,7 +154,8 @@ public boolean init( StepMetaInterface smi, StepDataInterface sdi ) { */ void createOutputValueMapping() throws KettleException { data.outputRowMeta = getInputRowMeta().clone(); - meta.getFields( getInputRowMeta(), getStepname(), null, null, this, repository, metaStore ); + meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository, + metaStore ); data.fieldIndex = getInputRowMeta().indexOfValue( meta.getFieldname() ); if ( data.fieldIndex < 0 ) { diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/switchcase/SwitchCaseMeta.java b/engine/src/main/java/org/pentaho/di/trans/steps/switchcase/SwitchCaseMeta.java index aed2cad18c29..38712d16a7d4 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/switchcase/SwitchCaseMeta.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/switchcase/SwitchCaseMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2018 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -22,6 +22,7 @@ package org.pentaho.di.trans.steps.switchcase; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.CheckResult; import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.Const; @@ -245,7 +246,8 @@ public void saveRep( Repository rep, IMetaStore metaStore, ObjectId id_transform } } - public void getFields( RowMetaInterface rowMeta, String origin, RowMetaInterface[] info, StepMeta nextStep, + @Override + public void getFields( Bowl bowl, RowMetaInterface rowMeta, String origin, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { // Default: nothing changes to rowMeta } diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/symmetriccrypto/secretkeygenerator/SecretKeyGenerator.java b/engine/src/main/java/org/pentaho/di/trans/steps/symmetriccrypto/secretkeygenerator/SecretKeyGenerator.java index e92a80806275..1e1607d6c2e2 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/symmetriccrypto/secretkeygenerator/SecretKeyGenerator.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/symmetriccrypto/secretkeygenerator/SecretKeyGenerator.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -87,7 +87,8 @@ public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws first = false; data.prevNrField = getInputRowMeta().size(); data.outputRowMeta = getInputRowMeta().clone(); - meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); + meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository, + metaStore ); } } else { @@ -95,7 +96,8 @@ public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws if ( first ) { first = false; data.outputRowMeta = new RowMeta(); - meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); + meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository, + metaStore ); } } for ( int i = 0; i < data.nr && !isStopped(); i++ ) { diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/symmetriccrypto/secretkeygenerator/SecretKeyGeneratorMeta.java b/engine/src/main/java/org/pentaho/di/trans/steps/symmetriccrypto/secretkeygenerator/SecretKeyGeneratorMeta.java index 95e34cd659e7..df43a8e60d03 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/symmetriccrypto/secretkeygenerator/SecretKeyGeneratorMeta.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/symmetriccrypto/secretkeygenerator/SecretKeyGeneratorMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -24,6 +24,7 @@ import java.util.List; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.CheckResult; import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.Const; @@ -277,7 +278,7 @@ public void setDefault() { } @Override - public void getFields( RowMetaInterface row, String name, RowMetaInterface[] info, StepMeta nextStep, + public void getFields( Bowl bowl, RowMetaInterface row, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { ValueMetaInterface v; diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/symmetriccrypto/symmetricalgorithm/SymmetricCrypto.java b/engine/src/main/java/org/pentaho/di/trans/steps/symmetriccrypto/symmetricalgorithm/SymmetricCrypto.java index 0011c48b08c5..94de8a15b6c0 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/symmetriccrypto/symmetricalgorithm/SymmetricCrypto.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/symmetriccrypto/symmetricalgorithm/SymmetricCrypto.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -29,6 +29,7 @@ import org.apache.commons.codec.binary.Hex; import org.apache.commons.vfs2.FileObject; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.Const; import org.pentaho.di.core.vfs.KettleVFS; import org.pentaho.di.i18n.BaseMessages; @@ -123,10 +124,10 @@ public void setSecretKey( byte[] keyBytes ) throws CryptoKeyException { } } - public void setSecretKeyFromFile( String filename ) throws CryptoKeyException { + public void setSecretKeyFromFile( Bowl bowl, String filename ) throws CryptoKeyException { FileObject file = null; try { - file = KettleVFS.getFileObject( filename ); + file = KettleVFS.getInstance( bowl ).getFileObject( filename ); if ( !file.exists() ) { throw new CryptoException( BaseMessages.getString( PKG, "SymmetricCrypto.CanNotFindFile", file.getName() ) ); } diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/symmetriccrypto/symmetriccryptotrans/SymmetricCryptoTrans.java b/engine/src/main/java/org/pentaho/di/trans/steps/symmetriccrypto/symmetriccryptotrans/SymmetricCryptoTrans.java index 3baba89e70f9..d6990c7ce47e 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/symmetriccrypto/symmetriccryptotrans/SymmetricCryptoTrans.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/symmetriccrypto/symmetriccryptotrans/SymmetricCryptoTrans.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -74,7 +74,8 @@ public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws first = false; data.outputRowMeta = getInputRowMeta().clone(); - meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); + meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository, + metaStore ); // Let's check that Result Field is given if ( Utils.isEmpty( meta.getResultfieldname() ) ) { diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/symmetriccrypto/symmetriccryptotrans/SymmetricCryptoTransMeta.java b/engine/src/main/java/org/pentaho/di/trans/steps/symmetriccrypto/symmetriccryptotrans/SymmetricCryptoTransMeta.java index 7a2e56a6c428..73dcd80eda76 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/symmetriccrypto/symmetriccryptotrans/SymmetricCryptoTransMeta.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/symmetriccrypto/symmetriccryptotrans/SymmetricCryptoTransMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -24,6 +24,7 @@ import java.util.List; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.CheckResult; import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.Const; @@ -293,7 +294,8 @@ public void setDefault() { outputResultAsBinary = false; } - public void getFields( RowMetaInterface rowMeta, String origin, RowMetaInterface[] info, StepMeta nextStep, + @Override + public void getFields( Bowl bowl, RowMetaInterface rowMeta, String origin, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { if ( !Utils.isEmpty( getResultfieldname() ) ) { diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/synchronizeaftermerge/SynchronizeAfterMerge.java b/engine/src/main/java/org/pentaho/di/trans/steps/synchronizeaftermerge/SynchronizeAfterMerge.java index 4aac576d5e2a..9ded3cf57b5d 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/synchronizeaftermerge/SynchronizeAfterMerge.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/synchronizeaftermerge/SynchronizeAfterMerge.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2018 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -664,7 +664,8 @@ public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws first = false; data.outputRowMeta = getInputRowMeta().clone(); data.inputRowMeta = data.outputRowMeta; - meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); + meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository, + metaStore ); if ( meta.istablenameInField() ) { // Cache the position of the table name field diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/systemdata/SystemData.java b/engine/src/main/java/org/pentaho/di/trans/steps/systemdata/SystemData.java index 448ae9a9d02e..198ab4b768c4 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/systemdata/SystemData.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/systemdata/SystemData.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2018 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -711,7 +711,8 @@ public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws if ( first ) { first = false; data.outputRowMeta = getInputRowMeta().clone(); - meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); + meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository, + metaStore ); } } else { @@ -721,7 +722,8 @@ public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws if ( first ) { first = false; data.outputRowMeta = new RowMeta(); - meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); + meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository, + metaStore ); } } diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/systemdata/SystemDataMeta.java b/engine/src/main/java/org/pentaho/di/trans/steps/systemdata/SystemDataMeta.java index 37967877b3af..0e966d33ac30 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/systemdata/SystemDataMeta.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/systemdata/SystemDataMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2018 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -28,6 +28,7 @@ import java.util.List; import java.util.Map; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.CheckResult; import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.Const; @@ -164,7 +165,7 @@ public void setDefault() { } @Override - public void getFields( RowMetaInterface row, String name, RowMetaInterface[] info, StepMeta nextStep, + public void getFields( Bowl bowl, RowMetaInterface row, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { for ( int i = 0; i < fieldName.length; i++ ) { ValueMetaInterface v; diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/tablecompare/TableCompare.java b/engine/src/main/java/org/pentaho/di/trans/steps/tablecompare/TableCompare.java index d7e243957c40..818da9d23871 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/tablecompare/TableCompare.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/tablecompare/TableCompare.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2018 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -77,7 +77,8 @@ public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws // What's the format of the output row? // data.outputRowMeta = getInputRowMeta().clone(); - meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); + meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository, + metaStore ); // Reference schema // diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/tablecompare/TableCompareMeta.java b/engine/src/main/java/org/pentaho/di/trans/steps/tablecompare/TableCompareMeta.java index 1b372dace6f4..e8cd6c2f12d2 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/tablecompare/TableCompareMeta.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/tablecompare/TableCompareMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -25,6 +25,7 @@ import java.util.ArrayList; import java.util.List; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.CheckResult; import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.database.DatabaseMeta; @@ -374,8 +375,8 @@ public Object clone() { } @Override - public void getFields( RowMetaInterface inputRowMeta, String origin, RowMetaInterface[] info, StepMeta nextStep, - VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { + public void getFields( Bowl bowl, RowMetaInterface inputRowMeta, String origin, RowMetaInterface[] info, + StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { if ( Utils.isEmpty( nrErrorsField ) ) { throw new KettleStepException( BaseMessages.getString( diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/tableexists/TableExists.java b/engine/src/main/java/org/pentaho/di/trans/steps/tableexists/TableExists.java index 523ef7f9c0f1..c7969df36980 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/tableexists/TableExists.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/tableexists/TableExists.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2018 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -70,7 +70,8 @@ public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws if ( first ) { first = false; data.outputRowMeta = getInputRowMeta().clone(); - meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); + meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository, + metaStore ); // Check is tablename field is provided if ( Utils.isEmpty( meta.getDynamicTablenameField() ) ) { diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/tableexists/TableExistsMeta.java b/engine/src/main/java/org/pentaho/di/trans/steps/tableexists/TableExistsMeta.java index 3c967e16a080..e259ce70e4e2 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/tableexists/TableExistsMeta.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/tableexists/TableExistsMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -24,6 +24,7 @@ import java.util.List; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.CheckResult; import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.database.DatabaseMeta; @@ -139,7 +140,8 @@ public void setDefault() { resultfieldname = "result"; } - public void getFields( RowMetaInterface inputRowMeta, String name, RowMetaInterface[] info, StepMeta nextStep, + @Override + public void getFields( Bowl bowl, RowMetaInterface inputRowMeta, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { // Output field (String) if ( !Utils.isEmpty( resultfieldname ) ) { diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/tableinput/TableInputMeta.java b/engine/src/main/java/org/pentaho/di/trans/steps/tableinput/TableInputMeta.java index 8454e3f88ad1..5bf2e23a0e84 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/tableinput/TableInputMeta.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/tableinput/TableInputMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2019 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -22,6 +22,7 @@ package org.pentaho.di.trans.steps.tableinput; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.CheckResult; import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.Const; @@ -208,7 +209,8 @@ protected Database getDatabase() { return new Database( loggingObject, databaseMeta ); } - public void getFields( RowMetaInterface row, String origin, RowMetaInterface[] info, StepMeta nextStep, + @Override + public void getFields( Bowl bowl, RowMetaInterface row, String origin, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { if ( databaseMeta == null ) { return; // TODO: throw an exception here @@ -545,7 +547,8 @@ public void analyseImpact( List impact, TransMeta transMeta, Ste // Find the lookupfields... RowMetaInterface out = new RowMeta(); // TODO: this builds, but does it work in all cases. - getFields( out, stepMeta.getName(), new RowMetaInterface[] { info }, null, transMeta, repository, metaStore ); + getFields( transMeta.getBowl(), out, stepMeta.getName(), new RowMetaInterface[] { info }, null, transMeta, + repository, metaStore ); if ( out != null ) { for ( int i = 0; i < out.size(); i++ ) { diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/tableoutput/TableOutput.java b/engine/src/main/java/org/pentaho/di/trans/steps/tableoutput/TableOutput.java index ee13a3f288d7..95fea621912e 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/tableoutput/TableOutput.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/tableoutput/TableOutput.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2018 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -82,7 +82,8 @@ public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws truncateTable(); } data.outputRowMeta = getInputRowMeta().clone(); - meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); + meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository, + metaStore ); if ( !meta.specifyFields() ) { // Just take the input row diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/tableoutput/TableOutputMeta.java b/engine/src/main/java/org/pentaho/di/trans/steps/tableoutput/TableOutputMeta.java index 89b33286d60d..301a948c2905 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/tableoutput/TableOutputMeta.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/tableoutput/TableOutputMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2020 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -24,6 +24,7 @@ import com.google.common.base.Preconditions; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.CheckResult; import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.Const; @@ -622,7 +623,8 @@ public void saveRep( Repository rep, IMetaStore metaStore, ObjectId id_transform } } - public void getFields( RowMetaInterface row, String origin, RowMetaInterface[] info, StepMeta nextStep, + @Override + public void getFields( Bowl bowl, RowMetaInterface row, String origin, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { // Just add the returning key field... if ( returningGeneratedKeys && generatedKeyField != null && generatedKeyField.length() > 0 ) { diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/textfileinput/TextFileInput.java b/engine/src/main/java/org/pentaho/di/trans/steps/textfileinput/TextFileInput.java index c36f9fe639ef..d7e320f788fb 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/textfileinput/TextFileInput.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/textfileinput/TextFileInput.java @@ -893,7 +893,8 @@ public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws } String fileValue = prevInfoFields.getString( fileRow, idx ); try { - FileObject fileObject = KettleVFS.getFileObject( fileValue, getTransMeta() ); + FileObject fileObject = KettleVFS.getInstance( getTransMeta().getBowl() ) + .getFileObject( fileValue, getTransMeta() ); data.getFiles().addFile( fileObject ); if ( meta.isPassingThruFields() ) { data.passThruFields.put( fileObject, fileRow ); @@ -916,7 +917,8 @@ public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws } // // get the metadata populated. Simple and easy. - meta.getFields( data.outputRowMeta, getStepname(), infoStep, null, this, repository, metaStore ); + meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), infoStep, null, this, repository, + metaStore ); // Create convert meta-data objects that will contain Date & Number formatters // data.convertRowMeta = data.outputRowMeta.cloneToType( ValueMetaInterface.TYPE_STRING ); diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/textfileinput/TextFileInputMeta.java b/engine/src/main/java/org/pentaho/di/trans/steps/textfileinput/TextFileInputMeta.java index 8aae69de7c80..a233c496bdab 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/textfileinput/TextFileInputMeta.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/textfileinput/TextFileInputMeta.java @@ -1052,7 +1052,7 @@ public void setDefault() { } @Override - public void getFields( RowMetaInterface row, String name, RowMetaInterface[] info, StepMeta nextStep, + public void getFields( Bowl bowl, RowMetaInterface row, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { if ( !isPassingThruFields() ) { // all incoming fields are not transmitted ! @@ -1189,9 +1189,9 @@ public void getFields( RowMetaInterface row, String name, RowMetaInterface[] inf @Override @Deprecated - public void getFields( RowMetaInterface inputRowMeta, String name, RowMetaInterface[] info, StepMeta nextStep, - VariableSpace space ) throws KettleStepException { - getFields( inputRowMeta, name, info, nextStep, space, null, null ); + public void getFields( Bowl bowl, RowMetaInterface inputRowMeta, String name, RowMetaInterface[] info, + StepMeta nextStep, VariableSpace space ) throws KettleStepException { + getFields( bowl, inputRowMeta, name, info, nextStep, space, null, null ); } @Override @@ -2043,7 +2043,7 @@ public List getResourceDependencies( TransMeta transMeta, Ste * @return the filename of the exported resource */ @Override - public String exportResources( VariableSpace space, Map definitions, + public String exportResources( Bowl bowl, VariableSpace space, Map definitions, ResourceNamingInterface resourceNamingInterface, Repository repository, IMetaStore metaStore ) throws KettleException { try { // The object that we're modifying here is a copy of the original! @@ -2055,7 +2055,8 @@ public String exportResources( VariableSpace space, Map definitions, + public String exportResources( Bowl bowl, VariableSpace space, Map definitions, ResourceNamingInterface resourceNamingInterface, Repository repository, IMetaStore metaStore ) throws KettleException { try { @@ -1104,7 +1105,8 @@ public String exportResources( VariableSpace space, Map 0 ) { ValueMetaInterface v = new ValueMetaBoolean( ignoreFlagField ); diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/userdefinedjavaclass/UserDefinedJavaClassMeta.java b/engine/src/main/java/org/pentaho/di/trans/steps/userdefinedjavaclass/UserDefinedJavaClassMeta.java index 99a93b20a001..f2eb0e55f9b7 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/userdefinedjavaclass/UserDefinedJavaClassMeta.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/userdefinedjavaclass/UserDefinedJavaClassMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2018 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -26,6 +26,7 @@ import org.codehaus.janino.ClassBodyEvaluator; import org.codehaus.commons.compiler.CompileException; import org.codehaus.janino.Scanner; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.CheckResult; import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.Const; @@ -473,7 +474,8 @@ public void searchInfoAndTargetSteps( List steps ) { } } - public void getFields( RowMetaInterface row, String originStepname, RowMetaInterface[] info, StepMeta nextStep, + @Override + public void getFields( Bowl bowl, RowMetaInterface row, String originStepname, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { if ( !checkClassCookings( getLog() ) ) { if ( cookErrors.size() > 0 ) { diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/valuemapper/ValueMapper.java b/engine/src/main/java/org/pentaho/di/trans/steps/valuemapper/ValueMapper.java index c5b83c0b3e23..063d4d869e7b 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/valuemapper/ValueMapper.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/valuemapper/ValueMapper.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -73,7 +73,7 @@ public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws data.previousMeta = getInputRowMeta().clone(); data.outputMeta = data.previousMeta.clone(); - meta.getFields( data.outputMeta, getStepname(), null, null, this, repository, metaStore ); + meta.getFields( getTransMeta().getBowl(), data.outputMeta, getStepname(), null, null, this, repository, metaStore ); data.keynr = data.previousMeta.indexOfValue( meta.getFieldToUse() ); if ( data.keynr < 0 ) { diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/valuemapper/ValueMapperMeta.java b/engine/src/main/java/org/pentaho/di/trans/steps/valuemapper/ValueMapperMeta.java index 1de5fa377c6d..87ba5182c9be 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/valuemapper/ValueMapperMeta.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/valuemapper/ValueMapperMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -25,6 +25,7 @@ import java.util.List; import org.apache.commons.lang.StringUtils; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.CheckResult; import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.Const; @@ -168,7 +169,7 @@ public void setDefault() { } @Override - public void getFields( RowMetaInterface r, String name, RowMetaInterface[] info, StepMeta nextStep, + public void getFields( Bowl bowl, RowMetaInterface r, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) { ValueMetaInterface extra = null; if ( !Utils.isEmpty( getTargetField() ) ) { diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/webserviceavailable/WebServiceAvailable.java b/engine/src/main/java/org/pentaho/di/trans/steps/webserviceavailable/WebServiceAvailable.java index 8a7504d9f7df..4a73402857ab 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/webserviceavailable/WebServiceAvailable.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/webserviceavailable/WebServiceAvailable.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -75,7 +75,8 @@ public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws data.previousRowMeta = getInputRowMeta().clone(); data.NrPrevFields = data.previousRowMeta.size(); data.outputRowMeta = data.previousRowMeta; - meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); + meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository, + metaStore ); // Check is URL field is provided if ( Utils.isEmpty( meta.getURLField() ) ) { diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/webserviceavailable/WebServiceAvailableMeta.java b/engine/src/main/java/org/pentaho/di/trans/steps/webserviceavailable/WebServiceAvailableMeta.java index 6ab2252ba9c8..f1b24145696b 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/webserviceavailable/WebServiceAvailableMeta.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/webserviceavailable/WebServiceAvailableMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -24,6 +24,7 @@ import java.util.List; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.CheckResult; import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.database.DatabaseMeta; @@ -134,7 +135,8 @@ public void setDefault() { readTimeOut = "0"; } - public void getFields( RowMetaInterface inputRowMeta, String name, RowMetaInterface[] info, StepMeta nextStep, + @Override + public void getFields( Bowl bowl, RowMetaInterface inputRowMeta, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { if ( !Utils.isEmpty( resultfieldname ) ) { diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/webservices/WebService.java b/engine/src/main/java/org/pentaho/di/trans/steps/webservices/WebService.java index ffafcfd3b52b..4a2b939ed644 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/webservices/WebService.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/webservices/WebService.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2019 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -175,7 +175,8 @@ public boolean processRow( StepMetaInterface metaInterface, StepDataInterface da } else { data.outputRowMeta = new RowMeta(); } - meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); + meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository, + metaStore ); defineIndexList( getInputRowMeta(), vCurrentRow ); } else { diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/webservices/WebServiceMeta.java b/engine/src/main/java/org/pentaho/di/trans/steps/webservices/WebServiceMeta.java index c504479604ec..5ea4c8f33c54 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/webservices/WebServiceMeta.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/webservices/WebServiceMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -26,6 +26,7 @@ import java.util.Iterator; import java.util.List; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.CheckResult; import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.Const; @@ -126,7 +127,7 @@ public WebServiceMeta( Repository rep, IMetaStore metaStore, ObjectId id_step, L } @Override - public void getFields( RowMetaInterface r, String name, RowMetaInterface[] info, StepMeta nextStep, + public void getFields( Bowl bowl, RowMetaInterface r, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { // Input rows and output rows are different in the webservice step // diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/xbaseinput/XBaseInput.java b/engine/src/main/java/org/pentaho/di/trans/steps/xbaseinput/XBaseInput.java index 3cb576721fcb..e0a69ea4a8e6 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/xbaseinput/XBaseInput.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/xbaseinput/XBaseInput.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2021 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -92,7 +92,8 @@ public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws } try { String filename = fileRowMeta.getString( fileRowData, idx ); - data.files.addFile( KettleVFS.getFileObject( filename, getTransMeta() ) ); + data.files.addFile( KettleVFS.getInstance( getTransMeta().getBowl() ) + .getFileObject( filename, getTransMeta() ) ); } catch ( Exception e ) { throw new KettleException( e ); } @@ -163,7 +164,7 @@ public boolean init( StepMetaInterface smi, StepDataInterface sdi ) { data = (XBaseInputData) sdi; if ( super.init( smi, sdi ) ) { - data.files = meta.getTextFileList( this ); + data.files = meta.getTextFileList( getTransMeta().getBowl(), this ); data.fileNr = 0; if ( data.files.nrOfFiles() == 0 && !meta.isAcceptingFilenames() ) { diff --git a/engine/src/main/java/org/pentaho/di/trans/steps/xbaseinput/XBaseInputMeta.java b/engine/src/main/java/org/pentaho/di/trans/steps/xbaseinput/XBaseInputMeta.java index 21341e3a5711..f0547226905c 100644 --- a/engine/src/main/java/org/pentaho/di/trans/steps/xbaseinput/XBaseInputMeta.java +++ b/engine/src/main/java/org/pentaho/di/trans/steps/xbaseinput/XBaseInputMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -26,6 +26,7 @@ import java.util.Map; import org.apache.commons.vfs2.FileObject; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.CheckResult; import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.Const; @@ -346,10 +347,10 @@ public RowMetaInterface getOutputFields( FileInputList files, String name ) thro } @Override - public void getFields( RowMetaInterface row, String name, RowMetaInterface[] info, StepMeta nextStep, + public void getFields( Bowl bowl, RowMetaInterface row, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { - FileInputList fileList = getTextFileList( space ); + FileInputList fileList = getTextFileList( bowl, space ); if ( fileList.nrOfFiles() == 0 ) { throw new KettleStepException( BaseMessages .getString( PKG, "XBaseInputMeta.Exception.NoFilesFoundToProcess" ) ); @@ -501,14 +502,14 @@ public StepDataInterface getStepData() { return new XBaseInputData(); } - public String[] getFilePaths( VariableSpace space ) { + public String[] getFilePaths( Bowl bowl, VariableSpace space ) { return FileInputList.createFilePathList( - space, new String[] { dbfFileName }, new String[] { null }, new String[] { null }, new String[] { "N" } ); + bowl, space, new String[] { dbfFileName }, new String[] { null }, new String[] { null }, new String[] { "N" } ); } - public FileInputList getTextFileList( VariableSpace space ) { - return FileInputList.createFileList( - space, new String[] { dbfFileName }, new String[] { null }, new String[] { null }, new String[] { "N" } ); + public FileInputList getTextFileList( Bowl bowl, VariableSpace space ) { + return FileInputList.createFileList( bowl, space, new String[] { dbfFileName }, new String[] { null }, + new String[] { null }, new String[] { "N" } ); } @Override @@ -549,7 +550,7 @@ public void setCharactersetName( String charactersetName ) { * @return the filename of the exported resource */ @Override - public String exportResources( VariableSpace space, Map definitions, + public String exportResources( Bowl bowl, VariableSpace space, Map definitions, ResourceNamingInterface resourceNamingInterface, Repository repository, IMetaStore metaStore ) throws KettleException { try { // The object that we're modifying here is a copy of the original! @@ -560,7 +561,8 @@ public String exportResources( VariableSpace space, Map remarks, TransMeta transMeta, } try { - TransMeta subMeta = mappingMetaRetriever.get( this, repository, metaStore, space ); + TransMeta subMeta = mappingMetaRetriever.get( transMeta.getBowl(), this, repository, metaStore, space ); if ( !StringUtil.isEmpty( getSubStep() ) ) { String realSubStepName = space.environmentSubstitute( getSubStep() ); @@ -252,18 +253,18 @@ public List getResourceDependencies( TransMeta transMeta, Ste return new boolean[] { !Utils.isEmpty( transformationPath ) }; } - @Override public Object loadReferencedObject( int index, Repository rep, IMetaStore metaStore, VariableSpace space ) - throws KettleException { - return loadMappingMeta( this, rep, metaStore, space ); + @Override public Object loadReferencedObject( Bowl bowl, int index, Repository rep, IMetaStore metaStore, + VariableSpace space ) throws KettleException { + return loadMappingMeta( bowl, this, rep, metaStore, space ); } public abstract RowMeta getRowMeta( String origin, VariableSpace space ) throws KettleStepException; - @Override public void getFields( RowMetaInterface rowMeta, String origin, RowMetaInterface[] info, StepMeta nextStep, - VariableSpace space, Repository repository, IMetaStore metaStore ) + @Override public void getFields( Bowl bowl, RowMetaInterface rowMeta, String origin, RowMetaInterface[] info, + StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { try { - TransMeta transMeta = mappingMetaRetriever.get( this, repository, metaStore, space ); + TransMeta transMeta = mappingMetaRetriever.get( bowl, this, repository, metaStore, space ); if ( !StringUtil.isEmpty( getSubStep() ) ) { String realSubStepName = space.environmentSubstitute( getSubStep() ); if ( transMeta.getSteps().stream().anyMatch( stepMeta -> stepMeta.getName().equals( realSubStepName ) ) ) { @@ -274,7 +275,7 @@ public List getResourceDependencies( TransMeta transMeta, Ste { try { stepMeta.getStepMetaInterface() - .getFields( rowMeta, origin, info, nextStep, space, repository, metaStore ); + .getFields( bowl, rowMeta, origin, info, nextStep, space, repository, metaStore ); } catch ( KettleStepException e ) { throw new RuntimeException( e ); } diff --git a/engine/src/main/java/org/pentaho/di/www/AddExportServlet.java b/engine/src/main/java/org/pentaho/di/www/AddExportServlet.java index 553073def182..d222bfccbec6 100644 --- a/engine/src/main/java/org/pentaho/di/www/AddExportServlet.java +++ b/engine/src/main/java/org/pentaho/di/www/AddExportServlet.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2019 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -23,10 +23,12 @@ package org.pentaho.di.www; import org.apache.commons.vfs2.FileObject; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.Const; import org.pentaho.di.core.util.Utils; import org.pentaho.di.core.logging.LoggingObjectType; import org.pentaho.di.core.logging.SimpleLoggingObject; +import org.pentaho.di.core.vfs.IKettleVFS; import org.pentaho.di.core.vfs.KettleVFS; import org.pentaho.di.core.xml.XMLHandler; import org.pentaho.di.job.Job; @@ -197,8 +199,10 @@ public void doGet( HttpServletRequest request, HttpServletResponse response ) th OutputStream outputStream = null; try { - FileObject tempFile = KettleVFS.createTempFile( "export", ".zip", System.getProperty( "java.io.tmpdir" ) ); - outputStream = KettleVFS.getOutputStream( tempFile, false ); + IKettleVFS vfs = KettleVFS.getInstance( DefaultBowl.getInstance() ); + + FileObject tempFile = vfs.createTempFile( "export", ".zip", System.getProperty( "java.io.tmpdir" ) ); + outputStream = vfs.getOutputStream( tempFile, false ); // Pass the input directly to a temporary file // @@ -229,13 +233,13 @@ public void doGet( HttpServletRequest request, HttpServletResponse response ) th if ( isJob ) { // Open the job from inside the ZIP archive // - KettleVFS.getFileObject( fileUrl ); + vfs.getFileObject( fileUrl ); - JobMeta jobMeta = new JobMeta( fileUrl, null ); // never with a repository + JobMeta jobMeta = new JobMeta( DefaultBowl.getInstance(), fileUrl, null ); // never with a repository // Also read the execution configuration information // String configUrl = "zip:" + archiveUrl + "!" + Job.CONFIGURATION_IN_EXPORT_FILENAME; - Document configDoc = XMLHandler.loadXMLFile( configUrl ); + Document configDoc = XMLHandler.loadXMLFile( DefaultBowl.getInstance(), configUrl ); JobExecutionConfiguration jobExecutionConfiguration = new JobExecutionConfiguration( XMLHandler.getSubNode( configDoc, JobExecutionConfiguration.XML_TAG ) ); @@ -273,11 +277,11 @@ public void doGet( HttpServletRequest request, HttpServletResponse response ) th } else { // Open the transformation from inside the ZIP archive // - TransMeta transMeta = new TransMeta( fileUrl ); + TransMeta transMeta = new TransMeta( DefaultBowl.getInstance(), fileUrl ); // Also read the execution configuration information // String configUrl = "zip:" + archiveUrl + "!" + Trans.CONFIGURATION_IN_EXPORT_FILENAME; - Document configDoc = XMLHandler.loadXMLFile( configUrl ); + Document configDoc = XMLHandler.loadXMLFile( DefaultBowl.getInstance(), configUrl ); TransExecutionConfiguration executionConfiguration = new TransExecutionConfiguration( XMLHandler.getSubNode( configDoc, TransExecutionConfiguration.XML_TAG ) ); diff --git a/engine/src/main/java/org/pentaho/di/www/AddTransServlet.java b/engine/src/main/java/org/pentaho/di/www/AddTransServlet.java index 992ab58cfe45..c98c8cbb12d6 100644 --- a/engine/src/main/java/org/pentaho/di/www/AddTransServlet.java +++ b/engine/src/main/java/org/pentaho/di/www/AddTransServlet.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2021 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -24,6 +24,7 @@ import org.apache.xerces.dom.DeferredTextImpl; import org.owasp.encoder.Encode; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.Const; import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.core.exception.KettleXMLException; @@ -305,7 +306,7 @@ private void setupLogChannelWriter( String realLogFilename, TransExecutionConfig FileUtil.createParentFolder( AddTransServlet.class, realLogFilename, transExecutionConfiguration .isCreateParentFolder(), trans.getLogChannel(), trans ); logChannelFileWriter = - new LogChannelFileWriter( servletLoggingObject.getLogChannelId(), KettleVFS + new LogChannelFileWriter( servletLoggingObject.getLogChannelId(), KettleVFS.getInstance( DefaultBowl.getInstance() ) .getFileObject( realLogFilename ), transExecutionConfiguration.isSetAppendLogfile() ); logChannelFileWriter.startLogging(); diff --git a/engine/src/main/java/org/pentaho/di/www/BaseJobServlet.java b/engine/src/main/java/org/pentaho/di/www/BaseJobServlet.java index 77ae9324b56d..76ee72f73124 100644 --- a/engine/src/main/java/org/pentaho/di/www/BaseJobServlet.java +++ b/engine/src/main/java/org/pentaho/di/www/BaseJobServlet.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2021 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -23,6 +23,7 @@ import org.apache.commons.lang.StringUtils; import org.pentaho.di.base.AbstractMeta; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.Const; import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.core.logging.LogChannelFileWriter; @@ -137,7 +138,8 @@ protected Trans createTrans( TransConfiguration transConfiguration ) throws Unkn .isCreateParentFolder(), trans.getLogChannel(), trans ); final LogChannelFileWriter logChannelFileWriter = new LogChannelFileWriter( servletLoggingObject.getLogChannelId(), - KettleVFS.getFileObject( realLogFilename ), transExecutionConfiguration.isSetAppendLogfile() ); + KettleVFS.getInstance( DefaultBowl.getInstance() ) + .getFileObject( realLogFilename ), transExecutionConfiguration.isSetAppendLogfile() ); logChannelFileWriter.startLogging(); trans.addTransListener( new TransAdapter() { diff --git a/engine/src/main/java/org/pentaho/di/www/Carte.java b/engine/src/main/java/org/pentaho/di/www/Carte.java index f211f6c6fdd2..314d624bf65d 100644 --- a/engine/src/main/java/org/pentaho/di/www/Carte.java +++ b/engine/src/main/java/org/pentaho/di/www/Carte.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2018 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -39,6 +39,7 @@ import org.apache.commons.lang.StringUtils; import org.apache.commons.vfs2.FileObject; import org.pentaho.di.cluster.SlaveServer; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.KettleClientEnvironment; import org.pentaho.di.core.KettleEnvironment; import org.pentaho.di.core.encryption.Encr; @@ -197,7 +198,7 @@ private static void parseAndRunCommand( String[] args ) throws Exception { throw new Carte.CarteCommandException( BaseMessages.getString( PKG, "Carte.Error.illegalStop" ) ); } usingConfigFile = true; - FileObject file = KettleVFS.getFileObject( arguments[0] ); + FileObject file = KettleVFS.getInstance( DefaultBowl.getInstance() ).getFileObject( arguments[0] ); Document document = XMLHandler.loadXMLFile( file ); setKettleEnvironment(); // Must stand up server now to allow decryption of password Node configNode = XMLHandler.getSubNode( document, SlaveServerConfig.XML_TAG ); diff --git a/engine/src/main/java/org/pentaho/di/www/ExecuteJobServlet.java b/engine/src/main/java/org/pentaho/di/www/ExecuteJobServlet.java index 0930512d0d29..7a3b352b832a 100644 --- a/engine/src/main/java/org/pentaho/di/www/ExecuteJobServlet.java +++ b/engine/src/main/java/org/pentaho/di/www/ExecuteJobServlet.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2019 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -35,7 +35,7 @@ import com.google.common.annotations.VisibleForTesting; import org.pentaho.di.core.Const; import org.pentaho.di.core.parameters.UnknownParamException; -import org.pentaho.di.core.util.Utils; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.encryption.Encr; import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.core.logging.KettleLogStore; @@ -44,6 +44,7 @@ import org.pentaho.di.core.logging.SimpleLoggingObject; import org.pentaho.di.core.plugins.PluginRegistry; import org.pentaho.di.core.plugins.RepositoryPluginType; +import org.pentaho.di.core.util.Utils; import org.pentaho.di.i18n.BaseMessages; import org.pentaho.di.job.Job; import org.pentaho.di.job.JobAdapter; @@ -335,7 +336,8 @@ private JobMeta loadJob( Repository repository, String job ) throws KettleExcept // Without a repository it's a filename --> file:///foo/bar/job.kjb // - JobMeta jobMeta = new JobMeta( job, repository ); + // Repository doesn't need bowl-specific VFS. Use DefaultBowl. + JobMeta jobMeta = new JobMeta( DefaultBowl.getInstance(), job, repository ); return jobMeta; } else { diff --git a/engine/src/main/java/org/pentaho/di/www/ExecuteTransServlet.java b/engine/src/main/java/org/pentaho/di/www/ExecuteTransServlet.java index 16eb5c34bc2f..0fcf3ea454a3 100644 --- a/engine/src/main/java/org/pentaho/di/www/ExecuteTransServlet.java +++ b/engine/src/main/java/org/pentaho/di/www/ExecuteTransServlet.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2022 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -33,7 +33,7 @@ import javax.servlet.http.HttpServletResponse; import org.pentaho.di.core.Const; -import org.pentaho.di.core.util.Utils; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.encryption.Encr; import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.core.logging.KettleLogStore; @@ -42,6 +42,7 @@ import org.pentaho.di.core.logging.SimpleLoggingObject; import org.pentaho.di.core.plugins.PluginRegistry; import org.pentaho.di.core.plugins.RepositoryPluginType; +import org.pentaho.di.core.util.Utils; import org.pentaho.di.i18n.BaseMessages; import org.pentaho.di.repository.Repository; import org.pentaho.di.repository.KettleAuthenticationException; @@ -364,7 +365,8 @@ private TransMeta loadTransformation( Repository repository, String trans ) thro // Without a repository it's a filename --> file:///foo/bar/trans.ktr // - TransMeta transMeta = new TransMeta( trans ); + // Repository doesn't need bowl-specific VFS. Use DefaultBowl. + TransMeta transMeta = new TransMeta( DefaultBowl.getInstance(), trans ); return transMeta; } else { diff --git a/engine/src/main/java/org/pentaho/di/www/RegisterPackageServlet.java b/engine/src/main/java/org/pentaho/di/www/RegisterPackageServlet.java index a363e0f1423d..edf1c0782082 100644 --- a/engine/src/main/java/org/pentaho/di/www/RegisterPackageServlet.java +++ b/engine/src/main/java/org/pentaho/di/www/RegisterPackageServlet.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2019 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -34,6 +34,7 @@ import org.apache.commons.io.FilenameUtils; import org.apache.commons.io.IOUtils; import org.apache.commons.vfs2.FileObject; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.core.exception.KettleXMLException; import org.pentaho.di.core.util.UUIDUtil; @@ -105,7 +106,7 @@ WebResult generateBody( HttpServletRequest request, HttpServletResponse response getConfigNode( zipBaseUrl, Job.CONFIGURATION_IN_EXPORT_FILENAME, JobExecutionConfiguration.XML_TAG ); JobExecutionConfiguration jobExecutionConfiguration = new JobExecutionConfiguration( node ); - JobMeta jobMeta = new JobMeta( fileUrl, jobExecutionConfiguration.getRepository() ); + JobMeta jobMeta = new JobMeta( DefaultBowl.getInstance(), fileUrl, jobExecutionConfiguration.getRepository() ); JobConfiguration jobConfiguration = new JobConfiguration( jobMeta, jobExecutionConfiguration ); Job job = createJob( jobConfiguration ); @@ -116,7 +117,8 @@ WebResult generateBody( HttpServletRequest request, HttpServletResponse response TransExecutionConfiguration.XML_TAG ); TransExecutionConfiguration transExecutionConfiguration = new TransExecutionConfiguration( node ); - TransMeta transMeta = new TransMeta( fileUrl, transExecutionConfiguration.getRepository() ); + TransMeta transMeta = new TransMeta( DefaultBowl.getInstance(), fileUrl, + transExecutionConfiguration.getRepository() ); TransConfiguration transConfiguration = new TransConfiguration( transMeta, transExecutionConfiguration ); Trans trans = createTrans( transConfiguration ); @@ -184,7 +186,7 @@ protected String concat( String basePath, String relativePath ) { */ protected Node getConfigNode( String archiveUrl, String fileName, String xmlTag ) throws KettleXMLException { String configUrl = concat( archiveUrl, fileName ); - Document configDoc = XMLHandler.loadXMLFile( configUrl ); + Document configDoc = XMLHandler.loadXMLFile( DefaultBowl.getInstance(), configUrl ); return XMLHandler.getSubNode( configDoc, xmlTag ); } @@ -242,12 +244,14 @@ protected String copyRequestToDirectory( HttpServletRequest request, String dire protected String copyRequestToDirectory( InputStream inputStream, String directory ) throws KettleException { String copiedFilePath; try { - FileObject foDirectory = KettleVFS.getFileObject( directory ); + FileObject foDirectory = KettleVFS.getInstance( DefaultBowl.getInstance() ).getFileObject( directory ); if ( !foDirectory.exists() ) { foDirectory.createFolder(); } - FileObject tempZipFile = KettleVFS.createTempFile( "export", ".zip", directory ); - OutputStream outputStream = KettleVFS.getOutputStream( tempZipFile, false ); + FileObject tempZipFile = KettleVFS.getInstance( DefaultBowl.getInstance() ) + .createTempFile( "export", ".zip", directory ); + OutputStream outputStream = KettleVFS.getInstance( DefaultBowl.getInstance() ) + .getOutputStream( tempZipFile, false ); copyAndClose( inputStream, outputStream ); copiedFilePath = tempZipFile.getName().getPath(); } catch ( IOException ioe ) { diff --git a/engine/src/test/java/org/pentaho/di/base/MetaFileLoaderImplTest.java b/engine/src/test/java/org/pentaho/di/base/MetaFileLoaderImplTest.java index 0bfe2855c948..350e0dbded1d 100644 --- a/engine/src/test/java/org/pentaho/di/base/MetaFileLoaderImplTest.java +++ b/engine/src/test/java/org/pentaho/di/base/MetaFileLoaderImplTest.java @@ -26,6 +26,7 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.junit.MockitoJUnitRunner; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.Const; import org.pentaho.di.core.ObjectLocationSpecificationMethod; import org.pentaho.di.core.logging.LogChannelInterface; @@ -90,10 +91,10 @@ public void getMetaForEntryAsJobFromFileSystemTest() throws Exception { setupJobEntryJob(); specificationMethod = ObjectLocationSpecificationMethod.FILENAME; MetaFileLoaderImpl metaFileLoader = new MetaFileLoaderImpl( jobEntryBase, specificationMethod ); - JobMeta jobMeta = (JobMeta) metaFileLoader.getMetaForEntry( repository, store, space ); + JobMeta jobMeta = (JobMeta) metaFileLoader.getMetaForEntry( DefaultBowl.getInstance(), repository, store, space ); validateFirstJobMetaAccess( jobMeta ); - jobMeta = (JobMeta) metaFileLoader.getMetaForEntry( repository, store, space ); + jobMeta = (JobMeta) metaFileLoader.getMetaForEntry( DefaultBowl.getInstance(), repository, store, space ); validateSecondJobMetaAccess( jobMeta ); } @@ -103,10 +104,10 @@ public void getMetaForEntryAsJobFromRepoTest() throws Exception { setupJobEntryJob(); specificationMethod = ObjectLocationSpecificationMethod.REPOSITORY_BY_NAME; MetaFileLoaderImpl metaFileLoader = new MetaFileLoaderImpl( jobEntryBase, specificationMethod ); - JobMeta jobMeta = (JobMeta) metaFileLoader.getMetaForEntry( repository, store, space ); + JobMeta jobMeta = (JobMeta) metaFileLoader.getMetaForEntry( DefaultBowl.getInstance(), repository, store, space ); validateFirstJobMetaAccess( jobMeta ); - jobMeta = (JobMeta) metaFileLoader.getMetaForEntry( repository, store, space ); + jobMeta = (JobMeta) metaFileLoader.getMetaForEntry( DefaultBowl.getInstance(), repository, store, space ); validateSecondJobMetaAccess( jobMeta ); } @@ -116,10 +117,11 @@ public void getMetaForEntryAsTransFromFileSystemTest() throws Exception { setupJobEntryTrans(); specificationMethod = ObjectLocationSpecificationMethod.FILENAME; MetaFileLoaderImpl metaFileLoader = new MetaFileLoaderImpl( jobEntryBase, specificationMethod ); - TransMeta transMeta = (TransMeta) metaFileLoader.getMetaForEntry( repository, store, space ); + TransMeta transMeta = (TransMeta) metaFileLoader.getMetaForEntry( DefaultBowl.getInstance(), repository, store, + space ); validateFirstTransMetaAccess( transMeta ); - transMeta = (TransMeta) metaFileLoader.getMetaForEntry( repository, store, space ); + transMeta = (TransMeta) metaFileLoader.getMetaForEntry( DefaultBowl.getInstance(), repository, store, space ); validateSecondTransMetaAccess( transMeta ); } @@ -129,10 +131,11 @@ public void getMetaForEntryAsTransFromRepoTest() throws Exception { setupJobEntryTrans(); specificationMethod = ObjectLocationSpecificationMethod.REPOSITORY_BY_NAME; MetaFileLoaderImpl metaFileLoader = new MetaFileLoaderImpl( jobEntryBase, specificationMethod ); - TransMeta transMeta = (TransMeta) metaFileLoader.getMetaForEntry( repository, store, space ); + TransMeta transMeta = (TransMeta) metaFileLoader.getMetaForEntry( DefaultBowl.getInstance(), repository, store, + space ); validateFirstTransMetaAccess( transMeta ); - transMeta = (TransMeta) metaFileLoader.getMetaForEntry( repository, store, space ); + transMeta = (TransMeta) metaFileLoader.getMetaForEntry( DefaultBowl.getInstance(), repository, store, space ); validateSecondTransMetaAccess( transMeta ); } @@ -142,9 +145,9 @@ public void getMetaForStepAsJobFromFileSystemTest() throws Exception { setupJobExecutorMeta(); specificationMethod = ObjectLocationSpecificationMethod.FILENAME; MetaFileLoaderImpl metaFileLoader = new MetaFileLoaderImpl( baseStepMeta, specificationMethod ); - JobMeta jobMeta = (JobMeta) metaFileLoader.getMetaForStep( repository, store, space ); + JobMeta jobMeta = (JobMeta) metaFileLoader.getMetaForStep( DefaultBowl.getInstance(), repository, store, space ); validateFirstJobMetaAccess( jobMeta ); - jobMeta = (JobMeta) metaFileLoader.getMetaForStep( repository, store, space ); + jobMeta = (JobMeta) metaFileLoader.getMetaForStep( DefaultBowl.getInstance(), repository, store, space ); validateSecondJobMetaAccess( jobMeta ); } @@ -154,9 +157,9 @@ public void getMetaForStepAsJobFromRepoTest() throws Exception { setupJobExecutorMeta(); specificationMethod = ObjectLocationSpecificationMethod.REPOSITORY_BY_NAME; MetaFileLoaderImpl metaFileLoader = new MetaFileLoaderImpl( baseStepMeta, specificationMethod ); - JobMeta jobMeta = (JobMeta) metaFileLoader.getMetaForStep( repository, store, space ); + JobMeta jobMeta = (JobMeta) metaFileLoader.getMetaForStep( DefaultBowl.getInstance(), repository, store, space ); validateFirstJobMetaAccess( jobMeta ); - jobMeta = (JobMeta) metaFileLoader.getMetaForStep( repository, store, space ); + jobMeta = (JobMeta) metaFileLoader.getMetaForStep( DefaultBowl.getInstance(), repository, store, space ); validateSecondJobMetaAccess( jobMeta ); } @@ -166,9 +169,9 @@ public void getMetaForStepAsTransFromFileSystemTest() throws Exception { setupTransExecutorMeta(); specificationMethod = ObjectLocationSpecificationMethod.FILENAME; MetaFileLoaderImpl metaFileLoader = new MetaFileLoaderImpl( baseStepMeta, specificationMethod ); - TransMeta transMeta = (TransMeta) metaFileLoader.getMetaForStep( repository, store, space ); + TransMeta transMeta = (TransMeta) metaFileLoader.getMetaForStep( DefaultBowl.getInstance(), repository, store, space ); validateFirstTransMetaAccess( transMeta ); - transMeta = (TransMeta) metaFileLoader.getMetaForStep( repository, store, space ); + transMeta = (TransMeta) metaFileLoader.getMetaForStep( DefaultBowl.getInstance(), repository, store, space ); validateSecondTransMetaAccess( transMeta ); } @@ -178,9 +181,9 @@ public void getMetaForStepAsTransFromRepoTest() throws Exception { setupTransExecutorMeta(); specificationMethod = ObjectLocationSpecificationMethod.REPOSITORY_BY_NAME; MetaFileLoaderImpl metaFileLoader = new MetaFileLoaderImpl( baseStepMeta, specificationMethod ); - TransMeta transMeta = (TransMeta) metaFileLoader.getMetaForStep( repository, store, space ); + TransMeta transMeta = (TransMeta) metaFileLoader.getMetaForStep( DefaultBowl.getInstance(), repository, store, space ); validateFirstTransMetaAccess( transMeta ); - transMeta = (TransMeta) metaFileLoader.getMetaForStep( repository, store, space ); + transMeta = (TransMeta) metaFileLoader.getMetaForStep( DefaultBowl.getInstance(), repository, store, space ); validateSecondTransMetaAccess( transMeta ); } diff --git a/engine/src/test/java/org/pentaho/di/core/row/ValueDataUtilTest.java b/engine/src/test/java/org/pentaho/di/core/row/ValueDataUtilTest.java index babcc827ba24..9174f3c0c718 100644 --- a/engine/src/test/java/org/pentaho/di/core/row/ValueDataUtilTest.java +++ b/engine/src/test/java/org/pentaho/di/core/row/ValueDataUtilTest.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2022 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -43,6 +43,7 @@ import org.junit.Test; import org.mockito.invocation.InvocationOnMock; import org.mockito.stubbing.Answer; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.Const; import org.pentaho.di.core.exception.KettleFileNotFoundException; import org.pentaho.di.core.row.value.ValueMetaBigNumber; @@ -210,324 +211,343 @@ public void testPlus() throws KettleValueException { @Test public void checksumTest() { String path = getClass().getResource( "txt-sample.txt" ).getPath(); - String checksum = ValueDataUtil.createChecksum( new ValueMetaString(), path, "MD5" ); + String checksum = ValueDataUtil.createChecksum( DefaultBowl.getInstance(), new ValueMetaString(), path, "MD5" ); assertEquals( "098f6bcd4621d373cade4e832627b4f6", checksum ); } @Test public void checksumMissingFileTest() { String nonExistingFile = "nonExistingFile"; - String checksum = ValueDataUtil.createChecksum( new ValueMetaString(), nonExistingFile, "MD5" ); + String checksum = ValueDataUtil.createChecksum( DefaultBowl.getInstance(), new ValueMetaString(), nonExistingFile, + "MD5" ); assertNull( checksum ); } @Test public void checksumNullPathTest() { String nonExistingFile = "nonExistingFile"; - String checksum = ValueDataUtil.createChecksum( new ValueMetaString(), nonExistingFile, "MD5" ); + String checksum = ValueDataUtil.createChecksum( DefaultBowl.getInstance(), new ValueMetaString(), nonExistingFile, + "MD5" ); assertNull( checksum ); } @Test public void checksumWithFailIfNoFileTest() throws Exception { String path = getClass().getResource( "txt-sample.txt" ).getPath(); - String checksum = ValueDataUtil.createChecksum( new ValueMetaString(), path, "MD5", true ); + String checksum = ValueDataUtil.createChecksum( DefaultBowl.getInstance(), new ValueMetaString(), path, "MD5", + true ); assertEquals( "098f6bcd4621d373cade4e832627b4f6", checksum ); } @Test public void checksumWithoutFailIfNoFileTest() throws Exception { String path = getClass().getResource( "txt-sample.txt" ).getPath(); - String checksum = ValueDataUtil.createChecksum( new ValueMetaString(), path, "MD5", false ); + String checksum = ValueDataUtil.createChecksum( DefaultBowl.getInstance(), new ValueMetaString(), path, "MD5", + false ); assertEquals( "098f6bcd4621d373cade4e832627b4f6", checksum ); } @Test public void checksumNoFailIfNoFileTest() throws KettleFileNotFoundException { String nonExistingFile = "nonExistingFile"; - String checksum = ValueDataUtil.createChecksum( new ValueMetaString(), nonExistingFile, "MD5", false ); + String checksum = ValueDataUtil.createChecksum( DefaultBowl.getInstance(), new ValueMetaString(), nonExistingFile, + "MD5", false ); assertNull( checksum ); } @Test( expected = KettleFileNotFoundException.class ) public void checksumFailIfNoFileTest() throws KettleFileNotFoundException { String nonExistingPath = "nonExistingPath"; - ValueDataUtil.createChecksum( new ValueMetaString(), nonExistingPath, "MD5", true ); + ValueDataUtil.createChecksum( DefaultBowl.getInstance(), new ValueMetaString(), nonExistingPath, "MD5", true ); } @Test public void checksumNullPathNoFailTest() throws KettleFileNotFoundException { - assertNull( ValueDataUtil.createChecksum( new ValueMetaString(), null, "MD5", false ) ); + assertNull( ValueDataUtil.createChecksum( DefaultBowl.getInstance(), new ValueMetaString(), null, "MD5", false ) ); } @Test public void checksumNullPathFailTest() throws KettleFileNotFoundException { - assertNull( ValueDataUtil.createChecksum( new ValueMetaString(), null, "MD5", true ) ); + assertNull( ValueDataUtil.createChecksum( DefaultBowl.getInstance(), new ValueMetaString(), null, "MD5", true ) ); } @Test public void checksumCRC32Test() { String path = getClass().getResource( "txt-sample.txt" ).getPath(); - long checksum = ValueDataUtil.ChecksumCRC32( new ValueMetaString(), path ); + long checksum = ValueDataUtil.ChecksumCRC32( DefaultBowl.getInstance(), new ValueMetaString(), path ); assertEquals( 3632233996l, checksum ); } @Test public void checksumCRC32MissingFileTest() { String nonExistingFile = "nonExistingFile"; - long checksum = ValueDataUtil.ChecksumCRC32( new ValueMetaString(), nonExistingFile ); + long checksum = ValueDataUtil.ChecksumCRC32( DefaultBowl.getInstance(), new ValueMetaString(), nonExistingFile ); assertEquals( 0, checksum ); } @Test public void checksumCRC32NullPathTest() throws Exception { String nonExistingFile = "nonExistingFile"; - long checksum = ValueDataUtil.ChecksumCRC32( new ValueMetaString(), nonExistingFile ); + long checksum = ValueDataUtil.ChecksumCRC32( DefaultBowl.getInstance(), new ValueMetaString(), nonExistingFile ); assertEquals( 0, checksum ); } @Test public void checksumCRC32WithoutFailIfNoFileTest() throws Exception { String path = getClass().getResource( "txt-sample.txt" ).getPath(); - long checksum = ValueDataUtil.checksumCRC32( new ValueMetaString(), path, false ); + long checksum = ValueDataUtil.checksumCRC32( DefaultBowl.getInstance(), new ValueMetaString(), path, false ); assertEquals( 3632233996l, checksum ); } @Test public void checksumCRC32NoFailIfNoFileTest() throws KettleFileNotFoundException { String nonExistingPath = "nonExistingPath"; - long checksum = ValueDataUtil.checksumCRC32( new ValueMetaString(), nonExistingPath, false ); + long checksum = ValueDataUtil.checksumCRC32( DefaultBowl.getInstance(), new ValueMetaString(), nonExistingPath, + false ); assertEquals( 0, checksum ); } @Test( expected = KettleFileNotFoundException.class ) public void checksumCRC32FailIfNoFileTest() throws KettleFileNotFoundException { String nonExistingPath = "nonExistingPath"; - ValueDataUtil.checksumCRC32( new ValueMetaString(), nonExistingPath, true ); + ValueDataUtil.checksumCRC32( DefaultBowl.getInstance(), new ValueMetaString(), nonExistingPath, true ); } @Test public void checksumCRC32NullPathNoFailTest() throws KettleFileNotFoundException { - long checksum = ValueDataUtil.checksumCRC32( new ValueMetaString(), null, false ); + long checksum = ValueDataUtil.checksumCRC32( DefaultBowl.getInstance(), new ValueMetaString(), null, false ); assertEquals( 0, checksum ); } @Test public void checksumCRC32NullPathFailTest() throws KettleFileNotFoundException { - long checksum = ValueDataUtil.checksumCRC32( new ValueMetaString(), null, true ); + long checksum = ValueDataUtil.checksumCRC32( DefaultBowl.getInstance(), new ValueMetaString(), null, true ); assertEquals( 0, checksum ); } @Test public void checksumAdlerTest() { String path = getClass().getResource( "txt-sample.txt" ).getPath(); - long checksum = ValueDataUtil.ChecksumAdler32( new ValueMetaString(), path ); + long checksum = ValueDataUtil.ChecksumAdler32( DefaultBowl.getInstance(), new ValueMetaString(), path ); assertEquals( 73204161L, checksum ); } @Test public void checksumAdlerMissingFileTest() { String nonExistingFile = "nonExistingFile"; - long checksum = ValueDataUtil.ChecksumAdler32( new ValueMetaString(), nonExistingFile ); + long checksum = ValueDataUtil.ChecksumAdler32( DefaultBowl.getInstance(), new ValueMetaString(), nonExistingFile ); assertEquals( 0, checksum ); } @Test public void checksumAdlerNullPathTest() { String nonExistingFile = "nonExistingFile"; - long checksum = ValueDataUtil.ChecksumAdler32( new ValueMetaString(), nonExistingFile ); + long checksum = ValueDataUtil.ChecksumAdler32( DefaultBowl.getInstance(), new ValueMetaString(), nonExistingFile ); assertEquals( 0, checksum ); } @Test public void checksumAdlerWithFailIfNoFileTest() throws Exception { String path = getClass().getResource( "txt-sample.txt" ).getPath(); - long checksum = ValueDataUtil.checksumAdler32( new ValueMetaString(), path, true ); + long checksum = ValueDataUtil.checksumAdler32( DefaultBowl.getInstance(), new ValueMetaString(), path, true ); assertEquals( 73204161L, checksum ); } @Test public void checksumAdlerWithoutFailIfNoFileTest() throws Exception { String path = getClass().getResource( "txt-sample.txt" ).getPath(); - long checksum = ValueDataUtil.checksumAdler32( new ValueMetaString(), path, false ); + long checksum = ValueDataUtil.checksumAdler32( DefaultBowl.getInstance(), new ValueMetaString(), path, false ); assertEquals( 73204161L, checksum ); } @Test public void checksumAdlerNoFailIfNoFileTest() throws KettleFileNotFoundException { String nonExistingPath = "nonExistingPath"; - long checksum = ValueDataUtil.checksumAdler32( new ValueMetaString(), nonExistingPath, false ); + long checksum = ValueDataUtil.checksumAdler32( DefaultBowl.getInstance(), new ValueMetaString(), nonExistingPath, + false ); assertEquals( 0, checksum ); } @Test( expected = KettleFileNotFoundException.class ) public void checksumAdlerFailIfNoFileTest() throws KettleFileNotFoundException { String nonExistingPath = "nonExistingPath"; - ValueDataUtil.checksumAdler32( new ValueMetaString(), nonExistingPath, true ); + ValueDataUtil.checksumAdler32( DefaultBowl.getInstance(), new ValueMetaString(), nonExistingPath, true ); } @Test public void checksumAdlerNullPathNoFailTest() throws KettleFileNotFoundException { - long checksum = ValueDataUtil.checksumAdler32( new ValueMetaString(), null, false ); + long checksum = ValueDataUtil.checksumAdler32( DefaultBowl.getInstance(), new ValueMetaString(), null, false ); assertEquals( 0, checksum ); } @Test public void checksumAdlerNullPathFailTest() throws KettleFileNotFoundException { - long checksum = ValueDataUtil.checksumAdler32( new ValueMetaString(), null, true ); + long checksum = ValueDataUtil.checksumAdler32( DefaultBowl.getInstance(), new ValueMetaString(), null, true ); assertEquals( 0, checksum ); } @Test public void xmlFileWellFormedTest() { String xmlFilePath = getClass().getResource( "xml-sample.xml" ).getPath(); - boolean wellFormed = ValueDataUtil.isXMLFileWellFormed( new ValueMetaString(), xmlFilePath ); + boolean wellFormed = ValueDataUtil.isXMLFileWellFormed( DefaultBowl.getInstance(), new ValueMetaString(), + xmlFilePath ); assertTrue( wellFormed ); } @Test public void xmlFileBadlyFormedTest() { String invalidXmlFilePath = getClass().getResource( "invalid-xml-sample.xml" ).getPath(); - boolean wellFormed = ValueDataUtil.isXMLFileWellFormed( new ValueMetaString(), invalidXmlFilePath ); + boolean wellFormed = ValueDataUtil.isXMLFileWellFormed( DefaultBowl.getInstance(), new ValueMetaString(), + invalidXmlFilePath ); assertFalse( wellFormed ); } @Test public void xmlFileWellFormedWithFailIfNoFileTest() throws KettleFileNotFoundException { String xmlFilePath = getClass().getResource( "xml-sample.xml" ).getPath(); - boolean wellFormed = ValueDataUtil.isXMLFileWellFormed( new ValueMetaString(), xmlFilePath, true ); + boolean wellFormed = ValueDataUtil.isXMLFileWellFormed( DefaultBowl.getInstance(), new ValueMetaString(), + xmlFilePath, true ); assertTrue( wellFormed ); } @Test public void xmlFileWellFormedWithoutFailIfNoFileTest() throws KettleFileNotFoundException { String xmlFilePath = getClass().getResource( "xml-sample.xml" ).getPath(); - boolean wellFormed = ValueDataUtil.isXMLFileWellFormed( new ValueMetaString(), xmlFilePath, false ); + boolean wellFormed = ValueDataUtil.isXMLFileWellFormed( DefaultBowl.getInstance(), new ValueMetaString(), + xmlFilePath, false ); assertTrue( wellFormed ); } @Test public void xmlFileBadlyFormedWithFailIfNoFileTest() throws KettleFileNotFoundException { String invalidXmlFilePath = getClass().getResource( "invalid-xml-sample.xml" ).getPath(); - boolean wellFormed = ValueDataUtil.isXMLFileWellFormed( new ValueMetaString(), invalidXmlFilePath, true ); + boolean wellFormed = ValueDataUtil.isXMLFileWellFormed( DefaultBowl.getInstance(), new ValueMetaString(), + invalidXmlFilePath, true ); assertFalse( wellFormed ); } @Test public void xmlFileBadlyFormedWithNoFailIfNoFileTest() throws KettleFileNotFoundException { String invalidXmlFilePath = getClass().getResource( "invalid-xml-sample.xml" ).getPath(); - boolean wellFormed = ValueDataUtil.isXMLFileWellFormed( new ValueMetaString(), invalidXmlFilePath, false ); + boolean wellFormed = ValueDataUtil.isXMLFileWellFormed( DefaultBowl.getInstance(), new ValueMetaString(), + invalidXmlFilePath, false ); assertFalse( wellFormed ); } @Test public void xmlFileWellFormedNoFailIfNoFileTest() throws KettleFileNotFoundException { String nonExistingPath = "nonExistingPath"; - boolean wellFormed = ValueDataUtil.isXMLFileWellFormed( new ValueMetaString(), nonExistingPath, false ); + boolean wellFormed = ValueDataUtil.isXMLFileWellFormed( DefaultBowl.getInstance(), new ValueMetaString(), + nonExistingPath, false ); assertFalse( wellFormed ); } @Test( expected = KettleFileNotFoundException.class ) public void xmlFileWellFormedFailIfNoFileTest() throws KettleFileNotFoundException { String nonExistingPath = "nonExistingPath"; - ValueDataUtil.isXMLFileWellFormed( new ValueMetaString(), nonExistingPath, true ); + ValueDataUtil.isXMLFileWellFormed( DefaultBowl.getInstance(), new ValueMetaString(), nonExistingPath, true ); } @Test public void xmlFileWellFormedNullPathNoFailTest() throws KettleFileNotFoundException { - boolean wellFormed = ValueDataUtil.isXMLFileWellFormed( new ValueMetaString(), null, false ); + boolean wellFormed = ValueDataUtil.isXMLFileWellFormed( DefaultBowl.getInstance(), new ValueMetaString(), null, + false ); assertFalse( wellFormed ); } @Test public void xmlFileWellFormedNullPathFailTest() throws KettleFileNotFoundException { - boolean wellFormed = ValueDataUtil.isXMLFileWellFormed( new ValueMetaString(), null, true ); + boolean wellFormed = ValueDataUtil.isXMLFileWellFormed( DefaultBowl.getInstance(), new ValueMetaString(), null, + true ); assertFalse( wellFormed ); } @Test public void loadFileContentInBinary() throws Exception { String path = getClass().getResource( "txt-sample.txt" ).getPath(); - byte[] content = ValueDataUtil.loadFileContentInBinary( new ValueMetaString(), path, true ); + byte[] content = ValueDataUtil.loadFileContentInBinary( DefaultBowl.getInstance(), new ValueMetaString(), path, + true ); assertTrue( Arrays.equals( "test".getBytes(), content ) ); } @Test public void loadFileContentInBinaryNoFailIfNoFileTest() throws Exception { String nonExistingPath = "nonExistingPath"; - assertNull( ValueDataUtil.loadFileContentInBinary( new ValueMetaString(), nonExistingPath, false ) ); + assertNull( ValueDataUtil.loadFileContentInBinary( DefaultBowl.getInstance(), new ValueMetaString(), + nonExistingPath, false ) ); } @Test( expected = KettleFileNotFoundException.class ) public void loadFileContentInBinaryFailIfNoFileTest() throws KettleFileNotFoundException, KettleValueException { String nonExistingPath = "nonExistingPath"; - ValueDataUtil.loadFileContentInBinary( new ValueMetaString(), nonExistingPath, true ); + ValueDataUtil.loadFileContentInBinary( DefaultBowl.getInstance(), new ValueMetaString(), nonExistingPath, true ); } @Test public void loadFileContentInBinaryNullPathNoFailTest() throws Exception { - assertNull( ValueDataUtil.loadFileContentInBinary( new ValueMetaString(), null, false ) ); + assertNull( ValueDataUtil.loadFileContentInBinary( DefaultBowl.getInstance(), new ValueMetaString(), null, false ) ); } @Test public void loadFileContentInBinaryNullPathFailTest() throws KettleFileNotFoundException, KettleValueException { - assertNull( ValueDataUtil.loadFileContentInBinary( new ValueMetaString(), null, true ) ); + assertNull( ValueDataUtil.loadFileContentInBinary( DefaultBowl.getInstance(), new ValueMetaString(), null, true ) ); } @Test public void getFileEncodingTest() throws Exception { String path = getClass().getResource( "txt-sample.txt" ).getPath(); - String encoding = ValueDataUtil.getFileEncoding( new ValueMetaString(), path ); + String encoding = ValueDataUtil.getFileEncoding( DefaultBowl.getInstance(), new ValueMetaString(), path ); assertEquals( "US-ASCII", encoding ); } @Test( expected = KettleValueException.class ) public void getFileEncodingMissingFileTest() throws KettleValueException { String nonExistingPath = "nonExistingPath"; - ValueDataUtil.getFileEncoding( new ValueMetaString(), nonExistingPath ); + ValueDataUtil.getFileEncoding( DefaultBowl.getInstance(), new ValueMetaString(), nonExistingPath ); } @Test public void getFileEncodingNullPathTest() throws Exception { - assertNull( ValueDataUtil.getFileEncoding( new ValueMetaString(), null ) ); + assertNull( ValueDataUtil.getFileEncoding( DefaultBowl.getInstance(), new ValueMetaString(), null ) ); } @Test public void getFileEncodingWithFailIfNoFileTest() throws Exception { String path = getClass().getResource( "txt-sample.txt" ).getPath(); - String encoding = ValueDataUtil.getFileEncoding( new ValueMetaString(), path, true ); + String encoding = ValueDataUtil.getFileEncoding( DefaultBowl.getInstance(), new ValueMetaString(), path, true ); assertEquals( "US-ASCII", encoding ); } @Test public void getFileEncodingWithoutFailIfNoFileTest() throws Exception { String path = getClass().getResource( "txt-sample.txt" ).getPath(); - String encoding = ValueDataUtil.getFileEncoding( new ValueMetaString(), path, false ); + String encoding = ValueDataUtil.getFileEncoding( DefaultBowl.getInstance(), new ValueMetaString(), path, false ); assertEquals( "US-ASCII", encoding ); } @Test public void getFileEncodingNoFailIfNoFileTest() throws Exception { String nonExistingPath = "nonExistingPath"; - String encoding = ValueDataUtil.getFileEncoding( new ValueMetaString(), nonExistingPath, false ); + String encoding = ValueDataUtil.getFileEncoding( DefaultBowl.getInstance(), new ValueMetaString(), nonExistingPath, + false ); assertNull( encoding ); } @Test( expected = KettleFileNotFoundException.class ) public void getFileEncodingFailIfNoFileTest() throws KettleFileNotFoundException, KettleValueException { String nonExistingPath = "nonExistingPath"; - ValueDataUtil.getFileEncoding( new ValueMetaString(), nonExistingPath, true ); + ValueDataUtil.getFileEncoding( DefaultBowl.getInstance(), new ValueMetaString(), nonExistingPath, true ); } @Test public void getFileEncodingNullPathNoFailTest() throws Exception { - String encoding = ValueDataUtil.getFileEncoding( new ValueMetaString(), null, false ); + String encoding = ValueDataUtil.getFileEncoding( DefaultBowl.getInstance(), new ValueMetaString(), null, false ); assertNull( encoding ); } @Test public void getFileEncodingNullPathFailTest() throws KettleFileNotFoundException, KettleValueException { - String encoding = ValueDataUtil.getFileEncoding( new ValueMetaString(), null, true ); + String encoding = ValueDataUtil.getFileEncoding( DefaultBowl.getInstance(), new ValueMetaString(), null, true ); assertNull( encoding ); } diff --git a/engine/src/test/java/org/pentaho/di/job/JobMetaTest.java b/engine/src/test/java/org/pentaho/di/job/JobMetaTest.java index b1d46a09299a..9c7942f6e121 100644 --- a/engine/src/test/java/org/pentaho/di/job/JobMetaTest.java +++ b/engine/src/test/java/org/pentaho/di/job/JobMetaTest.java @@ -27,6 +27,7 @@ import org.junit.ClassRule; import org.junit.Test; import org.mockito.Mockito; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.Const; import org.pentaho.di.core.NotePadMeta; import org.pentaho.di.core.exception.IdNotFoundException; @@ -216,8 +217,8 @@ public Object realClone( boolean doClear ) { }; jobMeta.setRepositoryDirectory( directoryJob ); jobMeta.setName( JOB_META_NAME ); - jobMeta.exportResources( null, new HashMap( 4 ), mock( ResourceNamingInterface.class ), - null, null ); + jobMeta.exportResources( DefaultBowl.getInstance(), null, new HashMap( 4 ), + mock( ResourceNamingInterface.class ), null, null ); // assert verify( jobMetaSpy ).setRepositoryDirectory( directoryJob ); diff --git a/engine/src/test/java/org/pentaho/di/job/entries/copyfiles/JobEntryCopyFilesTest.java b/engine/src/test/java/org/pentaho/di/job/entries/copyfiles/JobEntryCopyFilesTest.java index e0fa93d3b04a..7d7b60ebb8f1 100644 --- a/engine/src/test/java/org/pentaho/di/job/entries/copyfiles/JobEntryCopyFilesTest.java +++ b/engine/src/test/java/org/pentaho/di/job/entries/copyfiles/JobEntryCopyFilesTest.java @@ -24,6 +24,7 @@ import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.Result; import org.pentaho.di.core.database.DatabaseMeta; import org.pentaho.di.core.logging.KettleLogStore; @@ -69,6 +70,7 @@ public void setUp() { Job parentJob = new Job(); entry.setParentJob( parentJob ); JobMeta mockJobMeta = mock( JobMeta.class ); + when( mockJobMeta.getBowl() ).thenReturn( DefaultBowl.getInstance() ); mockNamedClusterEmbedManager = mock( NamedClusterEmbedManager.class ); when( mockJobMeta.getNamedClusterEmbedManager() ).thenReturn( mockNamedClusterEmbedManager ); entry.setParentJobMeta( mockJobMeta ); diff --git a/engine/src/test/java/org/pentaho/di/job/entries/deletefiles/JobEntryDeleteFilesTest.java b/engine/src/test/java/org/pentaho/di/job/entries/deletefiles/JobEntryDeleteFilesTest.java index 73907d758590..65f581a7c00a 100644 --- a/engine/src/test/java/org/pentaho/di/job/entries/deletefiles/JobEntryDeleteFilesTest.java +++ b/engine/src/test/java/org/pentaho/di/job/entries/deletefiles/JobEntryDeleteFilesTest.java @@ -28,6 +28,7 @@ import org.junit.rules.TemporaryFolder; import org.mockito.MockedConstruction; import org.mockito.Mockito; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.Const; import org.pentaho.di.core.Result; import org.pentaho.di.core.RowMetaAndData; @@ -112,6 +113,7 @@ public void setUp() throws Exception { jobEntry.setParentJob( parentJob ); JobMeta mockJobMeta = mock( JobMeta.class ); + when( mockJobMeta .getBowl() ).thenReturn( DefaultBowl.getInstance() ); mockNamedClusterEmbedManager = mock( NamedClusterEmbedManager.class ); when( mockJobMeta.getNamedClusterEmbedManager() ).thenReturn( mockNamedClusterEmbedManager ); jobEntry.setParentJobMeta( mockJobMeta ); diff --git a/engine/src/test/java/org/pentaho/di/job/entries/dostounix/JobEntryDosToUnix_ConversionIdempotency_Test.java b/engine/src/test/java/org/pentaho/di/job/entries/dostounix/JobEntryDosToUnix_ConversionIdempotency_Test.java index c497fb3cb2e5..558c491b9850 100644 --- a/engine/src/test/java/org/pentaho/di/job/entries/dostounix/JobEntryDosToUnix_ConversionIdempotency_Test.java +++ b/engine/src/test/java/org/pentaho/di/job/entries/dostounix/JobEntryDosToUnix_ConversionIdempotency_Test.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2018 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -28,6 +28,7 @@ import org.junit.BeforeClass; import org.junit.ClassRule; import org.junit.Test; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.KettleEnvironment; import org.pentaho.di.core.vfs.KettleVFS; import org.pentaho.di.junit.rules.RestorePDIEngineEnvironment; @@ -181,9 +182,9 @@ private void doTest( String content, boolean toUnix, String expected ) throws Ex IOUtils.write( content.getBytes(), os ); } - entry.convert( KettleVFS.getFileObject( tmpFilePath ), toUnix ); + entry.convert( KettleVFS.getInstance( DefaultBowl.getInstance() ).getFileObject( tmpFilePath ), toUnix ); - String converted = KettleVFS.getTextFileContent( tmpFilePath, "UTF-8" ); + String converted = KettleVFS.getInstance( DefaultBowl.getInstance() ).getTextFileContent( tmpFilePath, "UTF-8" ); assertEquals( expected, converted ); } } diff --git a/engine/src/test/java/org/pentaho/di/job/entries/filesexist/JobEntryFilesExistTest.java b/engine/src/test/java/org/pentaho/di/job/entries/filesexist/JobEntryFilesExistTest.java index 25511c2e7da7..7373d82cd6f9 100644 --- a/engine/src/test/java/org/pentaho/di/job/entries/filesexist/JobEntryFilesExistTest.java +++ b/engine/src/test/java/org/pentaho/di/job/entries/filesexist/JobEntryFilesExistTest.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2018 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -26,11 +26,13 @@ import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; import org.junit.After; import org.junit.Before; import org.junit.ClassRule; import org.junit.Test; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.Const; import org.pentaho.di.core.Result; import org.pentaho.di.job.Job; @@ -56,6 +58,7 @@ public void setUp() throws Exception { job.getJobMeta().addJobEntry( new JobEntryCopy( entry ) ); entry.setParentJob( job ); JobMeta mockJobMeta = mock( JobMeta.class ); + when( mockJobMeta .getBowl() ).thenReturn( DefaultBowl.getInstance() ); entry.setParentJobMeta( mockJobMeta ); job.setStopped( false ); diff --git a/engine/src/test/java/org/pentaho/di/job/entries/folderisempty/JobEntryFolderIsEmptyTest.java b/engine/src/test/java/org/pentaho/di/job/entries/folderisempty/JobEntryFolderIsEmptyTest.java index fce1d122c89f..25af343083dc 100644 --- a/engine/src/test/java/org/pentaho/di/job/entries/folderisempty/JobEntryFolderIsEmptyTest.java +++ b/engine/src/test/java/org/pentaho/di/job/entries/folderisempty/JobEntryFolderIsEmptyTest.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -26,6 +26,7 @@ import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; import java.io.File; import java.nio.file.Files; @@ -36,6 +37,7 @@ import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.Const; import org.pentaho.di.core.Result; import org.pentaho.di.core.logging.KettleLogStore; @@ -67,6 +69,7 @@ public void setUp() throws Exception { job.getJobMeta().addJobEntry( new JobEntryCopy( entry ) ); entry.setParentJob( job ); JobMeta mockJobMeta = mock( JobMeta.class ); + when( mockJobMeta .getBowl() ).thenReturn( DefaultBowl.getInstance() ); entry.setParentJobMeta( mockJobMeta ); job.setStopped( false ); diff --git a/engine/src/test/java/org/pentaho/di/job/entries/http/JobEntryHTTPTest.java b/engine/src/test/java/org/pentaho/di/job/entries/http/JobEntryHTTPTest.java index 3babc76d75fb..9b20965d2b00 100644 --- a/engine/src/test/java/org/pentaho/di/job/entries/http/JobEntryHTTPTest.java +++ b/engine/src/test/java/org/pentaho/di/job/entries/http/JobEntryHTTPTest.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2023 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -53,6 +53,7 @@ import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.core.plugins.PluginRegistry; import org.pentaho.di.core.util.EnvUtil; +import org.pentaho.di.job.JobMeta; import org.pentaho.di.junit.rules.RestorePDIEngineEnvironment; import org.pentaho.di.repository.ObjectId; import org.pentaho.di.repository.kdr.KettleDatabaseRepository; @@ -140,6 +141,7 @@ public void testExecute_simpleConfiguration() throws IOException { JobEntryHTTP basicHttpJobEntry = new JobEntryHTTP(); basicHttpJobEntry.setTargetFilename( tempTargetFile.getAbsolutePath() ); basicHttpJobEntry.setAddFilenameToResult( false ); + basicHttpJobEntry.setParentJobMeta( new JobMeta() ); // Test valid URL basicHttpJobEntry.setUrl( validURL ); @@ -168,6 +170,7 @@ public void testExecute_simpleAuthentication() throws IOException { JobEntryHTTP basicHttpJobEntry = new JobEntryHTTP(); basicHttpJobEntry.setTargetFilename( tempTargetFile.getAbsolutePath() ); basicHttpJobEntry.setAddFilenameToResult( false ); + basicHttpJobEntry.setParentJobMeta( new JobMeta() ); // Test no user or password when required basicHttpJobEntry.setUrl( passwordURL ); @@ -206,6 +209,7 @@ public void testExecute_simpleConfiguration_withProxy() throws IOException { JobEntryHTTP basicHttpJobEntry = new JobEntryHTTP(); basicHttpJobEntry.setTargetFilename( tempTargetFile.getAbsolutePath() ); basicHttpJobEntry.setAddFilenameToResult( false ); + basicHttpJobEntry.setParentJobMeta( new JobMeta() ); // Test URL without proxy basicHttpJobEntry.setUrl( proxyTestURL ); diff --git a/engine/src/test/java/org/pentaho/di/job/entries/http/JobEntryHTTP_PDI208_Test.java b/engine/src/test/java/org/pentaho/di/job/entries/http/JobEntryHTTP_PDI208_Test.java index 790ea8185569..c34e993844fc 100644 --- a/engine/src/test/java/org/pentaho/di/job/entries/http/JobEntryHTTP_PDI208_Test.java +++ b/engine/src/test/java/org/pentaho/di/job/entries/http/JobEntryHTTP_PDI208_Test.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2018 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -45,6 +45,7 @@ import org.pentaho.di.core.row.RowMeta; import org.pentaho.di.core.row.value.ValueMetaString; import org.pentaho.di.job.Job; +import org.pentaho.di.job.JobMeta; import com.sun.net.httpserver.Headers; import com.sun.net.httpserver.HttpExchange; @@ -92,6 +93,7 @@ public void testHTTPResultDefaultRows() throws IOException { JobEntryHTTP http = new JobEntryHTTP(); http.setParentJob( new Job() ); + http.setParentJobMeta( new JobMeta() ); http.setRunForEveryRow( true ); http.setAddFilenameToResult( false ); http.execute( previousResult, 0 ); @@ -118,6 +120,7 @@ public void testHTTPResultCustomRows() throws IOException { JobEntryHTTP http = new JobEntryHTTP(); http.setParentJob( new Job() ); + http.setParentJobMeta( new JobMeta() ); http.setRunForEveryRow( true ); http.setAddFilenameToResult( false ); http.setUrlFieldname( "MyURL" ); diff --git a/engine/src/test/java/org/pentaho/di/job/entries/http/JobEntryHTTP_PDI_18044_Test.java b/engine/src/test/java/org/pentaho/di/job/entries/http/JobEntryHTTP_PDI_18044_Test.java index 98397bd50f70..f9033b4f1c60 100644 --- a/engine/src/test/java/org/pentaho/di/job/entries/http/JobEntryHTTP_PDI_18044_Test.java +++ b/engine/src/test/java/org/pentaho/di/job/entries/http/JobEntryHTTP_PDI_18044_Test.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2019 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -40,6 +40,7 @@ import org.pentaho.di.core.row.RowMeta; import org.pentaho.di.core.row.value.ValueMetaString; import org.pentaho.di.job.Job; +import org.pentaho.di.job.JobMeta; import org.pentaho.di.junit.rules.RestorePDIEngineEnvironment; import java.io.File; @@ -111,6 +112,7 @@ public void testHTTPResultDefaultRows() throws IOException { JobEntryHTTP http = new JobEntryHTTP(); http.setParentJob( new Job() ); + http.setParentJobMeta( new JobMeta() ); http.setRunForEveryRow( true ); http.setAddFilenameToResult( false ); http.setUsername( "admin" ); diff --git a/engine/src/test/java/org/pentaho/di/job/entries/http/JobEntryHTTP_PDI_19104_Test.java b/engine/src/test/java/org/pentaho/di/job/entries/http/JobEntryHTTP_PDI_19104_Test.java index cde203bdffbf..4a94e1566661 100644 --- a/engine/src/test/java/org/pentaho/di/job/entries/http/JobEntryHTTP_PDI_19104_Test.java +++ b/engine/src/test/java/org/pentaho/di/job/entries/http/JobEntryHTTP_PDI_19104_Test.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2021 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2021-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -33,6 +33,7 @@ import org.pentaho.di.core.row.RowMeta; import org.pentaho.di.core.row.value.ValueMetaString; import org.pentaho.di.job.Job; +import org.pentaho.di.job.JobMeta; import org.pentaho.di.junit.rules.RestorePDIEngineEnvironment; import java.io.File; @@ -76,6 +77,7 @@ public void testHTTPResultDefaultRows() throws IOException { JobEntryHTTP http = new JobEntryHTTP(); http.setParentJob( new Job() ); + http.setParentJobMeta( new JobMeta() ); http.setRunForEveryRow( true ); http.setAddFilenameToResult( false ); http.execute( previousResult, 0 ); diff --git a/engine/src/test/java/org/pentaho/di/job/entries/job/JobEntryJobTest.java b/engine/src/test/java/org/pentaho/di/job/entries/job/JobEntryJobTest.java index 9e75ac04781b..fdc5a90f82d2 100644 --- a/engine/src/test/java/org/pentaho/di/job/entries/job/JobEntryJobTest.java +++ b/engine/src/test/java/org/pentaho/di/job/entries/job/JobEntryJobTest.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2021 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -52,6 +52,8 @@ import org.mockito.junit.MockitoJUnitRunner; import org.pentaho.di.base.MetaFileLoaderImpl; import org.pentaho.di.cluster.SlaveServer; +import org.pentaho.di.core.bowl.Bowl; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.Const; import org.pentaho.di.core.ObjectLocationSpecificationMethod; import org.pentaho.di.core.database.DatabaseMeta; @@ -119,8 +121,9 @@ public void testNotConnectedLoad_NoInfo() throws Exception { CurrentDirectoryResolver.class, ( mock, context ) -> { doCallRealMethod().when( mock ).normalizeSlashes( anyString() ); - doReturn( space ).when( mock ).resolveCurrentDirectory( any( ObjectLocationSpecificationMethod.class ), - any( VariableSpace.class ), nullable( Repository.class ), nullable( Job.class ), anyString() ); + doReturn( space ).when( mock ).resolveCurrentDirectory( any( Bowl.class ), + any( ObjectLocationSpecificationMethod.class ), any( VariableSpace.class ), + nullable( Repository.class ), nullable( Job.class ), anyString() ); } ) ) { JobEntryJob jej = getJej(); jej.loadXML( getNode( jej ), databases, servers, null, store ); @@ -140,11 +143,12 @@ public void testNotConnectedLoad_RepByRef() throws Exception { mockConstruction( JobMeta.class, ( mock, context ) -> { if ( context.getCount() > 1 ) { - assertEquals( context.arguments().get( 0 ), space ); - assertEquals( context.arguments().get( 1 ), null ); + assertEquals( context.arguments().get( 0 ), DefaultBowl.getInstance() ); + assertEquals( context.arguments().get( 1 ), space ); assertEquals( context.arguments().get( 2 ), null ); - assertEquals( context.arguments().get( 3 ), store ); - assertEquals( context.arguments().get( 4 ), null ); + assertEquals( context.arguments().get( 3 ), null ); + assertEquals( context.arguments().get( 4 ), store ); + assertEquals( context.arguments().get( 5 ), null ); } else { assertEquals( 0, context.arguments().size() ); } @@ -153,7 +157,8 @@ public void testNotConnectedLoad_RepByRef() throws Exception { CurrentDirectoryResolver.class, ( mock, context ) -> { doCallRealMethod().when( mock ).normalizeSlashes( anyString() ); - doReturn( space ).when( mock ).resolveCurrentDirectory( any( ObjectLocationSpecificationMethod.class ), + doReturn( space ).when( mock ).resolveCurrentDirectory( any( Bowl.class ), + any( ObjectLocationSpecificationMethod.class ), any( VariableSpace.class ), nullable( Repository.class ), nullable( Job.class ), nullable( String.class ) ); } ) ) { @@ -178,11 +183,12 @@ public void testNotConnectedLoad_RepByName() throws Exception { mockConstruction( JobMeta.class, ( mock, context ) -> { if ( context.getCount() > 1 ) { - assertEquals( context.arguments().get( 0 ), space ); - assertEquals( context.arguments().get( 1 ), null ); + assertEquals( context.arguments().get( 0 ), DefaultBowl.getInstance() ); + assertEquals( context.arguments().get( 1 ), space ); assertEquals( context.arguments().get( 2 ), null ); - assertEquals( context.arguments().get( 3 ), store ); - assertEquals( context.arguments().get( 4 ), null ); + assertEquals( context.arguments().get( 3 ), null ); + assertEquals( context.arguments().get( 4 ), store ); + assertEquals( context.arguments().get( 5 ), null ); } else { assertEquals( 0, context.arguments().size() ); } @@ -191,7 +197,8 @@ public void testNotConnectedLoad_RepByName() throws Exception { CurrentDirectoryResolver.class, ( mock, context ) -> { doCallRealMethod().when( mock ).normalizeSlashes( anyString() ); - doReturn( space ).when( mock ).resolveCurrentDirectory( any( ObjectLocationSpecificationMethod.class ), + doReturn( space ).when( mock ).resolveCurrentDirectory( any( Bowl.class ), + any( ObjectLocationSpecificationMethod.class ), any( VariableSpace.class ), nullable( Repository.class ), nullable( Job.class ), anyString() ); } ) ) { JobEntryJob jej = getJej(); @@ -215,11 +222,12 @@ public void testNotConnectedLoad_Filename() throws Exception { mockConstruction( JobMeta.class, ( mock, context ) -> { if ( context.getCount() > 1 ) { - assertEquals( context.arguments().get( 0 ), space ); - assertEquals( context.arguments().get( 1 ), JOB_ENTRY_FILE_PATH ); - assertEquals( context.arguments().get( 2 ), null ); - assertEquals( context.arguments().get( 3 ), store ); - assertEquals( context.arguments().get( 4 ), null ); + assertEquals( context.arguments().get( 0 ), DefaultBowl.getInstance() ); + assertEquals( context.arguments().get( 1 ), space ); + assertEquals( context.arguments().get( 2 ), JOB_ENTRY_FILE_PATH ); + assertEquals( context.arguments().get( 3 ), null ); + assertEquals( context.arguments().get( 4 ), store ); + assertEquals( context.arguments().get( 5 ), null ); } else { assertEquals( 0, context.arguments().size() ); } @@ -228,7 +236,8 @@ public void testNotConnectedLoad_Filename() throws Exception { CurrentDirectoryResolver.class, ( mock, context ) -> { doCallRealMethod().when( mock ).normalizeSlashes( anyString() ); - doReturn( space ).when( mock ).resolveCurrentDirectory( any( ObjectLocationSpecificationMethod.class ), + doReturn( space ).when( mock ).resolveCurrentDirectory( any( Bowl.class ), + any( ObjectLocationSpecificationMethod.class ), any( VariableSpace.class ), nullable( Repository.class ), nullable( Job.class ), anyString() ); } ) ) { JobEntryJob jej = getJej(); @@ -252,7 +261,8 @@ public void testConnectedImport_NoInfo() throws Exception { CurrentDirectoryResolver.class, ( mock, context ) -> { doCallRealMethod().when( mock ).normalizeSlashes( anyString() ); - doReturn( space ).when( mock ).resolveCurrentDirectory( any( ObjectLocationSpecificationMethod.class ), + doReturn( space ).when( mock ).resolveCurrentDirectory( any( Bowl.class ), + any( ObjectLocationSpecificationMethod.class ), any( VariableSpace.class ), any( Repository.class ), any( Job.class ), anyString() ); } ) ) { JobEntryJob jej = getJej(); @@ -274,7 +284,8 @@ public void testConnectedImport_RepByRef() throws Exception { CurrentDirectoryResolver.class, ( mock, context ) -> { doCallRealMethod().when( mock ).normalizeSlashes( anyString() ); - doReturn( space ).when( mock ).resolveCurrentDirectory( any( ObjectLocationSpecificationMethod.class ), + doReturn( space ).when( mock ).resolveCurrentDirectory( any( Bowl.class ), + any( ObjectLocationSpecificationMethod.class ), any( VariableSpace.class ), any( Repository.class ), any( Job.class ), anyString() ); } ) ) { JobEntryJob jej = getJej(); @@ -300,7 +311,8 @@ public void testConnectedImport_RepByName() throws Exception { CurrentDirectoryResolver.class, ( mock, context ) -> { doCallRealMethod().when( mock ).normalizeSlashes( anyString() ); - doReturn( space ).when( mock ).resolveCurrentDirectory( any( ObjectLocationSpecificationMethod.class ), + doReturn( space ).when( mock ).resolveCurrentDirectory( any( Bowl.class ), + any( ObjectLocationSpecificationMethod.class ), any( VariableSpace.class ), nullable( Repository.class ), nullable( Job.class ), nullable( String.class ) ); } ) ) { @@ -327,11 +339,12 @@ public void testConnectedImport_Filename() throws Exception { mockConstruction( JobMeta.class, ( mock, context ) -> { if ( context.getCount() > 1 ) { - assertEquals( context.arguments().get( 0 ), space ); - assertEquals( context.arguments().get( 1 ), JOB_ENTRY_FILE_PATH ); - assertEquals( context.arguments().get( 2 ), repository ); - assertEquals( context.arguments().get( 3 ), store ); - assertEquals( context.arguments().get( 4 ), null ); + assertEquals( context.arguments().get( 0 ), DefaultBowl.getInstance() ); + assertEquals( context.arguments().get( 1 ), space ); + assertEquals( context.arguments().get( 2 ), JOB_ENTRY_FILE_PATH ); + assertEquals( context.arguments().get( 3 ), repository ); + assertEquals( context.arguments().get( 4 ), store ); + assertEquals( context.arguments().get( 5 ), null ); } else { assertEquals( 0, context.arguments().size() ); } @@ -340,7 +353,8 @@ public void testConnectedImport_Filename() throws Exception { CurrentDirectoryResolver.class, ( mock, context ) -> { doCallRealMethod().when( mock ).normalizeSlashes( anyString() ); - doReturn( space ).when( mock ).resolveCurrentDirectory( any( ObjectLocationSpecificationMethod.class ), + doReturn( space ).when( mock ).resolveCurrentDirectory( any( Bowl.class ), + any( ObjectLocationSpecificationMethod.class ), any( VariableSpace.class ), nullable( Repository.class ), nullable( Job.class ), anyString() ); } ) ) { JobEntryJob jej = getJej(); @@ -365,7 +379,8 @@ public void testConnectedImport_RepByRef_Guess() throws Exception { CurrentDirectoryResolver.class, ( mock, context ) -> { doCallRealMethod().when( mock ).normalizeSlashes( anyString() ); - doReturn( space ).when( mock ).resolveCurrentDirectory( any( ObjectLocationSpecificationMethod.class ), + doReturn( space ).when( mock ).resolveCurrentDirectory( any( Bowl.class ), + any( ObjectLocationSpecificationMethod.class ), any( VariableSpace.class ), any( Repository.class ), any( Job.class ), anyString() ); } ) ) { JobEntryJob jej = getJej(); @@ -390,7 +405,8 @@ public void testConnectedImport_RepByName_Guess() throws Exception { CurrentDirectoryResolver.class, ( mock, context ) -> { doCallRealMethod().when( mock ).normalizeSlashes( anyString() ); - doReturn( space ).when( mock ).resolveCurrentDirectory( any( ObjectLocationSpecificationMethod.class ), + doReturn( space ).when( mock ).resolveCurrentDirectory( any( Bowl.class ), + any( ObjectLocationSpecificationMethod.class ), any( VariableSpace.class ), nullable( Repository.class ), nullable( Job.class ), nullable( String.class ) ); } ) ) { @@ -416,11 +432,12 @@ public void testConnectedImport_Filename_Guess() throws Exception { mockConstruction( JobMeta.class, ( mock, context ) -> { if ( context.getCount() > 1 ) { - assertEquals( context.arguments().get( 0 ), space ); - assertEquals( context.arguments().get( 1 ), JOB_ENTRY_FILE_PATH ); - assertEquals( context.arguments().get( 2 ), repository ); - assertEquals( context.arguments().get( 3 ), store ); - assertEquals( context.arguments().get( 4 ), null ); + assertEquals( context.arguments().get( 0 ), DefaultBowl.getInstance() ); + assertEquals( context.arguments().get( 1 ), space ); + assertEquals( context.arguments().get( 2 ), JOB_ENTRY_FILE_PATH ); + assertEquals( context.arguments().get( 3 ), repository ); + assertEquals( context.arguments().get( 4 ), store ); + assertEquals( context.arguments().get( 5 ), null ); } else { assertEquals( 0, context.arguments().size() ); } @@ -429,7 +446,8 @@ public void testConnectedImport_Filename_Guess() throws Exception { CurrentDirectoryResolver.class, ( mock, context ) -> { doCallRealMethod().when( mock ).normalizeSlashes( anyString() ); - doReturn( space ).when( mock ).resolveCurrentDirectory( any( ObjectLocationSpecificationMethod.class ), + doReturn( space ).when( mock ).resolveCurrentDirectory( any( Bowl.class ), + any( ObjectLocationSpecificationMethod.class ), any( VariableSpace.class ), nullable( Repository.class ), nullable( Job.class ), anyString() ); } ) ) { JobEntryJob jej = getJej(); @@ -452,7 +470,8 @@ public void testConnectedLoad_NoInfo() throws Exception { CurrentDirectoryResolver.class, ( mock, context ) -> { doCallRealMethod().when( mock ).normalizeSlashes( anyString() ); - doReturn( space ).when( mock ).resolveCurrentDirectory( any( ObjectLocationSpecificationMethod.class ), + doReturn( space ).when( mock ).resolveCurrentDirectory( any( Bowl.class ), + any( ObjectLocationSpecificationMethod.class ), any( VariableSpace.class ), any( Repository.class ), any( Job.class ), anyString() ); } ) ) { JobEntryJob jej = getJej(); @@ -474,7 +493,8 @@ public void testConnectedLoad_RepByRef() throws Exception { CurrentDirectoryResolver.class, ( mock, context ) -> { doCallRealMethod().when( mock ).normalizeSlashes( anyString() ); - doReturn( space ).when( mock ).resolveCurrentDirectory( any( ObjectLocationSpecificationMethod.class ), + doReturn( space ).when( mock ).resolveCurrentDirectory( any( Bowl.class ), + any( ObjectLocationSpecificationMethod.class ), any( VariableSpace.class ), any( Repository.class ), any( Job.class ), anyString() ); } ) ) { Repository myrepo = mock( Repository.class ); @@ -505,7 +525,8 @@ public void testConnectedLoad_RepByName() throws Exception { CurrentDirectoryResolver.class, ( mock, context ) -> { doCallRealMethod().when( mock ).normalizeSlashes( anyString() ); - doReturn( space ).when( mock ).resolveCurrentDirectory( any( ObjectLocationSpecificationMethod.class ), + doReturn( space ).when( mock ).resolveCurrentDirectory( any( Bowl.class ), + any( ObjectLocationSpecificationMethod.class ), any( VariableSpace.class ), nullable( Repository.class ), nullable( Job.class ), nullable( String.class ) ); } ) ) { @@ -539,11 +560,12 @@ public void testConnectedLoad_Filename() throws Exception { mockConstruction( JobMeta.class, ( mock, context ) -> { if ( context.getCount() > 1 ) { - assertEquals( context.arguments().get( 0 ), space ); - assertEquals( context.arguments().get( 1 ), JOB_ENTRY_FILE_PATH ); - assertEquals( context.arguments().get( 2 ), myrepo ); - assertEquals( context.arguments().get( 3 ), store ); - assertEquals( context.arguments().get( 4 ), null ); + assertEquals( context.arguments().get( 0 ), DefaultBowl.getInstance() ); + assertEquals( context.arguments().get( 1 ), space ); + assertEquals( context.arguments().get( 2 ), JOB_ENTRY_FILE_PATH ); + assertEquals( context.arguments().get( 3 ), myrepo ); + assertEquals( context.arguments().get( 4 ), store ); + assertEquals( context.arguments().get( 5 ), null ); } else { assertEquals( 0, context.arguments().size() ); } @@ -552,7 +574,8 @@ public void testConnectedLoad_Filename() throws Exception { CurrentDirectoryResolver.class, ( mock, context ) -> { doCallRealMethod().when( mock ).normalizeSlashes( anyString() ); - doReturn( space ).when( mock ).resolveCurrentDirectory( any( ObjectLocationSpecificationMethod.class ), + doReturn( space ).when( mock ).resolveCurrentDirectory( any( Bowl.class ), + any( ObjectLocationSpecificationMethod.class ), any( VariableSpace.class ), nullable( Repository.class ), nullable( Job.class ), anyString() ); } ) ) { @@ -581,11 +604,12 @@ public void testConnectedLoad_RepByName_HDFS() throws Exception { mockConstruction( JobMeta.class, ( mock, context ) -> { if ( context.getCount() > 1 ) { - assertEquals( context.arguments().get( 0 ), space ); - assertEquals( context.arguments().get( 1 ), "hdfs://server/path/job.kjb" ); - assertEquals( context.arguments().get( 2 ), myrepo ); - assertEquals( context.arguments().get( 3 ), store ); - assertEquals( context.arguments().get( 4 ), null ); + assertEquals( context.arguments().get( 0 ), DefaultBowl.getInstance() ); + assertEquals( context.arguments().get( 1 ), space ); + assertEquals( context.arguments().get( 2 ), "hdfs://server/path/job.kjb" ); + assertEquals( context.arguments().get( 3 ), myrepo ); + assertEquals( context.arguments().get( 4 ), store ); + assertEquals( context.arguments().get( 5 ), null ); } else { assertEquals( 0, context.arguments().size() ); } @@ -594,7 +618,8 @@ public void testConnectedLoad_RepByName_HDFS() throws Exception { CurrentDirectoryResolver.class, ( mock, context ) -> { doCallRealMethod().when( mock ).normalizeSlashes( anyString() ); - doReturn( space ).when( mock ).resolveCurrentDirectory( any( ObjectLocationSpecificationMethod.class ), + doReturn( space ).when( mock ).resolveCurrentDirectory( any( Bowl.class ), + any( ObjectLocationSpecificationMethod.class ), any( VariableSpace.class ), nullable( Repository.class ), nullable( Job.class ), nullable( String.class ) ); } ) ) { @@ -624,7 +649,8 @@ public void testConnectedLoad_RepByName_SingleParameter() throws Exception { CurrentDirectoryResolver.class, ( mock, context ) -> { doCallRealMethod().when( mock ).normalizeSlashes( anyString() ); - doReturn( space ).when( mock ).resolveCurrentDirectory( any( ObjectLocationSpecificationMethod.class ), + doReturn( space ).when( mock ).resolveCurrentDirectory( any( Bowl.class ), + any( ObjectLocationSpecificationMethod.class ), any( VariableSpace.class ), nullable( Repository.class ), nullable( Job.class ), nullable( String.class ) ); } ) ) { @@ -657,7 +683,8 @@ public void testConnectedLoad_RepByName_MultipleParameters() throws Exception { CurrentDirectoryResolver.class, ( mock, context ) -> { doCallRealMethod().when( mock ).normalizeSlashes( anyString() ); - doReturn( space ).when( mock ).resolveCurrentDirectory( any( ObjectLocationSpecificationMethod.class ), + doReturn( space ).when( mock ).resolveCurrentDirectory( any( Bowl.class ), + any( ObjectLocationSpecificationMethod.class ), any( VariableSpace.class ), nullable( Repository.class ), nullable( Job.class ), nullable( String.class ) ); } ) ) { @@ -690,7 +717,8 @@ public void testConnectedLoad_RepByRef_Guess() throws Exception { CurrentDirectoryResolver.class, ( mock, context ) -> { doCallRealMethod().when( mock ).normalizeSlashes( anyString() ); - doReturn( space ).when( mock ).resolveCurrentDirectory( any( ObjectLocationSpecificationMethod.class ), + doReturn( space ).when( mock ).resolveCurrentDirectory( any( Bowl.class ), + any( ObjectLocationSpecificationMethod.class ), any( VariableSpace.class ), any( Repository.class ), any( Job.class ), anyString() ); } ) ) { Repository myrepo = mock( Repository.class ); @@ -719,7 +747,8 @@ public void testConnectedLoad_RepByName_Guess() throws Exception { CurrentDirectoryResolver.class, ( mock, context ) -> { doCallRealMethod().when( mock ).normalizeSlashes( anyString() ); - doReturn( space ).when( mock ).resolveCurrentDirectory( any( ObjectLocationSpecificationMethod.class ), + doReturn( space ).when( mock ).resolveCurrentDirectory( any( Bowl.class ), + any( ObjectLocationSpecificationMethod.class ), any( VariableSpace.class ), nullable( Repository.class ), nullable( Job.class ), nullable( String.class ) ); } ) ) { @@ -751,11 +780,12 @@ public void testConnectedLoad_Filename_Guess() throws Exception { mockConstruction( JobMeta.class, ( mock, context ) -> { if ( context.getCount() > 1 ) { - assertEquals( context.arguments().get( 0 ), space ); - assertEquals( context.arguments().get( 1 ), JOB_ENTRY_FILE_PATH ); - assertEquals( context.arguments().get( 2 ), myrepo ); - assertEquals( context.arguments().get( 3 ), store ); - assertEquals( context.arguments().get( 4 ), null ); + assertEquals( context.arguments().get( 0 ), DefaultBowl.getInstance() ); + assertEquals( context.arguments().get( 1 ), space ); + assertEquals( context.arguments().get( 2 ), JOB_ENTRY_FILE_PATH ); + assertEquals( context.arguments().get( 3 ), myrepo ); + assertEquals( context.arguments().get( 4 ), store ); + assertEquals( context.arguments().get( 5 ), null ); } else { assertEquals( 0, context.arguments().size() ); } @@ -764,7 +794,8 @@ public void testConnectedLoad_Filename_Guess() throws Exception { CurrentDirectoryResolver.class, ( mock, context ) -> { doCallRealMethod().when( mock ).normalizeSlashes( anyString() ); - doReturn( space ).when( mock ).resolveCurrentDirectory( any( ObjectLocationSpecificationMethod.class ), + doReturn( space ).when( mock ).resolveCurrentDirectory( any( Bowl.class ), + any( ObjectLocationSpecificationMethod.class ), any( VariableSpace.class ), nullable( Repository.class ), nullable( Job.class ), anyString() ); } ) ) { doReturn( null ).when( myrepo ).getJobEntryAttributeString( any( ObjectId.class ), anyString() ); @@ -792,7 +823,8 @@ public void testCurrDirListener() throws Exception { CurrentDirectoryResolver.class, ( mock, context ) -> { doCallRealMethod().when( mock ).normalizeSlashes( anyString() ); - doReturn( space ).when( mock ).resolveCurrentDirectory( any( ObjectLocationSpecificationMethod.class ), + doReturn( space ).when( mock ).resolveCurrentDirectory( any( Bowl.class ), + any( ObjectLocationSpecificationMethod.class ), any( VariableSpace.class ), nullable( Repository.class ), nullable( Job.class ), anyString() ); } ) ) { JobMeta meta = mock( JobMeta.class ); @@ -812,7 +844,8 @@ public void testExportResources() throws Exception { CurrentDirectoryResolver.class, ( mock, context ) -> { doCallRealMethod().when( mock ).normalizeSlashes( anyString() ); - doReturn( space ).when( mock ).resolveCurrentDirectory( any( ObjectLocationSpecificationMethod.class ), + doReturn( space ).when( mock ).resolveCurrentDirectory( any( Bowl.class ), + any( ObjectLocationSpecificationMethod.class ), any( VariableSpace.class ), nullable( Repository.class ), nullable( Job.class ), anyString() ); } ) ) { JobMeta meta = mock( JobMeta.class ); @@ -821,11 +854,11 @@ public void testExportResources() throws Exception { doReturn( meta ).when( jej ).getJobMeta( nullable( Repository.class ), nullable( IMetaStore.class ), nullable( VariableSpace.class ) ); - doReturn( JOB_ENTRY_JOB_NAME ).when( meta ).exportResources( + doReturn( JOB_ENTRY_JOB_NAME ).when( meta ).exportResources( nullable( Bowl.class ), nullable( JobMeta.class ), nullable( Map.class ), nullable( ResourceNamingInterface.class ), nullable( Repository.class ), nullable( IMetaStore.class ) ); - jej.exportResources( null, null, null, null, null ); + jej.exportResources( null, null, null, null, null, null ); verify( meta ).setFilename( "${" + Const.INTERNAL_VARIABLE_ENTRY_CURRENT_DIRECTORY + "}/" + JOB_ENTRY_JOB_NAME ); verify( jej ).setSpecificationMethod( ObjectLocationSpecificationMethod.FILENAME ); @@ -839,7 +872,8 @@ public void testJobMetaInitializeVariablesFrom() throws Exception { CurrentDirectoryResolver.class, ( mock, context ) -> { doCallRealMethod().when( mock ).normalizeSlashes( anyString() ); - doReturn( space ).when( mock ).resolveCurrentDirectory( any( ObjectLocationSpecificationMethod.class ), + doReturn( space ).when( mock ).resolveCurrentDirectory( any( Bowl.class ), + any( ObjectLocationSpecificationMethod.class ), any( VariableSpace.class ), nullable( Repository.class ), nullable( Job.class ), anyString() ); } ) ) { Repository myrepo = mock( Repository.class ); @@ -865,6 +899,7 @@ private JobEntryJob getJej() { JobEntryJob jej = spy( new JobEntryJob( JOB_ENTRY_JOB_NAME ) ); jej.setParentJobMeta( new JobMeta() ); when( jej.getParentJobMeta().getNamedClusterEmbedManager() ).thenReturn( namedClusterEmbedManager ); + when( jej.getParentJobMeta().getBowl() ).thenReturn( DefaultBowl.getInstance() ); return jej; } } diff --git a/engine/src/test/java/org/pentaho/di/job/entries/sftp/SFTPClientTest.java b/engine/src/test/java/org/pentaho/di/job/entries/sftp/SFTPClientTest.java index 882147760f7d..0538d2de8bf7 100644 --- a/engine/src/test/java/org/pentaho/di/job/entries/sftp/SFTPClientTest.java +++ b/engine/src/test/java/org/pentaho/di/job/entries/sftp/SFTPClientTest.java @@ -33,6 +33,7 @@ import org.junit.Before; import org.junit.ClassRule; import org.junit.Test; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.core.exception.KettleJobException; import org.pentaho.di.core.vfs.KettleVFS; @@ -87,7 +88,7 @@ public void tearDown() { */ @Test public void shouldExcludeGssapiFromPreferredAuthenticationsByDefault() throws Exception { - new SFTPClient( server, port, username ) { + new SFTPClient( DefaultBowl.getInstance(), server, port, username ) { @Override JSch createJSch() { return jSch; @@ -109,7 +110,7 @@ JSch createJSch() { public void shouldIncludeGssapiToPreferredAuthenticationsIfSpecified() throws Exception { System.setProperty( SFTPClient.ENV_PARAM_USERAUTH_GSSAPI, "true" ); - new SFTPClient( server, port, username ) { + new SFTPClient( DefaultBowl.getInstance(), server, port, username ) { @Override JSch createJSch() { return jSch; @@ -131,7 +132,7 @@ JSch createJSch() { public void shouldIncludeGssapiToPreferredAuthenticationsIfOnlySpecifiedCorrectly() throws Exception { System.setProperty( SFTPClient.ENV_PARAM_USERAUTH_GSSAPI, "yes" ); - new SFTPClient( server, port, username ) { + new SFTPClient( DefaultBowl.getInstance(), server, port, username ) { @Override JSch createJSch() { return jSch; @@ -148,7 +149,7 @@ JSch createJSch() { @Test( expected = KettleJobException.class ) public void folderCreationEmptyTest() throws Exception { System.setProperty( SFTPClient.ENV_PARAM_USERAUTH_GSSAPI, "yes" ); - SFTPClient client = new SFTPClient( server, port, username ) { + SFTPClient client = new SFTPClient( DefaultBowl.getInstance(), server, port, username ) { @Override JSch createJSch() { return jSch; @@ -165,7 +166,7 @@ JSch createJSch() { @Test public void folderCreation_Relative_Simple() throws Exception { System.setProperty( SFTPClient.ENV_PARAM_USERAUTH_GSSAPI, "yes" ); - SFTPClient client = spy( new SFTPClient( server, port, username ) { + SFTPClient client = spy( new SFTPClient( DefaultBowl.getInstance(), server, port, username ) { @Override JSch createJSch() { return jSch; @@ -187,7 +188,7 @@ JSch createJSch() { @Test public void folderCreation_Relative_Nested() throws Exception { System.setProperty( SFTPClient.ENV_PARAM_USERAUTH_GSSAPI, "yes" ); - SFTPClient client = spy( new SFTPClient( server, port, username ) { + SFTPClient client = spy( new SFTPClient( DefaultBowl.getInstance(), server, port, username ) { @Override JSch createJSch() { return jSch; @@ -211,7 +212,7 @@ JSch createJSch() { @Test public void folderCreation_Absolute_Simple() throws Exception { System.setProperty( SFTPClient.ENV_PARAM_USERAUTH_GSSAPI, "yes" ); - SFTPClient client = spy( new SFTPClient( server, port, username ) { + SFTPClient client = spy( new SFTPClient( DefaultBowl.getInstance(), server, port, username ) { @Override JSch createJSch() { return jSch; @@ -235,7 +236,7 @@ JSch createJSch() { @Test public void folderCreation_Absolute_TrailingSlash() throws Exception { System.setProperty( SFTPClient.ENV_PARAM_USERAUTH_GSSAPI, "yes" ); - SFTPClient client = spy( new SFTPClient( server, port, username ) { + SFTPClient client = spy( new SFTPClient( DefaultBowl.getInstance(), server, port, username ) { @Override JSch createJSch() { return jSch; @@ -258,7 +259,7 @@ JSch createJSch() { @Test public void folderCreation_Absolute_Nested() throws Exception { System.setProperty( SFTPClient.ENV_PARAM_USERAUTH_GSSAPI, "yes" ); - SFTPClient client = spy( new SFTPClient( server, port, username ) { + SFTPClient client = spy( new SFTPClient( DefaultBowl.getInstance(), server, port, username ) { @Override JSch createJSch() { return jSch; @@ -310,7 +311,7 @@ public void testDirNoFiles() throws Exception { @Test public void testReadKeyFile() throws Exception { - FileObject pk = KettleVFS.createTempFile( "pk", KettleVFS.Suffix.TMP ); + FileObject pk = KettleVFS.getInstance( DefaultBowl.getInstance() ).createTempFile( "pk", KettleVFS.Suffix.TMP ); try { byte[] pk_bytes = new byte[] { 1, 3, 1 }; try ( OutputStream out = pk.getContent().getOutputStream() ) { @@ -330,7 +331,7 @@ private SFTPClient spyClient() throws KettleException { } private SFTPClient spyClient( String privateKeyFilename ) throws KettleException { - return spy( new SFTPClient( server, port, username, privateKeyFilename ) { + return spy( new SFTPClient( DefaultBowl.getInstance(), server, port, username, privateKeyFilename ) { @Override JSch createJSch() { return jSch; diff --git a/engine/src/test/java/org/pentaho/di/job/entries/trans/JobEntryTransTest.java b/engine/src/test/java/org/pentaho/di/job/entries/trans/JobEntryTransTest.java index b3da53546f9c..7eac5e8e162a 100644 --- a/engine/src/test/java/org/pentaho/di/job/entries/trans/JobEntryTransTest.java +++ b/engine/src/test/java/org/pentaho/di/job/entries/trans/JobEntryTransTest.java @@ -27,6 +27,7 @@ import org.junit.Test; import org.mockito.Mockito; import org.pentaho.di.cluster.SlaveServer; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.Const; import org.pentaho.di.core.ObjectLocationSpecificationMethod; import org.pentaho.di.core.Result; @@ -228,10 +229,11 @@ public void testExportResources() throws KettleException { doReturn( transMeta ).when( jobEntryTrans ).getTransMeta( any( Repository.class ), any( VariableSpace.class ) ); - when( transMeta.exportResources( any( TransMeta.class ), any( Map.class ), any( ResourceNamingInterface.class ), - any( Repository.class ), any( IMetaStore.class ) ) ).thenReturn( testName ); + when( transMeta.exportResources( any( Bowl.class ), any( TransMeta.class ), any( Map.class ), + any( ResourceNamingInterface.class ), any( Repository.class ), any( IMetaStore.class ) ) ) + .thenReturn( testName ); - jobEntryTrans.exportResources( null, null, null, null, null ); + jobEntryTrans.exportResources( null, null, null, null, null, null ); verify( transMeta ).setFilename( "${" + Const.INTERNAL_VARIABLE_ENTRY_CURRENT_DIRECTORY + "}/" + testName ); verify( jobEntryTrans ).setSpecificationMethod( ObjectLocationSpecificationMethod.FILENAME ); diff --git a/engine/src/test/java/org/pentaho/di/job/entries/unzip/JobEntryUnZipTest.java b/engine/src/test/java/org/pentaho/di/job/entries/unzip/JobEntryUnZipTest.java index 854f83e5dd59..0ba930f3e406 100644 --- a/engine/src/test/java/org/pentaho/di/job/entries/unzip/JobEntryUnZipTest.java +++ b/engine/src/test/java/org/pentaho/di/job/entries/unzip/JobEntryUnZipTest.java @@ -21,6 +21,9 @@ ******************************************************************************/ package org.pentaho.di.job.entries.unzip; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + import java.lang.reflect.Method; import java.util.Arrays; @@ -32,7 +35,9 @@ import org.junit.ClassRule; import org.junit.Test; import org.mockito.Mockito; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.job.entry.loadSave.JobEntryLoadSaveTestSupport; +import org.pentaho.di.job.JobMeta; import org.pentaho.di.junit.rules.RestorePDIEngineEnvironment; public class JobEntryUnZipTest extends JobEntryLoadSaveTestSupport { @@ -120,6 +125,9 @@ protected Map createSettersMap() { public void unzipPostProcessingTest() throws Exception { JobEntryUnZip jobEntryUnZip = new JobEntryUnZip(); + JobMeta mockJobMeta = mock( JobMeta.class ); + when( mockJobMeta .getBowl() ).thenReturn( DefaultBowl.getInstance() ); + jobEntryUnZip.setParentJobMeta( mockJobMeta ); Method unzipPostprocessingMethod = jobEntryUnZip.getClass().getDeclaredMethod( "doUnzipPostProcessing", FileObject.class, FileObject.class, String.class ); unzipPostprocessingMethod.setAccessible( true ); diff --git a/engine/src/test/java/org/pentaho/di/job/entries/zipfile/JobEntryZipFileMoveFilesTest.java b/engine/src/test/java/org/pentaho/di/job/entries/zipfile/JobEntryZipFileMoveFilesTest.java index ce6961adff9d..3ab877a57e71 100644 --- a/engine/src/test/java/org/pentaho/di/job/entries/zipfile/JobEntryZipFileMoveFilesTest.java +++ b/engine/src/test/java/org/pentaho/di/job/entries/zipfile/JobEntryZipFileMoveFilesTest.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2022 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -25,9 +25,12 @@ import org.apache.commons.vfs2.FileObject; import org.junit.*; import org.junit.rules.TemporaryFolder; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.exception.KettleFileException; +import org.pentaho.di.core.vfs.IKettleVFS; import org.pentaho.di.core.vfs.KettleVFS; import org.pentaho.di.job.Job; +import org.pentaho.di.job.JobMeta; import java.io.File; import java.io.IOException; @@ -44,15 +47,18 @@ public void testFoldersToMove() throws IOException { FileObject sourceFileOrFolder = null; FileObject[] fileObjects = new FileObject[2]; boolean result; + jobEntryZipFile.setParentJobMeta( new JobMeta() ); int i=0; //Try to duplicate the functionality of moving files //without zipping and with Junit TemporaryFolder feature try { - sourceFileOrFolder = KettleVFS.getFileObject( sourceFileorFolderPath.toString() ); + IKettleVFS vfs = KettleVFS.getInstance( DefaultBowl.getInstance() ); + + sourceFileOrFolder = vfs.getFileObject( sourceFileorFolderPath.toString() ); //Creating source files/folders while ( true ) { File sourceFile = temporaryFolder.newFile( "/Source/"+"source" + i+".txt" ); - fileObjects[i] = KettleVFS.getFileObject( sourceFile.toString() ); + fileObjects[i] = vfs.getFileObject( sourceFile.toString() ); i++; if ( i == 2 ) break; diff --git a/engine/src/test/java/org/pentaho/di/kitchen/KitchenCommandExecutorTest.java b/engine/src/test/java/org/pentaho/di/kitchen/KitchenCommandExecutorTest.java index 998ba8afce31..ef1e81c5da32 100644 --- a/engine/src/test/java/org/pentaho/di/kitchen/KitchenCommandExecutorTest.java +++ b/engine/src/test/java/org/pentaho/di/kitchen/KitchenCommandExecutorTest.java @@ -31,6 +31,8 @@ import org.mockito.MockedStatic; import org.pentaho.di.base.CommandExecutorCodes; import org.pentaho.di.base.Params; +import org.pentaho.di.core.bowl.Bowl; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.Result; import org.pentaho.di.core.exception.KettleXMLException; import org.pentaho.di.core.extension.ExtensionPointInterface; @@ -82,7 +84,8 @@ public void setUp() throws Exception { result = mock( Result.class ); logChannelInterface = mock( LogChannelInterface.class ); // call real methods for loadTransFromFilesystem(), loadTransFromRepository(); - doCallRealMethod().when( mockedKitchenCommandExecutor ).loadJobFromFilesystem( anyString(), anyString(), any() ); + doCallRealMethod().when( mockedKitchenCommandExecutor ).loadJobFromFilesystem( any( Bowl.class ), anyString(), + anyString(), any() ); doCallRealMethod().when( mockedKitchenCommandExecutor ).loadJobFromRepository( any(), anyString(), anyString() ); doCallRealMethod().when( mockedKitchenCommandExecutor ).decodeBase64ToZipFile( any(), anyBoolean() ); doCallRealMethod().when( mockedKitchenCommandExecutor ).decodeBase64ToZipFile( any(), anyString() ); @@ -101,7 +104,7 @@ public void testFilesystemBase64Zip() throws Exception { String fileName = "hello-world.kjb"; File zipFile = new File( getClass().getResource( "testKjbArchive.zip" ).toURI() ); String base64Zip = Base64.getEncoder().encodeToString( FileUtils.readFileToByteArray( zipFile ) ); - Job job = mockedKitchenCommandExecutor.loadJobFromFilesystem( "", fileName, base64Zip ); + Job job = mockedKitchenCommandExecutor.loadJobFromFilesystem( DefaultBowl.getInstance(), "", fileName, base64Zip ); assertNotNull( job ); } @@ -175,7 +178,7 @@ public void testJobFailOnInitializationExtensionPointCall() throws Throwable { when( params.getLocalJarFile() ).thenReturn( "" ); when( params.getBase64Zip() ).thenReturn( "" ); try { - job = mockedKitchenCommandExecutor.loadJobFromFilesystem( "", fullPath, "" ); + job = mockedKitchenCommandExecutor.loadJobFromFilesystem( DefaultBowl.getInstance(), "", fullPath, "" ); } catch ( KettleXMLException e ) { kettleXMLExceptionThrown = true; } diff --git a/engine/src/test/java/org/pentaho/di/pan/PanCommandExecutorTest.java b/engine/src/test/java/org/pentaho/di/pan/PanCommandExecutorTest.java index 330097ef5797..fae6df8b88b4 100644 --- a/engine/src/test/java/org/pentaho/di/pan/PanCommandExecutorTest.java +++ b/engine/src/test/java/org/pentaho/di/pan/PanCommandExecutorTest.java @@ -31,6 +31,8 @@ import org.mockito.MockedStatic; import org.pentaho.di.base.CommandExecutorCodes; import org.pentaho.di.base.Params; +import org.pentaho.di.core.bowl.Bowl; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.Result; import org.pentaho.di.core.exception.KettleXMLException; import org.pentaho.di.core.extension.ExtensionPointInterface; @@ -110,7 +112,7 @@ public void setUp() throws Exception { .thenReturn( directoryInterface ); // call real methods for loadTransFromFilesystem(), loadTransFromRepository(); - doCallRealMethod().when( mockedPanCommandExecutor ).loadTransFromFilesystem( anyString(), anyString(), anyString(), any() ); + doCallRealMethod().when( mockedPanCommandExecutor ).loadTransFromFilesystem( any( Bowl.class ), anyString(), anyString(), anyString(), any() ); doCallRealMethod().when( mockedPanCommandExecutor ).loadTransFromRepository( any(), anyString(), anyString() ); doCallRealMethod().when( mockedPanCommandExecutor ).decodeBase64ToZipFile( any(), anyBoolean() ); doCallRealMethod().when( mockedPanCommandExecutor ).decodeBase64ToZipFile( any(), anyString() ); @@ -130,7 +132,7 @@ public void tearDown() { public void testMetastoreFromRepoAddedIn() throws Exception { // mock Trans loading from repo - TransMeta t = new TransMeta( getClass().getResource( SAMPLE_KTR ).getPath() ); + TransMeta t = new TransMeta( DefaultBowl.getInstance(), getClass().getResource( SAMPLE_KTR ).getPath() ); when( repository.loadTransformation( anyString(), any(), any(), anyBoolean(), nullable( String.class ) ) ).thenReturn( t ); // test @@ -147,7 +149,7 @@ public void testMetastoreFromFilesystemAddedIn() throws Exception { String fullPath = getClass().getResource( SAMPLE_KTR ).getPath(); - Trans trans = mockedPanCommandExecutor.loadTransFromFilesystem( "", fullPath, "", "" ); + Trans trans = mockedPanCommandExecutor.loadTransFromFilesystem( DefaultBowl.getInstance(), "", fullPath, "", "" ); assertNotNull( trans ); assertNotNull( trans.getMetaStore() ); @@ -158,7 +160,8 @@ public void testFilesystemBase64Zip() throws Exception { String fileName = "test.ktr"; File zipFile = new File( getClass().getResource( "testKtrArchive.zip" ).toURI() ); String base64Zip = Base64.getEncoder().encodeToString( FileUtils.readFileToByteArray( zipFile ) ); - Trans trans = mockedPanCommandExecutor.loadTransFromFilesystem( "", fileName, "", base64Zip ); + Trans trans = mockedPanCommandExecutor.loadTransFromFilesystem( DefaultBowl.getInstance(), "", fileName, "", + base64Zip ); assertNotNull( trans ); } @@ -210,7 +213,7 @@ public void testNoTransformationFinishExtensionPointCalled() throws Throwable { when( params.getLocalFile() ).thenReturn( fullPath ); when( params.getLocalJarFile() ).thenReturn( "" ); when( params.getBase64Zip() ).thenReturn( "" ); - Trans trans = mockedPanCommandExecutor.loadTransFromFilesystem( "", fullPath, "", "" ); + Trans trans = mockedPanCommandExecutor.loadTransFromFilesystem( DefaultBowl.getInstance(), "", fullPath, "", "" ); PanCommandExecutor panCommandExecutor = new PanCommandExecutor( PanCommandExecutor.class ); Result result = panCommandExecutor.execute( params ); @@ -244,7 +247,7 @@ public void testTransformationFinishExtensionPointCalled() throws Throwable { when( params.getLocalFile() ).thenReturn( fullPath ); when( params.getLocalJarFile() ).thenReturn( "" ); when( params.getBase64Zip() ).thenReturn( "" ); - Trans trans = mockedPanCommandExecutor.loadTransFromFilesystem( "", fullPath, "", "" ); + Trans trans = mockedPanCommandExecutor.loadTransFromFilesystem( DefaultBowl.getInstance(), "", fullPath, "", "" ); PanCommandExecutor panCommandExecutor = new PanCommandExecutor( PanCommandExecutor.class ); Result result = panCommandExecutor.execute( params ); @@ -275,7 +278,8 @@ public void testTransformationInitializationErrorExtensionPointCalled() throws T when( params.getBase64Zip() ).thenReturn( BASE64_FAIL_ON_INIT_KTR ); try { trans = - mockedPanCommandExecutor.loadTransFromFilesystem( "", FAIL_ON_INIT_KTR, "", BASE64_FAIL_ON_INIT_KTR ); + mockedPanCommandExecutor.loadTransFromFilesystem( DefaultBowl.getInstance(), "", FAIL_ON_INIT_KTR, "", + BASE64_FAIL_ON_INIT_KTR ); } catch ( KettleXMLException e ) { kettleXMLExceptionThrown = true; } diff --git a/engine/src/test/java/org/pentaho/di/repository/filerep/KettleFileRepositoryTestBase.java b/engine/src/test/java/org/pentaho/di/repository/filerep/KettleFileRepositoryTestBase.java index 7157529f34af..ea3a2b40b081 100644 --- a/engine/src/test/java/org/pentaho/di/repository/filerep/KettleFileRepositoryTestBase.java +++ b/engine/src/test/java/org/pentaho/di/repository/filerep/KettleFileRepositoryTestBase.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -25,6 +25,7 @@ import org.apache.commons.io.FileUtils; import org.junit.After; import org.junit.Before; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.KettleEnvironment; import org.pentaho.di.core.vfs.KettleVFS; import org.pentaho.di.repository.RepositoryDirectoryInterface; @@ -50,7 +51,7 @@ public void setUp() throws Exception { KettleEnvironment.init(); virtualFolder = "ram://file-repo/" + UUID.randomUUID(); - KettleVFS.getFileObject( virtualFolder ).createFolder(); + KettleVFS.getInstance( DefaultBowl.getInstance() ).getFileObject( virtualFolder ).createFolder(); KettleFileRepositoryMeta repositoryMeta = new KettleFileRepositoryMeta( "KettleFileRepository", "FileRep", "File repository", virtualFolder ); @@ -71,7 +72,7 @@ public void setUp() throws Exception { @After public void tearDown() throws Exception { try { - KettleVFS.getFileObject( virtualFolder ).deleteAll(); + KettleVFS.getInstance( DefaultBowl.getInstance() ).getFileObject( virtualFolder ).deleteAll(); // remove residual files FileUtils.deleteDirectory( Paths.get( virtualFolder ).getParent().getParent().toFile() ); } catch ( Exception ignored ) { diff --git a/engine/src/test/java/org/pentaho/di/shared/SharedObjectsTest.java b/engine/src/test/java/org/pentaho/di/shared/SharedObjectsTest.java index 4101b54290b1..9d8cd4893f60 100644 --- a/engine/src/test/java/org/pentaho/di/shared/SharedObjectsTest.java +++ b/engine/src/test/java/org/pentaho/di/shared/SharedObjectsTest.java @@ -36,6 +36,7 @@ import org.junit.Test; import org.mockito.Mock; import org.mockito.MockitoAnnotations; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.core.vfs.KettleVFS; @@ -81,7 +82,7 @@ public void writeToFileTest() throws KettleException, IOException { public void testCopyBackupVfs() throws Exception { final String dirName = "ram:/SharedObjectsTest"; - FileObject baseDir = KettleVFS.getFileObject( dirName ); + FileObject baseDir = KettleVFS.getInstance( DefaultBowl.getInstance() ).getFileObject( dirName ); try { baseDir.createFolder(); final String fileName = dirName + "/shared.xml"; @@ -91,17 +92,17 @@ public void testCopyBackupVfs() throws Exception { sharedObjects.storeObject( shared1 ); sharedObjects.saveToFile(); final String backupFileName = fileName + ".backup"; - FileObject backup = KettleVFS.getFileObject( backupFileName ); + FileObject backup = KettleVFS.getInstance( DefaultBowl.getInstance() ).getFileObject( backupFileName ); Assert.assertFalse( backup.exists() ); - String contents = KettleVFS.getTextFileContent( fileName, "utf8" ); + String contents = KettleVFS.getInstance( DefaultBowl.getInstance() ).getTextFileContent( fileName, "utf8" ); Assert.assertTrue( contents.contains( shared1.getXML() ) ); SharedObjectInterface shared2 = new TestSharedObject( "shared2", "shared2" ); sharedObjects.storeObject( shared2 ); sharedObjects.saveToFile(); Assert.assertTrue( backup.exists() ); - String contentsBackup = KettleVFS.getTextFileContent( backupFileName, "utf8" ); + String contentsBackup = KettleVFS.getInstance( DefaultBowl.getInstance() ).getTextFileContent( backupFileName, "utf8" ); Assert.assertEquals( contents, contentsBackup ); } finally { diff --git a/engine/src/test/java/org/pentaho/di/trans/StepWithMappingMetaTest.java b/engine/src/test/java/org/pentaho/di/trans/StepWithMappingMetaTest.java index 48b6c67e47cb..4bb1be3b2aaf 100644 --- a/engine/src/test/java/org/pentaho/di/trans/StepWithMappingMetaTest.java +++ b/engine/src/test/java/org/pentaho/di/trans/StepWithMappingMetaTest.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2021 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -30,6 +30,7 @@ import org.mockito.Mockito; import org.mockito.stubbing.Answer; import org.pentaho.di.base.MetaFileLoaderImpl; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.Const; import org.pentaho.di.core.KettleEnvironment; import org.pentaho.di.core.ObjectLocationSpecificationMethod; @@ -116,7 +117,7 @@ public void loadMappingMeta() throws Exception { } ).when( rep ).loadTransformation( anyString(), nullable( RepositoryDirectoryInterface.class ), nullable( ProgressMonitorListener.class ), anyBoolean(), nullable( String.class ) ); - StepWithMappingMeta.loadMappingMeta( mappingMetaMock, rep, null, variables, true ); + StepWithMappingMeta.loadMappingMeta( DefaultBowl.getInstance(), mappingMetaMock, rep, null, variables, true ); } @Test @@ -139,12 +140,13 @@ public StepInterface getStep( StepMeta stepMeta, StepDataInterface stepDataInter } ); String testName = "test"; try ( MockedConstruction mockedConstruction = - mockConstruction( MetaFileLoaderImpl.class, ( m,c ) -> when( m.getMetaForStep( any(), any(), any() ) ).thenReturn( transMeta ) ) ) { + mockConstruction( MetaFileLoaderImpl.class, ( m,c ) -> when( m.getMetaForStep( any(), any(), any(), any() ) ) + .thenReturn( transMeta ) ) ) { - when( transMeta.exportResources( any(), any(), nullable( ResourceNamingInterface.class ), + when( transMeta.exportResources( any(), any(), any(), nullable( ResourceNamingInterface.class ), nullable( Repository.class ), nullable( IMetaStore.class ) ) ).thenReturn( testName ); - stepWithMappingMeta.exportResources( null, null, null, null, null ); + stepWithMappingMeta.exportResources( null, null, null, null, null, null ); verify( transMeta ).setFilename( "${" + Const.INTERNAL_VARIABLE_ENTRY_CURRENT_DIRECTORY + "}/" + testName ); verify( stepWithMappingMeta ).setSpecificationMethod( ObjectLocationSpecificationMethod.FILENAME ); } @@ -189,7 +191,8 @@ public void loadMappingMetaTest() throws Exception { child.setVariable( paramOverwrite, childValue ); Mockito.doReturn( child ).when( rep ).loadTransformation( anyString(), any(), any(), anyBoolean(), any() ); - TransMeta transMeta = StepWithMappingMeta.loadMappingMeta( mappingMetaMock, rep, null, variables, true ); + TransMeta transMeta = StepWithMappingMeta.loadMappingMeta( DefaultBowl.getInstance(), mappingMetaMock, rep, null, + variables, true ); Assert.assertNotNull( transMeta ); @@ -226,7 +229,8 @@ public void loadMappingMetaTest_PathShouldBeTakenFromParentTrans() throws Except when( mappingMetaMock.getParentStepMeta() ).thenReturn( stepMeta ); //we will try to load the subtras which was linked at the step metas - TransMeta transMeta = StepWithMappingMeta.loadMappingMeta( mappingMetaMock, null, null, variables, true ); + TransMeta transMeta = StepWithMappingMeta.loadMappingMeta( DefaultBowl.getInstance(), mappingMetaMock, null, null, + variables, true ); StringBuilder expected = new StringBuilder( parentFolder.toUri().toString() ); /** @@ -371,7 +375,8 @@ public void testFileNameAsVariable() throws Exception { Mockito.doReturn( new TransMeta() ).when( rep ) .loadTransformation( anyString(), any(), any(), anyBoolean(), any() ); - TransMeta transMeta = StepWithMappingMeta.loadMappingMeta( mappingMetaMock, rep, null, parent, true ); + TransMeta transMeta = StepWithMappingMeta.loadMappingMeta( DefaultBowl.getInstance(), mappingMetaMock, rep, null, + parent, true ); Assert.assertNotNull( transMeta ); Mockito.verify( rep, Mockito.times( 1 ) ).findDirectory( Mockito.eq( transDirectory ) ); diff --git a/engine/src/test/java/org/pentaho/di/trans/SubtransExecutorTest.java b/engine/src/test/java/org/pentaho/di/trans/SubtransExecutorTest.java index 37e29a24a6d4..de61603c03d5 100644 --- a/engine/src/test/java/org/pentaho/di/trans/SubtransExecutorTest.java +++ b/engine/src/test/java/org/pentaho/di/trans/SubtransExecutorTest.java @@ -29,6 +29,7 @@ import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.junit.MockitoJUnitRunner; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.Const; import org.pentaho.di.core.KettleClientEnvironment; import org.pentaho.di.core.Props; @@ -109,9 +110,11 @@ public void testRunningZeroRowsIsEmptyOptional() throws Exception { @Test public void testRunsATrans() throws Exception { TransMeta parentMeta = - new TransMeta( this.getClass().getResource( "subtrans-executor-parent.ktr" ).getPath(), new Variables() ); + new TransMeta( DefaultBowl.getInstance(), this.getClass().getResource( "subtrans-executor-parent.ktr" ).getPath(), + new Variables() ); TransMeta subMeta = - new TransMeta( this.getClass().getResource( "subtrans-executor-sub.ktr" ).getPath(), new Variables() ); + new TransMeta( DefaultBowl.getInstance(), this.getClass().getResource( "subtrans-executor-sub.ktr" ).getPath(), + new Variables() ); LoggingObjectInterface loggingObject = new LoggingObject( "anything" ); Trans parentTrans = spy( new Trans( parentMeta, loggingObject ) ); SubtransExecutor subtransExecutor = @@ -160,9 +163,11 @@ public void testRunsATrans() throws Exception { @Test public void stopsAll() throws KettleException { TransMeta parentMeta = - new TransMeta( this.getClass().getResource( "subtrans-executor-parent.ktr" ).getPath(), new Variables() ); + new TransMeta( DefaultBowl.getInstance(), this.getClass().getResource( "subtrans-executor-parent.ktr" ).getPath(), + new Variables() ); TransMeta subMeta = - new TransMeta( this.getClass().getResource( "subtrans-executor-sub.ktr" ).getPath(), new Variables() ); + new TransMeta( DefaultBowl.getInstance(), this.getClass().getResource( "subtrans-executor-sub.ktr" ).getPath(), + new Variables() ); LoggingObjectInterface loggingObject = new LoggingObject( "anything" ); Trans parentTrans = new Trans( parentMeta, loggingObject ); SubtransExecutor subtransExecutor = @@ -184,9 +189,11 @@ public void stopsAll() throws KettleException { public void doesNotExecuteWhenStopped() throws KettleException { TransMeta parentMeta = - new TransMeta( this.getClass().getResource( "subtrans-executor-parent.ktr" ).getPath(), new Variables() ); + new TransMeta( DefaultBowl.getInstance(), this.getClass().getResource( "subtrans-executor-parent.ktr" ).getPath(), + new Variables() ); TransMeta subMeta = - new TransMeta( this.getClass().getResource( "subtrans-executor-sub.ktr" ).getPath(), new Variables() ); + new TransMeta( DefaultBowl.getInstance(), this.getClass().getResource( "subtrans-executor-sub.ktr" ).getPath(), + new Variables() ); LoggingObjectInterface loggingObject = new LoggingObject( "anything" ); Trans parentTrans = new Trans( parentMeta, loggingObject ); SubtransExecutor subtransExecutor = @@ -237,9 +244,11 @@ public void blockAndUnblockTwice() throws KettleException, InterruptedException, final ExecutorService executorService = Executors.newFixedThreadPool( 1 ); TransMeta parentMeta = - new TransMeta( this.getClass().getResource( "subtrans-executor-parent.ktr" ).getPath(), new Variables() ); + new TransMeta( DefaultBowl.getInstance(), this.getClass().getResource( "subtrans-executor-parent.ktr" ).getPath(), + new Variables() ); TransMeta subMeta = - new TransMeta( this.getClass().getResource( "subtrans-executor-sub.ktr" ).getPath(), new Variables() ); + new TransMeta( DefaultBowl.getInstance(), this.getClass().getResource( "subtrans-executor-sub.ktr" ).getPath(), + new Variables() ); LoggingObjectInterface loggingObject = new LoggingObject( "anything" ); Trans parentTrans = new Trans( parentMeta, loggingObject ); SubtransExecutor subtransExecutor = diff --git a/engine/src/test/java/org/pentaho/di/trans/TransMetaTest.java b/engine/src/test/java/org/pentaho/di/trans/TransMetaTest.java index 3e92b4a964ac..526ce79e8759 100644 --- a/engine/src/test/java/org/pentaho/di/trans/TransMetaTest.java +++ b/engine/src/test/java/org/pentaho/di/trans/TransMetaTest.java @@ -26,6 +26,8 @@ import org.junit.Test; import org.mockito.Mockito; import org.mockito.stubbing.Answer; +import org.pentaho.di.core.bowl.Bowl; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.Const; import org.pentaho.di.core.KettleEnvironment; @@ -150,6 +152,7 @@ public void getThisStepFieldsPassesCloneRowMeta() throws Exception { rmi.addValueMeta( new ValueMetaString( overriddenValue ) ); return null; } ).when( smi ).getFields( + any( Bowl.class ), any( RowMetaInterface.class ), anyString(), any( RowMetaInterface[].class ), eq( nextStep ), any( VariableSpace.class ), any( Repository.class ), any( IMetaStore.class ) ); @@ -183,7 +186,8 @@ public void getThisStepFieldsPassesClonedInfoRowMeta() throws Exception { transMeta.getThisStepFields( thisStep, nextStep, row ); // then - verify( smi, never() ).getFields( any(), any(), eq( new RowMetaInterface[] { row } ), any(), any(), any(), any() ); + verify( smi, never() ).getFields( any(), any(), any(), eq( new RowMetaInterface[] { row } ), any(), any(), any(), + any() ); } @Test @@ -506,7 +510,8 @@ public void testLoadXml() throws KettleException { @Test public void testTransWithOneStepIsConsideredUsed() throws Exception { - TransMeta transMeta = new TransMeta( getClass().getResource( "one-step-trans.ktr" ).getPath() ); + TransMeta transMeta = new TransMeta( DefaultBowl.getInstance(), + getClass().getResource( "one-step-trans.ktr" ).getPath() ); assertEquals( 1, transMeta.getUsedSteps().size() ); Repository rep = mock( Repository.class ); ProgressMonitorListener monitor = mock( ProgressMonitorListener.class ); @@ -521,7 +526,8 @@ public void testTransWithOneStepIsConsideredUsed() throws Exception { @Test public void testGetCacheVersion() throws Exception { - TransMeta transMeta = new TransMeta( getClass().getResource( "one-step-trans.ktr" ).getPath() ); + TransMeta transMeta = new TransMeta( DefaultBowl.getInstance(), + getClass().getResource( "one-step-trans.ktr" ).getPath() ); int oldCacheVersion = transMeta.getCacheVersion(); transMeta.setSizeRowset( 10 ); int currCacheVersion = transMeta.getCacheVersion(); @@ -530,7 +536,8 @@ public void testGetCacheVersion() throws Exception { @Test public void testGetCacheVersionWithIrrelevantParameters() throws Exception { - TransMeta transMeta = new TransMeta( getClass().getResource( "one-step-trans.ktr" ).getPath() ); + TransMeta transMeta = new TransMeta( DefaultBowl.getInstance(), + getClass().getResource( "one-step-trans.ktr" ).getPath() ); int oldCacheVersion = transMeta.getCacheVersion(); int currCacheVersion; @@ -805,11 +812,11 @@ private StepMetaInterface stepMetaInterfaceWithFields( when( newSmi.getStepIOMeta() ).thenReturn( stepIOMeta ); doAnswer( (Answer) invocationOnMock -> { - RowMetaInterface passedRmi = (RowMetaInterface) invocationOnMock.getArguments()[ 0 ]; + RowMetaInterface passedRmi = (RowMetaInterface) invocationOnMock.getArguments()[ 1 ]; passedRmi.addRowMeta( rowMetaWithFields ); return null; } ).when( newSmi ) - .getFields( any(), any(), any(), any(), any(), any(), any() ); + .getFields( any(), any(), any(), any(), any(), any(), any(), any() ); return newSmi; } @@ -823,7 +830,7 @@ private StepMeta createStepMeta( String name ) { @Test public void testSetInternalEntryCurrentDirectoryWithFilename( ) { - TransMeta transMetaTest = new TransMeta( ); + TransMeta transMetaTest = new TransMeta(); transMetaTest.setFilename( "hasFilename" ); transMetaTest.setVariable( Const.INTERNAL_VARIABLE_ENTRY_CURRENT_DIRECTORY, "Original value defined at run execution" ); transMetaTest.setVariable( Const.INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_DIRECTORY, "file:///C:/SomeFilenameDirectory" ); @@ -836,7 +843,7 @@ public void testSetInternalEntryCurrentDirectoryWithFilename( ) { @Test public void testSetInternalEntryCurrentDirectoryWithRepository( ) { - TransMeta transMetaTest = new TransMeta( ); + TransMeta transMetaTest = new TransMeta(); RepositoryDirectoryInterface path = mock( RepositoryDirectoryInterface.class ); when( path.getPath() ).thenReturn( "aPath" ); @@ -852,7 +859,7 @@ public void testSetInternalEntryCurrentDirectoryWithRepository( ) { @Test public void testSetInternalEntryCurrentDirectoryWithoutFilenameOrRepository( ) { - TransMeta transMetaTest = new TransMeta( ); + TransMeta transMetaTest = new TransMeta(); transMetaTest.setVariable( Const.INTERNAL_VARIABLE_ENTRY_CURRENT_DIRECTORY, "Original value defined at run execution" ); transMetaTest.setVariable( Const.INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_DIRECTORY, "file:///C:/SomeFilenameDirectory" ); transMetaTest.setVariable( Const.INTERNAL_VARIABLE_TRANSFORMATION_REPOSITORY_DIRECTORY, "/SomeRepDirectory" ); diff --git a/engine/src/test/java/org/pentaho/di/trans/TransTest.java b/engine/src/test/java/org/pentaho/di/trans/TransTest.java index 9ffbfac28078..1cabe5d388e0 100644 --- a/engine/src/test/java/org/pentaho/di/trans/TransTest.java +++ b/engine/src/test/java/org/pentaho/di/trans/TransTest.java @@ -31,6 +31,7 @@ import org.junit.Test; import org.mockito.MockedConstruction; import org.mockito.Mockito; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.Const; import org.pentaho.di.core.ProgressMonitorListener; import org.pentaho.di.core.Result; @@ -180,7 +181,7 @@ public void testLoggingObjectIsNotLeakInTrans() throws Exception { nullable( ProgressMonitorListener.class ), anyBoolean(), nullable( String.class ) ) ).thenReturn( meta ); when( rep.findDirectory( anyString() ) ).thenReturn( repInt ); - Trans trans = new Trans( meta, rep, "junit", "junitDir", "fileName" ); + Trans trans = new Trans( DefaultBowl.getInstance(), meta, rep, "junit", "junitDir", "fileName" ); assertEquals( "Log channel General assigned", LogChannel.GENERAL.getLogChannelId(), trans.log .getLogChannelId() ); } @@ -235,13 +236,14 @@ public void testPDI12424ParametersFromMetaAreCopiedToTrans() throws Exception { when( meta.listVariables() ).thenReturn( new String[] {} ); when( meta.listParameters() ).thenReturn( new String[] { testParam } ); when( meta.getParameterValue( testParam ) ).thenReturn( testParamValue ); - FileObject ktr = KettleVFS.createTempFile( "parameters", ".ktr", KettleVFS.TEMP_DIR ); + FileObject ktr = KettleVFS.getInstance( DefaultBowl.getInstance() ) + .createTempFile( "parameters", ".ktr", KettleVFS.TEMP_DIR ); try ( OutputStream outputStream = ktr.getContent().getOutputStream() ) { InputStream inputStream = new ByteArrayInputStream( "".getBytes() ); IOUtils.copy( inputStream, outputStream ); } - Trans trans = new Trans( meta, null, null, null, ktr.getURL().toURI().toString() ); + Trans trans = new Trans( DefaultBowl.getInstance(), meta, null, null, null, ktr.getURL().toURI().toString() ); assertEquals( testParamValue, trans.getParameterValue( testParam ) ); } diff --git a/engine/src/test/java/org/pentaho/di/trans/step/errorhandling/AbstractFileErrorHandlerTest.java b/engine/src/test/java/org/pentaho/di/trans/step/errorhandling/AbstractFileErrorHandlerTest.java index 4c044382daa4..edf6f17e11ba 100644 --- a/engine/src/test/java/org/pentaho/di/trans/step/errorhandling/AbstractFileErrorHandlerTest.java +++ b/engine/src/test/java/org/pentaho/di/trans/step/errorhandling/AbstractFileErrorHandlerTest.java @@ -24,6 +24,7 @@ import org.apache.commons.vfs2.FileObject; import org.junit.Test; import org.mockito.Mockito; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.vfs.KettleVFS; import org.pentaho.di.trans.TransMeta; import org.pentaho.di.trans.step.BaseStep; @@ -63,7 +64,8 @@ public void getWriterEmptyEncoding() throws Exception { private void setupErrorHandler( String encoding, Object source ) throws Exception { File tempFile = File.createTempFile( "test", "file.txt" ); tempFile.deleteOnExit(); - FileObject fileObject = KettleVFS.getFileObject( tempFile.getAbsolutePath() ); + FileObject fileObject = KettleVFS.getInstance( DefaultBowl.getInstance() ) + .getFileObject( tempFile.getAbsolutePath() ); Date date = new Date(); String destDirectory = tempFile.getParent(); String fileExtension = ".txt"; diff --git a/engine/src/test/java/org/pentaho/di/trans/steps/csvinput/BaseCsvParsingTest.java b/engine/src/test/java/org/pentaho/di/trans/steps/csvinput/BaseCsvParsingTest.java index 955f18fc9e79..44868d310337 100644 --- a/engine/src/test/java/org/pentaho/di/trans/steps/csvinput/BaseCsvParsingTest.java +++ b/engine/src/test/java/org/pentaho/di/trans/steps/csvinput/BaseCsvParsingTest.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2016-2020 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2016-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -25,6 +25,7 @@ import org.apache.commons.lang.StringUtils; import org.junit.Before; import org.junit.Ignore; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.row.RowMeta; import org.pentaho.di.core.row.ValueMetaInterface; import org.pentaho.di.core.variables.Variables; @@ -74,7 +75,8 @@ protected void init( String file, boolean absolutePath ) throws Exception { */ protected void setFields( TextFileInputField... fields ) throws Exception { meta.setInputFields( fields ); - meta.getFields( data.outputRowMeta, meta.getName(), null, null, new Variables(), null, null ); + meta.getFields( DefaultBowl.getInstance(), data.outputRowMeta, meta.getName(), null, null, new Variables(), null, + null ); data.convertRowMeta = data.outputRowMeta.cloneToType( ValueMetaInterface.TYPE_STRING ); } diff --git a/engine/src/test/java/org/pentaho/di/trans/steps/databaselookup/DatabaseLookupMetaTest.java b/engine/src/test/java/org/pentaho/di/trans/steps/databaselookup/DatabaseLookupMetaTest.java index 30b21a829ce6..291fc9ebb497 100644 --- a/engine/src/test/java/org/pentaho/di/trans/steps/databaselookup/DatabaseLookupMetaTest.java +++ b/engine/src/test/java/org/pentaho/di/trans/steps/databaselookup/DatabaseLookupMetaTest.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2018 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -36,6 +36,7 @@ import org.junit.ClassRule; import org.junit.Test; import org.mockito.Mockito; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.KettleEnvironment; import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.core.exception.KettleStepException; @@ -127,7 +128,7 @@ public void getFieldWithValueUsedTwice() throws KettleStepException { RowMetaInterface row = new RowMeta(); row.setValueMetaList( new ArrayList( Arrays.asList( r1 ) ) ); - databaseLookupMeta.getFields( row, "", info, null, null, null, null ); + databaseLookupMeta.getFields( DefaultBowl.getInstance(), row, "", info, null, null, null, null ); List expectedRow = Arrays.asList( new ValueMetaInterface[] { new ValueMetaString( "value" ), new ValueMetaString( "v1" ), new ValueMetaString( "v2" ), } ); diff --git a/engine/src/test/java/org/pentaho/di/trans/steps/databaselookup/DatabaseLookupUTest.java b/engine/src/test/java/org/pentaho/di/trans/steps/databaselookup/DatabaseLookupUTest.java index b82290167ad2..4aefdc0d5fb0 100644 --- a/engine/src/test/java/org/pentaho/di/trans/steps/databaselookup/DatabaseLookupUTest.java +++ b/engine/src/test/java/org/pentaho/di/trans/steps/databaselookup/DatabaseLookupUTest.java @@ -32,6 +32,7 @@ import org.mockito.Mockito; import org.mockito.invocation.InvocationOnMock; import org.mockito.stubbing.Answer; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.KettleEnvironment; import org.pentaho.di.core.RowSet; import org.pentaho.di.core.database.Database; @@ -191,6 +192,7 @@ private DatabaseLookupMeta createDatabaseMeta() throws KettleException { return null; } } ).when( meta ).getFields( + any( Bowl.class ), any( RowMetaInterface.class ), anyString(), any( RowMetaInterface[].class ), @@ -297,6 +299,7 @@ public void testEqualsAndIsNullAreCached() throws Exception { return null; } } ).when( meta ).getFields( + any( Bowl.class ), any( RowMetaInterface.class ), anyString(), any( RowMetaInterface[].class ), diff --git a/engine/src/test/java/org/pentaho/di/trans/steps/databaselookup/PDI5436Test.java b/engine/src/test/java/org/pentaho/di/trans/steps/databaselookup/PDI5436Test.java index 11d02560040b..d4c3f755f715 100644 --- a/engine/src/test/java/org/pentaho/di/trans/steps/databaselookup/PDI5436Test.java +++ b/engine/src/test/java/org/pentaho/di/trans/steps/databaselookup/PDI5436Test.java @@ -29,6 +29,7 @@ import org.junit.BeforeClass; import org.junit.ClassRule; import org.junit.Test; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.KettleEnvironment; import org.pentaho.di.core.QueueRowSet; import org.pentaho.di.core.RowSet; @@ -122,7 +123,7 @@ private DatabaseLookupMeta mockStepMeta() throws KettleStepException { doReturn( mock( DatabaseMeta.class ) ).when( stepMeta ).getDatabaseMeta(); doReturn( new String[] { "=" } ).when( stepMeta ).getKeyCondition(); - doCallRealMethod().when( stepMeta ).getFields( any( RowMetaInterface.class ), anyString(), + doCallRealMethod().when( stepMeta ).getFields( any( Bowl.class ), any( RowMetaInterface.class ), anyString(), nullable( RowMetaInterface[].class ), nullable( StepMeta.class ), any( VariableSpace.class ), nullable( Repository.class ), nullable( IMetaStore.class ) ); doReturn( new String[] { "value" } ).when( stepMeta ).getReturnValueNewName(); diff --git a/engine/src/test/java/org/pentaho/di/trans/steps/denormaliser/DenormalizerMetaTest.java b/engine/src/test/java/org/pentaho/di/trans/steps/denormaliser/DenormalizerMetaTest.java index 5de7e5517c19..3a23f2ea50da 100644 --- a/engine/src/test/java/org/pentaho/di/trans/steps/denormaliser/DenormalizerMetaTest.java +++ b/engine/src/test/java/org/pentaho/di/trans/steps/denormaliser/DenormalizerMetaTest.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2019 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -33,6 +33,7 @@ import org.junit.Before; import org.junit.ClassRule; import org.junit.Test; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.KettleEnvironment; import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.core.exception.KettleStepException; @@ -199,7 +200,7 @@ public void testGetFields() throws KettleStepException { meta.setGroupField( new String[] { PERSON } ); meta.setDenormaliserTargetField( new DenormaliserTargetField[] { targetField2018, targetField2019 } ); - meta.getFields( inputRow, "Denormaliser", null, null, new Variables(), null, null ); + meta.getFields( DefaultBowl.getInstance(), inputRow, "Denormaliser", null, null, new Variables(), null, null ); Assert.assertEquals( 3, inputRow.size() ); diff --git a/engine/src/test/java/org/pentaho/di/trans/steps/detectlastrow/DetectLastRowMetaTest.java b/engine/src/test/java/org/pentaho/di/trans/steps/detectlastrow/DetectLastRowMetaTest.java index ede4d6939877..191dce0f82e1 100644 --- a/engine/src/test/java/org/pentaho/di/trans/steps/detectlastrow/DetectLastRowMetaTest.java +++ b/engine/src/test/java/org/pentaho/di/trans/steps/detectlastrow/DetectLastRowMetaTest.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2018 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -30,6 +30,7 @@ import org.junit.ClassRule; import org.junit.Test; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.core.exception.KettleStepException; import org.pentaho.di.core.row.RowMeta; @@ -69,7 +70,7 @@ public void testGetFields() throws KettleStepException { meta.setDefault(); meta.setResultFieldName( "The Result" ); RowMeta rowMeta = new RowMeta(); - meta.getFields( rowMeta, "this step", null, null, new Variables(), null, null ); + meta.getFields( DefaultBowl.getInstance(), rowMeta, "this step", null, null, new Variables(), null, null ); assertEquals( 1, rowMeta.size() ); assertEquals( "The Result", rowMeta.getValueMeta( 0 ).getName() ); diff --git a/engine/src/test/java/org/pentaho/di/trans/steps/dimensionlookup/DimensionLookupMetaTest.java b/engine/src/test/java/org/pentaho/di/trans/steps/dimensionlookup/DimensionLookupMetaTest.java index 606d93966561..b4f907085ee8 100644 --- a/engine/src/test/java/org/pentaho/di/trans/steps/dimensionlookup/DimensionLookupMetaTest.java +++ b/engine/src/test/java/org/pentaho/di/trans/steps/dimensionlookup/DimensionLookupMetaTest.java @@ -29,6 +29,7 @@ import org.junit.ClassRule; import org.junit.Test; import org.mockito.Mockito; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.KettleEnvironment; import org.pentaho.di.core.SQLStatement; import org.pentaho.di.core.database.Database; @@ -184,7 +185,8 @@ public void testGetFields() throws Exception { RowMeta row = new RowMeta(); try { - meta.getFields( row, "DimensionLookupMetaTest", new RowMeta[] { row }, null, null, null, null ); + meta.getFields( DefaultBowl.getInstance(), row, "DimensionLookupMetaTest", new RowMeta[] { row }, null, null, + null, null ); } catch ( Throwable e ) { Assert.assertTrue( e.getMessage().contains( BaseMessages.getString( DimensionLookupMeta.class, "DimensionLookupMeta.Error.NoTechnicalKeySpecified" ) ) ); diff --git a/engine/src/test/java/org/pentaho/di/trans/steps/fieldsplitter/FieldSplitterTest.java b/engine/src/test/java/org/pentaho/di/trans/steps/fieldsplitter/FieldSplitterTest.java index 246fa1546a83..0597e9fe9261 100644 --- a/engine/src/test/java/org/pentaho/di/trans/steps/fieldsplitter/FieldSplitterTest.java +++ b/engine/src/test/java/org/pentaho/di/trans/steps/fieldsplitter/FieldSplitterTest.java @@ -36,6 +36,7 @@ import org.junit.BeforeClass; import org.junit.ClassRule; import org.junit.Test; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.KettleEnvironment; import org.pentaho.di.core.QueueRowSet; import org.pentaho.di.core.RowSet; @@ -95,7 +96,7 @@ private RowSet mockInputRowSet() { private FieldSplitterMeta mockProcessRowMeta() throws KettleStepException { FieldSplitterMeta processRowMeta = smh.processRowsStepMetaInterface; doReturn( "field to split" ).when( processRowMeta ).getSplitField(); - doCallRealMethod().when( processRowMeta ).getFields( any( RowMetaInterface.class ), anyString(), + doCallRealMethod().when( processRowMeta ).getFields( any( Bowl.class ), any( RowMetaInterface.class ), anyString(), nullable( RowMetaInterface[].class ), nullable( StepMeta.class ), any( VariableSpace.class ), nullable( Repository.class ), nullable( IMetaStore.class ) ); doReturn( new String[] { "a", "b" } ).when( processRowMeta ).getFieldName(); diff --git a/engine/src/test/java/org/pentaho/di/trans/steps/fileinput/text/BaseTextParsingTest.java b/engine/src/test/java/org/pentaho/di/trans/steps/fileinput/text/BaseTextParsingTest.java index 47ec46dc3097..12047a53e10e 100644 --- a/engine/src/test/java/org/pentaho/di/trans/steps/fileinput/text/BaseTextParsingTest.java +++ b/engine/src/test/java/org/pentaho/di/trans/steps/fileinput/text/BaseTextParsingTest.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2016-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2016-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -24,6 +24,7 @@ import org.junit.Before; import org.junit.Ignore; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.row.RowMeta; import org.pentaho.di.core.row.ValueMetaInterface; import org.pentaho.di.core.variables.Variables; @@ -77,7 +78,8 @@ protected void initByURL( String url ) throws Exception { */ protected void setFields( BaseFileField... fields ) throws Exception { meta.inputFields = fields; - meta.getFields( data.outputRowMeta, meta.getName(), null, null, new Variables(), null, null ); + meta.getFields( DefaultBowl.getInstance(), data.outputRowMeta, meta.getName(), null, null, new Variables(), null, + null ); data.convertRowMeta = data.outputRowMeta.cloneToType( ValueMetaInterface.TYPE_STRING ); } } diff --git a/engine/src/test/java/org/pentaho/di/trans/steps/fileinput/text/TextFileInputMetaTest.java b/engine/src/test/java/org/pentaho/di/trans/steps/fileinput/text/TextFileInputMetaTest.java index 06597347b352..1fe1d29a086f 100644 --- a/engine/src/test/java/org/pentaho/di/trans/steps/fileinput/text/TextFileInputMetaTest.java +++ b/engine/src/test/java/org/pentaho/di/trans/steps/fileinput/text/TextFileInputMetaTest.java @@ -24,6 +24,7 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotEquals; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.doReturn; @@ -35,6 +36,8 @@ import org.apache.commons.vfs2.FileObject; import org.junit.Before; import org.junit.Test; +import org.pentaho.di.core.bowl.Bowl; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.util.StringUtil; import org.pentaho.di.core.variables.VariableSpace; import org.pentaho.di.resource.ResourceNamingInterface; @@ -69,7 +72,7 @@ public void setUp() throws Exception { doReturn( "" ).when( variableSpace ).environmentSubstitute( anyString() ); doReturn( FILE_NAME_VALID_PATH ).when( variableSpace ).environmentSubstitute( FILE_NAME_VALID_PATH ); FileObject mockedFileObject = mock( FileObject.class ); - doReturn( mockedFileObject ).when( inputMeta ).getFileObject( anyString(), eq( variableSpace ) ); + doReturn( mockedFileObject ).when( inputMeta ).getFileObject( any( Bowl.class ), anyString(), eq( variableSpace ) ); } @Test @@ -79,11 +82,12 @@ public void whenExportingResourcesWeGetFileObjectsOnlyFromFilesWithNotNullAndNot inputMeta.inputFiles.fileMask = new String[] { StringUtil.EMPTY_STRING, StringUtil.EMPTY_STRING, StringUtil.EMPTY_STRING }; - inputMeta.exportResources( variableSpace, null, mock( ResourceNamingInterface.class ), null, null ); + inputMeta.exportResources( DefaultBowl.getInstance(), variableSpace, null, mock( ResourceNamingInterface.class ), + null, null ); - verify( inputMeta ).getFileObject( FILE_NAME_VALID_PATH, variableSpace ); - verify( inputMeta, never() ).getFileObject( FILE_NAME_NULL, variableSpace ); - verify( inputMeta, never() ).getFileObject( FILE_NAME_EMPTY, variableSpace ); + verify( inputMeta ).getFileObject( DefaultBowl.getInstance(), FILE_NAME_VALID_PATH, variableSpace ); + verify( inputMeta, never() ).getFileObject( DefaultBowl.getInstance(), FILE_NAME_NULL, variableSpace ); + verify( inputMeta, never() ).getFileObject( DefaultBowl.getInstance(), FILE_NAME_EMPTY, variableSpace ); } @Test diff --git a/engine/src/test/java/org/pentaho/di/trans/steps/fileinput/text/TextFileInputTest.java b/engine/src/test/java/org/pentaho/di/trans/steps/fileinput/text/TextFileInputTest.java index 14e069be72db..6ea49d44b114 100644 --- a/engine/src/test/java/org/pentaho/di/trans/steps/fileinput/text/TextFileInputTest.java +++ b/engine/src/test/java/org/pentaho/di/trans/steps/fileinput/text/TextFileInputTest.java @@ -340,7 +340,7 @@ public void testFolderFromPreviousStep() throws Exception { meta.inputFiles.passingThruFields = true; meta.inputFiles.acceptingFilenames = true; TextFileInputData data = createDataObject( virtualFile, ",", "col1", "col2" ); - data.files.addFile( KettleVFS.getFileObject( virtualFile2 ) ); + data.files.addFile( KettleVFS.getInstance( DefaultBowl.getInstance() ).getFileObject( virtualFile2 ) ); TextFileInput input = Mockito.spy( StepMockUtil.getStep( TextFileInput.class, TextFileInputMeta.class, "test" ) ); @@ -492,7 +492,7 @@ private TextFileInputData createDataObject( String file, String... outputFields ) throws Exception { TextFileInputData data = new TextFileInputData(); data.files = new FileInputList(); - data.files.addFile( KettleVFS.getFileObject( file ) ); + data.files.addFile( KettleVFS.getInstance( DefaultBowl.getInstance() ).getFileObject( file ) ); data.separator = separator; @@ -521,7 +521,8 @@ private static String createVirtualFile( String filename, String... rows ) throw ByteArrayOutputStream bos = new ByteArrayOutputStream(); bos.write( content.toString().getBytes() ); - try ( OutputStream os = KettleVFS.getFileObject( virtualFile ).getContent().getOutputStream() ) { + try ( OutputStream os = KettleVFS.getInstance( DefaultBowl.getInstance() ) + .getFileObject( virtualFile ).getContent().getOutputStream() ) { IOUtils.copy( new ByteArrayInputStream( bos.toByteArray() ), os ); } diff --git a/engine/src/test/java/org/pentaho/di/trans/steps/fixedinput/BaseFixedParsingTest.java b/engine/src/test/java/org/pentaho/di/trans/steps/fixedinput/BaseFixedParsingTest.java index 46c1390610eb..bbd56c394e29 100644 --- a/engine/src/test/java/org/pentaho/di/trans/steps/fixedinput/BaseFixedParsingTest.java +++ b/engine/src/test/java/org/pentaho/di/trans/steps/fixedinput/BaseFixedParsingTest.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -24,6 +24,7 @@ import org.junit.Before; import org.junit.Ignore; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.row.RowMeta; import org.pentaho.di.core.row.ValueMetaInterface; import org.pentaho.di.core.variables.Variables; @@ -63,7 +64,8 @@ protected void init( String file ) throws Exception { */ protected void setFields( FixedFileInputField... fields ) throws Exception { meta.setFieldDefinition( fields ); - meta.getFields( data.outputRowMeta, meta.getName(), null, null, new Variables(), null, null ); + meta.getFields( DefaultBowl.getInstance(), data.outputRowMeta, meta.getName(), null, null, new Variables(), null, + null ); data.convertRowMeta = data.outputRowMeta.cloneToType( ValueMetaInterface.TYPE_STRING ); } diff --git a/engine/src/test/java/org/pentaho/di/trans/steps/getsubfolders/GetSubFoldersMetaTest.java b/engine/src/test/java/org/pentaho/di/trans/steps/getsubfolders/GetSubFoldersMetaTest.java index 980ef755cf59..646937456a69 100644 --- a/engine/src/test/java/org/pentaho/di/trans/steps/getsubfolders/GetSubFoldersMetaTest.java +++ b/engine/src/test/java/org/pentaho/di/trans/steps/getsubfolders/GetSubFoldersMetaTest.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2018 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -35,6 +35,7 @@ import org.junit.ClassRule; import org.junit.Test; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.core.exception.KettleStepException; import org.pentaho.di.core.row.RowMeta; @@ -54,7 +55,7 @@ public void getFieldsTest() throws KettleStepException { String stepName = UUID.randomUUID().toString(); RowMeta rowMeta = new RowMeta(); - stepMeta.getFields( rowMeta, stepName, null, null, new Variables(), null, null ); + stepMeta.getFields( DefaultBowl.getInstance(), rowMeta, stepName, null, null, new Variables(), null, null ); assertFalse( stepMeta.includeRowNumber() ); assertEquals( 10, rowMeta.size() ); @@ -71,7 +72,7 @@ public void getFieldsTest() throws KettleStepException { stepMeta.setIncludeRowNumber( true ); rowMeta = new RowMeta(); - stepMeta.getFields( rowMeta, stepName, null, null, new Variables(), null, null ); + stepMeta.getFields( DefaultBowl.getInstance(), rowMeta, stepName, null, null, new Variables(), null, null ); assertTrue( stepMeta.includeRowNumber() ); assertEquals( 11, rowMeta.size() ); assertEquals( "folderName", rowMeta.getValueMeta( 0 ).getName() ); @@ -88,7 +89,7 @@ public void getFieldsTest() throws KettleStepException { stepMeta.setRowNumberField( "MyRowNumber" ); rowMeta = new RowMeta(); - stepMeta.getFields( rowMeta, stepName, null, null, new Variables(), null, null ); + stepMeta.getFields( DefaultBowl.getInstance(), rowMeta, stepName, null, null, new Variables(), null, null ); assertEquals( "MyRowNumber", stepMeta.getRowNumberField() ); assertEquals( 11, rowMeta.size() ); assertEquals( "MyRowNumber", rowMeta.getValueMeta( 10 ).getName() ); diff --git a/engine/src/test/java/org/pentaho/di/trans/steps/getvariable/GetVariableMetaTest.java b/engine/src/test/java/org/pentaho/di/trans/steps/getvariable/GetVariableMetaTest.java index 812af8314f17..04cc95f6760c 100644 --- a/engine/src/test/java/org/pentaho/di/trans/steps/getvariable/GetVariableMetaTest.java +++ b/engine/src/test/java/org/pentaho/di/trans/steps/getvariable/GetVariableMetaTest.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * -* Copyright (C) 2002-2018 by Hitachi Vantara : http://www.pentaho.com +* Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -36,6 +36,7 @@ import org.junit.BeforeClass; import org.junit.ClassRule; import org.junit.Test; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.KettleEnvironment; import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.core.exception.KettleStepException; @@ -119,7 +120,7 @@ public void testGetValueMetaPlugin() throws KettleStepException { meta.setFieldDefinitions( new FieldDefinition[]{ field } ); RowMetaInterface rowMeta = new RowMeta(); - meta.getFields( rowMeta, "stepName", null, null, new Variables(), null, null ); + meta.getFields( DefaultBowl.getInstance(), rowMeta, "stepName", null, null, new Variables(), null, null ); assertNotNull( rowMeta ); assertEquals( 1, rowMeta.size() ); diff --git a/engine/src/test/java/org/pentaho/di/trans/steps/groupby/GroupByMetaGetFieldsTest.java b/engine/src/test/java/org/pentaho/di/trans/steps/groupby/GroupByMetaGetFieldsTest.java index 01420517466e..fc0b177f927e 100644 --- a/engine/src/test/java/org/pentaho/di/trans/steps/groupby/GroupByMetaGetFieldsTest.java +++ b/engine/src/test/java/org/pentaho/di/trans/steps/groupby/GroupByMetaGetFieldsTest.java @@ -26,6 +26,7 @@ import org.junit.Before; import org.junit.Test; import org.mockito.MockedStatic; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.exception.KettlePluginException; import org.pentaho.di.core.row.RowMeta; import org.pentaho.di.core.row.RowMetaInterface; @@ -103,7 +104,8 @@ public void getFieldsWithSubject_WithFormat() { groupByMeta.setAggregateField( new String[] { "maxDate" } ); groupByMeta.setAggregateType( new int[] { TYPE_GROUP_MAX } ); - groupByMeta.getFields( rowMeta, "Group by", mockInfo, mockNextStep, mockSpace, null, mockIMetaStore ); + groupByMeta.getFields( DefaultBowl.getInstance(), rowMeta, "Group by", mockInfo, mockNextStep, mockSpace, null, + mockIMetaStore ); verify( rowMeta, times( 1 ) ).clear(); verify( rowMeta, times( 1 ) ).addRowMeta( any() ); @@ -122,7 +124,8 @@ public void getFieldsWithSubject_NoFormat() { groupByMeta.setAggregateField( new String[] { "minDate" } ); groupByMeta.setAggregateType( new int[] { TYPE_GROUP_MIN } ); - groupByMeta.getFields( rowMeta, "Group by", mockInfo, mockNextStep, mockSpace, null, mockIMetaStore ); + groupByMeta.getFields( DefaultBowl.getInstance(), rowMeta, "Group by", mockInfo, mockNextStep, mockSpace, null, + mockIMetaStore ); verify( rowMeta, times( 1 ) ).clear(); verify( rowMeta, times( 1 ) ).addRowMeta( any() ); @@ -141,7 +144,8 @@ public void getFieldsWithoutSubject() { groupByMeta.setAggregateField( new String[] { "countDate" } ); groupByMeta.setAggregateType( new int[] { TYPE_GROUP_COUNT_ANY } ); - groupByMeta.getFields( rowMeta, "Group by", mockInfo, mockNextStep, mockSpace, null, mockIMetaStore ); + groupByMeta.getFields( DefaultBowl.getInstance(), rowMeta, "Group by", mockInfo, mockNextStep, mockSpace, null, + mockIMetaStore ); verify( rowMeta, times( 1 ) ).clear(); verify( rowMeta, times( 1 ) ).addRowMeta( any() ); diff --git a/engine/src/test/java/org/pentaho/di/trans/steps/groupby/GroupByTest.java b/engine/src/test/java/org/pentaho/di/trans/steps/groupby/GroupByTest.java index e2f17c77e148..4078800a0015 100644 --- a/engine/src/test/java/org/pentaho/di/trans/steps/groupby/GroupByTest.java +++ b/engine/src/test/java/org/pentaho/di/trans/steps/groupby/GroupByTest.java @@ -29,6 +29,7 @@ import org.junit.Test; import org.mockito.Mockito; import org.pentaho.di.core.BlockingRowSet; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.RowSet; import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.core.exception.KettlePluginException; @@ -147,7 +148,7 @@ public void testGetFields() { GroupByMeta.TYPE_GROUP_CONCAT_COMMA, GroupByMeta.TYPE_GROUP_CONCAT_STRING } ); - meta.getFields( outputFields, "Group By Step", null, null, + meta.getFields( DefaultBowl.getInstance(), outputFields, "Group By Step", null, null, null, null, null ); assertEquals( outputFields.getValueMetaList().size(), 9 ); diff --git a/engine/src/test/java/org/pentaho/di/trans/steps/ifnull/IfNullTest.java b/engine/src/test/java/org/pentaho/di/trans/steps/ifnull/IfNullTest.java index 187e9d2f2096..a9d0b3ef3c7e 100644 --- a/engine/src/test/java/org/pentaho/di/trans/steps/ifnull/IfNullTest.java +++ b/engine/src/test/java/org/pentaho/di/trans/steps/ifnull/IfNullTest.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2019 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -28,6 +28,7 @@ import org.junit.BeforeClass; import org.junit.ClassRule; import org.junit.Test; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.Const; import org.pentaho.di.core.KettleEnvironment; import org.pentaho.di.core.QueueRowSet; @@ -91,9 +92,9 @@ private IfNullMeta mockProcessRowMeta() throws KettleStepException { IfNullMeta processRowMeta = smh.processRowsStepMetaInterface; doReturn( createFields( "null-field", "empty-field", "space-field" ) ).when( processRowMeta ).getFields(); doReturn( "replace-value" ).when( processRowMeta ).getReplaceAllByValue(); - doCallRealMethod().when( processRowMeta ).getFields( any( RowMetaInterface.class ), anyString(), any( - RowMetaInterface[].class ), any( StepMeta.class ), any( VariableSpace.class ), any( Repository.class ), any( - IMetaStore.class ) ); + doCallRealMethod().when( processRowMeta ).getFields( any( Bowl.class ), any( RowMetaInterface.class ), anyString(), + any( RowMetaInterface[].class ), any( StepMeta.class ), any( VariableSpace.class ), any( Repository.class ), + any( IMetaStore.class ) ); return processRowMeta; } diff --git a/engine/src/test/java/org/pentaho/di/trans/steps/jobexecutor/JobExecutorMetaTest.java b/engine/src/test/java/org/pentaho/di/trans/steps/jobexecutor/JobExecutorMetaTest.java index 623dd872b32b..9095d783e113 100644 --- a/engine/src/test/java/org/pentaho/di/trans/steps/jobexecutor/JobExecutorMetaTest.java +++ b/engine/src/test/java/org/pentaho/di/trans/steps/jobexecutor/JobExecutorMetaTest.java @@ -27,6 +27,8 @@ import org.junit.ClassRule; import org.junit.Test; import org.mockito.Mockito; +import org.pentaho.di.core.bowl.Bowl; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.Const; import org.pentaho.di.core.ObjectLocationSpecificationMethod; import org.pentaho.di.core.exception.KettleException; @@ -119,12 +121,13 @@ public void testExportResources() throws KettleException { String testName = "test"; - doReturn( jobMeta ).when( jobExecutorMeta ).loadJobMetaProxy( any( JobExecutorMeta.class ), - nullable( Repository.class ), nullable( VariableSpace.class ) ); - when( jobMeta.exportResources( any( JobMeta.class ), nullable( Map.class ), nullable( ResourceNamingInterface.class ), - nullable( Repository.class ), nullable( IMetaStore.class ) ) ).thenReturn( testName ); + doReturn( jobMeta ).when( jobExecutorMeta ).loadJobMetaProxy( nullable( Bowl.class ), + nullable( JobExecutorMeta.class ), nullable( Repository.class ), nullable( VariableSpace.class ) ); + when( jobMeta.exportResources( any( Bowl.class ), any( JobMeta.class ), nullable( Map.class ), + nullable( ResourceNamingInterface.class ), nullable( Repository.class ), nullable( IMetaStore.class ) ) ) + .thenReturn( testName ); - jobExecutorMeta.exportResources( null, null, null, null, null ); + jobExecutorMeta.exportResources( DefaultBowl.getInstance(), null, null, null, null, null ); verify( jobMeta ).setFilename( "${" + Const.INTERNAL_VARIABLE_ENTRY_CURRENT_DIRECTORY + "}/" + testName ); verify( jobExecutorMeta ).setSpecificationMethod( ObjectLocationSpecificationMethod.FILENAME ); @@ -161,13 +164,13 @@ public void testLoadJobMeta() throws KettleException { JobMeta jobMeta; jobExecutorMeta.getParameters().setInheritingAllVariables( false ); - jobMeta = JobExecutorMeta.loadJobMeta( jobExecutorMeta, repository, parentSpace ); + jobMeta = JobExecutorMeta.loadJobMeta( DefaultBowl.getInstance(), jobExecutorMeta, repository, parentSpace ); assertNull( jobMeta.getVariable( param1 ) ); Assert.assertEquals( parentValue2, jobMeta.getVariable( param2 ) ); Assert.assertEquals( childValue3, jobMeta.getVariable( param3 ) ); jobExecutorMeta.getParameters().setInheritingAllVariables( true ); - jobMeta = JobExecutorMeta.loadJobMeta( jobExecutorMeta, repository, parentSpace ); + jobMeta = JobExecutorMeta.loadJobMeta( DefaultBowl.getInstance(), jobExecutorMeta, repository, parentSpace ); Assert.assertEquals( parentValue1, jobMeta.getVariable( param1 ) ); Assert.assertEquals( parentValue2, jobMeta.getVariable( param2 ) ); Assert.assertEquals( childValue3, jobMeta.getVariable( param3 ) ); diff --git a/engine/src/test/java/org/pentaho/di/trans/steps/loadfileinput/LoadFileInputTest.java b/engine/src/test/java/org/pentaho/di/trans/steps/loadfileinput/LoadFileInputTest.java index f5e56e0f92c4..1c041b0c6712 100644 --- a/engine/src/test/java/org/pentaho/di/trans/steps/loadfileinput/LoadFileInputTest.java +++ b/engine/src/test/java/org/pentaho/di/trans/steps/loadfileinput/LoadFileInputTest.java @@ -33,6 +33,7 @@ import org.junit.ClassRule; import org.junit.Test; import org.mockito.Mockito; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.Const; import org.pentaho.di.core.KettleClientEnvironment; import org.pentaho.di.core.exception.KettleException; @@ -123,7 +124,8 @@ public void setup() throws FileSystemException { stepMetaInterface = spy( new LoadFileInputMeta() ); stepInputFiles = new FileInputList(); - Mockito.doReturn( stepInputFiles ).when( stepMetaInterface ).getFiles( any( VariableSpace.class ) ); + Mockito.doReturn( stepInputFiles ).when( stepMetaInterface ) + .getFiles( any( Bowl.class), any( VariableSpace.class ) ); String stepId = PluginRegistry.getInstance().getPluginId( StepPluginType.class, stepMetaInterface ); StepMeta stepMeta = new StepMeta( stepId, "Load File Input", stepMetaInterface ); transMeta.addStep( stepMeta ); diff --git a/engine/src/test/java/org/pentaho/di/trans/steps/loadfileinput/PDI_6976_Test.java b/engine/src/test/java/org/pentaho/di/trans/steps/loadfileinput/PDI_6976_Test.java index f5f80884e7ba..bf2b5fd15481 100644 --- a/engine/src/test/java/org/pentaho/di/trans/steps/loadfileinput/PDI_6976_Test.java +++ b/engine/src/test/java/org/pentaho/di/trans/steps/loadfileinput/PDI_6976_Test.java @@ -25,6 +25,8 @@ import junit.framework.TestCase; import org.junit.Test; import org.mockito.stubbing.Answer; +import org.pentaho.di.core.bowl.Bowl; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.fileinput.FileInputList; import org.pentaho.di.core.row.RowMetaInterface; @@ -58,7 +60,7 @@ public void testVerifyNoPreviousStep() { FileInputList fileInputList = mock( FileInputList.class ); List files = when( mock( List.class ).size() ).thenReturn( 1 ).getMock(); doReturn( files ).when( fileInputList ).getFiles(); - doReturn( fileInputList ).when( spy ).getFiles( any( VariableSpace.class ) ); + doReturn( fileInputList ).when( spy ).getFiles( any( Bowl.class), any( VariableSpace.class ) ); @SuppressWarnings( "unchecked" ) List validationResults = mock( List.class ); @@ -73,7 +75,9 @@ public void testVerifyNoPreviousStep() { return null; } ).when( validationResults ).add( any( CheckResultInterface.class ) ); - spy.check( validationResults, mock( TransMeta.class ), mock( StepMeta.class ), mock( RowMetaInterface.class ), + TransMeta mockTransMeta = mock( TransMeta.class ); + when( mockTransMeta.getBowl() ).thenReturn( DefaultBowl.getInstance() ); + spy.check( validationResults, mockTransMeta, mock( StepMeta.class ), mock( RowMetaInterface.class ), new String[] {}, new String[] { "File content", "File size" }, mock( RowMetaInterface.class ), mock( VariableSpace.class ), mock( Repository.class ), mock( IMetaStore.class ) ); } diff --git a/engine/src/test/java/org/pentaho/di/trans/steps/mapping/MappingOutputMetaTest.java b/engine/src/test/java/org/pentaho/di/trans/steps/mapping/MappingOutputMetaTest.java index 93706d487886..bd5c35e1a269 100644 --- a/engine/src/test/java/org/pentaho/di/trans/steps/mapping/MappingOutputMetaTest.java +++ b/engine/src/test/java/org/pentaho/di/trans/steps/mapping/MappingOutputMetaTest.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2018 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2018-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -22,6 +22,7 @@ package org.pentaho.di.trans.steps.mapping; import org.junit.Test; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.exception.KettleStepException; import org.pentaho.di.core.row.RowMeta; import org.pentaho.di.core.row.RowMetaInterface; @@ -62,7 +63,7 @@ public void testGetFields_OutputValueRenames_WillRenameOutputIfValueMetaExist() outputValueRenames.add( new MappingValueRename( "valueMeta2", "valueMeta1" ) ); MappingOutputMeta meta = new MappingOutputMeta(); meta.setOutputValueRenames( outputValueRenames ); - meta.getFields( rowMeta, null, info, nextStep, space, repository, metaStore ); + meta.getFields( DefaultBowl.getInstance(), rowMeta, null, info, nextStep, space, repository, metaStore ); assertNotNull( rowMeta.getValueMetaList() ); diff --git a/engine/src/test/java/org/pentaho/di/trans/steps/mappinginput/MappingInputMeta_GetFields_Test.java b/engine/src/test/java/org/pentaho/di/trans/steps/mappinginput/MappingInputMeta_GetFields_Test.java index 32f71db8a744..c516db4df119 100644 --- a/engine/src/test/java/org/pentaho/di/trans/steps/mappinginput/MappingInputMeta_GetFields_Test.java +++ b/engine/src/test/java/org/pentaho/di/trans/steps/mappinginput/MappingInputMeta_GetFields_Test.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -26,6 +26,7 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.exception.KettlePluginException; import org.pentaho.di.core.row.RowMeta; import org.pentaho.di.core.row.RowMetaInterface; @@ -149,7 +150,7 @@ public void getFields() throws Exception { meta.setSelectingAndSortingUnspecifiedFields( sortUnspecified ); RowMeta rowMeta = new RowMeta(); - meta.getFields( rowMeta, "origin", new RowMetaInterface[ 0 ], null, null, null, null ); + meta.getFields( DefaultBowl.getInstance(), rowMeta, "origin", new RowMetaInterface[ 0 ], null, null, null, null ); assertEquals( Arrays.toString( expectedOutputFields ), expectedOutputFields.length, rowMeta.size() ); for ( int i = 0; i < rowMeta.size(); i++ ) { diff --git a/engine/src/test/java/org/pentaho/di/trans/steps/memgroupby/MemoryGroupByMetaGetFieldsTest.java b/engine/src/test/java/org/pentaho/di/trans/steps/memgroupby/MemoryGroupByMetaGetFieldsTest.java index 40613ea0506b..a88ac1ee0af6 100644 --- a/engine/src/test/java/org/pentaho/di/trans/steps/memgroupby/MemoryGroupByMetaGetFieldsTest.java +++ b/engine/src/test/java/org/pentaho/di/trans/steps/memgroupby/MemoryGroupByMetaGetFieldsTest.java @@ -26,6 +26,7 @@ import org.junit.Before; import org.junit.Test; import org.mockito.MockedStatic; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.exception.KettlePluginException; import org.pentaho.di.core.row.RowMeta; import org.pentaho.di.core.row.RowMetaInterface; @@ -101,8 +102,8 @@ public void getFieldsWithSubject_WithFormat() { memoryGroupByMeta.setAggregateField( new String[] { "maxDate" } ); memoryGroupByMeta.setAggregateType( new int[] { TYPE_GROUP_MAX } ); - memoryGroupByMeta.getFields( rowMeta, "Memory Group by", mockInfo, mockNextStep, mockSpace, null, - mockIMetaStore ); + memoryGroupByMeta.getFields( DefaultBowl.getInstance(), rowMeta, "Memory Group by", mockInfo, mockNextStep, + mockSpace, null, mockIMetaStore ); verify( rowMeta, times( 1 ) ).clear(); verify( rowMeta, times( 1 ) ).addRowMeta( any() ); @@ -137,7 +138,8 @@ public void getFieldsWithSubject_NoFormat() { memoryGroupByMeta.setAggregateField( new String[] { "minDate" } ); memoryGroupByMeta.setAggregateType( new int[] { TYPE_GROUP_MIN } ); - memoryGroupByMeta.getFields( rowMeta, "Group by", mockInfo, mockNextStep, mockSpace, null, mockIMetaStore ); + memoryGroupByMeta.getFields( DefaultBowl.getInstance(), rowMeta, "Group by", mockInfo, mockNextStep, mockSpace, + null, mockIMetaStore ); verify( rowMeta, times( 1 ) ).clear(); verify( rowMeta, times( 1 ) ).addRowMeta( any() ); @@ -172,7 +174,8 @@ public void getFieldsWithoutSubject() { memoryGroupByMeta.setAggregateField( new String[] { "countDate" } ); memoryGroupByMeta.setAggregateType( new int[] { TYPE_GROUP_COUNT_ANY } ); - memoryGroupByMeta.getFields( rowMeta, "Group by", mockInfo, mockNextStep, mockSpace, null, mockIMetaStore ); + memoryGroupByMeta.getFields( DefaultBowl.getInstance(), rowMeta, "Group by", mockInfo, mockNextStep, mockSpace, + null, mockIMetaStore ); verify( rowMeta, times( 1 ) ).clear(); verify( rowMeta, times( 1 ) ).addRowMeta( any() ); diff --git a/engine/src/test/java/org/pentaho/di/trans/steps/memgroupby/MemoryGroupByMetaTest.java b/engine/src/test/java/org/pentaho/di/trans/steps/memgroupby/MemoryGroupByMetaTest.java index c75437decccf..1cfcc9a706a5 100644 --- a/engine/src/test/java/org/pentaho/di/trans/steps/memgroupby/MemoryGroupByMetaTest.java +++ b/engine/src/test/java/org/pentaho/di/trans/steps/memgroupby/MemoryGroupByMetaTest.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -35,6 +35,7 @@ import org.junit.ClassRule; import org.junit.Test; import org.junit.Assert; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.Const; import org.pentaho.di.core.KettleEnvironment; import org.pentaho.di.core.exception.KettleException; @@ -263,7 +264,7 @@ public void testGetFields() { meta.setValueField( valueFields ); Variables vars = new Variables(); - meta.getFields( rm, stepName, null, null, vars, null, null ); + meta.getFields( DefaultBowl.getInstance(), rm, stepName, null, null, vars, null, null ); assertNotNull( rm ); assertEquals( 26, rm.size() ); assertTrue( rm.indexOfValue( "myGroupField1" ) >= 0 ); @@ -323,7 +324,7 @@ public void testGetFields() { // Test Compatibility rm = getInputRowMeta(); vars.setVariable( Const.KETTLE_COMPATIBILITY_MEMORY_GROUP_BY_SUM_AVERAGE_RETURN_NUMBER_TYPE, "Y" ); - meta.getFields( rm, stepName, null, null, vars, null, null ); + meta.getFields( DefaultBowl.getInstance(), rm, stepName, null, null, vars, null, null ); assertNotNull( rm ); assertEquals( 26, rm.size() ); assertTrue( rm.indexOfValue( "Average(Integer)" ) >= 0 ); diff --git a/engine/src/test/java/org/pentaho/di/trans/steps/mergejoin/MergeJoinMetaTest.java b/engine/src/test/java/org/pentaho/di/trans/steps/mergejoin/MergeJoinMetaTest.java index 0ed0f67f0931..83ae216e55b9 100644 --- a/engine/src/test/java/org/pentaho/di/trans/steps/mergejoin/MergeJoinMetaTest.java +++ b/engine/src/test/java/org/pentaho/di/trans/steps/mergejoin/MergeJoinMetaTest.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2016 - 2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2016 - 2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -24,6 +24,7 @@ import org.junit.ClassRule; import org.junit.Test; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.core.row.RowMeta; import org.pentaho.di.core.row.RowMetaInterface; @@ -131,7 +132,7 @@ public void testGetFieldsEmptyInput() throws Exception { StepMeta stepMeta = new StepMeta( "Merge", meta ); - meta.getFields( outputRowMeta, "Merge Join", + meta.getFields( DefaultBowl.getInstance(), outputRowMeta, "Merge Join", new RowMetaInterface[]{ inputRow1, inputRow2 }, stepMeta, new Variables(), null, null ); assertNotNull( outputRowMeta ); diff --git a/engine/src/test/java/org/pentaho/di/trans/steps/mock/StepMockHelper.java b/engine/src/test/java/org/pentaho/di/trans/steps/mock/StepMockHelper.java index 3dfa126efa76..bb65648e2173 100644 --- a/engine/src/test/java/org/pentaho/di/trans/steps/mock/StepMockHelper.java +++ b/engine/src/test/java/org/pentaho/di/trans/steps/mock/StepMockHelper.java @@ -25,6 +25,8 @@ import org.mockito.Mockito; import org.mockito.invocation.InvocationOnMock; import org.mockito.stubbing.Answer; +import org.pentaho.di.core.bowl.Bowl; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.RowSet; import org.pentaho.di.core.logging.KettleLogStore; import org.pentaho.di.core.logging.LogChannel; @@ -59,6 +61,7 @@ public class StepMockHelper stepMetaClass, Class s stepDataInterface = mock( stepDataClass ); transMeta = mock( TransMeta.class ); when( transMeta.findStep( stepName ) ).thenReturn( stepMeta ); + bowl = DefaultBowl.getInstance(); + Mockito.lenient().when( transMeta.getBowl() ).thenReturn( bowl ); trans = mock( Trans.class ); initStepMetaInterface = mock( stepMetaClass ); initStepDataInterface = mock( stepDataClass ); diff --git a/engine/src/test/java/org/pentaho/di/trans/steps/nullif/NullIfTest.java b/engine/src/test/java/org/pentaho/di/trans/steps/nullif/NullIfTest.java index cb130b6e64ff..9ac0b06d0caa 100644 --- a/engine/src/test/java/org/pentaho/di/trans/steps/nullif/NullIfTest.java +++ b/engine/src/test/java/org/pentaho/di/trans/steps/nullif/NullIfTest.java @@ -39,6 +39,7 @@ import org.junit.Before; import org.junit.ClassRule; import org.junit.Test; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.KettleEnvironment; import org.pentaho.di.core.QueueRowSet; import org.pentaho.di.core.RowSet; @@ -88,7 +89,7 @@ private NullIfMeta mockProcessRowMeta() throws KettleStepException { NullIfMeta processRowMeta = smh.processRowsStepMetaInterface; Field[] fields = createArrayWithOneField( "nullable-field", "nullable-value" ); doReturn( fields ).when( processRowMeta ).getFields(); - doCallRealMethod().when( processRowMeta ).getFields( any( RowMetaInterface.class ), anyString(), + doCallRealMethod().when( processRowMeta ).getFields( any( Bowl.class ), any( RowMetaInterface.class ), anyString(), any( RowMetaInterface[].class ), any( StepMeta.class ), any( VariableSpace.class ), any( Repository.class ), any( IMetaStore.class ) ); @@ -163,7 +164,7 @@ private NullIfMeta mockProcessRowMeta2() throws KettleStepException { fields[2] = createArrayWithOneField( "value3", "20150606" )[0]; fields[3] = createArrayWithOneField( "value4", "2015/06/06 00:00:00.000" )[0]; doReturn( fields ).when( processRowMeta ).getFields(); - doCallRealMethod().when( processRowMeta ).getFields( any( RowMetaInterface.class ), anyString(), + doCallRealMethod().when( processRowMeta ).getFields( any( Bowl.class ), any( RowMetaInterface.class ), anyString(), any( RowMetaInterface[].class ), any( StepMeta.class ), any( VariableSpace.class ), any( Repository.class ), any( IMetaStore.class ) ); diff --git a/engine/src/test/java/org/pentaho/di/trans/steps/propertyinput/BasePropertyParsingTest.java b/engine/src/test/java/org/pentaho/di/trans/steps/propertyinput/BasePropertyParsingTest.java index d37ea231d883..510436f5313c 100644 --- a/engine/src/test/java/org/pentaho/di/trans/steps/propertyinput/BasePropertyParsingTest.java +++ b/engine/src/test/java/org/pentaho/di/trans/steps/propertyinput/BasePropertyParsingTest.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -24,6 +24,7 @@ import org.junit.Before; import org.junit.Ignore; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.row.RowMeta; import org.pentaho.di.core.row.ValueMetaInterface; import org.pentaho.di.core.variables.Variables; @@ -65,7 +66,8 @@ protected void init( String file ) throws Exception { */ protected void setFields( PropertyInputField... fields ) throws Exception { meta.setInputFields( fields ); - meta.getFields( data.outputRowMeta, meta.getName(), null, null, new Variables(), null, null ); + meta.getFields( DefaultBowl.getInstance(), data.outputRowMeta, meta.getName(), null, null, new Variables(), null, + null ); data.convertRowMeta = data.outputRowMeta.cloneToType( ValueMetaInterface.TYPE_STRING ); } diff --git a/engine/src/test/java/org/pentaho/di/trans/steps/regexeval/RegexEvalMetaTest.java b/engine/src/test/java/org/pentaho/di/trans/steps/regexeval/RegexEvalMetaTest.java index 9e283f6fa3b7..d14f0c4c98db 100644 --- a/engine/src/test/java/org/pentaho/di/trans/steps/regexeval/RegexEvalMetaTest.java +++ b/engine/src/test/java/org/pentaho/di/trans/steps/regexeval/RegexEvalMetaTest.java @@ -39,6 +39,7 @@ import org.junit.ClassRule; import org.junit.Test; import org.mockito.ArgumentCaptor; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.KettleEnvironment; import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.core.exception.KettleStepException; @@ -88,7 +89,8 @@ public void testGetFieldsReplacesResultFieldIfItExists() throws KettleStepExcept when( mockValueMeta.getName() ).thenReturn( mockName ); when( mockInputRowMeta.getValueMeta( 0 ) ).thenReturn( mockValueMeta ); regexEvalMeta.setReplacefields( true ); - regexEvalMeta.getFields( mockInputRowMeta, name, null, null, mockVariableSpace, null, null ); + regexEvalMeta.getFields( DefaultBowl.getInstance(), mockInputRowMeta, name, null, null, mockVariableSpace, null, + null ); ArgumentCaptor captor = ArgumentCaptor.forClass( ValueMetaInterface.class ); verify( mockInputRowMeta ).setValueMeta( eq( 0 ), captor.capture() ); assertEquals( mockName, captor.getValue().getName() ); @@ -106,7 +108,8 @@ public void testGetFieldsAddsResultFieldIfDoesntExist() throws KettleStepExcepti when( mockVariableSpace.environmentSubstitute( resultField ) ).thenReturn( mockName ); when( mockInputRowMeta.getValueMeta( 0 ) ).thenReturn( mockValueMeta ); regexEvalMeta.setReplacefields( true ); - regexEvalMeta.getFields( mockInputRowMeta, name, null, null, mockVariableSpace, null, null ); + regexEvalMeta.getFields( DefaultBowl.getInstance(), mockInputRowMeta, name, null, null, mockVariableSpace, null, + null ); ArgumentCaptor captor = ArgumentCaptor.forClass( ValueMetaInterface.class ); verify( mockInputRowMeta ).addValueMeta( captor.capture() ); assertEquals( mockName, captor.getValue().getName() ); @@ -127,7 +130,8 @@ public void testGetFieldsReplacesFieldIfItExists() throws KettleStepException { when( mockInputRowMeta.getValueMeta( 0 ) ).thenReturn( mockValueMeta ); regexEvalMeta.setReplacefields( true ); regexEvalMeta.setAllowCaptureGroupsFlag( true ); - regexEvalMeta.getFields( mockInputRowMeta, name, null, null, mockVariableSpace, null, null ); + regexEvalMeta.getFields( DefaultBowl.getInstance(), mockInputRowMeta, name, null, null, mockVariableSpace, null, + null ); ArgumentCaptor captor = ArgumentCaptor.forClass( ValueMetaInterface.class ); verify( mockInputRowMeta ).setValueMeta( eq( 0 ), captor.capture() ); assertEquals( mockName, captor.getValue().getName() ); @@ -147,7 +151,8 @@ public void testGetFieldsAddsFieldIfDoesntExist() throws KettleStepException { when( mockInputRowMeta.getValueMeta( 0 ) ).thenReturn( mockValueMeta ); regexEvalMeta.setReplacefields( true ); regexEvalMeta.setAllowCaptureGroupsFlag( true ); - regexEvalMeta.getFields( mockInputRowMeta, name, null, null, mockVariableSpace, null, null ); + regexEvalMeta.getFields( DefaultBowl.getInstance(), mockInputRowMeta, name, null, null, mockVariableSpace, null, + null ); ArgumentCaptor captor = ArgumentCaptor.forClass( ValueMetaInterface.class ); verify( mockInputRowMeta ).addValueMeta( captor.capture() ); assertEquals( fieldName, captor.getValue().getName() ); diff --git a/engine/src/test/java/org/pentaho/di/trans/steps/replacestring/ReplaceStringMetaTest.java b/engine/src/test/java/org/pentaho/di/trans/steps/replacestring/ReplaceStringMetaTest.java index 0b47a0ce3a38..edb1be21aebb 100644 --- a/engine/src/test/java/org/pentaho/di/trans/steps/replacestring/ReplaceStringMetaTest.java +++ b/engine/src/test/java/org/pentaho/di/trans/steps/replacestring/ReplaceStringMetaTest.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2019 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -38,6 +38,7 @@ import org.junit.ClassRule; import org.junit.Test; import org.mockito.ArgumentCaptor; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.core.exception.KettleStepException; import org.pentaho.di.core.row.RowMetaInterface; @@ -76,7 +77,7 @@ public void testGetFields() throws KettleStepException { VariableSpace space = mock( VariableSpace.class ); Repository repository = mock( Repository.class ); IMetaStore metaStore = mock( IMetaStore.class ); - meta.getFields( inputRowMeta, "test", null, nextStep, space, repository, metaStore ); + meta.getFields( DefaultBowl.getInstance(), inputRowMeta, "test", null, nextStep, space, repository, metaStore ); ArgumentCaptor argument = ArgumentCaptor.forClass( ValueMetaInterface.class ); verify( inputRowMeta ).addValueMeta( argument.capture() ); diff --git a/engine/src/test/java/org/pentaho/di/trans/steps/rowgenerator/RowGeneratorUnitTest.java b/engine/src/test/java/org/pentaho/di/trans/steps/rowgenerator/RowGeneratorUnitTest.java index c6f6c58df1fe..63113d30732e 100644 --- a/engine/src/test/java/org/pentaho/di/trans/steps/rowgenerator/RowGeneratorUnitTest.java +++ b/engine/src/test/java/org/pentaho/di/trans/steps/rowgenerator/RowGeneratorUnitTest.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2018 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -35,6 +35,7 @@ import org.junit.ClassRule; import org.junit.Test; import org.pentaho.di.core.KettleEnvironment; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.core.exception.KettleStepException; import org.pentaho.di.core.row.RowMetaInterface; @@ -94,7 +95,8 @@ public void testReadRowLimitAsTransformationVar() throws KettleException { @Test public void doesNotWriteRowOnTimeWhenStopped() throws KettleException, InterruptedException { - TransMeta transMeta = new TransMeta( getClass().getResource( "safe-stop.ktr" ).getPath() ); + TransMeta transMeta = new TransMeta( DefaultBowl.getInstance(), + getClass().getResource( "safe-stop.ktr" ).getPath() ); Trans trans = new Trans( transMeta ); trans.prepareExecution( new String[] {} ); trans.getSteps().get( 1 ).step.addRowListener( new RowAdapter() { diff --git a/engine/src/test/java/org/pentaho/di/trans/steps/ssh/SSHDataTest.java b/engine/src/test/java/org/pentaho/di/trans/steps/ssh/SSHDataTest.java index fd63e07513de..ce93e56d6fb3 100644 --- a/engine/src/test/java/org/pentaho/di/trans/steps/ssh/SSHDataTest.java +++ b/engine/src/test/java/org/pentaho/di/trans/steps/ssh/SSHDataTest.java @@ -21,7 +21,6 @@ ******************************************************************************/ package org.pentaho.di.trans.steps.ssh; - import com.trilead.ssh2.Connection; import com.trilead.ssh2.HTTPProxyData; import com.trilead.ssh2.ServerHostKeyVerifier; @@ -32,8 +31,10 @@ import org.junit.Test; import org.mockito.Mock; import org.mockito.MockedStatic; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.core.variables.VariableSpace; +import org.pentaho.di.core.vfs.IKettleVFS; import org.pentaho.di.core.vfs.KettleVFS; import java.io.ByteArrayInputStream; @@ -84,9 +85,11 @@ public void setup() throws Exception { sshDataMockedStatic = mockStatic( SSHData.class ); kettleVFSMockedStatic = mockStatic( KettleVFS.class ); when( SSHData.createConnection( server, port ) ).thenReturn( connection ); - when( SSHData.OpenConnection( any(), anyInt(), any(), any(), anyBoolean(), + when( SSHData.OpenConnection( any(), any(), anyInt(), any(), any(), anyBoolean(), any(), any(), anyInt(), any(), any(), anyInt(), any(), any() ) ).thenCallRealMethod(); - when( KettleVFS.getFileObject( keyFilePath ) ).thenReturn( fileObject ); + IKettleVFS ikettleVFS = mock( IKettleVFS.class ); + when( ikettleVFS.getFileObject( keyFilePath ) ).thenReturn( fileObject ); + when( KettleVFS.getInstance( any() ) ).thenReturn( ikettleVFS ); } @After @@ -98,7 +101,7 @@ public void tearDown() { @Test public void testOpenConnection_1() throws Exception { when( connection.authenticateWithPassword( username, password ) ).thenReturn( true ); - assertNotNull( SSHData.OpenConnection( server, port, username, password, false, null, + assertNotNull( SSHData.OpenConnection( DefaultBowl.getInstance(), server, port, username, password, false, null, null, 0, null, null, 0, null, null ) ); verify( connection ).connect(); verify( connection ).authenticateWithPassword( username, password ); @@ -107,7 +110,7 @@ public void testOpenConnection_1() throws Exception { @Test( expected = KettleException.class ) public void testOpenConnection_2() throws Exception { when( connection.authenticateWithPassword( username, password ) ).thenReturn( false ); - SSHData.OpenConnection( server, port, username, password, false, null, + SSHData.OpenConnection( DefaultBowl.getInstance(), server, port, username, password, false, null, null, 0, null, null, 0, null, null ); verify( connection ).connect(); verify( connection ).authenticateWithPassword( username, password ); @@ -116,7 +119,7 @@ public void testOpenConnection_2() throws Exception { @Test( expected = KettleException.class ) public void testOpenConnectionUseKey_1() throws Exception { when( fileObject.exists() ).thenReturn( false ); - SSHData.OpenConnection( server, port, null, null, true, null, + SSHData.OpenConnection( DefaultBowl.getInstance(), server, port, null, null, true, null, null, 0, null, null, 0, null, null ); verify( fileObject ).exists(); } @@ -129,7 +132,7 @@ public void testOpenConnectionUseKey_2() throws Exception { when( fileContent.getInputStream() ).thenReturn( new ByteArrayInputStream( new byte[] { 1, 2, 3, 4, 5 } ) ); when( variableSpace.environmentSubstitute( passPhrase ) ).thenReturn( passPhrase ); when( connection.authenticateWithPublicKey( eq( username ), any( char[].class ), eq( passPhrase ) ) ).thenReturn( true ); - SSHData.OpenConnection( server, port, username, null, true, keyFilePath, + SSHData.OpenConnection( DefaultBowl.getInstance(), server, port, username, null, true, keyFilePath, passPhrase, 0, variableSpace, null, 0, null, null ); verify( connection ).connect(); verify( connection ).authenticateWithPublicKey( eq( username ), any( char[].class ), eq( passPhrase ) ); @@ -138,7 +141,7 @@ public void testOpenConnectionUseKey_2() throws Exception { @Test public void testOpenConnectionProxy() throws Exception { when( connection.authenticateWithPassword( username, password ) ).thenReturn( true ); - assertNotNull( SSHData.OpenConnection( server, port, username, password, false, null, + assertNotNull( SSHData.OpenConnection( DefaultBowl.getInstance(), server, port, username, password, false, null, null, 0, null, proxyHost, proxyPort, proxyUsername, proxyPassword ) ); verify( connection ).connect(); verify( connection ).authenticateWithPassword( username, password ); @@ -148,7 +151,7 @@ public void testOpenConnectionProxy() throws Exception { @Test public void testOpenConnectionTimeOut() throws Exception { when( connection.authenticateWithPassword( username, password ) ).thenReturn( true ); - assertNotNull( SSHData.OpenConnection( server, port, username, password, false, null, + assertNotNull( SSHData.OpenConnection( DefaultBowl.getInstance(), server, port, username, password, false, null, null, 100, null, null, proxyPort, proxyUsername, proxyPassword ) ); verify( connection ).connect( isNull(), eq( 0 ), eq( 100 * 1000 ) ); } diff --git a/engine/src/test/java/org/pentaho/di/trans/steps/streamlookup/StreamLookupTest.java b/engine/src/test/java/org/pentaho/di/trans/steps/streamlookup/StreamLookupTest.java index 26db5132d09e..089b5a94679b 100644 --- a/engine/src/test/java/org/pentaho/di/trans/steps/streamlookup/StreamLookupTest.java +++ b/engine/src/test/java/org/pentaho/di/trans/steps/streamlookup/StreamLookupTest.java @@ -30,11 +30,11 @@ import static org.mockito.Mockito.when; import org.junit.After; -import org.pentaho.di.core.row.ValueMetaInterface; import junit.framework.Assert; import org.junit.Before; import org.junit.Test; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.QueueRowSet; import org.pentaho.di.core.RowSet; import org.pentaho.di.core.exception.KettleException; @@ -42,6 +42,7 @@ import org.pentaho.di.core.logging.LoggingObjectInterface; import org.pentaho.di.core.row.RowMeta; import org.pentaho.di.core.row.RowMetaInterface; +import org.pentaho.di.core.row.ValueMetaInterface; import org.pentaho.di.core.row.value.ValueMetaString; import org.pentaho.di.core.variables.VariableSpace; import org.pentaho.di.repository.Repository; @@ -158,8 +159,9 @@ private StreamLookupMeta mockProcessRowMeta( boolean memoryPreservationActive ) doReturn( new String[] { "" } ).when( meta ).getValueDefault(); doReturn( new String[] { "Value" } ).when( meta ).getValueName(); doReturn( new String[] { "Value" } ).when( meta ).getValue(); - doCallRealMethod().when( meta ).getFields( any( RowMetaInterface.class ), anyString(), any( RowMetaInterface[].class ), any( StepMeta.class ), - any( VariableSpace.class ), any( Repository.class ), any( IMetaStore.class ) ); + doCallRealMethod().when( meta ).getFields( any( Bowl.class ), any( RowMetaInterface.class ), anyString(), + any( RowMetaInterface[].class ), any( StepMeta.class ), any( VariableSpace.class ), any( Repository.class ), + any( IMetaStore.class ) ); return meta; } diff --git a/engine/src/test/java/org/pentaho/di/trans/steps/stringoperations/StringOperationsMetaTest.java b/engine/src/test/java/org/pentaho/di/trans/steps/stringoperations/StringOperationsMetaTest.java index b8ec3313e6a9..43923eb2b9ee 100644 --- a/engine/src/test/java/org/pentaho/di/trans/steps/stringoperations/StringOperationsMetaTest.java +++ b/engine/src/test/java/org/pentaho/di/trans/steps/stringoperations/StringOperationsMetaTest.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2019 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -122,7 +122,7 @@ public void testGetFields() throws Exception { rowMetaInterface.addValueMeta( valueMeta ); VariableSpace space = mock( VariableSpace.class ); - meta.getFields( rowMetaInterface, "STRING_OPERATIONS", null, null, space, null, null ); + meta.getFields( null, rowMetaInterface, "STRING_OPERATIONS", null, null, space, null, null ); RowMetaInterface expectedRowMeta = new RowMeta(); expectedRowMeta.addValueMeta( new ValueMetaString( "field1" ) ); assertEquals( expectedRowMeta.toString(), rowMetaInterface.toString() ); diff --git a/engine/src/test/java/org/pentaho/di/trans/steps/tableinput/TableInputMetaTest.java b/engine/src/test/java/org/pentaho/di/trans/steps/tableinput/TableInputMetaTest.java index cdd5f55cffc8..91154227c993 100644 --- a/engine/src/test/java/org/pentaho/di/trans/steps/tableinput/TableInputMetaTest.java +++ b/engine/src/test/java/org/pentaho/di/trans/steps/tableinput/TableInputMetaTest.java @@ -38,6 +38,7 @@ import org.junit.Before; import org.junit.ClassRule; import org.junit.Test; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.KettleEnvironment; import org.pentaho.di.core.database.Database; import org.pentaho.di.core.database.DatabaseMeta; @@ -110,7 +111,7 @@ public void testGetFields() throws Exception { VariableSpace space = mock( VariableSpace.class ); RowMetaInterface rowMetaInterface = new RowMeta(); - meta.getFields( rowMetaInterface, "TABLE_INPUT_META", null, null, space, null, null ); + meta.getFields( DefaultBowl.getInstance(), rowMetaInterface, "TABLE_INPUT_META", null, null, space, null, null ); verify( mockDB).getQueryFields( any(), anyBoolean() ) ; } diff --git a/engine/src/test/java/org/pentaho/di/trans/steps/textfileinput/TextFileInputTest.java b/engine/src/test/java/org/pentaho/di/trans/steps/textfileinput/TextFileInputTest.java index d9bca75fc319..6787119b6a5c 100644 --- a/engine/src/test/java/org/pentaho/di/trans/steps/textfileinput/TextFileInputTest.java +++ b/engine/src/test/java/org/pentaho/di/trans/steps/textfileinput/TextFileInputTest.java @@ -37,6 +37,7 @@ import org.junit.ClassRule; import org.junit.Test; import org.mockito.Mockito; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.KettleEnvironment; import org.pentaho.di.core.exception.KettleFileException; import org.pentaho.di.core.exception.KettleValueException; @@ -142,7 +143,7 @@ public void readWrappedInputWithoutHeaders() throws Exception { TextFileInputData data = new TextFileInputData(); data.setFiles( new FileInputList() ); - data.getFiles().addFile( KettleVFS.getFileObject( virtualFile ) ); + data.getFiles().addFile( KettleVFS.getInstance( DefaultBowl.getInstance() ).getFileObject( virtualFile ) ); data.outputRowMeta = new RowMeta(); data.outputRowMeta.addValueMeta( new ValueMetaString( "col1" ) ); @@ -181,7 +182,7 @@ public void readInputWithMissedValues() throws Exception { TextFileInputData data = new TextFileInputData(); data.setFiles( new FileInputList() ); - data.getFiles().addFile( KettleVFS.getFileObject( virtualFile ) ); + data.getFiles().addFile( KettleVFS.getInstance( DefaultBowl.getInstance() ).getFileObject( virtualFile ) ); data.outputRowMeta = new RowMeta(); data.outputRowMeta.addValueMeta( new ValueMetaString( "col1" ) ); @@ -220,7 +221,7 @@ public void readInputWithDefaultValues() throws Exception { TextFileInputData data = new TextFileInputData(); data.setFiles( new FileInputList() ); - data.getFiles().addFile( KettleVFS.getFileObject( virtualFile ) ); + data.getFiles().addFile( KettleVFS.getInstance( DefaultBowl.getInstance() ).getFileObject( virtualFile ) ); data.outputRowMeta = new RowMeta(); data.outputRowMeta.addValueMeta( new ValueMetaString( "col1" ) ); @@ -251,7 +252,7 @@ private static String createVirtualFile( String filename, String... rows ) throw ByteArrayOutputStream bos = new ByteArrayOutputStream(); bos.write( content.toString().getBytes() ); - OutputStream os = KettleVFS.getFileObject( virtualFile ).getContent().getOutputStream(); + OutputStream os = KettleVFS.getInstance( DefaultBowl.getInstance() ).getFileObject( virtualFile ).getContent().getOutputStream(); try { IOUtils.copy( new ByteArrayInputStream( bos.toByteArray() ), os ); } finally { diff --git a/engine/src/test/java/org/pentaho/di/trans/steps/transexecutor/TransExecutorMetaTest.java b/engine/src/test/java/org/pentaho/di/trans/steps/transexecutor/TransExecutorMetaTest.java index 6592238c1ce6..e613091f4300 100644 --- a/engine/src/test/java/org/pentaho/di/trans/steps/transexecutor/TransExecutorMetaTest.java +++ b/engine/src/test/java/org/pentaho/di/trans/steps/transexecutor/TransExecutorMetaTest.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -272,28 +272,28 @@ public void testGetFields() throws Exception { StepMeta nextStep = mock( StepMeta.class ); // Test null - meta.getFields( null, null, null, nextStep, null, null, null ); + meta.getFields( null, null, null, null, nextStep, null, null, null ); verify( meta, never() ).addFieldToRow( any( RowMetaInterface.class ), anyString(), anyInt() ); RowMetaInterface rowMeta = mock( RowMetaInterface.class ); - meta.getFields( rowMeta, null, null, nextStep, null, null, null ); + meta.getFields( null, rowMeta, null, null, nextStep, null, null, null ); verify( rowMeta, never() ).clear(); StepMeta executionResultTargetStepMeta = mock( StepMeta.class ); meta.setExecutionResultTargetStepMeta( executionResultTargetStepMeta ); - meta.getFields( rowMeta, null, null, nextStep, null, null, null ); + meta.getFields( null, rowMeta, null, null, nextStep, null, null, null ); verify( rowMeta, atMost( 1 ) ).clear(); meta.setExecutionResultTargetStepMeta( null ); StepMeta resultFilesTargetStepMeta = mock( StepMeta.class ); meta.setResultFilesTargetStepMeta( resultFilesTargetStepMeta ); - meta.getFields( rowMeta, null, null, nextStep, null, null, null ); + meta.getFields( null, rowMeta, null, null, nextStep, null, null, null ); verify( rowMeta, atMost( 1 ) ).clear(); meta.setResultFilesTargetStepMeta( null ); StepMeta outputRowsSourceStepMeta = mock( StepMeta.class ); meta.setOutputRowsSourceStepMeta( outputRowsSourceStepMeta ); - meta.getFields( rowMeta, null, null, nextStep, null, null, null ); + meta.getFields( null, rowMeta, null, null, nextStep, null, null, null ); verify( rowMeta, atMost( 1 ) ).clear(); meta.setOutputRowsSourceStepMeta( null ); } diff --git a/engine/src/test/java/org/pentaho/di/trans/steps/transexecutor/TransExecutorMeta_GetFields_Test.java b/engine/src/test/java/org/pentaho/di/trans/steps/transexecutor/TransExecutorMeta_GetFields_Test.java index 36ce43d9c090..3b8409d9869b 100644 --- a/engine/src/test/java/org/pentaho/di/trans/steps/transexecutor/TransExecutorMeta_GetFields_Test.java +++ b/engine/src/test/java/org/pentaho/di/trans/steps/transexecutor/TransExecutorMeta_GetFields_Test.java @@ -26,6 +26,7 @@ import org.junit.BeforeClass; import org.junit.ClassRule; import org.junit.Test; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.plugins.PluginRegistry; import org.pentaho.di.core.row.RowMetaInterface; import org.pentaho.di.core.row.ValueMetaInterface; @@ -106,7 +107,7 @@ public void getFieldsForInternalTransformationOutputRows() throws Exception { private RowMetaInterface invokeGetFieldsWith( StepMeta stepMeta ) throws Exception { RowMetaInterface rowMeta = mock( RowMetaInterface.class ); - meta.getFields( rowMeta, "", null, stepMeta, null, null, null ); + meta.getFields( DefaultBowl.getInstance(), rowMeta, "", null, stepMeta, null, null, null ); return rowMeta; } } diff --git a/engine/src/test/java/org/pentaho/di/trans/steps/univariatestats/UnivariateStatsMetaTest.java b/engine/src/test/java/org/pentaho/di/trans/steps/univariatestats/UnivariateStatsMetaTest.java index 5d6b092e85ca..61078de59d58 100644 --- a/engine/src/test/java/org/pentaho/di/trans/steps/univariatestats/UnivariateStatsMetaTest.java +++ b/engine/src/test/java/org/pentaho/di/trans/steps/univariatestats/UnivariateStatsMetaTest.java @@ -26,6 +26,7 @@ import org.junit.ClassRule; import org.junit.Test; import org.mockito.stubbing.Answer; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.core.exception.KettleStepException; @@ -175,7 +176,7 @@ public void testGetFields() throws KettleStepException { valueMetaInterfaces.add( (ValueMetaInterface) invocation.getArguments()[0] ); return null; } ).when( mockRowMetaInterface ).addValueMeta( any( ValueMetaInterface.class ) ); - meta.getFields( mockRowMetaInterface, null, null, null, null, null, null ); + meta.getFields( DefaultBowl.getInstance(), mockRowMetaInterface, null, null, null, null, null, null ); Map valueMetas = new HashMap<>(); for ( ValueMetaInterface vmi : valueMetaInterfaces ) { valueMetas.put( vmi.getName(), vmi.getType() ); diff --git a/engine/src/test/java/org/pentaho/di/trans/steps/webservices/WebServiceMetaTest.java b/engine/src/test/java/org/pentaho/di/trans/steps/webservices/WebServiceMetaTest.java index d5bf523e2b8c..9afcfbbcb56c 100644 --- a/engine/src/test/java/org/pentaho/di/trans/steps/webservices/WebServiceMetaTest.java +++ b/engine/src/test/java/org/pentaho/di/trans/steps/webservices/WebServiceMetaTest.java @@ -29,6 +29,7 @@ import org.junit.ClassRule; import org.junit.Test; import org.mockito.Mockito; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.KettleClientEnvironment; import org.pentaho.di.core.database.DatabaseMeta; @@ -265,7 +266,8 @@ public void testGetFields() throws Exception { field3.setWsName( "field3WS" ); field3.setXsdType( "string" ); webServiceMeta.setFieldsOut( Arrays.asList( field1, field2, field3 ) ); - webServiceMeta.getFields( rmi, "idk", new RowMetaInterface[]{ rmi2 }, nextStep, new Variables(), rep, metastore ); + webServiceMeta.getFields( DefaultBowl.getInstance(), rmi, "idk", new RowMetaInterface[]{ rmi2 }, nextStep, + new Variables(), rep, metastore ); verify( rmi ).addValueMeta( argThat( matchValueMetaString( "field1" ) ) ); verify( rmi ).addValueMeta( argThat( matchValueMetaString( "field2" ) ) ); verify( rmi ).addValueMeta( argThat( matchValueMetaString( "field3" ) ) ); diff --git a/engine/src/test/java/org/pentaho/di/trans/streaming/common/BaseStreamStepMetaTest.java b/engine/src/test/java/org/pentaho/di/trans/streaming/common/BaseStreamStepMetaTest.java index 6b298cdcc3e4..dd8e0aa391e3 100644 --- a/engine/src/test/java/org/pentaho/di/trans/streaming/common/BaseStreamStepMetaTest.java +++ b/engine/src/test/java/org/pentaho/di/trans/streaming/common/BaseStreamStepMetaTest.java @@ -33,6 +33,7 @@ import org.pentaho.di.core.Const; import org.pentaho.di.core.ObjectLocationSpecificationMethod; import org.pentaho.di.core.annotations.Step; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.encryption.Encr; import org.pentaho.di.core.encryption.TwoWayPasswordEncoderPluginType; import org.pentaho.di.core.exception.KettleException; @@ -89,6 +90,7 @@ public class BaseStreamStepMetaTest { @Mock private LogChannelInterface logChannel; @Mock private RowMetaInterface rowMeta; @Mock private RowMetaInterface prevRowMeta; + @Mock private StepMeta stepMeta; @Mock private StepMeta subTransStepMeta; @Mock private StepMeta nextStepMeta; @Mock private StepMetaInterface stepMetaInterface; @@ -111,12 +113,15 @@ public static void setUpBeforeClass() throws KettleException { public void setUp() throws Exception { meta = new StuffStreamMeta(); KettleLogStore.setLogChannelInterfaceFactory( logChannelFactory ); - when( mappingMetaRetriever.get( any(), any(), any(), any() ) ).thenReturn( subTransMeta ); + when( mappingMetaRetriever.get( any(), any(), any(), any(), any() ) ).thenReturn( subTransMeta ); when( subTransMeta.getPrevStepFields( anyString() ) ).thenReturn( prevRowMeta ); when( subTransMeta.getSteps() ).thenReturn( singletonList( subTransStepMeta ) ); when( subTransStepMeta.getStepMetaInterface() ).thenReturn( stepMetaInterface ); when( subTransStepMeta.getName() ).thenReturn( "SubStepName" ); + when( stepMeta.getParentTransMeta() ).thenReturn( transMeta ); + when( transMeta.getBowl() ).thenReturn( DefaultBowl.getInstance() ); + meta.mappingMetaRetriever = mappingMetaRetriever; } @@ -157,7 +162,7 @@ public void testCheckErrorsOnZeroSizeAndDuration() { meta.setBatchDuration( "0" ); meta.setBatchSize( "0" ); ArrayList remarks = new ArrayList<>(); - meta.check( remarks, null, null, null, null, null, null, new Variables(), null, null ); + meta.check( remarks, transMeta, null, null, null, null, null, new Variables(), null, null ); assertEquals( 1, remarks.size() ); assertEquals( "The \"Number of records\" and \"Duration\" fields can’t both be set to 0. Please set a value of 1 or higher " @@ -171,7 +176,7 @@ public void testCheckErrorsOnNaN() { meta.setBatchDuration( "blah" ); meta.setBatchSize( "blah" ); meta.setPrefetchCount( "blahblah" ); - meta.check( remarks, null, null, null, null, null, null, new Variables(), null, null ); + meta.check( remarks, transMeta, null, null, null, null, null, new Variables(), null, null ); assertEquals( 3, remarks.size() ); assertEquals( CheckResultInterface.TYPE_RESULT_ERROR, remarks.get( 0 ).getType() ); assertEquals( "The \"Duration\" field is using a non-numeric value. Please set a numeric value.", @@ -189,7 +194,7 @@ public void testCheckLessThanBatch() { List remarks = new ArrayList<>(); meta.setBatchSize( "2" ); meta.setPrefetchCount( "1" ); - meta.check( remarks, null, null, null, null, null, null, new Variables(), null, null ); + meta.check( remarks, transMeta, null, null, null, null, null, new Variables(), null, null ); assertEquals( 1, remarks.size() ); assertEquals( CheckResultInterface.TYPE_RESULT_ERROR, remarks.get( 0 ).getType() ); assertEquals( "The \"Message prefetch limit\" must be equal to or greater than the \"Number of records\". 1 is not equal to or greater than 2", @@ -201,7 +206,7 @@ public void testCheckEqualToBatch() { List remarks = new ArrayList<>(); meta.setBatchSize( "1" ); meta.setPrefetchCount( "1" ); - meta.check( remarks, null, null, null, null, null, null, new Variables(), null, null ); + meta.check( remarks, transMeta, null, null, null, null, null, new Variables(), null, null ); assertEquals( 0, remarks.size() ); } @@ -209,7 +214,7 @@ public void testCheckEqualToBatch() { public void testCheckPrefetchZero() { List remarks = new ArrayList<>(); meta.setPrefetchCount( "0" ); - meta.check( remarks, null, null, null, null, null, null, new Variables(), null, null ); + meta.check( remarks, transMeta, null, null, null, null, null, new Variables(), null, null ); assertEquals( 2, remarks.size() ); assertEquals( CheckResultInterface.TYPE_RESULT_ERROR, remarks.get( 0 ).getType() ); assertEquals( "The \"Message prefetch limit\" must be greater than 0. 0 is not greater than 0", @@ -224,7 +229,7 @@ public void testCheckPrefetchZero() { public void testCheckPrefetchNull() { List remarks = new ArrayList<>(); meta.setPrefetchCount( null ); - meta.check( remarks, null, null, null, null, null, null, new Variables(), null, null ); + meta.check( remarks, transMeta, null, null, null, null, null, new Variables(), null, null ); assertEquals( 1, remarks.size() ); assertEquals( CheckResultInterface.TYPE_RESULT_ERROR, remarks.get( 0 ).getType() ); assertEquals( "The \"Message prefetch limit\" field is using a non-numeric value. Please set a numeric value.", @@ -238,7 +243,7 @@ public void testCheckErrorsOnVariables() { space.setVariable( "something", "1000" ); meta.setBatchSize( "${something}" ); meta.setBatchDuration( "0" ); - meta.check( remarks, null, null, null, null, null, null, space, null, null ); + meta.check( remarks, transMeta, null, null, null, null, null, space, null, null ); assertEquals( 0, remarks.size() ); } @@ -250,7 +255,7 @@ public void testCheckErrorsOnSubStepName() { meta.setBatchSize( "10" ); meta.setBatchDuration( "10" ); meta.setSubStep( "MissingStep" ); - meta.check( remarks, null, null, null, null, null, null, space, null, null ); + meta.check( remarks, transMeta, null, null, null, null, null, space, null, null ); assertEquals( 1, remarks.size() ); assertEquals( "Unable to complete \"null\". Cannot return fields from \"MissingStep\" because it does not exist in the sub-transformation.", remarks.get( 0 ).getText() ); } @@ -262,7 +267,7 @@ public void testCheckErrorsOnVariablesSubstituteError() { space.setVariable( "something", "0" ); meta.setBatchSize( "${something}" ); meta.setBatchDuration( "${something}" ); - meta.check( remarks, null, null, null, null, null, null, space, null, null ); + meta.check( remarks, transMeta, null, null, null, null, null, space, null, null ); assertEquals( 1, remarks.size() ); assertEquals( "The \"Number of records\" and \"Duration\" fields can’t both be set to 0. Please set a value of 1 " + "or higher for one of the fields.", remarks.get( 0 ).getText() ); @@ -339,10 +344,12 @@ public void testIsReferencedObjectEnabled() { @Test public void testLoadReferencedObject() { BaseStreamStepMeta meta = new StuffStreamMeta(); + meta.setParentStepMeta( stepMeta ); meta.setFileName( getClass().getResource( "/org/pentaho/di/trans/subtrans-executor-sub.ktr" ).getPath() ); meta.setSpecificationMethod( ObjectLocationSpecificationMethod.FILENAME ); try { - TransMeta subTrans = (TransMeta) meta.loadReferencedObject( 0, null, null, new Variables() ); + TransMeta subTrans = (TransMeta) meta.loadReferencedObject( DefaultBowl.getInstance(), 0, null, null, + new Variables() ); assertEquals( "subtrans-executor-sub", subTrans.getName() ); } catch ( KettleException e ) { fail(); @@ -359,12 +366,12 @@ public void testGetFieldsDoesEnvSubstitutionForSubStepName() throws KettleStepEx when( subTransStepMeta.getName() ).thenReturn( "realSubStepName" ); meta.mappingMetaRetriever = mappingMetaRetriever; - meta.getFields( rowMeta, "origin", null, nextStepMeta, space, repo, null ); + meta.getFields( DefaultBowl.getInstance(), rowMeta, "origin", null, nextStepMeta, space, repo, null ); verify( space ).environmentSubstitute( "${parameter}" ); verify( subTransMeta ).getPrevStepFields( "realSubStepName" ); verify( stepMetaInterface ) - .getFields( rowMeta, "origin", null, nextStepMeta, space, repo, null ); + .getFields( DefaultBowl.getInstance(), rowMeta, "origin", null, nextStepMeta, space, repo, null ); } @Test diff --git a/engine/src/test/java/org/pentaho/di/trans/streaming/common/BaseStreamStepTest.java b/engine/src/test/java/org/pentaho/di/trans/streaming/common/BaseStreamStepTest.java index ebe952f2bc5a..47f07841c175 100644 --- a/engine/src/test/java/org/pentaho/di/trans/streaming/common/BaseStreamStepTest.java +++ b/engine/src/test/java/org/pentaho/di/trans/streaming/common/BaseStreamStepTest.java @@ -90,6 +90,10 @@ public void setUp() throws KettleException { transMeta.addStep( stepMeta ); Trans trans = new Trans( transMeta ); + stepMeta.setParentTransMeta( transMeta ); + when( parentStepMeta.getParentTransMeta() ).thenReturn( transMeta ); + when( meta.getParentStepMeta() ).thenReturn( stepMeta ); + baseStreamStep = new BaseStreamStep( stepMeta, stepData, 1, transMeta, trans ); baseStreamStep.source = streamSource; baseStreamStep.window = streamWindow; diff --git a/engine/src/test/java/org/pentaho/di/utils/TestUtils.java b/engine/src/test/java/org/pentaho/di/utils/TestUtils.java index 96b4ddcbb789..f8fc29a6fe6f 100644 --- a/engine/src/test/java/org/pentaho/di/utils/TestUtils.java +++ b/engine/src/test/java/org/pentaho/di/utils/TestUtils.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -31,6 +31,7 @@ import org.apache.commons.io.FileUtils; import org.apache.commons.vfs2.FileObject; import org.apache.commons.vfs2.FileSystemException; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.exception.KettleFileException; import org.pentaho.di.core.variables.VariableSpace; import org.pentaho.di.core.variables.Variables; @@ -79,7 +80,7 @@ public static String createRamFile( String path, VariableSpace space ) { space.initializeVariablesFrom( null ); } try { - FileObject file = KettleVFS.getFileObject( "ram://" + path, space ); + FileObject file = KettleVFS.getInstance( DefaultBowl.getInstance() ).getFileObject( "ram://" + path, space ); file.createFile(); return file.getName().getURI(); } catch ( FileSystemException | KettleFileException e ) { @@ -97,7 +98,7 @@ public static FileObject getFileObject( String vfsPath, VariableSpace space ) { space.initializeVariablesFrom( null ); } try { - return KettleVFS.getFileObject( vfsPath, space ); + return KettleVFS.getInstance( DefaultBowl.getInstance() ).getFileObject( vfsPath, space ); } catch ( KettleFileException e ) { throw new RuntimeException( e ); } diff --git a/engine/src/test/java/org/pentaho/di/www/RegisterPackageServletTest.java b/engine/src/test/java/org/pentaho/di/www/RegisterPackageServletTest.java index 551b86faed9a..505bfcac3313 100644 --- a/engine/src/test/java/org/pentaho/di/www/RegisterPackageServletTest.java +++ b/engine/src/test/java/org/pentaho/di/www/RegisterPackageServletTest.java @@ -31,6 +31,8 @@ import org.mockito.MockedStatic; import org.mockito.Mockito; import org.mockito.exceptions.base.MockitoException; +import org.pentaho.di.core.bowl.Bowl; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.core.vfs.KettleVFS; import org.pentaho.di.core.xml.XMLHandler; @@ -152,7 +154,8 @@ public void testGetConfigNode() throws Exception { Node node = Mockito.mock( Node.class ); // SETUP - xmlHandlerMockedStatic.when( () -> XMLHandler.loadXMLFile( eq( configUrl ) ) ).thenReturn( configDoc ); + xmlHandlerMockedStatic.when( () -> XMLHandler.loadXMLFile( any( Bowl.class ), eq( configUrl ) ) ) + .thenReturn( configDoc ); xmlHandlerMockedStatic.when( () -> XMLHandler.getSubNode( eq( configDoc ), eq( xmlTag ) ) ).thenReturn( node ); assertEquals( node, servlet.getConfigNode( archiveUrl, fileName, xmlTag ) ); } @@ -216,7 +219,9 @@ public void testCopyRequestToDirectory_Exception2() throws Exception { InputStream inputStream = Mockito.mock( InputStream.class ); - kettleVFSMockedStatic.when( () -> KettleVFS.getFileObject( anyString() ) ).thenThrow( IOException.class ); + kettleVFSMockedStatic.when( () -> KettleVFS.getInstance( any( Bowl.class ) ) + .getFileObject( anyString() ) ) + .thenThrow( IOException.class ); servlet.copyRequestToDirectory( inputStream, "/tmp/path" ); } diff --git a/integration/src/it/java/org/pentaho/di/cluster/PartitioningIT.java b/integration/src/it/java/org/pentaho/di/cluster/PartitioningIT.java index e72aee02450e..aa15dcf39f3b 100644 --- a/integration/src/it/java/org/pentaho/di/cluster/PartitioningIT.java +++ b/integration/src/it/java/org/pentaho/di/cluster/PartitioningIT.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -66,7 +66,8 @@ public void testPartitioningSwimmingLanesOnCluster() throws Exception { // Remove the output file : we don't want to leave too much clutter around // - FileObject file = KettleVFS.getFileObject( transMeta.environmentSubstitute( filename ) ); + FileObject file = KettleVFS.getInstance( DefaultBowl.getInstance() ) + .getFileObject( transMeta.environmentSubstitute( filename ) ); file.delete(); } @@ -117,7 +118,8 @@ public void testPartitioningRepartitioningOnCluster() throws Exception { // Remove the output file : we don't want to leave too much clutter around // - FileObject file = KettleVFS.getFileObject( transMeta.environmentSubstitute( filename ) ); + FileObject file = KettleVFS.getInstance( DefaultBowl.getInstance() ) + .getFileObject( transMeta.environmentSubstitute( filename ) ); file.delete(); } diff --git a/integration/src/it/java/org/pentaho/di/core/vfs/VfsCoreTest.java b/integration/src/it/java/org/pentaho/di/core/vfs/VfsCoreTest.java index 520700c5a425..b4596f2845e6 100644 --- a/integration/src/it/java/org/pentaho/di/core/vfs/VfsCoreTest.java +++ b/integration/src/it/java/org/pentaho/di/core/vfs/VfsCoreTest.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -29,6 +29,7 @@ import junit.framework.TestCase; import org.apache.commons.vfs2.FileObject; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.Const; public class VfsCoreTest extends TestCase { @@ -40,7 +41,7 @@ public void testWriteReadFile() throws Exception { // Write a text // FileObject tempFile = KettleVFS.createTempFile( "prefix", "suffix", tmpDir ); - OutputStream outputStream = KettleVFS.getOutputStream( tempFile, false ); + OutputStream outputStream = KettleVFS.getInstance( DefaultBowl.getInstance() ).getOutputStream( tempFile, false ); OutputStreamWriter writer = new OutputStreamWriter( outputStream ); writer.write( content ); writer.close(); diff --git a/integration/src/it/java/org/pentaho/di/repository/KettleDatabaseRepositoryIT.java b/integration/src/it/java/org/pentaho/di/repository/KettleDatabaseRepositoryIT.java index 637a46f8425b..7ccc5bd22329 100644 --- a/integration/src/it/java/org/pentaho/di/repository/KettleDatabaseRepositoryIT.java +++ b/integration/src/it/java/org/pentaho/di/repository/KettleDatabaseRepositoryIT.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -182,7 +182,7 @@ public boolean accept( File dir, String name ) { } protected void verifyJobSamples( RepositoryDirectoryInterface samplesDirectory ) throws Exception { - FileObject jobSamplesFolder = KettleVFS.getFileObject( "samples/jobs/" ); + FileObject jobSamplesFolder = KettleVFS.getInstance( DefaultBowl.getInstance() ).getFileObject( "samples/jobs/" ); FileObject[] files = jobSamplesFolder.findFiles( new FileSelector() { @Override diff --git a/integration/src/it/java/org/pentaho/di/repository/KettleFileRepositoryIT.java b/integration/src/it/java/org/pentaho/di/repository/KettleFileRepositoryIT.java index 7258ea426c2b..5f62d11bf045 100644 --- a/integration/src/it/java/org/pentaho/di/repository/KettleFileRepositoryIT.java +++ b/integration/src/it/java/org/pentaho/di/repository/KettleFileRepositoryIT.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -184,7 +184,7 @@ public boolean accept( File dir, String name ) { } private void verifyJobSamples( RepositoryDirectoryInterface samplesDirectory ) throws Exception { - FileObject jobSamplesFolder = KettleVFS.getFileObject( "samples/jobs/" ); + FileObject jobSamplesFolder = KettleVFS.getInstance( DefaultBowl.getInstance() ).getFileObject( "samples/jobs/" ); FileObject[] files = jobSamplesFolder.findFiles( new FileSelector() { @Override diff --git a/integration/src/it/java/org/pentaho/di/resource/NameResourceIT.java b/integration/src/it/java/org/pentaho/di/resource/NameResourceIT.java index e1cbd8c291e7..76ec13a9c6d1 100644 --- a/integration/src/it/java/org/pentaho/di/resource/NameResourceIT.java +++ b/integration/src/it/java/org/pentaho/di/resource/NameResourceIT.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -145,7 +145,7 @@ private void testNamingResourceLegacyAndNew( String fileName, String extension, // Create a new transformation. TransMeta transMeta = new TransMeta(); - FileObject fileObject = KettleVFS.getFileObject( fileName, transMeta ); + FileObject fileObject = KettleVFS.getInstance( DefaultBowl.getInstance() ).getFileObject( fileName, transMeta ); // This code is modeled after the legacy code in legacy step meta classes // that have an exportResources method that deal with file masks diff --git a/integration/src/it/java/org/pentaho/di/resource/ResourceExportIT.java b/integration/src/it/java/org/pentaho/di/resource/ResourceExportIT.java index ffbc46a9c44b..266d16ff9778 100644 --- a/integration/src/it/java/org/pentaho/di/resource/ResourceExportIT.java +++ b/integration/src/it/java/org/pentaho/di/resource/ResourceExportIT.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -27,6 +27,7 @@ import junit.framework.TestCase; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.KettleEnvironment; import org.pentaho.di.job.JobMeta; @@ -52,7 +53,8 @@ public void testJobExport() throws Exception { // We get back the top-level filename: it's the starting point... // - String topLevelFilename = jobMeta.exportResources( jobMeta, definitions, resourceNaming, null, null ); + String topLevelFilename = jobMeta.exportResources( DefaultBowl.getInstance(), jobMeta, definitions, resourceNaming, + null, null ); System.out.println( "Top level filename = " + topLevelFilename ); diff --git a/integration/src/it/java/org/pentaho/di/trans/steps/textfileoutput/TextFileOutputSplittingIT.java b/integration/src/it/java/org/pentaho/di/trans/steps/textfileoutput/TextFileOutputSplittingIT.java index 701e5afd445c..8130d78b00e9 100644 --- a/integration/src/it/java/org/pentaho/di/trans/steps/textfileoutput/TextFileOutputSplittingIT.java +++ b/integration/src/it/java/org/pentaho/di/trans/steps/textfileoutput/TextFileOutputSplittingIT.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -155,7 +155,7 @@ private static void runTransformation( TransMeta transMeta ) throws Exception { } private static FileObject getFolder() throws FileSystemException, KettleFileException { - return KettleVFS.getFileObject( OUTPUT_DIR ); + return KettleVFS.getInstance( DefaultBowl.getInstance() ).getFileObject( OUTPUT_DIR ); } private static void assertSplitFileIsCorrect( FileObject file, String expectedName, String... expectedLines ) diff --git a/plugins/aggregate-rows/core/src/main/java/org/pentaho/di/trans/steps/aggregaterows/AggregateRows.java b/plugins/aggregate-rows/core/src/main/java/org/pentaho/di/trans/steps/aggregaterows/AggregateRows.java index 561cad94e8fd..3866a2e0ff1e 100644 --- a/plugins/aggregate-rows/core/src/main/java/org/pentaho/di/trans/steps/aggregaterows/AggregateRows.java +++ b/plugins/aggregate-rows/core/src/main/java/org/pentaho/di/trans/steps/aggregaterows/AggregateRows.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -168,7 +168,8 @@ public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws first = false; data.outputRowMeta = getInputRowMeta().clone(); - meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); + meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository, + metaStore ); for ( int i = 0; i < meta.getFieldName().length; i++ ) { data.fieldnrs[i] = getInputRowMeta().indexOfValue( meta.getFieldName()[i] ); diff --git a/plugins/aggregate-rows/core/src/main/java/org/pentaho/di/trans/steps/aggregaterows/AggregateRowsMeta.java b/plugins/aggregate-rows/core/src/main/java/org/pentaho/di/trans/steps/aggregaterows/AggregateRowsMeta.java index 7343af6a3f73..06287862977e 100644 --- a/plugins/aggregate-rows/core/src/main/java/org/pentaho/di/trans/steps/aggregaterows/AggregateRowsMeta.java +++ b/plugins/aggregate-rows/core/src/main/java/org/pentaho/di/trans/steps/aggregaterows/AggregateRowsMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -28,6 +28,7 @@ import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.Const; import org.pentaho.di.core.annotations.Step; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.database.DatabaseMeta; import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.core.exception.KettleStepException; @@ -222,7 +223,7 @@ public void setDefault() { } @Override - public void getFields( RowMetaInterface row, String name, RowMetaInterface[] info, StepMeta nextStep, + public void getFields( Bowl bowl, RowMetaInterface row, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { try { // Remember the types of the row. diff --git a/plugins/avro-format/core/src/main/java/org/pentaho/di/trans/steps/avro/input/AvroInput.java b/plugins/avro-format/core/src/main/java/org/pentaho/di/trans/steps/avro/input/AvroInput.java index 8710f026f9a4..33dc8e9e6b93 100644 --- a/plugins/avro-format/core/src/main/java/org/pentaho/di/trans/steps/avro/input/AvroInput.java +++ b/plugins/avro-format/core/src/main/java/org/pentaho/di/trans/steps/avro/input/AvroInput.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2022 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2022-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -22,6 +22,7 @@ package org.pentaho.di.trans.steps.avro.input; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.RowMetaAndData; import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.core.row.RowMeta; @@ -160,11 +161,13 @@ private void fileFinishedHousekeeping() { data.input = null; } - public static List getLeafFields(String schemaPath, String dataPath, VariableSpace variableSpace ) throws Exception { + public static List getLeafFields( Bowl bowl, String schemaPath, String dataPath, + VariableSpace variableSpace ) throws Exception { IPentahoAvroInputFormat in = new PentahoAvroInputFormat(); in.setVariableSpace( variableSpace ); in.setInputSchemaFile( schemaPath ); in.setInputFile( dataPath ); + in.setBowl( bowl ); return in.getLeafFields(); } @@ -193,9 +196,10 @@ private boolean initializeSource() throws Exception { } data.input = new PentahoAvroInputFormat(); - meta.getFields( outRowMeta, getStepname(), null, null, this, null, null ); + meta.getFields( getTransMeta().getBowl(), outRowMeta, getStepname(), null, null, this, null, null ); data.input.setIncomingRowMeta( getInputRowMeta() ); data.input.setOutputRowMeta( outRowMeta ); + data.input.setBowl( getTransMeta().getBowl() ); Boolean isDatum = false; Boolean useFieldAsSchema = false; String inputSchemaFileName = null; @@ -274,7 +278,7 @@ public void checkForLegacyFieldNames( String schemaFileName, String avroFileName try { if ( !data.input.isUseFieldAsInputStream() ) { List rawAvroFields = AvroInput - .getLeafFields( schemaFileName, avroFileName, this.getTransMeta() ); + .getLeafFields( getTransMeta().getBowl(), schemaFileName, avroFileName, this.getTransMeta() ); Map hackedFieldNames = new HashMap<>(); int pointer; String fieldName; diff --git a/plugins/avro-format/core/src/main/java/org/pentaho/di/trans/steps/avro/input/AvroInputDialog.java b/plugins/avro-format/core/src/main/java/org/pentaho/di/trans/steps/avro/input/AvroInputDialog.java index c715c1e51637..ad0e140715a9 100644 --- a/plugins/avro-format/core/src/main/java/org/pentaho/di/trans/steps/avro/input/AvroInputDialog.java +++ b/plugins/avro-format/core/src/main/java/org/pentaho/di/trans/steps/avro/input/AvroInputDialog.java @@ -134,7 +134,7 @@ protected void populateNestedFieldsTable() { List defaultFields; try { defaultFields = AvroInput - .getLeafFields( schemaFileName, avroFileName, transMeta ); + .getLeafFields( transMeta.getBowl(), schemaFileName, avroFileName, transMeta ); if ( defaultFields != null ) { wInputFields.clearAll(); for ( IAvroInputField field : defaultFields ) { diff --git a/plugins/avro-format/core/src/main/java/org/pentaho/di/trans/steps/avro/input/AvroInputMetaBase.java b/plugins/avro-format/core/src/main/java/org/pentaho/di/trans/steps/avro/input/AvroInputMetaBase.java index fb9eda9b85d2..3b615c9c328a 100644 --- a/plugins/avro-format/core/src/main/java/org/pentaho/di/trans/steps/avro/input/AvroInputMetaBase.java +++ b/plugins/avro-format/core/src/main/java/org/pentaho/di/trans/steps/avro/input/AvroInputMetaBase.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2022 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2022-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -22,10 +22,7 @@ package org.pentaho.di.trans.steps.avro.input; -import com.google.common.annotations.VisibleForTesting; -import org.pentaho.di.trans.steps.avro.AvroSpec; -import org.apache.commons.vfs2.FileObject; -import org.pentaho.di.trans.steps.avro.AvroTypeConverter; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.Const; import org.pentaho.di.core.database.DatabaseMeta; import org.pentaho.di.core.exception.KettleException; @@ -36,9 +33,9 @@ import org.pentaho.di.core.injection.Injection; import org.pentaho.di.core.injection.InjectionDeep; import org.pentaho.di.core.row.RowMetaInterface; -import org.pentaho.di.core.row.ValueMetaInterface; import org.pentaho.di.core.row.value.ValueMetaBase; import org.pentaho.di.core.row.value.ValueMetaFactory; +import org.pentaho.di.core.row.ValueMetaInterface; import org.pentaho.di.core.variables.VariableSpace; import org.pentaho.di.core.vfs.AliasedFileObject; import org.pentaho.di.core.vfs.KettleVFS; @@ -49,13 +46,19 @@ import org.pentaho.di.trans.step.StepMeta; import org.pentaho.di.trans.step.StepMetaInterface; import org.pentaho.di.trans.steps.avro.AvroSpec; +import org.pentaho.di.trans.steps.avro.AvroSpec; +import org.pentaho.di.trans.steps.avro.AvroTypeConverter; import org.pentaho.di.workarounds.ResolvableResource; import org.pentaho.metastore.api.IMetaStore; -import org.w3c.dom.Node; + +import com.google.common.annotations.VisibleForTesting; import java.util.ArrayList; import java.util.List; +import org.apache.commons.vfs2.FileObject; +import org.w3c.dom.Node; + public abstract class AvroInputMetaBase extends BaseStepMeta implements StepMetaInterface, ResolvableResource { public static final Class PKG = AvroInputMetaBase.class; @@ -407,7 +410,7 @@ public void saveRep( Repository rep, IMetaStore metaStore, ObjectId id_transform } @Override - public void getFields( RowMetaInterface rowMeta, String origin, RowMetaInterface[] info, StepMeta nextStep, + public void getFields( Bowl bowl, RowMetaInterface rowMeta, String origin, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { try { @@ -439,11 +442,12 @@ public void getFields( RowMetaInterface rowMeta, String origin, RowMetaInterface @Override - public void resolve() { + public void resolve( Bowl bowl ) { if ( dataLocation != null && !dataLocation.isEmpty() ) { try { String realFileName = getParentStepMeta().getParentTransMeta().environmentSubstitute( dataLocation ); - FileObject fileObject = KettleVFS.getFileObject( realFileName ); + FileObject fileObject = KettleVFS.getInstance( bowl ) + .getFileObject( realFileName ); if ( AliasedFileObject.isAliasedFile( fileObject ) ) { dataLocation = ( (AliasedFileObject) fileObject ).getAELSafeURIString(); } @@ -455,7 +459,8 @@ public void resolve() { if ( schemaLocation != null && !schemaLocation.isEmpty() ) { try { String realSchemaFilename = getParentStepMeta().getParentTransMeta().environmentSubstitute( schemaLocation ); - FileObject fileObject = KettleVFS.getFileObject( realSchemaFilename ); + FileObject fileObject = KettleVFS.getInstance( bowl ) + .getFileObject( realSchemaFilename ); if ( AliasedFileObject.isAliasedFile( fileObject ) ) { schemaLocation = ( (AliasedFileObject) fileObject ).getAELSafeURIString(); } diff --git a/plugins/avro-format/core/src/main/java/org/pentaho/di/trans/steps/avro/input/AvroNestedReader.java b/plugins/avro-format/core/src/main/java/org/pentaho/di/trans/steps/avro/input/AvroNestedReader.java index 0a5eb3cbe990..d3d036fa4bf6 100644 --- a/plugins/avro-format/core/src/main/java/org/pentaho/di/trans/steps/avro/input/AvroNestedReader.java +++ b/plugins/avro-format/core/src/main/java/org/pentaho/di/trans/steps/avro/input/AvroNestedReader.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2022 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2022-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -21,36 +21,24 @@ ******************************************************************************/ package org.pentaho.di.trans.steps.avro.input; -import org.pentaho.di.trans.steps.avro.AvroSpec; -import org.pentaho.di.trans.steps.avro.AvroToPdiConverter; -import org.apache.avro.Conversions; -import org.apache.avro.LogicalTypes; -import org.apache.avro.Schema; -import org.apache.avro.file.DataFileStream; -import org.apache.avro.generic.GenericContainer; -import org.apache.avro.generic.GenericData; -import org.apache.avro.generic.GenericDatumReader; -import org.apache.avro.io.Decoder; -import org.apache.avro.io.DecoderFactory; -import org.apache.avro.util.Utf8; -import org.apache.commons.vfs2.FileObject; -import org.apache.commons.vfs2.FileSystemException; -import org.codehaus.jackson.node.NullNode; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.Const; import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.core.logging.LogChannelInterface; import org.pentaho.di.core.row.RowDataUtil; import org.pentaho.di.core.row.RowMetaInterface; +import org.pentaho.di.core.row.value.ValueMetaBase; import org.pentaho.di.core.row.ValueMeta; import org.pentaho.di.core.row.ValueMetaInterface; -import org.pentaho.di.core.row.value.ValueMetaBase; import org.pentaho.di.core.variables.VariableSpace; import org.pentaho.di.core.vfs.KettleVFS; import org.pentaho.di.i18n.BaseMessages; +import org.pentaho.di.trans.steps.avro.AvroSpec; +import org.pentaho.di.trans.steps.avro.AvroToPdiConverter; import org.pentaho.di.trans.steps.avro.AvroToPdiConverter; -import java.io.IOException; import java.io.InputStream; +import java.io.IOException; import java.net.InetAddress; import java.net.UnknownHostException; import java.nio.ByteBuffer; @@ -58,7 +46,26 @@ import java.text.SimpleDateFormat; import java.time.LocalDate; import java.time.ZoneId; -import java.util.*; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.apache.avro.Conversions; +import org.apache.avro.file.DataFileStream; +import org.apache.avro.generic.GenericContainer; +import org.apache.avro.generic.GenericData; +import org.apache.avro.generic.GenericDatumReader; +import org.apache.avro.io.Decoder; +import org.apache.avro.io.DecoderFactory; +import org.apache.avro.LogicalTypes; +import org.apache.avro.Schema; +import org.apache.avro.util.Utf8; +import org.apache.commons.vfs2.FileObject; +import org.apache.commons.vfs2.FileSystemException; +import org.codehaus.jackson.node.NullNode; + /** @@ -115,6 +122,11 @@ public class AvroNestedReader { protected Decoder m_decoder; protected InputStream m_inStream; + /** + * For KettleVFS usage. + */ + protected Bowl m_bowl; + /** * The schema used to write the file - will be null if the file is not a container file */ @@ -1649,7 +1661,7 @@ protected void setSchemaToUse( String schemaKey, boolean useCache, VariableSpace BaseMessages.getString( PKG, "AvroInput.Message.LoadingSchema", schemaKey ) ); } try { - toUse = loadSchema( schemaKey ); + toUse = loadSchema( m_bowl, schemaKey ); } catch ( KettleException ex ) { // fall back to default (if possible) if ( m_defaultDatumReader != null ) { @@ -1720,12 +1732,12 @@ protected void setTopLevelStructure( Object topLevel ) { * @return the schema * @throws KettleException if a problem occurs */ - protected static Schema loadSchema( String schemaFile ) throws KettleException { + protected static Schema loadSchema( Bowl bowl, String schemaFile ) throws KettleException { Schema s = null; Schema.Parser p = new Schema.Parser(); - FileObject fileO = KettleVFS.getFileObject( schemaFile ); + FileObject fileO = KettleVFS.getInstance( bowl ).getFileObject( schemaFile ); try { InputStream in = KettleVFS.getInputStream( fileO ); s = p.parse( in ); @@ -1747,10 +1759,10 @@ protected static Schema loadSchema( String schemaFile ) throws KettleException { * @return the schema * @throws KettleException if a problem occurs */ - protected static Schema loadSchemaFromContainer( String containerFilename ) throws KettleException { + protected static Schema loadSchemaFromContainer( Bowl bowl, String containerFilename ) throws KettleException { Schema s = null; - FileObject fileO = KettleVFS.getFileObject( containerFilename ); + FileObject fileO = KettleVFS.getInstance( bowl ).getFileObject( containerFilename ); InputStream in = null; try { diff --git a/plugins/avro-format/core/src/main/java/org/pentaho/di/trans/steps/avro/input/AvroNestedRecordReader.java b/plugins/avro-format/core/src/main/java/org/pentaho/di/trans/steps/avro/input/AvroNestedRecordReader.java index 6c8c1f1a6446..250dbe1f08e2 100644 --- a/plugins/avro-format/core/src/main/java/org/pentaho/di/trans/steps/avro/input/AvroNestedRecordReader.java +++ b/plugins/avro-format/core/src/main/java/org/pentaho/di/trans/steps/avro/input/AvroNestedRecordReader.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2022 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2022-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -26,10 +26,12 @@ import org.apache.avro.generic.GenericDatumReader; import org.apache.avro.io.DecoderFactory; import org.apache.commons.vfs2.FileObject; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.RowMetaAndData; import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.core.row.RowMetaInterface; import org.pentaho.di.core.variables.VariableSpace; +import org.pentaho.di.core.vfs.IKettleVFS; import org.pentaho.di.core.vfs.KettleVFS; import java.io.IOException; @@ -52,7 +54,7 @@ public class AvroNestedRecordReader implements IPentahoInputFormat.IPentahoRecor private boolean isDatum; private int nextCallCounter = 0; - public AvroNestedRecordReader( DataFileStream nativeAvroRecordReader, + public AvroNestedRecordReader( Bowl bowl, DataFileStream nativeAvroRecordReader, Schema avroSchema, List fields, VariableSpace avroInputStep, RowMetaInterface incomingRowMeta, Object[] incomingFields, RowMetaInterface outputRowMeta, @@ -75,6 +77,7 @@ public AvroNestedRecordReader( DataFileStream nativeAvroRecordReader, avroNestedReader.m_jsonEncoded = !isDataBinaryEncoded; avroNestedReader.m_decodingFromField = fieldIndexForDataStream >= 0 ? true : false; avroNestedReader.m_fieldToDecodeIndex = fieldIndexForDataStream; + avroNestedReader.m_bowl = bowl; try { if ( nativeAvroRecordReader != null ) { // Is Avro File @@ -82,9 +85,10 @@ public AvroNestedRecordReader( DataFileStream nativeAvroRecordReader, } else { if ( avroSchema != null ) { + IKettleVFS vfs = KettleVFS.getInstance( bowl ); avroNestedReader.m_datumReader = new GenericDatumReader( avroSchema ); if ( fileName != null ) { - FileObject fileObject = KettleVFS.getFileObject( fileName ); + FileObject fileObject = vfs.getFileObject( fileName ); if ( avroNestedReader.m_jsonEncoded ) { avroNestedReader.m_decoder = DecoderFactory.get().jsonDecoder( avroSchema, KettleVFS.getInputStream( fileObject ) ); diff --git a/plugins/avro-format/core/src/main/java/org/pentaho/di/trans/steps/avro/input/IPentahoAvroInputFormat.java b/plugins/avro-format/core/src/main/java/org/pentaho/di/trans/steps/avro/input/IPentahoAvroInputFormat.java index 9459cb837d1f..ceb14b9ee184 100644 --- a/plugins/avro-format/core/src/main/java/org/pentaho/di/trans/steps/avro/input/IPentahoAvroInputFormat.java +++ b/plugins/avro-format/core/src/main/java/org/pentaho/di/trans/steps/avro/input/IPentahoAvroInputFormat.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2022 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2022-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -21,6 +21,7 @@ ******************************************************************************/ package org.pentaho.di.trans.steps.avro.input; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.row.RowMetaInterface; import org.pentaho.di.core.variables.VariableSpace; @@ -86,4 +87,6 @@ public interface IPentahoAvroInputFormat extends IPentahoInputFormat { void setSchemaFieldName( String schemaFieldName ); void setUseFieldAsInputStream( boolean useFieldAsInputStream ); + + void setBowl( Bowl bowl ); } diff --git a/plugins/avro-format/core/src/main/java/org/pentaho/di/trans/steps/avro/input/PentahoAvroInputFormat.java b/plugins/avro-format/core/src/main/java/org/pentaho/di/trans/steps/avro/input/PentahoAvroInputFormat.java index decef6ca73b6..f496a240c189 100644 --- a/plugins/avro-format/core/src/main/java/org/pentaho/di/trans/steps/avro/input/PentahoAvroInputFormat.java +++ b/plugins/avro-format/core/src/main/java/org/pentaho/di/trans/steps/avro/input/PentahoAvroInputFormat.java @@ -2,7 +2,7 @@ * * Pentaho Big Data * - * Copyright (C) 2022 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2022-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -31,6 +31,7 @@ import org.apache.avro.io.DatumReader; import org.apache.commons.vfs2.FileExtensionSelector; import org.apache.commons.vfs2.FileObject; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.row.RowMetaInterface; import org.pentaho.di.core.row.ValueMetaInterface; import org.pentaho.di.core.util.Utils; @@ -57,6 +58,7 @@ public class PentahoAvroInputFormat implements IPentahoAvroInputFormat { private Object[] incomingFields = null; private boolean isDatum; private String schemaFieldName; + private Bowl bowl; private RowMetaInterface incomingRowMeta; private RowMetaInterface outputRowMeta; @@ -74,9 +76,8 @@ public IPentahoRecordReader createRecordReader( IPentahoInputSplit split ) throw Schema avroSchema = readAvroSchema(); int dataFieldIndex = useFieldAsInputStream ? determineStringFieldIndex( inputStreamFieldName ) : -1; - return new AvroNestedRecordReader( nestedDfs, avroSchema, getFields(), variableSpace, incomingRowMeta, - incomingFields, - outputRowMeta, fileName, isDataBinaryEncoded, dataFieldIndex, isDatum ); + return new AvroNestedRecordReader( bowl, nestedDfs, avroSchema, getFields(), variableSpace, incomingRowMeta, + incomingFields, outputRowMeta, fileName, isDataBinaryEncoded, dataFieldIndex, isDatum ); } @@ -86,7 +87,8 @@ public Schema readAvroSchema() throws Exception { return new Schema.Parser().parse( ( (String) incomingFields[ determineStringFieldIndex( schemaFieldName ) ] ) ); } else { if ( schemaFileName != null && schemaFileName.length() > 0 ) { - return new Schema.Parser().parse( KettleVFS.getInputStream( schemaFileName, variableSpace ) ); + return new Schema.Parser().parse( KettleVFS.getInstance( bowl ) + .getInputStream( schemaFileName, variableSpace ) ); } else if ( ( fileName != null && fileName.length() > 0 ) || ( useFieldAsInputStream && inputStream != null ) ) { Schema schema; DataFileStream dataFileStream = createDataFileStream(); @@ -160,6 +162,11 @@ public void setSplitSize( long blockSize ) throws Exception { //do nothing } + @Override + public void setBowl( Bowl bowl ) { + this.bowl = bowl; + } + private DataFileStream createDataFileStream() throws Exception { DatumReader datumReader; if ( useFieldAsInputStream ) { @@ -168,12 +175,13 @@ private DataFileStream createDataFileStream() throws Exception { return new DataFileStream( inputStream, datumReader ); } if ( schemaFileName != null && schemaFileName.length() > 0 ) { - Schema schema = new Schema.Parser().parse( KettleVFS.getInputStream( schemaFileName, variableSpace ) ); + Schema schema = new Schema.Parser().parse( KettleVFS.getInstance( bowl ) + .getInputStream( schemaFileName, variableSpace ) ); datumReader = new GenericDatumReader( schema ); } else { datumReader = new GenericDatumReader(); } - FileObject fileObject = KettleVFS.getFileObject( fileName, variableSpace ); + FileObject fileObject = KettleVFS.getInstance( bowl ).getFileObject( fileName, variableSpace ); if ( fileObject.isFile() ) { this.inputStream = fileObject.getContent().getInputStream(); return new DataFileStream<>( inputStream, datumReader ); @@ -195,12 +203,13 @@ private DataFileStream createNestedDataFileStream() throws Exception { return new DataFileStream( inputStream, datumReader ); } if ( schemaFileName != null && schemaFileName.length() > 0 ) { - Schema schema = new Schema.Parser().parse( KettleVFS.getInputStream( schemaFileName, variableSpace ) ); + Schema schema = new Schema.Parser().parse( KettleVFS.getInstance( bowl ) + .getInputStream( schemaFileName, variableSpace ) ); datumReader = new GenericDatumReader( schema ); } else { datumReader = new GenericDatumReader(); } - FileObject fileObject = KettleVFS.getFileObject( fileName, variableSpace ); + FileObject fileObject = KettleVFS.getInstance( bowl ).getFileObject( fileName, variableSpace ); if ( fileObject.isFile() ) { this.inputStream = fileObject.getContent().getInputStream(); return new DataFileStream<>( inputStream, datumReader ); diff --git a/plugins/avro-format/core/src/main/java/org/pentaho/di/trans/steps/avro/output/AvroOutput.java b/plugins/avro-format/core/src/main/java/org/pentaho/di/trans/steps/avro/output/AvroOutput.java index 117908084b33..39f0ad140e4c 100644 --- a/plugins/avro-format/core/src/main/java/org/pentaho/di/trans/steps/avro/output/AvroOutput.java +++ b/plugins/avro-format/core/src/main/java/org/pentaho/di/trans/steps/avro/output/AvroOutput.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2022 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2022-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -117,6 +117,7 @@ public void init() throws Exception { } TransMeta parentTransMeta = meta.getParentStepMeta().getParentTransMeta(); data.output = new PentahoAvroOutputFormat(); + data.output.setBowl( getTransMeta().getBowl() ); data.output .setOutputFile( parentTransMeta.environmentSubstitute( meta.constructOutputFilename( meta.getFilename() ) ), meta.isOverrideOutput() ); diff --git a/plugins/avro-format/core/src/main/java/org/pentaho/di/trans/steps/avro/output/AvroOutputMetaBase.java b/plugins/avro-format/core/src/main/java/org/pentaho/di/trans/steps/avro/output/AvroOutputMetaBase.java index e06e8013f78f..3a0367f4fe25 100644 --- a/plugins/avro-format/core/src/main/java/org/pentaho/di/trans/steps/avro/output/AvroOutputMetaBase.java +++ b/plugins/avro-format/core/src/main/java/org/pentaho/di/trans/steps/avro/output/AvroOutputMetaBase.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2022-2023 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2022-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -25,6 +25,7 @@ import org.apache.commons.lang.StringUtils; import org.pentaho.di.trans.steps.avro.AvroTypeConverter; import org.apache.commons.vfs2.FileObject; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.Const; import org.pentaho.di.core.database.DatabaseMeta; import org.pentaho.di.core.exception.KettleException; @@ -305,11 +306,11 @@ public void saveRep( Repository rep, IMetaStore metaStore, ObjectId transformati } @Override - public void resolve() { + public void resolve( Bowl bowl ) { if ( filename != null && !filename.isEmpty() ) { try { String realFileName = getParentStepMeta().getParentTransMeta().environmentSubstitute( filename ); - FileObject fileObject = KettleVFS.getFileObject( realFileName ); + FileObject fileObject = KettleVFS.getInstance( bowl ).getFileObject( realFileName ); if ( AliasedFileObject.isAliasedFile( fileObject ) ) { filename = ( (AliasedFileObject) fileObject ).getAELSafeURIString(); } @@ -321,7 +322,7 @@ public void resolve() { if ( schemaFilename != null && !schemaFilename.isEmpty() ) { try { String realSchemaFilename = getParentStepMeta().getParentTransMeta().environmentSubstitute( schemaFilename ); - FileObject fileObject = KettleVFS.getFileObject( realSchemaFilename ); + FileObject fileObject = KettleVFS.getInstance( bowl ).getFileObject( realSchemaFilename ); if ( AliasedFileObject.isAliasedFile( fileObject ) ) { schemaFilename = ( (AliasedFileObject) fileObject ).getAELSafeURIString(); } diff --git a/plugins/avro-format/core/src/main/java/org/pentaho/di/trans/steps/avro/output/IPentahoAvroOutputFormat.java b/plugins/avro-format/core/src/main/java/org/pentaho/di/trans/steps/avro/output/IPentahoAvroOutputFormat.java index a6ac9bb4bb54..d3a711be451d 100644 --- a/plugins/avro-format/core/src/main/java/org/pentaho/di/trans/steps/avro/output/IPentahoAvroOutputFormat.java +++ b/plugins/avro-format/core/src/main/java/org/pentaho/di/trans/steps/avro/output/IPentahoAvroOutputFormat.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2022 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2022-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -21,6 +21,7 @@ ******************************************************************************/ package org.pentaho.di.trans.steps.avro.output; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.variables.VariableSpace; import java.util.List; @@ -45,6 +46,8 @@ enum COMPRESSION { void setSchemaFilename( String schemaFilename ); + void setBowl( Bowl bowl ); + @SuppressWarnings( "squid:S00112" ) default void setVariableSpace( VariableSpace variableSpace ) { throw new UnsupportedOperationException(); diff --git a/plugins/avro-format/core/src/main/java/org/pentaho/di/trans/steps/avro/output/PentahoAvroOutputFormat.java b/plugins/avro-format/core/src/main/java/org/pentaho/di/trans/steps/avro/output/PentahoAvroOutputFormat.java index 9284156fc84d..1b32026293d3 100644 --- a/plugins/avro-format/core/src/main/java/org/pentaho/di/trans/steps/avro/output/PentahoAvroOutputFormat.java +++ b/plugins/avro-format/core/src/main/java/org/pentaho/di/trans/steps/avro/output/PentahoAvroOutputFormat.java @@ -2,7 +2,7 @@ * * Pentaho Big Data * - * Copyright (C) 2022 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2022-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -34,6 +34,7 @@ import org.apache.avro.generic.GenericRecord; import org.apache.avro.io.DatumWriter; import org.apache.commons.lang.StringUtils; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.exception.KettleFileException; import org.pentaho.di.core.variables.VariableSpace; import org.pentaho.di.core.vfs.KettleVFS; @@ -59,6 +60,7 @@ public class PentahoAvroOutputFormat implements IPentahoAvroOutputFormat { private String docValue; private String schemaFilename; private Schema schema = null; + private Bowl bowl; ObjectNode schemaObjectNode = null; private VariableSpace variableSpace; @@ -75,7 +77,8 @@ public IPentahoRecordWriter createRecordWriter() throws Exception { DatumWriter datumWriter = new GenericDatumWriter( schema ); DataFileWriter dataFileWriter = new DataFileWriter( datumWriter ); dataFileWriter.setCodec( codecFactory ); - dataFileWriter.create( schema, KettleVFS.getOutputStream( outputFilename, variableSpace, false ) ); + dataFileWriter.create( schema, KettleVFS.getInstance( bowl ) + .getOutputStream( outputFilename, variableSpace, false ) ); return new PentahoAvroRecordWriter( dataFileWriter, schema, fields ); } @@ -110,7 +113,7 @@ public void setFields( List fields ) throws Exceptio @Override public void setOutputFile( String file, boolean override ) throws Exception { - if ( !override && KettleVFS.fileExists( file, variableSpace ) ) { + if ( !override && KettleVFS.getInstance( bowl ).fileExists( file, variableSpace ) ) { throw new FileAlreadyExistsException( file ); } @@ -233,7 +236,8 @@ protected void writeAvroSchemaToFile( String schemaFilename ) throws KettleFileE if ( schemaObjectNode != null && schemaFilename != null ) { ObjectMapper mapper = new ObjectMapper(); ObjectWriter writer = mapper.writer( new DefaultPrettyPrinter() ); - writer.writeValue( KettleVFS.getOutputStream( schemaFilename, variableSpace, false ), schemaObjectNode ); + writer.writeValue( KettleVFS.getInstance( bowl ) + .getOutputStream( schemaFilename, variableSpace, false ), schemaObjectNode ); } } @@ -242,4 +246,9 @@ public void setVariableSpace( VariableSpace variableSpace ) { this.variableSpace = variableSpace; } + @Override + public void setBowl( Bowl bowl ) { + this.bowl = bowl; + } } + diff --git a/plugins/avro-format/core/src/test/java/org/pentaho/di/trans/steps/avro/input/AvroInputMetaTest.java b/plugins/avro-format/core/src/test/java/org/pentaho/di/trans/steps/avro/input/AvroInputMetaTest.java index 214c7591ffa9..23fba6d7a910 100644 --- a/plugins/avro-format/core/src/test/java/org/pentaho/di/trans/steps/avro/input/AvroInputMetaTest.java +++ b/plugins/avro-format/core/src/test/java/org/pentaho/di/trans/steps/avro/input/AvroInputMetaTest.java @@ -27,6 +27,7 @@ import org.mockito.ArgumentCaptor; import org.mockito.Mock; import org.mockito.junit.MockitoJUnitRunner; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.exception.KettlePluginException; import org.pentaho.di.core.exception.KettleStepException; import org.pentaho.di.core.osgi.api.MetastoreLocatorOsgi; @@ -114,14 +115,14 @@ public void setUp() throws KettlePluginException { @Test public void testGetFields_clearPreviousFileds() throws KettleStepException { - meta.getFields( rowMeta, origin, info, nextStep, space, repository, metaStore ); + meta.getFields( DefaultBowl.getInstance(), rowMeta, origin, info, nextStep, space, repository, metaStore ); verify( rowMeta ).clear(); } @Test public void testGetFields_originShouldBeSetedToRowMeta() throws KettleStepException { meta.setInputFields( Arrays.asList( field ) ); - meta.getFields( rowMeta, origin, info, nextStep, space, repository, metaStore ); + meta.getFields( DefaultBowl.getInstance(), rowMeta, origin, info, nextStep, space, repository, metaStore ); ArgumentCaptor argument = ArgumentCaptor.forClass( ValueMetaInterface.class ); verify( rowMeta ).addValueMeta( argument.capture() ); assertEquals( origin, argument.getValue().getOrigin() ); @@ -130,7 +131,7 @@ public void testGetFields_originShouldBeSetedToRowMeta() throws KettleStepExcept @Test public void testGetFields_theNameWasUpdatedByVariables() throws KettleStepException { meta.setInputFields( Arrays.asList( field ) ); - meta.getFields( rowMeta, origin, info, nextStep, space, repository, metaStore ); + meta.getFields( DefaultBowl.getInstance(), rowMeta, origin, info, nextStep, space, repository, metaStore ); verify( space ).environmentSubstitute( nullable( String.class) ); } @@ -141,7 +142,7 @@ public void testGetFields_infoMetaShouldBeMerged_ifWePassingFieldsThroughStep() RowMetaInterface forMerge = mock( RowMetaInterface.class ); RowMetaInterface[] rmi = new RowMetaInterface[] { forMerge }; meta.setInputFields( Arrays.asList( field ) ); - meta.getFields( rowMeta, origin, rmi, nextStep, space, repository, metaStore ); + meta.getFields( DefaultBowl.getInstance(), rowMeta, origin, rmi, nextStep, space, repository, metaStore ); verify( rowMeta ).mergeRowMeta( eq( forMerge ), eq( origin ) ); } @@ -150,7 +151,7 @@ public void testGetFields_infoMetaShouldNotBeMerged_ifWeDoNotHaveadditionalField meta.passingThruFields = true; meta.setInputFields( Arrays.asList( field ) ); - meta.getFields( rowMeta, origin, info, nextStep, space, repository, metaStore ); + meta.getFields( DefaultBowl.getInstance(), rowMeta, origin, info, nextStep, space, repository, metaStore ); verify( rowMeta, never() ).mergeRowMeta( any( RowMetaInterface.class ), anyString() ); } @@ -160,6 +161,6 @@ public void testGetFields_unknownPluginForFieldType() throws KettleStepException when( fld.getPentahoType() ).thenReturn( Integer.MIN_VALUE ); // invalid type meta.setInputFields( Arrays.asList( fld ) ); - meta.getFields( rowMeta, origin, info, nextStep, space, repository, metaStore ); + meta.getFields( DefaultBowl.getInstance(), rowMeta, origin, info, nextStep, space, repository, metaStore ); } } diff --git a/plugins/avro-format/core/src/test/java/org/pentaho/di/trans/steps/avro/input/PentahoAvroInputFormatTest.java b/plugins/avro-format/core/src/test/java/org/pentaho/di/trans/steps/avro/input/PentahoAvroInputFormatTest.java index ea73d69c4d06..cbf2d5605e53 100644 --- a/plugins/avro-format/core/src/test/java/org/pentaho/di/trans/steps/avro/input/PentahoAvroInputFormatTest.java +++ b/plugins/avro-format/core/src/test/java/org/pentaho/di/trans/steps/avro/input/PentahoAvroInputFormatTest.java @@ -2,7 +2,7 @@ * * Pentaho Big Data * - * Copyright (C) 2022 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2022-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -21,6 +21,7 @@ ******************************************************************************/ package org.pentaho.di.trans.steps.avro.input; +import org.pentaho.di.core.bowl.DefaultBowl; import org.apache.avro.Schema; import org.junit.Before; import org.junit.Test; @@ -46,6 +47,7 @@ public class PentahoAvroInputFormatTest { @Before public void setUp() throws Exception { format = new PentahoAvroInputFormat( ); + format.setBowl( DefaultBowl.getInstance() ); } @Test diff --git a/plugins/avro-format/core/src/test/java/org/pentaho/di/trans/steps/avro/input/PentahoAvroReadWriteTest.java b/plugins/avro-format/core/src/test/java/org/pentaho/di/trans/steps/avro/input/PentahoAvroReadWriteTest.java index 0a8eb395a9fc..38e3151e10ff 100644 --- a/plugins/avro-format/core/src/test/java/org/pentaho/di/trans/steps/avro/input/PentahoAvroReadWriteTest.java +++ b/plugins/avro-format/core/src/test/java/org/pentaho/di/trans/steps/avro/input/PentahoAvroReadWriteTest.java @@ -2,7 +2,7 @@ * * Pentaho Big Data * - * Copyright (C) 2022 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2022-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -22,17 +22,18 @@ package org.pentaho.di.trans.steps.avro.input; -import org.pentaho.di.trans.steps.avro.AvroSpec; -import org.pentaho.di.trans.steps.avro.output.*; import org.junit.Before; import org.junit.Test; import org.junit.rules.TemporaryFolder; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.RowMetaAndData; import org.pentaho.di.core.plugins.PluginRegistry; import org.pentaho.di.core.row.RowMeta; import org.pentaho.di.core.row.ValueMetaInterface; import org.pentaho.di.core.row.value.*; import org.pentaho.di.core.util.Assert; +import org.pentaho.di.trans.steps.avro.AvroSpec; +import org.pentaho.di.trans.steps.avro.output.*; import java.math.BigDecimal; import java.math.MathContext; @@ -687,6 +688,7 @@ private void testRecordWriter( List avroOutputFields, RowMeta r avroOutputFormat.setRecordName( "recordName" ); avroOutputFormat.setFields( avroOutputFields ); avroOutputFormat.setCompression( compressionType ); + avroOutputFormat.setBowl( DefaultBowl.getInstance() ); avroOutputFormat.setOutputFile( filePath, overwrite ); IPentahoOutputFormat.IPentahoRecordWriter avroRecordWriter = avroOutputFormat.createRecordWriter(); @@ -714,6 +716,7 @@ private void testRecordReader( List avroInputFields, RowMeta row pentahoAvroInputFormat.setInputFields( avroInputFields ); pentahoAvroInputFormat.setInputFile( filePath ); pentahoAvroInputFormat.setOutputRowMeta( rowMeta ); + pentahoAvroInputFormat.setBowl( DefaultBowl.getInstance() ); IPentahoInputFormat.IPentahoRecordReader pentahoRecordReader = pentahoAvroInputFormat.createRecordReader( null ); for ( RowMetaAndData row : pentahoRecordReader ) { for ( int colNum = 0; colNum < avroInputFields.size(); colNum++ ) { diff --git a/plugins/core/impl/src/it/java/org/pentaho/di/job/entries/checkdbconnection/JobEntryCheckDbConnectionsIT.java b/plugins/core/impl/src/it/java/org/pentaho/di/job/entries/checkdbconnection/JobEntryCheckDbConnectionsIT.java index fad4d978d47b..e5ab3185cb72 100644 --- a/plugins/core/impl/src/it/java/org/pentaho/di/job/entries/checkdbconnection/JobEntryCheckDbConnectionsIT.java +++ b/plugins/core/impl/src/it/java/org/pentaho/di/job/entries/checkdbconnection/JobEntryCheckDbConnectionsIT.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2018 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -49,7 +49,7 @@ public static void setUpBeforeClass() throws KettleException { @After public void cleanup() { try { - FileObject dbFile = KettleVFS.getFileObject( H2_DATABASE + ".h2.db" ); + FileObject dbFile = KettleVFS.getInstance( DefaultBowl.getInstance() ).getFileObject( H2_DATABASE + ".h2.db" ); if ( dbFile.exists() ) { System.out.println( "deleting file" ); dbFile.delete(); diff --git a/plugins/core/impl/src/main/java/org/pentaho/di/job/entries/addresultfilenames/JobEntryAddResultFilenames.java b/plugins/core/impl/src/main/java/org/pentaho/di/job/entries/addresultfilenames/JobEntryAddResultFilenames.java index f7fec25bc75f..01d14746ec1f 100644 --- a/plugins/core/impl/src/main/java/org/pentaho/di/job/entries/addresultfilenames/JobEntryAddResultFilenames.java +++ b/plugins/core/impl/src/main/java/org/pentaho/di/job/entries/addresultfilenames/JobEntryAddResultFilenames.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2018 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -281,7 +281,7 @@ private boolean processFile( String filename, String wildcard, Job parentJob, Re parentJobMeta.getNamedClusterEmbedManager() .passEmbeddedMetastoreKey( this, parentJobMeta.getEmbeddedMetastoreProviderKey() ); } - filefolder = KettleVFS.getFileObject( realFilefoldername, this ); + filefolder = KettleVFS.getInstance( parentJobMeta.getBowl() ).getFileObject( realFilefoldername, this ); if ( filefolder.exists() ) { // the file or folder exists @@ -293,8 +293,8 @@ private boolean processFile( String filename, String wildcard, Job parentJob, Re } ResultFile resultFile = new ResultFile( - ResultFile.FILE_TYPE_GENERAL, KettleVFS.getFileObject( filefolder.toString(), this ), parentJob - .getJobname(), toString() ); + ResultFile.FILE_TYPE_GENERAL, KettleVFS.getInstance( parentJobMeta.getBowl() ) + .getFileObject( filefolder.toString(), this ), parentJob.getJobname(), toString() ); result.getResultFiles().put( resultFile.getFile().toString(), resultFile ); } else { FileObject[] list = filefolder.findFiles( new TextFileSelector( filefolder.toString(), realwildcard ) ); @@ -307,8 +307,8 @@ private boolean processFile( String filename, String wildcard, Job parentJob, Re } ResultFile resultFile = new ResultFile( - ResultFile.FILE_TYPE_GENERAL, KettleVFS.getFileObject( list[i].toString(), this ), parentJob - .getJobname(), toString() ); + ResultFile.FILE_TYPE_GENERAL, KettleVFS.getInstance( parentJobMeta.getBowl() ) + .getFileObject( list[i].toString(), this ), parentJob.getJobname(), toString() ); result.getResultFiles().put( resultFile.getFile().toString(), resultFile ); } } @@ -442,7 +442,7 @@ public boolean isIncludeSubfolders() { public void check( List remarks, JobMeta jobMeta, VariableSpace space, Repository repository, IMetaStore metaStore ) { - boolean res = JobEntryValidatorUtils.andValidator().validate( this, "arguments", remarks, + boolean res = JobEntryValidatorUtils.andValidator().validate( jobMeta.getBowl(), this, "arguments", remarks, AndValidator.putValidators( JobEntryValidatorUtils.notNullValidator() ) ); if ( res == false ) { @@ -454,7 +454,7 @@ public void check( List remarks, JobMeta jobMeta, Variable AndValidator.putValidators( ctx, JobEntryValidatorUtils.notNullValidator(), JobEntryValidatorUtils.fileExistsValidator() ); for ( int i = 0; i < arguments.length; i++ ) { - JobEntryValidatorUtils.andValidator().validate( this, "arguments[" + i + "]", remarks, ctx ); + JobEntryValidatorUtils.andValidator().validate( jobMeta.getBowl(), this, "arguments[" + i + "]", remarks, ctx ); } } diff --git a/plugins/core/impl/src/main/java/org/pentaho/di/job/entries/checkdbconnection/JobEntryCheckDbConnections.java b/plugins/core/impl/src/main/java/org/pentaho/di/job/entries/checkdbconnection/JobEntryCheckDbConnections.java index 552772e5ff3d..a6da022424f2 100644 --- a/plugins/core/impl/src/main/java/org/pentaho/di/job/entries/checkdbconnection/JobEntryCheckDbConnections.java +++ b/plugins/core/impl/src/main/java/org/pentaho/di/job/entries/checkdbconnection/JobEntryCheckDbConnections.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2018 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -415,8 +415,10 @@ public List getResourceDependencies( JobMeta jobMeta ) { @Override public void check( List remarks, JobMeta jobMeta, VariableSpace space, Repository repository, IMetaStore metaStore ) { - JobEntryValidatorUtils.andValidator().validate( this, "tablename", remarks, AndValidator.putValidators( JobEntryValidatorUtils.notBlankValidator() ) ); - JobEntryValidatorUtils.andValidator().validate( this, "columnname", remarks, AndValidator.putValidators( JobEntryValidatorUtils.notBlankValidator() ) ); + JobEntryValidatorUtils.andValidator().validate( jobMeta.getBowl(), this, "tablename", remarks, + AndValidator.putValidators( JobEntryValidatorUtils.notBlankValidator() ) ); + JobEntryValidatorUtils.andValidator().validate( jobMeta.getBowl(), this, "columnname", remarks, + AndValidator.putValidators( JobEntryValidatorUtils.notBlankValidator() ) ); } } diff --git a/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/abort/AbortMeta.java b/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/abort/AbortMeta.java index 5f1e8abf321d..0afe94b430e9 100644 --- a/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/abort/AbortMeta.java +++ b/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/abort/AbortMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2019 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -27,6 +27,7 @@ import org.pentaho.di.core.CheckResult; import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.annotations.Step; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.database.DatabaseMeta; import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.core.exception.KettleStepException; @@ -81,7 +82,8 @@ public enum AbortOption { private AbortOption abortOption; - public void getFields( RowMetaInterface inputRowMeta, String name, RowMetaInterface[] info, StepMeta nextStep, + @Override + public void getFields( Bowl bowl, RowMetaInterface inputRowMeta, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { // Default: no values are added to the row in the step } diff --git a/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/addsequence/AddSequence.java b/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/addsequence/AddSequence.java index e78c70f47e46..76c10cfc67e9 100644 --- a/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/addsequence/AddSequence.java +++ b/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/addsequence/AddSequence.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2019 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -115,7 +115,8 @@ public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws if ( first ) { first = false; data.outputRowMeta = getInputRowMeta().clone(); - meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); + meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository, + metaStore ); } if ( log.isRowLevel() ) { diff --git a/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/addsequence/AddSequenceMeta.java b/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/addsequence/AddSequenceMeta.java index 881e76803c12..0fab3fd13ab1 100644 --- a/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/addsequence/AddSequenceMeta.java +++ b/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/addsequence/AddSequenceMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2019 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -29,6 +29,7 @@ import org.pentaho.di.core.Const; import org.pentaho.di.core.SQLStatement; import org.pentaho.di.core.annotations.Step; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.database.Database; import org.pentaho.di.core.database.DatabaseMeta; import org.pentaho.di.core.exception.KettleException; @@ -274,7 +275,7 @@ public void setDefault() { } @Override - public void getFields( RowMetaInterface row, String name, RowMetaInterface[] info, StepMeta nextStep, + public void getFields( Bowl bowl, RowMetaInterface row, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { ValueMetaInterface v = new ValueMetaInteger( valuename ); // v.setLength(ValueMetaInterface.DEFAULT_INTEGER_LENGTH, 0); Removed for 2.5.x compatibility reasons. diff --git a/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/analyticquery/AnalyticQuery.java b/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/analyticquery/AnalyticQuery.java index 77d1be37354d..4344098d7002 100644 --- a/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/analyticquery/AnalyticQuery.java +++ b/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/analyticquery/AnalyticQuery.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -79,7 +79,8 @@ public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws } data.outputRowMeta = data.inputRowMeta.clone(); - meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); + meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository, + metaStore ); data.groupnrs = new int[meta.getGroupField().length]; for ( int i = 0; i < meta.getGroupField().length; i++ ) { diff --git a/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/analyticquery/AnalyticQueryMeta.java b/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/analyticquery/AnalyticQueryMeta.java index f876d43a5583..ecd93a20c2ca 100644 --- a/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/analyticquery/AnalyticQueryMeta.java +++ b/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/analyticquery/AnalyticQueryMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -28,6 +28,7 @@ import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.Const; import org.pentaho.di.core.annotations.Step; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.database.DatabaseMeta; import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.core.exception.KettleStepException; @@ -262,7 +263,8 @@ public void setDefault() { allocate( sizegroup, nrfields ); } - public void getFields( RowMetaInterface r, String origin, RowMetaInterface[] info, StepMeta nextStep, + @Override + public void getFields( Bowl bowl, RowMetaInterface r, String origin, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { // re-assemble a new row of metadata // diff --git a/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/append/AppendMeta.java b/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/append/AppendMeta.java index de72b98cbbd7..c71dda47bbe4 100644 --- a/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/append/AppendMeta.java +++ b/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/append/AppendMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2018 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -25,6 +25,7 @@ import org.pentaho.di.core.CheckResult; import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.annotations.Step; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.database.DatabaseMeta; import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.core.exception.KettleStepException; @@ -154,7 +155,8 @@ public String[] getTargetSteps() { return null; } - public void getFields( RowMetaInterface r, String name, RowMetaInterface[] info, StepMeta nextStep, + @Override + public void getFields( Bowl bowl, RowMetaInterface r, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { // We don't have any input fields here in "r" as they are all info fields. // So we just take the info fields. diff --git a/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/autodoc/AutoDoc.java b/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/autodoc/AutoDoc.java index 10e01cd7d393..54a13f55f662 100644 --- a/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/autodoc/AutoDoc.java +++ b/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/autodoc/AutoDoc.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -86,13 +86,15 @@ public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws // End of the line, create the documentation... // - FileObject targetFile = KettleVFS.getFileObject( environmentSubstitute( meta.getTargetFilename() ) ); + FileObject targetFile = KettleVFS.getInstance( getTransMeta().getBowl() ) + .getFileObject( environmentSubstitute( meta.getTargetFilename() ) ); String targetFilename = KettleVFS.getFilename( targetFile ); // Create the report builder // KettleReportBuilder kettleReportBuilder = - new KettleReportBuilder( this, data.filenames, KettleVFS.getFilename( targetFile ), meta ); + new KettleReportBuilder( getTransMeta().getBowl(), this, data.filenames, KettleVFS.getFilename( targetFile ), + meta ); try { // Try to get the Classic Reporting Engine to boot inside of the plugin class loader... @@ -138,7 +140,8 @@ public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws first = false; data.outputRowMeta = getInputRowMeta().clone(); - meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); + meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository, + metaStore ); // Get the filename field index... // @@ -235,8 +238,8 @@ public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws switch ( location.getObjectType() ) { case TRANSFORMATION: TransformationInformation ti = TransformationInformation.getInstance(); - TransMeta transMeta = ti.getTransMeta( location ); - imageAreaList = ti.getImageAreaList( location ); + TransMeta transMeta = ti.getTransMeta( getTransMeta().getBowl(), location ); + imageAreaList = ti.getImageAreaList( getTransMeta().getBowl(), location ); // TransMeta outputRow[outputIndex++] = transMeta; @@ -244,8 +247,8 @@ public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws case JOB: JobInformation ji = JobInformation.getInstance(); - JobMeta jobMeta = ji.getJobMeta( location ); - imageAreaList = ji.getImageAreaList( location ); + JobMeta jobMeta = ji.getJobMeta( getTransMeta().getBowl(), location ); + imageAreaList = ji.getImageAreaList( getTransMeta().getBowl(), location ); // TransMeta outputRow[outputIndex++] = jobMeta; @@ -256,34 +259,34 @@ public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws // Name if ( meta.isIncludingName() ) { - outputRow[outputIndex++] = KettleFileTableModel.getName( location ); + outputRow[outputIndex++] = KettleFileTableModel.getName( getTransMeta().getBowl(), location ); } // Description if ( meta.isIncludingDescription() ) { - outputRow[outputIndex++] = KettleFileTableModel.getDescription( location ); + outputRow[outputIndex++] = KettleFileTableModel.getDescription( getTransMeta().getBowl(), location ); } // Extended Description if ( meta.isIncludingExtendedDescription() ) { - outputRow[outputIndex++] = KettleFileTableModel.getExtendedDescription( location ); + outputRow[outputIndex++] = KettleFileTableModel.getExtendedDescription( getTransMeta().getBowl(), location ); } // created if ( meta.isIncludingCreated() ) { - outputRow[outputIndex++] = KettleFileTableModel.getCreation( location ); + outputRow[outputIndex++] = KettleFileTableModel.getCreation( getTransMeta().getBowl(), location ); } // modified if ( meta.isIncludingModified() ) { - outputRow[outputIndex++] = KettleFileTableModel.getModification( location ); + outputRow[outputIndex++] = KettleFileTableModel.getModification( getTransMeta().getBowl(), location ); } // image if ( meta.isIncludingImage() ) { ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); try { - BufferedImage image = KettleFileTableModel.getImage( location ); + BufferedImage image = KettleFileTableModel.getImage( getTransMeta().getBowl(), location ); ImageIO.write( image, "png", outputStream ); outputRow[outputIndex++] = outputStream.toByteArray(); @@ -299,11 +302,11 @@ public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws } if ( meta.isIncludingLoggingConfiguration() ) { - outputRow[outputIndex++] = KettleFileTableModel.getLogging( location ); + outputRow[outputIndex++] = KettleFileTableModel.getLogging( getTransMeta().getBowl(), location ); } if ( meta.isIncludingLastExecutionResult() ) { - outputRow[outputIndex++] = KettleFileTableModel.getLogging( location ); + outputRow[outputIndex++] = KettleFileTableModel.getLogging( getTransMeta().getBowl(), location ); } if ( meta.isIncludingImageAreaList() ) { diff --git a/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/autodoc/AutoDocMeta.java b/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/autodoc/AutoDocMeta.java index 1670b66a5e43..e3078ebad62b 100644 --- a/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/autodoc/AutoDocMeta.java +++ b/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/autodoc/AutoDocMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -27,6 +27,7 @@ import org.pentaho.di.core.CheckResult; import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.annotations.Step; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.database.DatabaseMeta; import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.core.exception.KettleStepException; @@ -222,7 +223,7 @@ public void saveRep( Repository rep, IMetaStore metaStore, ObjectId id_transform } @Override - public void getFields( RowMetaInterface rowMeta, String origin, RowMetaInterface[] info, StepMeta nextStep, + public void getFields( Bowl bowl, RowMetaInterface rowMeta, String origin, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { if ( outputType == OutputType.METADATA ) { diff --git a/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/autodoc/JobInformation.java b/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/autodoc/JobInformation.java index 33dc0e44e75e..0e54b9c15881 100644 --- a/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/autodoc/JobInformation.java +++ b/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/autodoc/JobInformation.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -31,6 +31,7 @@ import java.util.List; import java.util.Map; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.core.gui.AreaOwner; import org.pentaho.di.core.gui.GCInterface; @@ -73,42 +74,42 @@ private JobInformation() { this.map = new HashMap(); } - public BufferedImage getImage( ReportSubjectLocation location ) throws KettleException { - return getValues( location ).image; + public BufferedImage getImage( Bowl bowl, ReportSubjectLocation location ) throws KettleException { + return getValues( bowl, location ).image; } - public JobMeta getJobMeta( ReportSubjectLocation location ) throws KettleException { - return getValues( location ).jobMeta; + public JobMeta getJobMeta( Bowl bowl, ReportSubjectLocation location ) throws KettleException { + return getValues( bowl, location ).jobMeta; } - public List getImageAreaList( ReportSubjectLocation location ) throws KettleException { - return getValues( location ).areaOwners; + public List getImageAreaList( Bowl bowl, ReportSubjectLocation location ) throws KettleException { + return getValues( bowl, location ).areaOwners; } - private JobInformationValues getValues( ReportSubjectLocation location ) throws KettleException { + private JobInformationValues getValues( Bowl bowl, ReportSubjectLocation location ) throws KettleException { JobInformationValues values = map.get( location ); if ( values == null ) { - values = loadValues( location ); + values = loadValues( bowl, location ); map.put( location, values ); } return values; } - private JobMeta loadJob( ReportSubjectLocation location ) throws KettleException { + private JobMeta loadJob( Bowl bowl, ReportSubjectLocation location ) throws KettleException { JobMeta jobMeta; if ( !Utils.isEmpty( location.getFilename() ) ) { - jobMeta = new JobMeta( location.getFilename(), repository ); + jobMeta = new JobMeta( bowl, location.getFilename(), repository ); } else { jobMeta = repository.loadJob( location.getName(), location.getDirectory(), null, null ); } return jobMeta; } - private JobInformationValues loadValues( ReportSubjectLocation location ) throws KettleException { + private JobInformationValues loadValues( Bowl bowl, ReportSubjectLocation location ) throws KettleException { // Load the job // - JobMeta jobMeta = loadJob( location ); + JobMeta jobMeta = loadJob( bowl, location ); Point min = jobMeta.getMinimum(); Point area = jobMeta.getMaximum(); @@ -150,12 +151,12 @@ public int getSelection() { return values; } - public void drawImage( final Graphics2D g2d, final Rectangle2D rectangle2d, ReportSubjectLocation location, + public void drawImage( Bowl bowl, final Graphics2D g2d, final Rectangle2D rectangle2d, ReportSubjectLocation location, boolean pixelateImages ) throws KettleException { // Load the job // - JobMeta jobMeta = loadJob( location ); + JobMeta jobMeta = loadJob( bowl, location ); Point min = jobMeta.getMinimum(); Point area = jobMeta.getMaximum(); diff --git a/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/autodoc/KettleFileTableModel.java b/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/autodoc/KettleFileTableModel.java index 202ac79a5186..478436869827 100644 --- a/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/autodoc/KettleFileTableModel.java +++ b/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/autodoc/KettleFileTableModel.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -22,30 +22,32 @@ package org.pentaho.di.trans.steps.autodoc; -import java.awt.image.BufferedImage; -import java.util.Date; -import java.util.Iterator; -import java.util.List; - -import javax.swing.event.TableModelListener; -import javax.swing.table.TableModel; - -import org.jfree.ui.Drawable; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.Const; -import org.pentaho.di.core.util.Utils; -import org.pentaho.di.core.RowMetaAndData; import org.pentaho.di.core.database.Database; import org.pentaho.di.core.database.DatabaseMeta; import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.core.logging.LogChannel; import org.pentaho.di.core.logging.LogChannelInterface; +import org.pentaho.di.core.logging.LoggingObjectInterface; import org.pentaho.di.core.logging.LogStatus; import org.pentaho.di.core.logging.LogTableInterface; -import org.pentaho.di.core.logging.LoggingObjectInterface; +import org.pentaho.di.core.RowMetaAndData; +import org.pentaho.di.core.util.Utils; import org.pentaho.di.core.xml.XMLHandler; import org.pentaho.di.job.JobMeta; import org.pentaho.di.trans.TransMeta; +import java.awt.image.BufferedImage; +import java.util.Date; +import java.util.Iterator; +import java.util.List; + +import javax.swing.event.TableModelListener; +import javax.swing.table.TableModel; + +import org.jfree.ui.Drawable; + public class KettleFileTableModel implements TableModel { public enum Field { @@ -64,6 +66,7 @@ public Class getClazz() { } } + private Bowl bowl; private List locations; private LoggingObjectInterface parentObject; private LogChannelInterface log; @@ -71,7 +74,8 @@ public Class getClazz() { public KettleFileTableModel() { } - public KettleFileTableModel( LoggingObjectInterface parentObject, List locations ) { + public KettleFileTableModel( Bowl bowl, LoggingObjectInterface parentObject, List locations ) { + this.bowl = bowl; this.parentObject = parentObject; this.locations = locations; this.log = new LogChannel( "Kettle File Table Model", parentObject ); @@ -96,6 +100,7 @@ public int getRowCount() { return locations.size(); } + @Override public Object getValueAt( int rowIndex, int columnIndex ) { ReportSubjectLocation location = locations.get( rowIndex ); @@ -109,21 +114,21 @@ public Object getValueAt( int rowIndex, int columnIndex ) { case filename: return location.getFilename(); case name: - return getName( location ); + return getName( bowl, location ); case description: - return getDescription( location ); + return getDescription( bowl, location ); case extended_description: - return getExtendedDescription( location ); + return getExtendedDescription( bowl, location ); case logging: - return getLogging( location ); + return getLogging( bowl, location ); case creation: - return getCreation( location ); + return getCreation( bowl, location ); case modification: - return getModification( location ); + return getModification( bowl, location ); case last_exec_result: - return getLastExecutionResult( log, parentObject, location ); + return getLastExecutionResult( bowl, log, parentObject, location ); case image: - return getImage( location ); + return getImage( bowl, location ); default: throw new RuntimeException( "Unhandled field type: " + field + " in function getValueAt()" ); } @@ -133,37 +138,37 @@ public Object getValueAt( int rowIndex, int columnIndex ) { } } - public static String getName( ReportSubjectLocation filename ) throws KettleException { + public static String getName( Bowl bowl, ReportSubjectLocation filename ) throws KettleException { if ( filename.isTransformation() ) { - return TransformationInformation.getInstance().getTransMeta( filename ).getName(); + return TransformationInformation.getInstance().getTransMeta( bowl, filename ).getName(); } else { - return JobInformation.getInstance().getJobMeta( filename ).getName(); + return JobInformation.getInstance().getJobMeta( bowl, filename ).getName(); } } - public static String getDescription( ReportSubjectLocation filename ) throws KettleException { + public static String getDescription( Bowl bowl, ReportSubjectLocation filename ) throws KettleException { if ( filename.isTransformation() ) { - return TransformationInformation.getInstance().getTransMeta( filename ).getDescription(); + return TransformationInformation.getInstance().getTransMeta( bowl, filename ).getDescription(); } else { - return JobInformation.getInstance().getJobMeta( filename ).getDescription(); + return JobInformation.getInstance().getJobMeta( bowl, filename ).getDescription(); } } - public static String getExtendedDescription( ReportSubjectLocation filename ) throws KettleException { + public static String getExtendedDescription( Bowl bowl, ReportSubjectLocation filename ) throws KettleException { if ( filename.isTransformation() ) { - return TransformationInformation.getInstance().getTransMeta( filename ).getExtendedDescription(); + return TransformationInformation.getInstance().getTransMeta( bowl, filename ).getExtendedDescription(); } else { - return JobInformation.getInstance().getJobMeta( filename ).getExtendedDescription(); + return JobInformation.getInstance().getJobMeta( bowl, filename ).getExtendedDescription(); } } - public static String getLogging( ReportSubjectLocation filename ) throws KettleException { + public static String getLogging( Bowl bowl, ReportSubjectLocation filename ) throws KettleException { List logTables; if ( filename.isTransformation() ) { - TransMeta transMeta = TransformationInformation.getInstance().getTransMeta( filename ); + TransMeta transMeta = TransformationInformation.getInstance().getTransMeta( bowl, filename ); logTables = transMeta.getLogTables(); } else { - JobMeta jobMeta = JobInformation.getInstance().getJobMeta( filename ); + JobMeta jobMeta = JobInformation.getInstance().getJobMeta( bowl, filename ); logTables = jobMeta.getLogTables(); } String logging = ""; @@ -179,49 +184,49 @@ public static String getLogging( ReportSubjectLocation filename ) throws KettleE return logging; } - public static BufferedImage getImage( ReportSubjectLocation filename ) throws KettleException { + public static BufferedImage getImage( Bowl bowl, ReportSubjectLocation filename ) throws KettleException { if ( filename.isTransformation() ) { - return TransformationInformation.getInstance().getImage( filename ); + return TransformationInformation.getInstance().getImage( bowl, filename ); } else { - return JobInformation.getInstance().getImage( filename ); + return JobInformation.getInstance().getImage( bowl, filename ); } } - public static String getCreation( ReportSubjectLocation filename ) throws KettleException { + public static String getCreation( Bowl bowl, ReportSubjectLocation filename ) throws KettleException { Date date = null; String user = null; if ( filename.isTransformation() ) { - date = TransformationInformation.getInstance().getTransMeta( filename ).getCreatedDate(); - user = TransformationInformation.getInstance().getTransMeta( filename ).getCreatedUser(); + date = TransformationInformation.getInstance().getTransMeta( bowl, filename ).getCreatedDate(); + user = TransformationInformation.getInstance().getTransMeta( bowl, filename ).getCreatedUser(); } else { - date = JobInformation.getInstance().getJobMeta( filename ).getCreatedDate(); - user = JobInformation.getInstance().getJobMeta( filename ).getCreatedUser(); + date = JobInformation.getInstance().getJobMeta( bowl, filename ).getCreatedDate(); + user = JobInformation.getInstance().getJobMeta( bowl, filename ).getCreatedUser(); } return Const.NVL( XMLHandler.date2string( date ), "-" ) + " by " + Const.NVL( user, "-" ); } - public static String getModification( ReportSubjectLocation filename ) throws KettleException { + public static String getModification( Bowl bowl, ReportSubjectLocation filename ) throws KettleException { Date date = null; String user = null; if ( filename.isTransformation() ) { - date = TransformationInformation.getInstance().getTransMeta( filename ).getModifiedDate(); - user = TransformationInformation.getInstance().getTransMeta( filename ).getModifiedUser(); + date = TransformationInformation.getInstance().getTransMeta( bowl, filename ).getModifiedDate(); + user = TransformationInformation.getInstance().getTransMeta( bowl, filename ).getModifiedUser(); } else { - date = JobInformation.getInstance().getJobMeta( filename ).getModifiedDate(); - user = JobInformation.getInstance().getJobMeta( filename ).getModifiedUser(); + date = JobInformation.getInstance().getJobMeta( bowl, filename ).getModifiedDate(); + user = JobInformation.getInstance().getJobMeta( bowl, filename ).getModifiedUser(); } return Const.NVL( XMLHandler.date2string( date ), "-" ) + " by " + Const.NVL( user, "-" ); } - public static String getLastExecutionResult( LogChannelInterface log, LoggingObjectInterface parentObject, + public static String getLastExecutionResult( Bowl bowl, LogChannelInterface log, LoggingObjectInterface parentObject, ReportSubjectLocation filename ) throws KettleException { LogTableInterface logTable = null; if ( filename.isTransformation() ) { - TransMeta transMeta = TransformationInformation.getInstance().getTransMeta( filename ); + TransMeta transMeta = TransformationInformation.getInstance().getTransMeta( bowl, filename ); logTable = transMeta.getTransLogTable(); } else { - JobMeta jobMeta = JobInformation.getInstance().getJobMeta( filename ); + JobMeta jobMeta = JobInformation.getInstance().getJobMeta( bowl, filename ); logTable = jobMeta.getJobLogTable(); } if ( logTable != null && logTable.isDefined() ) { diff --git a/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/autodoc/KettleReportBuilder.java b/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/autodoc/KettleReportBuilder.java index 3a2cbbf7ef42..1e1efb1b9f00 100644 --- a/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/autodoc/KettleReportBuilder.java +++ b/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/autodoc/KettleReportBuilder.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -28,6 +28,7 @@ import java.util.List; import com.google.common.annotations.VisibleForTesting; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.Const; import org.pentaho.di.core.logging.LoggingObjectInterface; import org.pentaho.reporting.engine.classic.core.AttributeNames; @@ -76,8 +77,11 @@ public enum OutputType { private LoggingObjectInterface parentObject; - public KettleReportBuilder( LoggingObjectInterface parentObject, List locations, + private Bowl bowl; + + public KettleReportBuilder( Bowl bowl, LoggingObjectInterface parentObject, List locations, String targetFilename, AutoDocOptionsInterface options ) { + this.bowl = bowl; this.parentObject = parentObject; this.filenames = locations; this.targetFilename = targetFilename; @@ -134,7 +138,7 @@ public void createReport() throws Exception { // Define where which transformation and step to read from, explain it to the reporting engine // - KettleFileTableModel transMetaTableModel = new KettleFileTableModel( parentObject, filenames ); + KettleFileTableModel transMetaTableModel = new KettleFileTableModel( bowl, parentObject, filenames ); TableDataFactory dataFactory = new TableDataFactory( "default", transMetaTableModel ); diff --git a/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/autodoc/TransJobDrawable.java b/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/autodoc/TransJobDrawable.java index e807b3a3ac79..51af2f3ff3f2 100644 --- a/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/autodoc/TransJobDrawable.java +++ b/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/autodoc/TransJobDrawable.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -26,14 +26,17 @@ import java.awt.geom.Rectangle2D; import org.jfree.ui.Drawable; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.reporting.engine.classic.core.DataRow; public class TransJobDrawable implements Drawable { private DataRow dataRow; private boolean pixelateImages; + private Bowl bowl; - public TransJobDrawable( DataRow dataRow, boolean pixelateImages ) { + public TransJobDrawable( Bowl bowl, DataRow dataRow, boolean pixelateImages ) { + this.bowl = bowl; this.dataRow = dataRow; this.pixelateImages = pixelateImages; } @@ -44,10 +47,10 @@ public void draw( Graphics2D graphics2D, Rectangle2D rectangle2D ) { ReportSubjectLocation location = (ReportSubjectLocation) dataRow.get( "location" ); if ( location.isTransformation() ) { TransformationInformation ti = TransformationInformation.getInstance(); - ti.drawImage( graphics2D, rectangle2D, location, pixelateImages ); + ti.drawImage( bowl, graphics2D, rectangle2D, location, pixelateImages ); } else { JobInformation ji = JobInformation.getInstance(); - ji.drawImage( graphics2D, rectangle2D, location, pixelateImages ); + ji.drawImage( bowl, graphics2D, rectangle2D, location, pixelateImages ); } } catch ( Exception e ) { throw new RuntimeException( "Unable to draw image onto report", e ); diff --git a/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/autodoc/TransformationInformation.java b/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/autodoc/TransformationInformation.java index 553db1959b72..109ed1019788 100644 --- a/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/autodoc/TransformationInformation.java +++ b/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/autodoc/TransformationInformation.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -31,6 +31,7 @@ import java.util.List; import java.util.Map; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.core.gui.AreaOwner; import org.pentaho.di.core.gui.GCInterface; @@ -73,22 +74,23 @@ private TransformationInformation() { this.map = new HashMap(); } - public BufferedImage getImage( ReportSubjectLocation location ) throws KettleException { - return getValues( location ).image; + public BufferedImage getImage( Bowl bowl, ReportSubjectLocation location ) throws KettleException { + return getValues( bowl, location ).image; } - public TransMeta getTransMeta( ReportSubjectLocation location ) throws KettleException { - return getValues( location ).transMeta; + public TransMeta getTransMeta( Bowl bowl, ReportSubjectLocation location ) throws KettleException { + return getValues( bowl, location ).transMeta; } - public List getImageAreaList( ReportSubjectLocation location ) throws KettleException { - return getValues( location ).areaOwners; + public List getImageAreaList( Bowl bowl, ReportSubjectLocation location ) throws KettleException { + return getValues( bowl, location ).areaOwners; } - private TransformationInformationValues getValues( ReportSubjectLocation location ) throws KettleException { + private TransformationInformationValues getValues( Bowl bowl, ReportSubjectLocation location ) + throws KettleException { TransformationInformationValues values = map.get( location ); if ( values == null ) { - values = loadValues( location ); + values = loadValues( bowl, location ); // Dump the other values, keep things nice & tidy. // @@ -98,21 +100,22 @@ private TransformationInformationValues getValues( ReportSubjectLocation locatio return values; } - private TransMeta loadTransformation( ReportSubjectLocation location ) throws KettleException { + private TransMeta loadTransformation( Bowl bowl, ReportSubjectLocation location ) throws KettleException { TransMeta transMeta; if ( !Utils.isEmpty( location.getFilename() ) ) { - transMeta = new TransMeta( location.getFilename() ); + transMeta = new TransMeta( bowl, location.getFilename() ); } else { transMeta = repository.loadTransformation( location.getName(), location.getDirectory(), null, true, null ); } return transMeta; } - private TransformationInformationValues loadValues( ReportSubjectLocation location ) throws KettleException { + private TransformationInformationValues loadValues( Bowl bowl, ReportSubjectLocation location ) + throws KettleException { // Load the transformation // - TransMeta transMeta = loadTransformation( location ); + TransMeta transMeta = loadTransformation( bowl, location ); Point min = transMeta.getMinimum(); Point area = transMeta.getMaximum(); @@ -156,12 +159,12 @@ public int getSelection() { return values; } - public void drawImage( final Graphics2D g2d, final Rectangle2D rectangle2d, ReportSubjectLocation location, + public void drawImage( Bowl bowl, final Graphics2D g2d, final Rectangle2D rectangle2d, ReportSubjectLocation location, boolean pixelateImages ) throws KettleException { // Load the transformation // - TransMeta transMeta = loadTransformation( location ); + TransMeta transMeta = loadTransformation( bowl, location ); Point min = transMeta.getMinimum(); Point area = transMeta.getMaximum(); diff --git a/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/blockingstep/BlockingStep.java b/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/blockingstep/BlockingStep.java index b03330f1cb02..1618d24c5e0b 100644 --- a/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/blockingstep/BlockingStep.java +++ b/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/blockingstep/BlockingStep.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2018 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -81,11 +81,13 @@ private boolean addBuffer( RowMetaInterface rowMeta, Object[] r ) { try { FileObject fileObject = - KettleVFS.createTempFile( meta.getPrefix(), ".tmp", environmentSubstitute( meta.getDirectory() ), + KettleVFS.getInstance( getTransMeta().getBowl() ) + .createTempFile( meta.getPrefix(), ".tmp", environmentSubstitute( meta.getDirectory() ), getTransMeta() ); data.files.add( fileObject ); // Remember the files! - OutputStream outputStream = KettleVFS.getOutputStream( fileObject, false ); + OutputStream outputStream = KettleVFS.getInstance( getTransMeta().getBowl() ) + .getOutputStream( fileObject, false ); if ( meta.getCompress() ) { gzos = new GZIPOutputStream( new BufferedOutputStream( outputStream ) ); dos = new DataOutputStream( gzos ); diff --git a/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/blockingstep/BlockingStepMeta.java b/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/blockingstep/BlockingStepMeta.java index d59519531600..cb1e41e06482 100644 --- a/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/blockingstep/BlockingStepMeta.java +++ b/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/blockingstep/BlockingStepMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2018 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -26,6 +26,7 @@ import java.util.List; import org.pentaho.di.core.annotations.Step; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.CheckResult; import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.Const; @@ -134,8 +135,9 @@ public void check( List remarks, TransMeta transMeta, Step } } - public void getFields( RowMetaInterface inputRowMeta, String name, RowMetaInterface[] info, StepMeta nextStep, - VariableSpace space, Repository repository, IMetaStore metaStore ) + @Override + public void getFields( Bowl bowl, RowMetaInterface inputRowMeta, String name, RowMetaInterface[] info, + StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { // Default: no values are added to the row in the step } diff --git a/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/blockuntilstepsfinish/BlockUntilStepsFinishMeta.java b/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/blockuntilstepsfinish/BlockUntilStepsFinishMeta.java index 236c97936913..4ea84af2493a 100644 --- a/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/blockuntilstepsfinish/BlockUntilStepsFinishMeta.java +++ b/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/blockuntilstepsfinish/BlockUntilStepsFinishMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2019 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -28,6 +28,7 @@ import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.Const; import org.pentaho.di.core.annotations.Step; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.database.DatabaseMeta; import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.core.exception.KettleStepException; @@ -117,7 +118,8 @@ public void setStepCopyNr( String[] stepCopyNr ) { this.stepCopyNr = stepCopyNr; } - public void getFields( RowMetaInterface r, String name, RowMetaInterface[] info, StepMeta nextStep, + @Override + public void getFields( Bowl bowl, RowMetaInterface r, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { } diff --git a/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/changefileencoding/ChangeFileEncoding.java b/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/changefileencoding/ChangeFileEncoding.java index c21d0b5815a1..3a0845cb5b58 100644 --- a/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/changefileencoding/ChangeFileEncoding.java +++ b/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/changefileencoding/ChangeFileEncoding.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2018 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -140,7 +140,7 @@ public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws meta.getTargetFilenameField() ) ); } - data.sourceFile = KettleVFS.getFileObject( sourceFilename ); + data.sourceFile = KettleVFS.getInstance( getTransMeta().getBowl() ).getFileObject( sourceFilename ); // Check if source file exists if ( !data.sourceFile.exists() ) { @@ -236,7 +236,8 @@ private void changeEncoding( String sourceFilename, String targetFilename ) thro if ( meta.addTargetResultFilenames() ) { // Add this to the result file names... ResultFile resultFile = - new ResultFile( ResultFile.FILE_TYPE_GENERAL, KettleVFS.getFileObject( targetFilename ), + new ResultFile( ResultFile.FILE_TYPE_GENERAL, + KettleVFS.getInstance( getTransMeta().getBowl() ).getFileObject( targetFilename ), getTransMeta().getName(), getStepname() ); resultFile.setComment( BaseMessages.getString( PKG, "ChangeFileEncoding.Log.FileAddedResult" ) ); addResultFile( resultFile ); diff --git a/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/checksum/CheckSum.java b/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/checksum/CheckSum.java index bf0f5a758dff..f07cc2fdf47c 100644 --- a/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/checksum/CheckSum.java +++ b/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/checksum/CheckSum.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2022 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -81,7 +81,8 @@ public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws RowMetaInterface inputRowMeta = getInputRowMeta(); data.outputRowMeta = inputRowMeta.clone(); data.nrInfields = data.outputRowMeta.size(); - meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); + meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository, + metaStore ); if ( meta.getFieldSeparatorString() != null && !meta.getFieldSeparatorString().isEmpty() ) { data.fieldSeparatorStringBytes = meta.getFieldSeparatorString().getBytes( StandardCharsets.UTF_8 ); diff --git a/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/checksum/CheckSumMeta.java b/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/checksum/CheckSumMeta.java index 3d41a05734c9..0261085012c3 100644 --- a/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/checksum/CheckSumMeta.java +++ b/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/checksum/CheckSumMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2021 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -28,6 +28,7 @@ import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.Const; import org.pentaho.di.core.annotations.Step; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.injection.Injection; import org.pentaho.di.core.injection.InjectionSupported; import org.pentaho.di.core.util.Utils; @@ -573,8 +574,8 @@ public void saveRep( Repository rep, IMetaStore metaStore, ObjectId id_transform } @Override - public void getFields( RowMetaInterface inputRowMeta, String name, RowMetaInterface[] info, StepMeta nextStep, - VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { + public void getFields( Bowl bowl, RowMetaInterface inputRowMeta, String name, RowMetaInterface[] info, + StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { // Output field (String) if ( !Utils.isEmpty( resultfieldName ) ) { ValueMetaInterface v = null; diff --git a/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/clonerow/CloneRow.java b/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/clonerow/CloneRow.java index a4cdebf3849d..dcaf01643210 100644 --- a/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/clonerow/CloneRow.java +++ b/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/clonerow/CloneRow.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2018 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -68,7 +68,8 @@ public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws first = false; data.outputRowMeta = getInputRowMeta().clone(); data.NrPrevFields = getInputRowMeta().size(); - meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); + meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository, + metaStore ); data.addInfosToRow = ( meta.isAddCloneFlag() || meta.isAddCloneNum() ); if ( meta.isAddCloneFlag() ) { diff --git a/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/clonerow/CloneRowMeta.java b/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/clonerow/CloneRowMeta.java index 8cc21c8e1588..cf647cf2409e 100644 --- a/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/clonerow/CloneRowMeta.java +++ b/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/clonerow/CloneRowMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2018 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -27,6 +27,7 @@ import org.pentaho.di.core.CheckResult; import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.annotations.Step; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.database.DatabaseMeta; import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.core.exception.KettleStepException; @@ -231,7 +232,8 @@ public void saveRep( Repository rep, IMetaStore metaStore, ObjectId id_transform } } - public void getFields( RowMetaInterface rowMeta, String origin, RowMetaInterface[] info, StepMeta nextStep, + @Override + public void getFields( Bowl bowl, RowMetaInterface rowMeta, String origin, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { // Output field (boolean) ? if ( addcloneflag ) { diff --git a/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/closure/ClosureGenerator.java b/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/closure/ClosureGenerator.java index dbef63d41bc0..612da1849115 100644 --- a/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/closure/ClosureGenerator.java +++ b/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/closure/ClosureGenerator.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2018 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -65,7 +65,8 @@ public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws // Create the output row metadata // data.outputRowMeta = getInputRowMeta().clone(); - meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); + meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository, + metaStore ); // Get indexes of parent and child field // diff --git a/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/closure/ClosureGeneratorMeta.java b/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/closure/ClosureGeneratorMeta.java index 1944194e97ea..6d4c48acdf70 100644 --- a/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/closure/ClosureGeneratorMeta.java +++ b/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/closure/ClosureGeneratorMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2018 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -27,6 +27,7 @@ import org.pentaho.di.core.CheckResult; import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.annotations.Step; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.database.DatabaseMeta; import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.core.exception.KettleStepException; @@ -96,7 +97,7 @@ public void setDefault() { } @Override - public void getFields( RowMetaInterface row, String origin, RowMetaInterface[] info, StepMeta nextStep, + public void getFields( Bowl bowl, RowMetaInterface row, String origin, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { // The output for the closure table is: // diff --git a/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/columnexists/ColumnExists.java b/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/columnexists/ColumnExists.java index 8e507fd34348..c6872fdc795c 100644 --- a/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/columnexists/ColumnExists.java +++ b/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/columnexists/ColumnExists.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2018 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -70,7 +70,8 @@ public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws first = false; data.outputRowMeta = getInputRowMeta().clone(); - meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); + meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository, + metaStore ); // Check is columnname field is provided if ( Utils.isEmpty( meta.getDynamicColumnnameField() ) ) { diff --git a/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/columnexists/ColumnExistsMeta.java b/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/columnexists/ColumnExistsMeta.java index b91847075738..a0f337cad542 100644 --- a/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/columnexists/ColumnExistsMeta.java +++ b/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/columnexists/ColumnExistsMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2018 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -27,6 +27,7 @@ import org.pentaho.di.core.CheckResult; import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.annotations.Step; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.database.DatabaseMeta; import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.core.exception.KettleStepException; @@ -200,8 +201,9 @@ public void setDefault() { resultfieldname = "result"; } - public void getFields( RowMetaInterface inputRowMeta, String name, RowMetaInterface[] info, StepMeta nextStep, - VariableSpace space, Repository repository, IMetaStore metaStore ) + @Override + public void getFields( Bowl bowl, RowMetaInterface inputRowMeta, String name, RowMetaInterface[] info, + StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { // Output field (String) if ( !Utils.isEmpty( resultfieldname ) ) { diff --git a/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/combinationlookup/CombinationLookup.java b/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/combinationlookup/CombinationLookup.java index 9366d8ffff8c..04fd114b1da1 100644 --- a/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/combinationlookup/CombinationLookup.java +++ b/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/combinationlookup/CombinationLookup.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2018 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -336,7 +336,8 @@ public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws first = false; data.outputRowMeta = getInputRowMeta().clone(); - meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); + meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository, + metaStore ); data.schemaTable = meta.getDatabaseMeta().getQuotedSchemaTableCombination( data.realSchemaName, data.realTableName ); diff --git a/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/combinationlookup/CombinationLookupMeta.java b/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/combinationlookup/CombinationLookupMeta.java index 536d3b84299d..060d8a7a23ce 100644 --- a/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/combinationlookup/CombinationLookupMeta.java +++ b/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/combinationlookup/CombinationLookupMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2018 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -30,6 +30,7 @@ import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.Const; import org.pentaho.di.core.annotations.Step; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.injection.AfterInjection; import org.pentaho.di.core.util.Utils; import org.pentaho.di.core.ProvidesModelerMeta; @@ -483,7 +484,7 @@ public void setDefault() { } @Override - public void getFields( RowMetaInterface row, String origin, RowMetaInterface[] info, StepMeta nextStep, + public void getFields( Bowl bowl, RowMetaInterface row, String origin, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { ValueMetaInterface v = new ValueMetaInteger( technicalKeyField ); v.setLength( 10 ); diff --git a/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/concatfields/ConcatFields.java b/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/concatfields/ConcatFields.java index 4345546d24e8..471341bbbf4e 100644 --- a/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/concatfields/ConcatFields.java +++ b/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/concatfields/ConcatFields.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2023 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -72,13 +72,15 @@ public synchronized boolean processRow( StepMetaInterface smi, StepDataInterface data.inputRowMeta = getInputRowMeta(); data.outputRowMeta = data.inputRowMeta.clone(); - meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); + meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository, + metaStore ); // the field precisions and lengths are altered! see TextFileOutputMeta.getFields(). // otherwise trim(), padding etc. will not work data.inputRowMetaModified = getInputRowMeta().clone(); meta - .getFieldsModifyInput( data.inputRowMetaModified, getStepname(), null, null, this, repository, metaStore ); + .getFieldsModifyInput( getTransMeta().getBowl(), data.inputRowMetaModified, getStepname(), null, null, + this, repository, metaStore ); data.posTargetField = data.outputRowMeta.indexOfValue( meta.getTargetFieldName() ); if ( data.posTargetField < 0 ) { diff --git a/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/concatfields/ConcatFieldsMeta.java b/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/concatfields/ConcatFieldsMeta.java index 4c202ee3264d..19a865740fb4 100644 --- a/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/concatfields/ConcatFieldsMeta.java +++ b/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/concatfields/ConcatFieldsMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2022 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -29,6 +29,7 @@ import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.Const; import org.pentaho.di.core.annotations.Step; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.util.StringUtil; import org.pentaho.di.core.util.Utils; import org.pentaho.di.core.database.DatabaseMeta; @@ -122,20 +123,20 @@ public void setDefault() { } @Deprecated - public void getFieldsModifyInput( RowMetaInterface row, String name, RowMetaInterface[] info, StepMeta nextStep, - VariableSpace space ) throws KettleStepException { - getFieldsModifyInput( row, name, info, nextStep, space, null, null ); + public void getFieldsModifyInput( Bowl bowl, RowMetaInterface row, String name, RowMetaInterface[] info, + StepMeta nextStep, VariableSpace space ) throws KettleStepException { + getFieldsModifyInput( bowl, row, name, info, nextStep, space, null, null ); } - public void getFieldsModifyInput( RowMetaInterface row, String name, RowMetaInterface[] info, StepMeta nextStep, - VariableSpace space, Repository repository, IMetaStore metaStore ) + public void getFieldsModifyInput( Bowl bowl, RowMetaInterface row, String name, RowMetaInterface[] info, + StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { // the field precisions and lengths are altered! see TextFileOutputMeta.getFields(). - super.getFields( row, name, info, nextStep, space, repository, metaStore ); + super.getFields( bowl, row, name, info, nextStep, space, repository, metaStore ); } @Override - public void getFields( RowMetaInterface row, String name, RowMetaInterface[] info, StepMeta nextStep, + public void getFields( Bowl bowl, RowMetaInterface row, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { // do not call the super class from TextFileOutputMeta since it modifies the source meta data // see getFieldsModifyInput() instead @@ -326,7 +327,7 @@ protected void saveSource( StringBuilder retVal, String value ) { * @return Always null */ @Override - public String exportResources( VariableSpace space, Map definitions, + public String exportResources( Bowl bowl, VariableSpace space, Map definitions, ResourceNamingInterface resourceNamingInterface, Repository repository, IMetaStore metaStore ) throws KettleException { diff --git a/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/cubeinput/CubeInput.java b/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/cubeinput/CubeInput.java index 084d905781a8..d7df8ae71c2c 100644 --- a/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/cubeinput/CubeInput.java +++ b/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/cubeinput/CubeInput.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2019 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -102,13 +102,14 @@ public CubeInput( StepMeta stepMeta, StepDataInterface stepDataInterface, int co if ( meta.isAddResultFile() ) { ResultFile resultFile = new ResultFile( - ResultFile.FILE_TYPE_GENERAL, KettleVFS.getFileObject( filename, getTransMeta() ), + ResultFile.FILE_TYPE_GENERAL, KettleVFS.getInstance( getTransMeta().getBowl() ) + .getFileObject( filename, getTransMeta() ), getTransMeta().getName(), toString() ); resultFile.setComment( "File was read by a Cube Input step" ); addResultFile( resultFile ); } - data.fis = KettleVFS.getInputStream( filename, this ); + data.fis = KettleVFS.getInstance( getTransMeta().getBowl() ).getInputStream( filename, this ); data.zip = new GZIPInputStream( data.fis ); data.dis = new DataInputStream( data.zip ); diff --git a/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/cubeinput/CubeInputMeta.java b/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/cubeinput/CubeInputMeta.java index b51299f17d71..06286582438a 100644 --- a/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/cubeinput/CubeInputMeta.java +++ b/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/cubeinput/CubeInputMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2019 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -34,6 +34,7 @@ import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.Const; import org.pentaho.di.core.annotations.Step; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.database.DatabaseMeta; import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.core.exception.KettleFileException; @@ -159,13 +160,13 @@ private void readData( Node stepnode ) throws KettleXMLException { addfilenameresult = false; } - @Override public void getFields( RowMetaInterface r, String name, RowMetaInterface[] info, StepMeta nextStep, + @Override public void getFields( Bowl bowl, RowMetaInterface r, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { GZIPInputStream fis = null; DataInputStream dis = null; try { - InputStream is = KettleVFS.getInputStream( space.environmentSubstitute( filename ), space ); + InputStream is = KettleVFS.getInstance( bowl ).getInputStream( space.environmentSubstitute( filename ), space ); fis = new GZIPInputStream( is ); dis = new DataInputStream( fis ); @@ -270,7 +271,7 @@ private void readData( Node stepnode ) throws KettleXMLException { * * @return the filename of the exported resource */ - @Override public String exportResources( VariableSpace space, Map definitions, + @Override public String exportResources( Bowl bowl, VariableSpace space, Map definitions, ResourceNamingInterface resourceNamingInterface, Repository repository, IMetaStore metaStore ) throws KettleException { try { @@ -280,7 +281,8 @@ private void readData( Node stepnode ) throws KettleXMLException { // From : ${Internal.Transformation.Filename.Directory}/../foo/bar.data // To : /home/matt/test/files/foo/bar.data // - FileObject fileObject = KettleVFS.getFileObject( space.environmentSubstitute( filename ), space ); + FileObject fileObject = KettleVFS.getInstance( bowl ) + .getFileObject( space.environmentSubstitute( filename ), space ); // If the file doesn't exist, forget about this effort too! // diff --git a/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/cubeoutput/CubeOutput.java b/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/cubeoutput/CubeOutput.java index 855bb5ad6426..2b3fe669697c 100644 --- a/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/cubeoutput/CubeOutput.java +++ b/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/cubeoutput/CubeOutput.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2019 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -183,13 +183,13 @@ private void prepareFile() throws KettleFileException { // Add this to the result file names... ResultFile resultFile = new ResultFile( - ResultFile.FILE_TYPE_GENERAL, KettleVFS.getFileObject( filename, getTransMeta() ), getTransMeta() - .getName(), getStepname() ); + ResultFile.FILE_TYPE_GENERAL, KettleVFS.getInstance( getTransMeta().getBowl() ) + .getFileObject( filename, getTransMeta() ), getTransMeta().getName(), getStepname() ); resultFile.setComment( "This file was created with a cube file output step" ); addResultFile( resultFile ); } - data.fos = KettleVFS.getOutputStream( filename, getTransMeta(), false ); + data.fos = KettleVFS.getInstance( getTransMeta().getBowl() ).getOutputStream( filename, getTransMeta(), false ); data.zip = new GZIPOutputStream( data.fos ); data.dos = new DataOutputStream( data.zip ); } catch ( Exception e ) { diff --git a/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/cubeoutput/CubeOutputMeta.java b/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/cubeoutput/CubeOutputMeta.java index 5d3119e514b1..34af98e48d7c 100644 --- a/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/cubeoutput/CubeOutputMeta.java +++ b/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/cubeoutput/CubeOutputMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2019 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -30,6 +30,7 @@ import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.Const; import org.pentaho.di.core.annotations.Step; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.database.DatabaseMeta; import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.core.exception.KettleXMLException; @@ -225,8 +226,10 @@ public StepDataInterface getStepData() { * * @return the filename of the exported resource */ - public String exportResources( VariableSpace space, Map definitions, - ResourceNamingInterface resourceNamingInterface, Repository repository, IMetaStore metaStore ) throws KettleException { + @Override + public String exportResources( Bowl bowl, VariableSpace space, Map definitions, + ResourceNamingInterface resourceNamingInterface, Repository repository, IMetaStore metaStore ) + throws KettleException { try { // The object that we're modifying here is a copy of the original! // So let's change the filename from relative to absolute by grabbing the file object... @@ -234,7 +237,7 @@ public String exportResources( VariableSpace space, MapemptyList(), "", options ); + KettleReportBuilder builder = new KettleReportBuilder( DefaultBowl.getInstance(), log, + Collections.emptyList(), "", options ); builder.createReport(); assertNotNull( builder.getReport() ); diff --git a/plugins/core/impl/src/test/java/org/pentaho/di/trans/steps/concatfields/ConcatFieldsMetaTest.java b/plugins/core/impl/src/test/java/org/pentaho/di/trans/steps/concatfields/ConcatFieldsMetaTest.java index 908c5ca55b5b..8c68744de9e2 100644 --- a/plugins/core/impl/src/test/java/org/pentaho/di/trans/steps/concatfields/ConcatFieldsMetaTest.java +++ b/plugins/core/impl/src/test/java/org/pentaho/di/trans/steps/concatfields/ConcatFieldsMetaTest.java @@ -26,6 +26,7 @@ import org.junit.BeforeClass; import org.junit.ClassRule; import org.junit.Test; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.KettleEnvironment; import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.core.util.StringUtil; @@ -106,7 +107,7 @@ public void testFileNameHandling() throws KettleException, IOException { // 'exportResources' will always return 'null' concatFieldsMeta = new ConcatFieldsMeta(); concatFieldsMeta.setOutputFields( new TextFileField[] {} ); - assertNull( concatFieldsMeta.exportResources( mock( VariableSpace.class ), new HashMap<>(), + assertNull( concatFieldsMeta.exportResources( mock( Bowl.class ), mock( VariableSpace.class ), new HashMap<>(), mock( ResourceNamingInterface.class ), mock( Repository.class ), mock( IMetaStore.class ) ) ); diff --git a/plugins/core/impl/src/test/java/org/pentaho/di/trans/steps/concatfields/ConcatFieldsTest.java b/plugins/core/impl/src/test/java/org/pentaho/di/trans/steps/concatfields/ConcatFieldsTest.java index 45350c2f8a6a..7f5f0fe3a9da 100644 --- a/plugins/core/impl/src/test/java/org/pentaho/di/trans/steps/concatfields/ConcatFieldsTest.java +++ b/plugins/core/impl/src/test/java/org/pentaho/di/trans/steps/concatfields/ConcatFieldsTest.java @@ -26,6 +26,7 @@ import org.junit.Assert; import org.junit.Before; import org.junit.Test; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.Const; import org.pentaho.di.core.RowSet; import org.pentaho.di.core.exception.KettleException; @@ -184,7 +185,7 @@ public void testWriteHeaderWithoutFields() throws Exception { when( stepMockHelper.processRowsStepMetaInterface.getTargetFieldName() ).thenCallRealMethod(); doCallRealMethod().when( stepMockHelper.processRowsStepMetaInterface ).getFields( - any( RowMetaInterface.class ), any( String.class ), any(), nullable( StepMeta.class ), + any( Bowl.class ), any( RowMetaInterface.class ), any( String.class ), any(), nullable( StepMeta.class ), nullable( VariableSpace.class ), nullable( Repository.class ), nullable( IMetaStore.class ) ); stepMockHelper.processRowsStepMetaInterface.setTargetFieldName( "target_result" ); @@ -258,7 +259,7 @@ private ConcatFieldsHandler createConcatFieldsHandler( List rows ) thr when( stepMockHelper.processRowsStepMetaInterface.getTargetFieldName() ).thenCallRealMethod(); doCallRealMethod().when( stepMockHelper.processRowsStepMetaInterface ).setTargetFieldName( any( String.class ) ); doCallRealMethod().when( stepMockHelper.processRowsStepMetaInterface ).getFields( - any( RowMetaInterface.class ), any( String.class ), any(), any( StepMeta.class ), + any( Bowl.class ), any( RowMetaInterface.class ), any( String.class ), any(), any( StepMeta.class ), any( VariableSpace.class ), any( Repository.class ), any( IMetaStore.class ) ); stepMockHelper.processRowsStepMetaInterface.setTargetFieldName( "target_result" ); diff --git a/plugins/credit-card-validator/impl/src/main/java/org/pentaho/di/trans/steps/creditcardvalidator/CreditCardValidator.java b/plugins/credit-card-validator/impl/src/main/java/org/pentaho/di/trans/steps/creditcardvalidator/CreditCardValidator.java index 80e2cae0a9f8..c20b53fb5732 100644 --- a/plugins/credit-card-validator/impl/src/main/java/org/pentaho/di/trans/steps/creditcardvalidator/CreditCardValidator.java +++ b/plugins/credit-card-validator/impl/src/main/java/org/pentaho/di/trans/steps/creditcardvalidator/CreditCardValidator.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2023 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -79,7 +79,8 @@ public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws data.previousRowMeta = getInputRowMeta().clone(); data.NrPrevFields = data.previousRowMeta.size(); data.outputRowMeta = data.previousRowMeta; - meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); + meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository, + metaStore ); // Check if field is provided if ( Utils.isEmpty( meta.getDynamicField() ) ) { diff --git a/plugins/credit-card-validator/impl/src/main/java/org/pentaho/di/trans/steps/creditcardvalidator/CreditCardValidatorMeta.java b/plugins/credit-card-validator/impl/src/main/java/org/pentaho/di/trans/steps/creditcardvalidator/CreditCardValidatorMeta.java index be689988c10a..7c2bcfb826e4 100644 --- a/plugins/credit-card-validator/impl/src/main/java/org/pentaho/di/trans/steps/creditcardvalidator/CreditCardValidatorMeta.java +++ b/plugins/credit-card-validator/impl/src/main/java/org/pentaho/di/trans/steps/creditcardvalidator/CreditCardValidatorMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2023 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -50,6 +50,7 @@ import org.pentaho.metastore.api.IMetaStore; import org.w3c.dom.Node; import org.pentaho.di.core.annotations.Step; +import org.pentaho.di.core.bowl.Bowl; /* * Created on 03-Juin-2008 @@ -167,8 +168,9 @@ public void setDefault() { notvalidmsg = "not valid message"; } - public void getFields( RowMetaInterface inputRowMeta, String name, RowMetaInterface[] info, StepMeta nextStep, - VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { + @Override + public void getFields( Bowl bowl, RowMetaInterface inputRowMeta, String name, RowMetaInterface[] info, + StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { String realresultfieldname = space.environmentSubstitute( resultfieldname ); if ( !Utils.isEmpty( realresultfieldname ) ) { ValueMetaInterface v = new ValueMetaBoolean( realresultfieldname ); diff --git a/plugins/credit-card-validator/impl/src/test/java/org/pentaho/di/trans/steps/creditcardvalidator/CreditCardValidatorMetaTest.java b/plugins/credit-card-validator/impl/src/test/java/org/pentaho/di/trans/steps/creditcardvalidator/CreditCardValidatorMetaTest.java index 7a84c18e9c31..b324413a900a 100644 --- a/plugins/credit-card-validator/impl/src/test/java/org/pentaho/di/trans/steps/creditcardvalidator/CreditCardValidatorMetaTest.java +++ b/plugins/credit-card-validator/impl/src/test/java/org/pentaho/di/trans/steps/creditcardvalidator/CreditCardValidatorMetaTest.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2023 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -31,6 +31,7 @@ import org.junit.ClassRule; import org.junit.Test; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.core.exception.KettleStepException; import org.pentaho.di.core.row.RowMeta; @@ -76,7 +77,7 @@ public void testGetFields() throws KettleStepException { meta.setNotValidMsg( "Is Card Valid" ); RowMeta rowMeta = new RowMeta(); - meta.getFields( rowMeta, "this step", null, null, new Variables(), null, null ); + meta.getFields( DefaultBowl.getInstance(), rowMeta, "this step", null, null, new Variables(), null, null ); assertEquals( 3, rowMeta.size() ); assertEquals( "The Result Field", rowMeta.getValueMeta( 0 ).getName() ); assertEquals( ValueMetaInterface.TYPE_BOOLEAN, rowMeta.getValueMeta( 0 ).getType() ); diff --git a/plugins/drools/core/src/main/java/org/pentaho/di/trans/steps/rules/RulesAccumulator.java b/plugins/drools/core/src/main/java/org/pentaho/di/trans/steps/rules/RulesAccumulator.java index 154c8dd75056..915f488963c9 100644 --- a/plugins/drools/core/src/main/java/org/pentaho/di/trans/steps/rules/RulesAccumulator.java +++ b/plugins/drools/core/src/main/java/org/pentaho/di/trans/steps/rules/RulesAccumulator.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -60,7 +60,8 @@ public boolean runtimeInit() throws KettleStepException { try { data.setOutputRowMeta( getInputRowMeta().clone() ); meta.setKeepInputFields( false ); - meta.getFields( data.getOutputRowMeta(), getStepname(), null, null, this, repository, metaStore ); + meta.getFields( getTransMeta().getBowl(), data.getOutputRowMeta(), getStepname(), null, null, this, repository, + metaStore ); data.setRuleFilePath( meta.getRuleFile() ); data.setRuleString( meta.getRuleDefinition() ); diff --git a/plugins/drools/core/src/main/java/org/pentaho/di/trans/steps/rules/RulesAccumulatorMeta.java b/plugins/drools/core/src/main/java/org/pentaho/di/trans/steps/rules/RulesAccumulatorMeta.java index c532de74e283..603a85d7f7dc 100644 --- a/plugins/drools/core/src/main/java/org/pentaho/di/trans/steps/rules/RulesAccumulatorMeta.java +++ b/plugins/drools/core/src/main/java/org/pentaho/di/trans/steps/rules/RulesAccumulatorMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2019 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -27,6 +27,7 @@ import org.pentaho.di.core.Const; import org.pentaho.di.core.annotations.Step; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.database.DatabaseMeta; import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.core.exception.KettleStepException; @@ -212,7 +213,7 @@ public void setDefault() { } @Override - public void getFields( RowMetaInterface row, String origin, RowMetaInterface[] info, StepMeta nextStep, + public void getFields( Bowl bowl, RowMetaInterface row, String origin, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { if ( !keepInputFields ) { row.clear(); diff --git a/plugins/drools/core/src/main/java/org/pentaho/di/trans/steps/rules/RulesExecutor.java b/plugins/drools/core/src/main/java/org/pentaho/di/trans/steps/rules/RulesExecutor.java index 8989f0cfadf7..0e68afdceafc 100644 --- a/plugins/drools/core/src/main/java/org/pentaho/di/trans/steps/rules/RulesExecutor.java +++ b/plugins/drools/core/src/main/java/org/pentaho/di/trans/steps/rules/RulesExecutor.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -70,7 +70,8 @@ public boolean init( StepMetaInterface smi, StepDataInterface sdi ) { public boolean runtimeInit() throws KettleStepException { data.setOutputRowMeta( getInputRowMeta().clone() ); - meta.getFields( data.getOutputRowMeta(), getStepname(), null, null, this, repository, metaStore ); + meta.getFields( getTransMeta().getBowl(), data.getOutputRowMeta(), getStepname(), null, null, this, repository, + metaStore ); data.setRuleFilePath( meta.getRuleFile() ); data.setRuleString( meta.getRuleDefinition() ); diff --git a/plugins/drools/core/src/main/java/org/pentaho/di/trans/steps/rules/RulesExecutorMeta.java b/plugins/drools/core/src/main/java/org/pentaho/di/trans/steps/rules/RulesExecutorMeta.java index 9fbb724ae5ba..9dc93fce51af 100644 --- a/plugins/drools/core/src/main/java/org/pentaho/di/trans/steps/rules/RulesExecutorMeta.java +++ b/plugins/drools/core/src/main/java/org/pentaho/di/trans/steps/rules/RulesExecutorMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2019 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -27,6 +27,7 @@ import org.pentaho.di.core.Const; import org.pentaho.di.core.annotations.Step; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.database.DatabaseMeta; import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.core.exception.KettleStepException; @@ -219,7 +220,7 @@ public void setDefault() { } @Override - public void getFields( RowMetaInterface row, String origin, RowMetaInterface[] info, StepMeta nextStep, + public void getFields( Bowl bowl, RowMetaInterface row, String origin, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { if ( !keepInputFields ) { row.clear(); diff --git a/plugins/dummy/core/src/main/java/org/pentaho/di/be/ibridge/kettle/dummy/DummyPlugin.java b/plugins/dummy/core/src/main/java/org/pentaho/di/be/ibridge/kettle/dummy/DummyPlugin.java index dc1cba7c57a7..099a86a3366c 100644 --- a/plugins/dummy/core/src/main/java/org/pentaho/di/be/ibridge/kettle/dummy/DummyPlugin.java +++ b/plugins/dummy/core/src/main/java/org/pentaho/di/be/ibridge/kettle/dummy/DummyPlugin.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -64,7 +64,7 @@ public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws first = false; data.outputRowMeta = getInputRowMeta().clone(); - meta.getFields( data.outputRowMeta, getStepname(), null, null, this ); + meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this ); } Object extraValue = meta.getValue().getValueData(); diff --git a/plugins/dummy/core/src/main/java/org/pentaho/di/be/ibridge/kettle/dummy/DummyPluginMeta.java b/plugins/dummy/core/src/main/java/org/pentaho/di/be/ibridge/kettle/dummy/DummyPluginMeta.java index 0c74a0c162c8..1b5b32482817 100644 --- a/plugins/dummy/core/src/main/java/org/pentaho/di/be/ibridge/kettle/dummy/DummyPluginMeta.java +++ b/plugins/dummy/core/src/main/java/org/pentaho/di/be/ibridge/kettle/dummy/DummyPluginMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2019 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -25,6 +25,7 @@ import org.eclipse.swt.widgets.*; import org.pentaho.di.core.*; import org.pentaho.di.core.annotations.*; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.database.*; import org.pentaho.di.core.exception.*; import org.pentaho.di.core.row.*; @@ -86,7 +87,8 @@ public String getXML() throws KettleException { } @Override - public void getFields( RowMetaInterface r, String origin, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space ) { + public void getFields( Bowl bowl, RowMetaInterface r, String origin, RowMetaInterface[] info, StepMeta nextStep, + VariableSpace space ) { if ( value != null ) { ValueMetaInterface v = value.getValueMeta(); v.setOrigin( origin ); diff --git a/plugins/edi2xml/impl/src/main/java/org/pentaho/di/trans/steps/edi2xml/Edi2Xml.java b/plugins/edi2xml/impl/src/main/java/org/pentaho/di/trans/steps/edi2xml/Edi2Xml.java index 37b4be04a637..13d0d7198db0 100644 --- a/plugins/edi2xml/impl/src/main/java/org/pentaho/di/trans/steps/edi2xml/Edi2Xml.java +++ b/plugins/edi2xml/impl/src/main/java/org/pentaho/di/trans/steps/edi2xml/Edi2Xml.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2022 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -75,7 +75,8 @@ public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws data.inputRowMeta = getInputRowMeta().clone(); data.outputRowMeta = getInputRowMeta().clone(); - meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); + meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository, + metaStore ); String realInputField = environmentSubstitute( meta.getInputField() ); String realOutputField = environmentSubstitute( meta.getOutputField() ); diff --git a/plugins/edi2xml/impl/src/main/java/org/pentaho/di/trans/steps/edi2xml/Edi2XmlMeta.java b/plugins/edi2xml/impl/src/main/java/org/pentaho/di/trans/steps/edi2xml/Edi2XmlMeta.java index 6dcb351f622e..ca9e2df2410b 100644 --- a/plugins/edi2xml/impl/src/main/java/org/pentaho/di/trans/steps/edi2xml/Edi2XmlMeta.java +++ b/plugins/edi2xml/impl/src/main/java/org/pentaho/di/trans/steps/edi2xml/Edi2XmlMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2022 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -49,6 +49,7 @@ import org.pentaho.metastore.api.IMetaStore; import org.w3c.dom.Node; import org.pentaho.di.core.annotations.Step; +import org.pentaho.di.core.bowl.Bowl; @Step( id = "TypeExitEdi2XmlStep", name = "BaseStep.TypeLongDesc.Edi2Xml", description = "BaseStep.TypeTooltipDesc.Edi2Xml", @@ -129,7 +130,7 @@ public void saveRep( Repository rep, IMetaStore metaStore, ObjectId id_transform } @Override - public void getFields( RowMetaInterface r, String origin, RowMetaInterface[] info, StepMeta nextStep, + public void getFields( Bowl bowl, RowMetaInterface r, String origin, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) { ValueMetaInterface extra = null; diff --git a/plugins/elasticsearch-bulk-insert/core/src/main/java/org/pentaho/di/trans/steps/elasticsearchbulk/ElasticSearchBulk.java b/plugins/elasticsearch-bulk-insert/core/src/main/java/org/pentaho/di/trans/steps/elasticsearchbulk/ElasticSearchBulk.java index 1af34a9f0e7d..b2f67db8dfa8 100644 --- a/plugins/elasticsearch-bulk-insert/core/src/main/java/org/pentaho/di/trans/steps/elasticsearchbulk/ElasticSearchBulk.java +++ b/plugins/elasticsearch-bulk-insert/core/src/main/java/org/pentaho/di/trans/steps/elasticsearchbulk/ElasticSearchBulk.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2018 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -158,7 +158,8 @@ private void setupData() throws KettleStepException { data.inputRowMeta = getInputRowMeta().clone(); // only available after first getRow(); data.inputRowBuffer = new Object[batchSize][]; data.outputRowMeta = data.inputRowMeta.clone(); - meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); + meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository, + metaStore ); } private void initFieldIndexes() throws KettleStepException { diff --git a/plugins/elasticsearch-bulk-insert/core/src/main/java/org/pentaho/di/trans/steps/elasticsearchbulk/ElasticSearchBulkMeta.java b/plugins/elasticsearch-bulk-insert/core/src/main/java/org/pentaho/di/trans/steps/elasticsearchbulk/ElasticSearchBulkMeta.java index 7e45be30cc07..e0a7f4b4c06d 100644 --- a/plugins/elasticsearch-bulk-insert/core/src/main/java/org/pentaho/di/trans/steps/elasticsearchbulk/ElasticSearchBulkMeta.java +++ b/plugins/elasticsearch-bulk-insert/core/src/main/java/org/pentaho/di/trans/steps/elasticsearchbulk/ElasticSearchBulkMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2019 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -27,6 +27,7 @@ import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.Const; import org.pentaho.di.core.annotations.Step; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.database.DatabaseMeta; import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.core.exception.KettleStepException; @@ -380,7 +381,8 @@ public void setDefault() { } /* This function adds meta data to the rows being pushed out */ - public void getFields( RowMetaInterface r, String name, RowMetaInterface[] info, StepMeta nextStep, + @Override + public void getFields( Bowl bowl, RowMetaInterface r, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { if ( StringUtils.isNotBlank( this.getIdOutField() ) ) { ValueMetaInterface valueMeta = new ValueMetaString( space.environmentSubstitute( this.getIdOutField() ) ); diff --git a/plugins/email-messages/impl/src/main/java/org/pentaho/di/job/entries/getpop/JobEntryGetPOP.java b/plugins/email-messages/impl/src/main/java/org/pentaho/di/job/entries/getpop/JobEntryGetPOP.java index a9f15414e203..fda5dba3a392 100644 --- a/plugins/email-messages/impl/src/main/java/org/pentaho/di/job/entries/getpop/JobEntryGetPOP.java +++ b/plugins/email-messages/impl/src/main/java/org/pentaho/di/job/entries/getpop/JobEntryGetPOP.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2023 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -927,8 +927,9 @@ && getAfterGetIMAP() == MailConnectionMeta.AFTER_GET_IMAP_MOVE ) ) { // create a mail connection object mailConn = new MailConnection( - log, MailConnectionMeta.getProtocolFromString( getProtocol(), MailConnectionMeta.PROTOCOL_IMAP ), - realserver, realport, realusername, realpassword, isUseSSL(), isUseProxy(), realProxyUsername ); + parentJobMeta.getBowl(), log, MailConnectionMeta.getProtocolFromString( getProtocol(), + MailConnectionMeta.PROTOCOL_IMAP ), realserver, realport, realusername, realpassword, isUseSSL(), + isUseProxy(), realProxyUsername ); // connect mailConn.connect(); @@ -1296,20 +1297,20 @@ private void initVariables() { public void check( List remarks, JobMeta jobMeta, VariableSpace space, Repository repository, IMetaStore metaStore ) { - JobEntryValidatorUtils.andValidator().validate( this, "serverName", remarks, + JobEntryValidatorUtils.andValidator().validate( jobMeta.getBowl(), this, "serverName", remarks, AndValidator.putValidators( JobEntryValidatorUtils.notBlankValidator() ) ); - JobEntryValidatorUtils.andValidator().validate( this, "userName", remarks, + JobEntryValidatorUtils.andValidator().validate( jobMeta.getBowl(), this, "userName", remarks, AndValidator.putValidators( JobEntryValidatorUtils.notBlankValidator() ) ); - JobEntryValidatorUtils.andValidator().validate( this, "password", remarks, + JobEntryValidatorUtils.andValidator().validate( jobMeta.getBowl(), this, "password", remarks, AndValidator.putValidators( JobEntryValidatorUtils.notNullValidator() ) ); ValidatorContext ctx = new ValidatorContext(); AbstractFileValidator.putVariableSpace( ctx, getVariables() ); AndValidator.putValidators( ctx, JobEntryValidatorUtils.notBlankValidator(), JobEntryValidatorUtils.fileExistsValidator() ); - JobEntryValidatorUtils.andValidator().validate( this, "outputDirectory", remarks, ctx ); + JobEntryValidatorUtils.andValidator().validate( jobMeta.getBowl(), this, "outputDirectory", remarks, ctx ); - JobEntryValidatorUtils.andValidator().validate( this, "SSLPort", remarks, + JobEntryValidatorUtils.andValidator().validate( jobMeta.getBowl(), this, "SSLPort", remarks, AndValidator.putValidators( JobEntryValidatorUtils.integerValidator() ) ); } @@ -1351,7 +1352,7 @@ String createOutputDirectory( int folderType ) throws KettleException, FileSyste .getString( PKG, "JobGetMailsFromPOP.Error.AttachmentFolderEmpty" ) ); } } - FileObject folder = KettleVFS.getFileObject( folderName, this ); + FileObject folder = KettleVFS.getInstance( parentJobMeta.getBowl() ).getFileObject( folderName, this ); if ( folder.exists() ) { if ( folder.getType() != FileType.FOLDER ) { switch ( folderType ) { diff --git a/plugins/email-messages/impl/src/main/java/org/pentaho/di/job/entries/getpop/MailConnection.java b/plugins/email-messages/impl/src/main/java/org/pentaho/di/job/entries/getpop/MailConnection.java index 71a9f6b0e34d..f24747729fcf 100644 --- a/plugins/email-messages/impl/src/main/java/org/pentaho/di/job/entries/getpop/MailConnection.java +++ b/plugins/email-messages/impl/src/main/java/org/pentaho/di/job/entries/getpop/MailConnection.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2023 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -27,6 +27,7 @@ import com.sun.mail.pop3.POP3SSLStore; import org.apache.commons.io.FilenameUtils; import org.apache.commons.io.IOUtils; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.Const; import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.core.logging.LogChannelInterface; @@ -140,6 +141,7 @@ public class MailConnection { private Folder destinationIMAPFolder = null; private LogChannelInterface log; + private Bowl bowl; /** * Construct a new Database MailConnection @@ -158,10 +160,11 @@ public class MailConnection { * @param proxyusername * proxy authorised user */ - public MailConnection( LogChannelInterface log, int protocol, String server, int port, String username, + public MailConnection( Bowl bowl, LogChannelInterface log, int protocol, String server, int port, String username, String password, boolean usessl, boolean useproxy, String proxyusername ) throws KettleException { this.log = log; + this.bowl = bowl; // Get system properties try { @@ -731,7 +734,8 @@ public void disconnect( boolean expunge ) throws KettleException { public void saveMessageContentToFile( String filename, String foldername ) throws KettleException { OutputStream os = null; try { - os = KettleVFS.getOutputStream( foldername + ( foldername.endsWith( "/" ) ? "" : "/" ) + filename, false ); + os = KettleVFS.getInstance( bowl ) + .getOutputStream( foldername + ( foldername.endsWith( "/" ) ? "" : "/" ) + filename, false ); getMessage().writeTo( os ); updateSavedMessagesCounter(); } catch ( Exception e ) { @@ -812,7 +816,7 @@ private void handlePart( String foldername, Part part, Pattern pattern ) throws String filename = MimeUtility.decodeText( part.getFileName() ); if ( isWildcardMatch( filename, pattern ) ) { // Save file - saveFile( foldername, filename, part.getInputStream() ); + saveFile( bowl, foldername, filename, part.getInputStream() ); updateSavedAttachedFilesCounter(); if ( log.isDetailed() ) { log.logDetailed( BaseMessages.getString( PKG, "JobGetMailsFromPOP.AttachedFileSaved", filename, "" @@ -827,7 +831,7 @@ private void handlePart( String foldername, Part part, Pattern pattern ) throws } @VisibleForTesting - static String findValidTarget( String folderName, final String fileName ) throws KettleException { + static String findValidTarget( Bowl bowl, String folderName, final String fileName ) throws KettleException { if ( fileName == null || folderName == null ) { throw new IllegalArgumentException( "Cannot have null arguments to findValidTarget" ); } @@ -844,12 +848,13 @@ static String findValidTarget( String folderName, final String fileName ) throws build.setLength( baseSz ); // bring string back to size build.append( i > 0 ? Integer.toString( i ) : "" ).append( ext ); rtn = build.toString(); - } while ( KettleVFS.fileExists( rtn ) ); + } while ( KettleVFS.getInstance( bowl ).fileExists( rtn ) ); return rtn; } - private static void saveFile( String foldername, String filename, InputStream input ) throws KettleException { + private static void saveFile( Bowl bowl, String foldername, String filename, InputStream input ) + throws KettleException { OutputStream fos = null; BufferedOutputStream bos = null; BufferedInputStream bis = null; @@ -862,9 +867,9 @@ private static void saveFile( String foldername, String filename, InputStream in filename = f.getName(); targetFileName = foldername + "/" + filename; // Note - createTempFile Used - so will be unique } else { - targetFileName = findValidTarget( foldername, filename ); + targetFileName = findValidTarget( bowl, foldername, filename ); } - fos = KettleVFS.getOutputStream( targetFileName, false ); + fos = KettleVFS.getInstance( bowl ).getOutputStream( targetFileName, false ); bos = new BufferedOutputStream( fos ); bis = new BufferedInputStream( input ); IOUtils.copy( bis, bos ); diff --git a/plugins/email-messages/impl/src/main/java/org/pentaho/di/trans/steps/mailinput/MailInput.java b/plugins/email-messages/impl/src/main/java/org/pentaho/di/trans/steps/mailinput/MailInput.java index e7e23cb07999..da86fc268e6a 100644 --- a/plugins/email-messages/impl/src/main/java/org/pentaho/di/trans/steps/mailinput/MailInput.java +++ b/plugins/email-messages/impl/src/main/java/org/pentaho/di/trans/steps/mailinput/MailInput.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2023 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -279,7 +279,8 @@ private boolean openNextFolder() { data.inputRowMeta = getInputRowMeta(); data.outputRowMeta = data.inputRowMeta.clone(); - meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); + meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository, + metaStore ); // Get total previous fields data.totalpreviousfields = data.inputRowMeta.size(); @@ -385,9 +386,8 @@ public boolean init( StepMetaInterface smi, StepDataInterface sdi ) { try { // Create the output row meta-data data.outputRowMeta = new RowMeta(); - meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); // get the - // metadata - // populated + meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository, + metaStore ); // get the metadata populated } catch ( Exception e ) { logError( BaseMessages.getString( PKG, "MailInput.ErrorInit", e.toString() ) ); @@ -461,7 +461,7 @@ public boolean init( StepMetaInterface smi, StepDataInterface sdi ) { // create a mail connection object data.mailConn = new MailConnection( - log, MailConnectionMeta.getProtocolFromString( + getTransMeta().getBowl(), log, MailConnectionMeta.getProtocolFromString( meta.getProtocol(), MailConnectionMeta.PROTOCOL_IMAP ), realserver, realport, realusername, realpassword, meta.isUseSSL(), meta.isUseProxy(), realProxyUsername ); // connect diff --git a/plugins/email-messages/impl/src/main/java/org/pentaho/di/trans/steps/mailinput/MailInputMeta.java b/plugins/email-messages/impl/src/main/java/org/pentaho/di/trans/steps/mailinput/MailInputMeta.java index 355034c9939a..9668fb114fb0 100644 --- a/plugins/email-messages/impl/src/main/java/org/pentaho/di/trans/steps/mailinput/MailInputMeta.java +++ b/plugins/email-messages/impl/src/main/java/org/pentaho/di/trans/steps/mailinput/MailInputMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2023 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -28,6 +28,7 @@ import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.Const; import org.pentaho.di.core.annotations.Step; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.util.Utils; import org.pentaho.di.core.database.DatabaseMeta; import org.pentaho.di.core.encryption.Encr; @@ -741,7 +742,7 @@ public StepDataInterface getStepData() { } @Override - public void getFields( RowMetaInterface r, String name, RowMetaInterface[] info, StepMeta nextStep, + public void getFields( Bowl bowl, RowMetaInterface r, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { int i; for ( i = 0; i < inputFields.length; i++ ) { diff --git a/plugins/email-messages/impl/src/test/java/org/pentaho/di/job/entries/getpop/JobEntryGetPOPTest.java b/plugins/email-messages/impl/src/test/java/org/pentaho/di/job/entries/getpop/JobEntryGetPOPTest.java index 625bcfb0d0bf..c73cd3aac492 100644 --- a/plugins/email-messages/impl/src/test/java/org/pentaho/di/job/entries/getpop/JobEntryGetPOPTest.java +++ b/plugins/email-messages/impl/src/test/java/org/pentaho/di/job/entries/getpop/JobEntryGetPOPTest.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2023 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -48,6 +48,7 @@ import org.pentaho.di.core.logging.LogLevel; import org.pentaho.di.i18n.BaseMessages; import org.pentaho.di.job.Job; +import org.pentaho.di.job.JobMeta; import org.pentaho.di.utils.TestUtils; public class JobEntryGetPOPTest { @@ -67,6 +68,7 @@ public void before() throws IOException, KettleException, MessagingException { Mockito.when( parentJob.getLogLevel() ).thenReturn( LogLevel.BASIC ); entry.setParentJob( parentJob ); + entry.setParentJobMeta( new JobMeta() ); entry.setSaveMessage( true ); Mockito.when( message.getMessageNumber() ).thenReturn( 1 ); diff --git a/plugins/email-messages/impl/src/test/java/org/pentaho/di/job/entries/getpop/MailConnectionTest.java b/plugins/email-messages/impl/src/test/java/org/pentaho/di/job/entries/getpop/MailConnectionTest.java index 0a99e151ab2e..282c5b066d2a 100644 --- a/plugins/email-messages/impl/src/test/java/org/pentaho/di/job/entries/getpop/MailConnectionTest.java +++ b/plugins/email-messages/impl/src/test/java/org/pentaho/di/job/entries/getpop/MailConnectionTest.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2023 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -27,6 +27,7 @@ import org.mockito.Mockito; import org.mockito.invocation.InvocationOnMock; import org.mockito.stubbing.Answer; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.core.logging.LogChannel; import org.pentaho.di.core.logging.LogChannelInterface; @@ -112,14 +113,14 @@ public void findValidTargetTest() throws IOException, KettleException { // Should now have six files in the tmp folder... // with extensions: {tempdir}/pdi17713-0.junk, {tempdir}/pdi17713-1.junk, and {tempdir}/pdi17713-2.junk // without extensions: {tempdir}/pdi17713-0, {tempdir}/pdi17713-1, and {tempdir}/pdi17713-2 - String validTargetTestRtn = MailConnection.findValidTarget( tmpFileLocation, aBaseFile ); + String validTargetTestRtn = MailConnection.findValidTarget( DefaultBowl.getInstance(), tmpFileLocation, aBaseFile ); // Tests that if the base file doesn't already exist (like IMG00003.png), it will use that one Assert.assertTrue( "Original file name should be tried first.", validTargetTestRtn.endsWith( aBaseFile ) ); // Make sure that the target file already exists so it has to try to find the next available one makeAFile( tmpFileLocation + aBaseFile ); - validTargetTestRtn = MailConnection.findValidTarget( tmpFileLocation, aBaseFile ); + validTargetTestRtn = MailConnection.findValidTarget( DefaultBowl.getInstance(), tmpFileLocation, aBaseFile ); // Tests that next available file has a "-3" because 0, 1, and 2 are taken Assert.assertTrue( "File extension test failed - expected pdi17713-3.junk as file name", validTargetTestRtn.endsWith( "pdi17713-3.junk" ) ); @@ -128,24 +129,24 @@ public void findValidTargetTest() throws IOException, KettleException { //********************************** aBaseFile = "pdi17713-"; - validTargetTestRtn = MailConnection.findValidTarget( tmpFileLocation, aBaseFile ); + validTargetTestRtn = MailConnection.findValidTarget( DefaultBowl.getInstance(), tmpFileLocation, aBaseFile ); // Makes sure that it will still use the base file, even with no file extension Assert.assertTrue( "Original file name should be tried first.", validTargetTestRtn.endsWith( aBaseFile ) ); makeAFile( tmpFileLocation + aBaseFile ); // Make sure that the target file already exists so it has to try to find the next available one - validTargetTestRtn = MailConnection.findValidTarget( tmpFileLocation, aBaseFile ); + validTargetTestRtn = MailConnection.findValidTarget( DefaultBowl.getInstance(), tmpFileLocation, aBaseFile ); // Tests that next available file has a "-3" because 0, 1, and 2 are taken, even without a file extension Assert.assertTrue( "File without extension test failed - expected pdi17713-3.junk as file name", validTargetTestRtn.endsWith( "pdi17713-3" ) ); try { - validTargetTestRtn = MailConnection.findValidTarget( null, "wibble" ); + validTargetTestRtn = MailConnection.findValidTarget( DefaultBowl.getInstance(), null, "wibble" ); Assert.fail( "Expected an IllegalArgumentException with a null parameter for folderName to findValidTarget" ); } catch ( IllegalArgumentException expected ) { // Expect this exception } try { - validTargetTestRtn = MailConnection.findValidTarget( "wibble", null ); + validTargetTestRtn = MailConnection.findValidTarget( DefaultBowl.getInstance(), "wibble", null ); Assert.fail( "Expected an IllegalArgumentException with a null parameter for fileName to findValidTarget" ); } catch ( IllegalArgumentException expected ) { // Expect this exception @@ -184,7 +185,8 @@ private class Mconn extends MailConnection { boolean cCreated = false; public Mconn( LogChannelInterface log ) throws KettleException, MessagingException { - super( log, MailConnectionMeta.PROTOCOL_IMAP, "junit", 0, "junit", "junit", false, false, "junit" ); + super( DefaultBowl.getInstance(), log, MailConnectionMeta.PROTOCOL_IMAP, "junit", 0, "junit", "junit", false, + false, "junit" ); store = Mockito.mock( Store.class ); diff --git a/plugins/email-messages/ui/src/main/java/org/pentaho/di/ui/job/entries/getpop/JobEntryGetPOPDialog.java b/plugins/email-messages/ui/src/main/java/org/pentaho/di/ui/job/entries/getpop/JobEntryGetPOPDialog.java index 606eb93f5a4e..c006a133c8bc 100644 --- a/plugins/email-messages/ui/src/main/java/org/pentaho/di/ui/job/entries/getpop/JobEntryGetPOPDialog.java +++ b/plugins/email-messages/ui/src/main/java/org/pentaho/di/ui/job/entries/getpop/JobEntryGetPOPDialog.java @@ -1755,7 +1755,7 @@ private boolean connect() { String realproxyuser = jobMeta.environmentSubstitute( wProxyUsername.getText() ); try { mailConn = - new MailConnection( + new MailConnection( jobMeta.getBowl(), LogChannel.UI, MailConnectionMeta.getProtocolFromString( wProtocol.getText(), MailConnectionMeta.PROTOCOL_IMAP ), realserver, realport, realuser, realpass, wUseSSL.getSelection(), wUseProxy.getSelection(), realproxyuser ); diff --git a/plugins/email-messages/ui/src/main/java/org/pentaho/di/ui/trans/steps/mailinput/MailInputDialog.java b/plugins/email-messages/ui/src/main/java/org/pentaho/di/ui/trans/steps/mailinput/MailInputDialog.java index 38b3ade40d06..b3fbb9092a57 100644 --- a/plugins/email-messages/ui/src/main/java/org/pentaho/di/ui/trans/steps/mailinput/MailInputDialog.java +++ b/plugins/email-messages/ui/src/main/java/org/pentaho/di/ui/trans/steps/mailinput/MailInputDialog.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2023 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -1707,7 +1707,7 @@ private boolean connect() { try { mailConn = - new MailConnection( + new MailConnection( transMeta.getBowl(), LogChannel.UI, MailConnectionMeta.getProtocolFromString( wProtocol.getText(), MailConnectionMeta.PROTOCOL_IMAP ), realserver, realport, realuser, realpass, wUseSSL.getSelection(), wUseProxy.getSelection(), realProxyUsername ); diff --git a/plugins/excel/core/src/main/java/org/pentaho/di/trans/steps/excelinput/ExcelInput.java b/plugins/excel/core/src/main/java/org/pentaho/di/trans/steps/excelinput/ExcelInput.java index 58942852a755..90156961b183 100644 --- a/plugins/excel/core/src/main/java/org/pentaho/di/trans/steps/excelinput/ExcelInput.java +++ b/plugins/excel/core/src/main/java/org/pentaho/di/trans/steps/excelinput/ExcelInput.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2023 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -366,7 +366,8 @@ public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws first = false; data.outputRowMeta = new RowMeta(); // start from scratch! - meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); + meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository, + metaStore ); if ( meta.isAcceptingFilenames() ) { // Read the files from the specified input stream... @@ -389,7 +390,8 @@ public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws } String fileValue = rowSet.getRowMeta().getString( fileRow, idx ); try { - data.files.addFile( KettleVFS.getFileObject( fileValue, getTransMeta() ) ); + data.files.addFile( KettleVFS.getInstance( getTransMeta().getBowl() ) + .getFileObject( fileValue, getTransMeta() ) ); } catch ( KettleFileException e ) { throw new KettleException( BaseMessages.getString( PKG, "ExcelInput.Exception.CanNotCreateFileObject", fileValue ), e ); @@ -544,7 +546,8 @@ public Object[] getRowFromWorkbooks() { + data.filenr + " : " + data.filename ) ); } - data.workbook = WorkbookFactory.getWorkbook( meta.getSpreadSheetType(), data.filename, meta.getEncoding(), meta.getPassword() ); + data.workbook = WorkbookFactory.getWorkbook( getTransMeta().getBowl(), meta.getSpreadSheetType(), + data.filename, meta.getEncoding(), meta.getPassword() ); data.errorHandler.handleFile( data.file ); // Start at the first sheet again... @@ -738,7 +741,7 @@ public boolean init( StepMetaInterface smi, StepDataInterface sdi ) { if ( super.init( smi, sdi ) ) { initErrorHandling(); initReplayFactory(); - data.files = meta.getFileList( this ); + data.files = meta.getFileList( getTransMeta().getBowl(), this ); if ( data.files.nrOfFiles() == 0 && data.files.nrOfMissingFiles() > 0 && !meta.isAcceptingFilenames() ) { logError( BaseMessages.getString( PKG, "ExcelInput.Error.NoFileSpecified" ) ); diff --git a/plugins/excel/core/src/main/java/org/pentaho/di/trans/steps/excelinput/ExcelInputDialog.java b/plugins/excel/core/src/main/java/org/pentaho/di/trans/steps/excelinput/ExcelInputDialog.java index c703bfe847a2..6ef9d56c5ce9 100644 --- a/plugins/excel/core/src/main/java/org/pentaho/di/trans/steps/excelinput/ExcelInputDialog.java +++ b/plugins/excel/core/src/main/java/org/pentaho/di/trans/steps/excelinput/ExcelInputDialog.java @@ -1902,12 +1902,12 @@ public void getSheets() { ExcelInputMeta info = new ExcelInputMeta(); getInfo( info ); - FileInputList fileList = info.getFileList( transMeta ); + FileInputList fileList = info.getFileList( transMeta.getBowl(), transMeta ); for ( FileObject fileObject : fileList.getFiles() ) { try { KWorkbook workbook = - WorkbookFactory.getWorkbook( info.getSpreadSheetType(), KettleVFS.getFilename( fileObject ), info - .getEncoding(), wPassword.getText() ); + WorkbookFactory.getWorkbook( transMeta.getBowl(), info.getSpreadSheetType(), + KettleVFS.getFilename( fileObject ), info.getEncoding(), wPassword.getText() ); int nrSheets = workbook.getNumberOfSheets(); for ( int j = 0; j < nrSheets; j++ ) { @@ -1964,12 +1964,12 @@ public void getFields() { } } - FileInputList fileList = info.getFileList( transMeta ); + FileInputList fileList = info.getFileList( transMeta.getBowl(), transMeta ); for ( FileObject file : fileList.getFiles() ) { try { KWorkbook workbook = - WorkbookFactory.getWorkbook( info.getSpreadSheetType(), KettleVFS.getFilename( file ), info - .getEncoding(), wPassword.getText() ); + WorkbookFactory.getWorkbook( transMeta.getBowl(), info.getSpreadSheetType(), + KettleVFS.getFilename( file ), info.getEncoding(), wPassword.getText() ); processingWorkbook( fields, info, workbook ); workbook.close(); } catch ( Exception e ) { @@ -2094,7 +2094,7 @@ private void processingWorkbook( RowMetaInterface fields, ExcelInputMeta info, K private void showFiles() { ExcelInputMeta eii = new ExcelInputMeta(); getInfo( eii ); - String[] files = eii.getFilePaths( transMeta ); + String[] files = eii.getFilePaths( transMeta.getBowl(), transMeta ); if ( files.length > 0 ) { EnterSelectionDialog esd = new EnterSelectionDialog( shell, files, diff --git a/plugins/excel/core/src/main/java/org/pentaho/di/trans/steps/excelinput/ExcelInputExternalResourceConsumer.java b/plugins/excel/core/src/main/java/org/pentaho/di/trans/steps/excelinput/ExcelInputExternalResourceConsumer.java index 0b6e487938fb..e27d581b3e5d 100644 --- a/plugins/excel/core/src/main/java/org/pentaho/di/trans/steps/excelinput/ExcelInputExternalResourceConsumer.java +++ b/plugins/excel/core/src/main/java/org/pentaho/di/trans/steps/excelinput/ExcelInputExternalResourceConsumer.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2022 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -23,6 +23,7 @@ package org.pentaho.di.trans.steps.excelinput; import org.apache.commons.vfs2.FileObject; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.Const; import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.core.exception.KettleFileException; @@ -50,7 +51,7 @@ public boolean isDataDriven( ExcelInputMeta meta ) { } @Override - public Collection getResourcesFromMeta( ExcelInputMeta meta, IAnalysisContext context ) { + public Collection getResourcesFromMeta( Bowl bowl, ExcelInputMeta meta, IAnalysisContext context ) { Collection resources = Collections.emptyList(); // We only need to collect these resources if we're not data-driven and there are no used variables in the @@ -60,7 +61,7 @@ public Collection getResourcesFromMeta( ExcelInputMeta me if ( parentStepMeta != null ) { TransMeta parentTransMeta = parentStepMeta.getParentTransMeta(); if ( parentTransMeta != null ) { - String[] paths = meta.getFilePaths( parentTransMeta ); + String[] paths = meta.getFilePaths( parentTransMeta.getBowl(), parentTransMeta ); if ( paths != null ) { resources = new ArrayList( paths.length ); @@ -69,7 +70,8 @@ public Collection getResourcesFromMeta( ExcelInputMeta me try { IExternalResourceInfo resource = ExternalResourceInfoFactory - .createFileResource( KettleVFS.getFileObject( path ), true ); + .createFileResource( KettleVFS.getInstance( parentTransMeta.getBowl() ) + .getFileObject( path ), true ); if ( resource != null ) { resources.add( resource ); } else { @@ -99,7 +101,7 @@ public Collection getResourcesFromRow( try { String filename = rowMeta.getString( row, meta.getAcceptingField(), null ); if ( !Const.isEmpty( filename ) ) { - FileObject fileObject = KettleVFS.getFileObject( filename ); + FileObject fileObject = KettleVFS.getInstance( excelInput.getTransMeta().getBowl() ).getFileObject( filename ); resources.add( ExternalResourceInfoFactory.createFileResource( fileObject, true ) ); } } catch ( KettleException kve ) { diff --git a/plugins/excel/core/src/main/java/org/pentaho/di/trans/steps/excelinput/ExcelInputMeta.java b/plugins/excel/core/src/main/java/org/pentaho/di/trans/steps/excelinput/ExcelInputMeta.java index e274c3c1d724..620af9c62b05 100644 --- a/plugins/excel/core/src/main/java/org/pentaho/di/trans/steps/excelinput/ExcelInputMeta.java +++ b/plugins/excel/core/src/main/java/org/pentaho/di/trans/steps/excelinput/ExcelInputMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2022 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -70,6 +70,7 @@ import org.pentaho.metastore.api.IMetaStore; import org.w3c.dom.Node; import org.pentaho.di.core.annotations.Step; +import org.pentaho.di.core.bowl.Bowl; /** * Meta data for the Excel step. */ @@ -912,7 +913,7 @@ public void setDefault() { } @Override - public void getFields( RowMetaInterface row, String name, RowMetaInterface[] info, StepMeta nextStep, + public void getFields( Bowl bowl, RowMetaInterface row, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { for ( int i = 0; i < field.length; i++ ) { int type = field[ i ].getType(); @@ -1356,16 +1357,16 @@ public static final String getTrimTypeDesc( int i ) { return type_trim_desc[ i ]; } - public String[] getFilePaths( VariableSpace space ) { + public String[] getFilePaths( Bowl bowl, VariableSpace space ) { normilizeAllocation(); return FileInputList.createFilePathList( - space, fileName, fileMask, excludeFileMask, fileRequired, includeSubFolderBoolean() ); + bowl, space, fileName, fileMask, excludeFileMask, fileRequired, includeSubFolderBoolean() ); } - public FileInputList getFileList( VariableSpace space ) { + public FileInputList getFileList( Bowl bowl, VariableSpace space ) { normilizeAllocation(); return FileInputList.createFileList( - space, fileName, fileMask, excludeFileMask, fileRequired, includeSubFolderBoolean() ); + bowl, space, fileName, fileMask, excludeFileMask, fileRequired, includeSubFolderBoolean() ); } private boolean[] includeSubFolderBoolean() { @@ -1420,7 +1421,7 @@ public void check( List remarks, TransMeta transMeta, Step remarks.add( cr ); } - FileInputList fileList = getFileList( transMeta ); + FileInputList fileList = getFileList( transMeta.getBowl(), transMeta ); if ( fileList.nrOfFiles() == 0 ) { if ( !isAcceptingFilenames() ) { cr = @@ -1655,7 +1656,7 @@ public boolean readAllSheets() { * @return the filename of the exported resource */ @Override - public String exportResources( VariableSpace space, Map definitions, + public String exportResources( Bowl bowl, VariableSpace space, Map definitions, ResourceNamingInterface resourceNamingInterface, Repository repository, IMetaStore metaStore ) throws KettleException { try { @@ -1669,7 +1670,8 @@ public String exportResources( VariableSpace space, Map getUsedFields( ExcelInputMeta meta ) { @Override public IMetaverseNode createResourceNode( IExternalResourceInfo resource ) throws MetaverseException { - return createFileNode( resource.getName(), descriptor ); + return createFileNode( parentTransMeta.getBowl(), resource.getName(), descriptor ); } @Override diff --git a/plugins/excel/core/src/main/java/org/pentaho/di/trans/steps/excelinput/WorkbookFactory.java b/plugins/excel/core/src/main/java/org/pentaho/di/trans/steps/excelinput/WorkbookFactory.java index 8b1de3e5bfe9..fe7040fad449 100644 --- a/plugins/excel/core/src/main/java/org/pentaho/di/trans/steps/excelinput/WorkbookFactory.java +++ b/plugins/excel/core/src/main/java/org/pentaho/di/trans/steps/excelinput/WorkbookFactory.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2022 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -24,6 +24,7 @@ import java.io.InputStream; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.core.spreadsheet.KWorkbook; import org.pentaho.di.trans.steps.excelinput.jxl.XLSWorkbook; @@ -33,21 +34,22 @@ public class WorkbookFactory { - public static KWorkbook getWorkbook( SpreadSheetType type, String filename, String encoding ) throws KettleException { - return getWorkbook( type, filename, encoding, null ); + public static KWorkbook getWorkbook( Bowl bowl, SpreadSheetType type, String filename, String encoding ) + throws KettleException { + return getWorkbook( bowl, type, filename, encoding, null ); } - public static KWorkbook getWorkbook( SpreadSheetType type, String filename, String encoding, String password ) + public static KWorkbook getWorkbook( Bowl bowl, SpreadSheetType type, String filename, String encoding, String password ) throws KettleException { switch ( type ) { case JXL: - return new XLSWorkbook( filename, encoding ); + return new XLSWorkbook( bowl, filename, encoding ); case POI: - return new PoiWorkbook( filename, encoding, password ); // encoding is not used, perhaps detected automatically? + return new PoiWorkbook( bowl, filename, encoding, password ); // encoding is not used, perhaps detected automatically? case SAX_POI: return new StaxPoiWorkbook( filename, encoding ); case ODS: - return new OdfWorkbook( filename, encoding ); // encoding is not used, perhaps detected automatically? + return new OdfWorkbook( bowl, filename, encoding ); // encoding is not used, perhaps detected automatically? default: throw new KettleException( "Sorry, spreadsheet type " + type.getDescription() + " is not yet supported" ); } diff --git a/plugins/excel/core/src/main/java/org/pentaho/di/trans/steps/excelinput/jxl/XLSWorkbook.java b/plugins/excel/core/src/main/java/org/pentaho/di/trans/steps/excelinput/jxl/XLSWorkbook.java index ada628304711..8eb6bb29c3e1 100644 --- a/plugins/excel/core/src/main/java/org/pentaho/di/trans/steps/excelinput/jxl/XLSWorkbook.java +++ b/plugins/excel/core/src/main/java/org/pentaho/di/trans/steps/excelinput/jxl/XLSWorkbook.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2022 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -25,6 +25,7 @@ import java.io.IOException; import java.io.InputStream; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.core.logging.LogChannelInterface; import org.pentaho.di.core.spreadsheet.KSheet; @@ -45,7 +46,7 @@ public class XLSWorkbook implements KWorkbook { private String encoding; private InputStream inputStream; - public XLSWorkbook( String filename, String encoding ) throws KettleException { + public XLSWorkbook( Bowl bowl, String filename, String encoding ) throws KettleException { this.filename = filename; this.encoding = encoding; @@ -54,7 +55,7 @@ public XLSWorkbook( String filename, String encoding ) throws KettleException { ws.setEncoding( encoding ); } try { - inputStream = KettleVFS.getInputStream( filename ); + inputStream = KettleVFS.getInstance( bowl ).getInputStream( filename ); workbook = Workbook.getWorkbook( inputStream, ws ); } catch ( Exception e ) { throw new KettleException( e ); diff --git a/plugins/excel/core/src/main/java/org/pentaho/di/trans/steps/excelinput/ods/OdfWorkbook.java b/plugins/excel/core/src/main/java/org/pentaho/di/trans/steps/excelinput/ods/OdfWorkbook.java index 22f24a5ce141..c33f2043e0ee 100644 --- a/plugins/excel/core/src/main/java/org/pentaho/di/trans/steps/excelinput/ods/OdfWorkbook.java +++ b/plugins/excel/core/src/main/java/org/pentaho/di/trans/steps/excelinput/ods/OdfWorkbook.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2022 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -30,6 +30,7 @@ import org.odftoolkit.odfdom.doc.OdfDocument; import org.odftoolkit.odfdom.doc.OdfSpreadsheetDocument; import org.odftoolkit.odfdom.doc.table.OdfTable; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.core.spreadsheet.KSheet; import org.pentaho.di.core.spreadsheet.KWorkbook; @@ -42,12 +43,12 @@ public class OdfWorkbook implements KWorkbook { private OdfDocument document; private Map openSheetsMap = new HashMap(); - public OdfWorkbook( String filename, String encoding ) throws KettleException { + public OdfWorkbook( Bowl bowl, String filename, String encoding ) throws KettleException { this.filename = filename; this.encoding = encoding; try { - document = OdfSpreadsheetDocument.loadDocument( KettleVFS.getInputStream( filename ) ); + document = OdfSpreadsheetDocument.loadDocument( KettleVFS.getInstance( bowl ).getInputStream( filename ) ); } catch ( Exception e ) { throw new KettleException( e ); } diff --git a/plugins/excel/core/src/main/java/org/pentaho/di/trans/steps/excelinput/poi/PoiWorkbook.java b/plugins/excel/core/src/main/java/org/pentaho/di/trans/steps/excelinput/poi/PoiWorkbook.java index 7b3b6a38f5b5..01018546e2f9 100644 --- a/plugins/excel/core/src/main/java/org/pentaho/di/trans/steps/excelinput/poi/PoiWorkbook.java +++ b/plugins/excel/core/src/main/java/org/pentaho/di/trans/steps/excelinput/poi/PoiWorkbook.java @@ -33,6 +33,7 @@ import org.apache.poi.poifs.filesystem.POIFSFileSystem; import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.Workbook; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.core.logging.KettleLogStore; import org.pentaho.di.core.logging.LogChannelInterface; @@ -53,16 +54,16 @@ public class PoiWorkbook implements KWorkbook { private POIFSFileSystem npoifs; private OPCPackage opcpkg; - public PoiWorkbook( String filename, String encoding ) throws KettleException { - this( filename, encoding, null ); + public PoiWorkbook( Bowl bowl, String filename, String encoding ) throws KettleException { + this( bowl, filename, encoding, null ); } - public PoiWorkbook( String filename, String encoding, String password ) throws KettleException { + public PoiWorkbook( Bowl bowl, String filename, String encoding, String password ) throws KettleException { this.filename = filename; this.encoding = encoding; this.log = KettleLogStore.getLogChannelInterfaceFactory().create( this ); try { - FileObject fileObject = KettleVFS.getFileObject( filename ); + FileObject fileObject = KettleVFS.getInstance( bowl ).getFileObject( filename ); if ( fileObject instanceof LocalFile ) { // This supposedly shaves off a little bit of memory usage by allowing POI to randomly access data in the file // @@ -80,7 +81,7 @@ public PoiWorkbook( String filename, String encoding, String password ) throws K } } } else { - internalIS = KettleVFS.getInputStream( filename ); + internalIS = KettleVFS.getInstance( bowl ).getInputStream( filename ); workbook = org.apache.poi.ss.usermodel.WorkbookFactory.create( internalIS, password ); } } catch ( EncryptedDocumentException e ) { diff --git a/plugins/excel/core/src/main/java/org/pentaho/di/trans/steps/exceloutput/ExcelOutput.java b/plugins/excel/core/src/main/java/org/pentaho/di/trans/steps/exceloutput/ExcelOutput.java index f0692904a783..a3f6f6b46e5a 100644 --- a/plugins/excel/core/src/main/java/org/pentaho/di/trans/steps/exceloutput/ExcelOutput.java +++ b/plugins/excel/core/src/main/java/org/pentaho/di/trans/steps/exceloutput/ExcelOutput.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2023 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -491,7 +491,7 @@ public boolean openNewFile() { try { // Static filename data.realFilename = buildFilename(); - data.file = KettleVFS.getFileObject( data.realFilename, getTransMeta() ); + data.file = KettleVFS.getInstance( getTransMeta().getBowl() ).getFileObject( data.realFilename, getTransMeta() ); if ( meta.isCreateParentFolder() ) { if ( !createParentFolder( data.file ) ) { return retval; @@ -520,7 +520,7 @@ public boolean openNewFile() { meta.setHeaderEnabled( false ); } else { // Create a new Workbook - data.outputStream = KettleVFS.getOutputStream( data.file, false ); + data.outputStream = KettleVFS.getInstance( getTransMeta().getBowl() ).getOutputStream( data.file, false ); data.workbook = Workbook.createWorkbook( data.outputStream, data.ws ); } @@ -534,7 +534,8 @@ public boolean openNewFile() { } } else { String templateFilename = environmentSubstitute( meta.getTemplateFileName() ); - try ( FileObject templateFile = KettleVFS.getFileObject( templateFilename, getTransMeta() ) ) { + try ( FileObject templateFile = KettleVFS.getInstance( getTransMeta().getBowl() ) + .getFileObject( templateFilename, getTransMeta() ) ) { // create the openFile from the template Workbook templateWorkbook = Workbook.getWorkbook( KettleVFS.getInputStream( templateFile ), data.ws ); @@ -545,7 +546,7 @@ public boolean openNewFile() { // Do not rewrite header meta.setHeaderEnabled( false ); } else { - data.outputStream = KettleVFS.getOutputStream( data.file, false ); + data.outputStream = KettleVFS.getInstance( getTransMeta().getBowl() ).getOutputStream( data.file, false ); data.workbook = Workbook.createWorkbook( data.outputStream, templateWorkbook ); } @@ -815,7 +816,8 @@ private void setFonts() throws Exception { // Do we need to put a image on the header if ( !Utils.isEmpty( data.realHeaderImage ) ) { InputStream imageStream = null; - try ( FileObject imageFile = KettleVFS.getFileObject( data.realHeaderImage ) ) { + try ( FileObject imageFile = KettleVFS.getInstance( getTransMeta().getBowl() ) + .getFileObject( data.realHeaderImage ) ) { if ( !imageFile.exists() ) { throw new KettleException( BaseMessages.getString( PKG, "ExcelInputLog.ImageFileNotExists", data.realHeaderImage ) ); } diff --git a/plugins/excel/core/src/main/java/org/pentaho/di/trans/steps/exceloutput/ExcelOutputExternalResourceConsumer.java b/plugins/excel/core/src/main/java/org/pentaho/di/trans/steps/exceloutput/ExcelOutputExternalResourceConsumer.java index d08ce34d2e7b..6cf0d3a7defe 100644 --- a/plugins/excel/core/src/main/java/org/pentaho/di/trans/steps/exceloutput/ExcelOutputExternalResourceConsumer.java +++ b/plugins/excel/core/src/main/java/org/pentaho/di/trans/steps/exceloutput/ExcelOutputExternalResourceConsumer.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2022 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -23,6 +23,7 @@ package org.pentaho.di.trans.steps.exceloutput; import org.apache.commons.vfs2.FileObject; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.Const; import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.core.exception.KettleFileException; @@ -46,7 +47,7 @@ public class ExcelOutputExternalResourceConsumer extends BaseStepExternalResourceConsumer { @Override - public Collection getResourcesFromMeta( ExcelOutputMeta meta, IAnalysisContext context ) { + public Collection getResourcesFromMeta( Bowl bowl, ExcelOutputMeta meta, IAnalysisContext context ) { Collection resources = Collections.emptyList(); // We only need to collect these resources if we're not data-driven and there are no used variables in the @@ -65,7 +66,7 @@ public Collection getResourcesFromMeta( ExcelOutputMeta m try { IExternalResourceInfo resource = ExternalResourceInfoFactory.createFileResource( - KettleVFS.getFileObject( path ), false ); + KettleVFS.getInstance( parentTransMeta.getBowl() ).getFileObject( path ), false ); if ( resource != null ) { resources.add( resource ); } else { @@ -92,7 +93,7 @@ public Collection getResourcesFromRow( ExcelOutput excelO try { String filename = excelOutput.buildFilename(); if ( !Const.isEmpty( filename ) ) { - FileObject fileObject = KettleVFS.getFileObject( filename ); + FileObject fileObject = KettleVFS.getInstance( excelOutput.getTransMeta().getBowl() ).getFileObject( filename ); resources.add( ExternalResourceInfoFactory.createFileResource( fileObject, false ) ); } } catch ( KettleException kve ) { diff --git a/plugins/excel/core/src/main/java/org/pentaho/di/trans/steps/exceloutput/ExcelOutputMeta.java b/plugins/excel/core/src/main/java/org/pentaho/di/trans/steps/exceloutput/ExcelOutputMeta.java index e8d186261db8..3fd7bb62a564 100644 --- a/plugins/excel/core/src/main/java/org/pentaho/di/trans/steps/exceloutput/ExcelOutputMeta.java +++ b/plugins/excel/core/src/main/java/org/pentaho/di/trans/steps/exceloutput/ExcelOutputMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2022 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -59,6 +59,7 @@ import org.pentaho.metastore.api.IMetaStore; import org.w3c.dom.Node; import org.pentaho.di.core.annotations.Step; +import org.pentaho.di.core.bowl.Bowl; /** * Metadata of the Excel Output step. @@ -1048,7 +1049,7 @@ public String buildFilename( VariableSpace space, int stepnr, int splitnr ) { } @Override - public void getFields( RowMetaInterface r, String name, RowMetaInterface[] info, StepMeta nextStep, + public void getFields( Bowl bowl, RowMetaInterface r, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) { if ( r == null ) { r = new RowMeta(); // give back values @@ -1389,14 +1390,16 @@ public void check( List remarks, TransMeta transMeta, Step * @return the filename of the exported resource */ @Override - public String exportResources( VariableSpace space, Map definitions, - ResourceNamingInterface resourceNamingInterface, Repository repository, IMetaStore metaStore ) throws KettleException { + public String exportResources( Bowl bowl, VariableSpace space, Map definitions, + ResourceNamingInterface resourceNamingInterface, Repository repository, IMetaStore metaStore ) + throws KettleException { try { // The object that we're modifying here is a copy of the original! // So let's change the filename from relative to absolute by grabbing the file object... // if ( !Utils.isEmpty( fileName ) ) { - FileObject fileObject = KettleVFS.getFileObject( space.environmentSubstitute( fileName ), space ); + FileObject fileObject = KettleVFS.getInstance( bowl ) + .getFileObject( space.environmentSubstitute( fileName ), space ); fileName = resourceNamingInterface.nameResource( fileObject, space, true ); } diff --git a/plugins/excel/core/src/main/java/org/pentaho/di/trans/steps/exceloutput/ExcelOutputStepAnalyzer.java b/plugins/excel/core/src/main/java/org/pentaho/di/trans/steps/exceloutput/ExcelOutputStepAnalyzer.java index 6a0f1e0b0e47..567e0ecff3d4 100644 --- a/plugins/excel/core/src/main/java/org/pentaho/di/trans/steps/exceloutput/ExcelOutputStepAnalyzer.java +++ b/plugins/excel/core/src/main/java/org/pentaho/di/trans/steps/exceloutput/ExcelOutputStepAnalyzer.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2022 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -49,7 +49,7 @@ public class ExcelOutputStepAnalyzer extends ExternalResourceStepAnalyzer remarks, TransMeta transMeta, Step * @return the filename of the exported resource */ @Override - public String exportResources( VariableSpace space, Map definitions, + public String exportResources( Bowl bowl, VariableSpace space, Map definitions, ResourceNamingInterface resourceNamingInterface, Repository repository, IMetaStore metaStore ) throws KettleException { try { // The object that we're modifying here is a copy of the original! // So let's change the filename from relative to absolute by grabbing the file object... // if ( !Utils.isEmpty( fileName ) ) { - FileObject fileObject = KettleVFS.getFileObject( space.environmentSubstitute( fileName ), space ); + FileObject fileObject = KettleVFS.getInstance( bowl ) + .getFileObject( space.environmentSubstitute( fileName ), space ); fileName = resourceNamingInterface.nameResource( fileObject, space, true ); } if ( !Utils.isEmpty( templateFileName ) ) { - FileObject fileObject = KettleVFS.getFileObject( space.environmentSubstitute( templateFileName ), space ); + FileObject fileObject = KettleVFS.getInstance( bowl ) + .getFileObject( space.environmentSubstitute( templateFileName ), space ); templateFileName = resourceNamingInterface.nameResource( fileObject, space, true ); } diff --git a/plugins/excel/core/src/test/java/org/pentaho/di/trans/steps/excelinput/BaseExcelParsingTest.java b/plugins/excel/core/src/test/java/org/pentaho/di/trans/steps/excelinput/BaseExcelParsingTest.java index 89f8bddbe9e2..14c78987db96 100644 --- a/plugins/excel/core/src/test/java/org/pentaho/di/trans/steps/excelinput/BaseExcelParsingTest.java +++ b/plugins/excel/core/src/test/java/org/pentaho/di/trans/steps/excelinput/BaseExcelParsingTest.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2022 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -24,6 +24,7 @@ import org.junit.Before; import org.junit.Ignore; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.row.RowMeta; import org.pentaho.di.core.variables.Variables; import org.pentaho.di.trans.steps.file.BaseFileField; @@ -68,7 +69,8 @@ protected void init( String file ) throws Exception { */ protected void setFields( ExcelInputField... fields ) throws Exception { meta.setField( fields ); - meta.getFields( data.outputRowMeta, meta.getName(), null, null, new Variables(), null, null ); + meta.getFields( DefaultBowl.getInstance(), data.outputRowMeta, meta.getName(), null, null, new Variables(), null, + null ); } /** diff --git a/plugins/excel/core/src/test/java/org/pentaho/di/trans/steps/excelinput/ExcelInputStepAnalyzerTest.java b/plugins/excel/core/src/test/java/org/pentaho/di/trans/steps/excelinput/ExcelInputStepAnalyzerTest.java index 23e30858ecd2..077d0da13797 100644 --- a/plugins/excel/core/src/test/java/org/pentaho/di/trans/steps/excelinput/ExcelInputStepAnalyzerTest.java +++ b/plugins/excel/core/src/test/java/org/pentaho/di/trans/steps/excelinput/ExcelInputStepAnalyzerTest.java @@ -28,6 +28,8 @@ import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.junit.MockitoJUnitRunner; +import org.pentaho.di.core.bowl.Bowl; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.exception.KettleValueException; import org.pentaho.di.core.row.RowMetaInterface; import org.pentaho.di.core.variables.VariableSpace; @@ -77,6 +79,8 @@ public class ExcelInputStepAnalyzerTest extends ClonableStepAnalyzerTest { public void setUp() throws Exception { lenient().when( mockNamespace.getParentNamespace() ).thenReturn( mockNamespace ); descriptor = new MetaverseComponentDescriptor( "test", DictionaryConst.NODE_TYPE_TRANS_STEP, mockNamespace ); + lenient().when( transMeta.getBowl() ).thenReturn( DefaultBowl.getInstance() ); + lenient().when( excelInput.getTransMeta() ).thenReturn( transMeta ); analyzer = spy( new ExcelInputStepAnalyzer() ); analyzer.setDescriptor( descriptor ); analyzer.setObjectFactory( MetaverseTestUtils.getMetaverseObjectFactory() ); @@ -155,10 +159,10 @@ public void resourcesFromMetaGotSuccessfully() throws Exception { lenient().when( meta.getFileName() ).thenReturn( null ); when( meta.isAcceptingFilenames() ).thenReturn( false ); String[] filePaths = { "/path/to/file1", "/another/path/to/file2" }; - when( meta.getFilePaths( Mockito.any( VariableSpace.class ) ) ).thenReturn( filePaths ); + when( meta.getFilePaths( Mockito.any( Bowl.class), Mockito.any( VariableSpace.class ) ) ).thenReturn( filePaths ); assertFalse( consumer.isDataDriven( meta ) ); - Collection resources = consumer.getResourcesFromMeta( meta ); + Collection resources = consumer.getResourcesFromMeta( DefaultBowl.getInstance(), meta ); assertEquals( 2, resources.size() ); } @@ -167,7 +171,7 @@ public void resourcesFromRowGotSuccessfully() throws Exception { when( meta.isAcceptingFilenames() ).thenReturn( true ); assertTrue( consumer.isDataDriven( meta ) ); - assertTrue( consumer.getResourcesFromMeta( meta ).isEmpty() ); + assertTrue( consumer.getResourcesFromMeta( DefaultBowl.getInstance(), meta ).isEmpty() ); when( rmi.getString( Mockito.any( Object[].class ), Mockito.any(), Mockito.any() ) ) .thenReturn( "/path/to/row/file" ); when( excelInput.getStepMetaInterface() ).thenReturn( meta ); diff --git a/plugins/excel/core/src/test/java/org/pentaho/di/trans/steps/excelinput/OdfSheetTest.java b/plugins/excel/core/src/test/java/org/pentaho/di/trans/steps/excelinput/OdfSheetTest.java index 2a1918bcaaa6..9ed914bb92ec 100644 --- a/plugins/excel/core/src/test/java/org/pentaho/di/trans/steps/excelinput/OdfSheetTest.java +++ b/plugins/excel/core/src/test/java/org/pentaho/di/trans/steps/excelinput/OdfSheetTest.java @@ -1,7 +1,7 @@ /* * Pentaho Data Integration * - * Copyright (C) 2002-2022 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * * ************************************************************************** * @@ -24,6 +24,7 @@ import org.junit.Before; import org.junit.Test; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.core.spreadsheet.KCell; import org.pentaho.di.core.spreadsheet.KWorkbook; @@ -37,11 +38,11 @@ public class OdfSheetTest { @Before public void init() throws KettleException { ods341 = - WorkbookFactory.getWorkbook( SpreadSheetType.ODS, this.getClass().getResource( "files/sample-3.4.1.ods" ) - .getPath(), null ); + WorkbookFactory.getWorkbook( DefaultBowl.getInstance(), SpreadSheetType.ODS, + this.getClass().getResource( "files/sample-3.4.1.ods" ).getPath(), null ); ods24 = - WorkbookFactory.getWorkbook( SpreadSheetType.ODS, this.getClass().getResource( "files/sample-2.4.ods" ) - .getPath(), null ); + WorkbookFactory.getWorkbook( DefaultBowl.getInstance(), SpreadSheetType.ODS, + this.getClass().getResource( "files/sample-2.4.ods" ).getPath(), null ); } @Test diff --git a/plugins/excel/core/src/test/java/org/pentaho/di/trans/steps/exceloutput/ExcelOutputStepAnalyzerTest.java b/plugins/excel/core/src/test/java/org/pentaho/di/trans/steps/exceloutput/ExcelOutputStepAnalyzerTest.java index ccfa55e13f33..6f78c3012f34 100644 --- a/plugins/excel/core/src/test/java/org/pentaho/di/trans/steps/exceloutput/ExcelOutputStepAnalyzerTest.java +++ b/plugins/excel/core/src/test/java/org/pentaho/di/trans/steps/exceloutput/ExcelOutputStepAnalyzerTest.java @@ -30,6 +30,7 @@ import org.mockito.invocation.InvocationOnMock; import org.mockito.junit.MockitoJUnitRunner; import org.mockito.stubbing.Answer; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.row.RowMetaInterface; import org.pentaho.di.core.variables.VariableSpace; import org.pentaho.di.trans.TransMeta; @@ -44,6 +45,7 @@ import org.pentaho.metaverse.api.MetaverseComponentDescriptor; import org.pentaho.metaverse.api.analyzer.kettle.step.IClonableStepAnalyzer; import org.pentaho.metaverse.api.analyzer.kettle.step.StepNodes; +import org.pentaho.metaverse.api.IMetaverseBuilder; import org.pentaho.metaverse.api.model.IExternalResourceInfo; import java.util.Collection; @@ -82,8 +84,17 @@ public void setUp() throws Exception { analyzer = spy( new ExcelOutputStepAnalyzer() ); analyzer.setDescriptor( descriptor ); + IMetaverseBuilder builder = mock( IMetaverseBuilder.class ); + analyzer.setMetaverseBuilder( builder ); analyzer.setObjectFactory( MetaverseTestUtils.getMetaverseObjectFactory() ); + StepMeta mockStepMeta = mock( StepMeta.class ); + when( meta.getParentStepMeta() ).thenReturn( mockStepMeta ); + + lenient().when( transMeta.getBowl() ).thenReturn( DefaultBowl.getInstance() ); + lenient().when( step.getTransMeta() ).thenReturn( transMeta ); + lenient().when( mockStepMeta.getParentTransMeta() ).thenReturn( transMeta ); + inputs = new StepNodes(); inputs.addNode( "previousStep", "first", node ); inputs.addNode( "previousStep", "last", node ); @@ -116,6 +127,7 @@ public void testIsInput() throws Exception { public void testCreateResourceNode() throws Exception { IExternalResourceInfo res = mock( IExternalResourceInfo.class ); when( res.getName() ).thenReturn( "file:///Users/home/tmp/xyz.ktr" ); + analyzer.validateState( descriptor, meta); IMetaverseNode resourceNode = analyzer.createResourceNode( res ); assertNotNull( resourceNode ); assertEquals( DictionaryConst.NODE_TYPE_FILE, resourceNode.getType() ); @@ -149,14 +161,14 @@ public void testExcelOutputExternalResourceConsumer() throws Exception { when( this.meta.getFiles( Mockito.any( VariableSpace.class ) ) ).thenReturn( filePaths ); assertFalse( consumer.isDataDriven( this.meta ) ); - Collection resources = consumer.getResourcesFromMeta( this.meta ); + Collection resources = consumer.getResourcesFromMeta( DefaultBowl.getInstance(), this.meta ); assertFalse( resources.isEmpty() ); assertEquals( 2, resources.size() ); lenient().when( this.meta.getExtension() ).thenReturn( "xls" ); - assertFalse( consumer.getResourcesFromMeta( this.meta ).isEmpty() ); + assertFalse( consumer.getResourcesFromMeta( DefaultBowl.getInstance(), this.meta ).isEmpty() ); data.realFilename = "/path/to/row/file"; when( step.buildFilename() ) diff --git a/plugins/excel/core/src/test/java/org/pentaho/di/trans/steps/excelwriter/ExcelWriterFullTest.java b/plugins/excel/core/src/test/java/org/pentaho/di/trans/steps/excelwriter/ExcelWriterFullTest.java index 1adf2f380d9f..cf1a956ab66b 100644 --- a/plugins/excel/core/src/test/java/org/pentaho/di/trans/steps/excelwriter/ExcelWriterFullTest.java +++ b/plugins/excel/core/src/test/java/org/pentaho/di/trans/steps/excelwriter/ExcelWriterFullTest.java @@ -44,6 +44,7 @@ import org.junit.BeforeClass; import org.junit.Test; import org.pentaho.di.core.BlockingRowSet; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.KettleClientEnvironment; import org.pentaho.di.core.RowSet; import org.pentaho.di.core.exception.KettleException; @@ -188,7 +189,7 @@ public void testDataValidationExtension() throws Exception { final String sheetName = "TicketData"; // set up: add data validation constraint in a new template - try ( InputStream in = KettleVFS.getInputStream( origTemplate.toString() ); + try ( InputStream in = KettleVFS.getInstance( DefaultBowl.getInstance() ).getInputStream( origTemplate.toString() ); XSSFWorkbook wb = new XSSFWorkbook( in ) ) { XSSFSheet sheet = wb.getSheet( sheetName ); @@ -199,7 +200,8 @@ public void testDataValidationExtension() throws Exception { DataValidation lenValidation = validationHelper.createValidation( constr, rangeList ); sheet.addValidationData( lenValidation ); - try ( OutputStream out = KettleVFS.getOutputStream( template.toString(), false ) ) { + try ( OutputStream out = KettleVFS.getInstance( DefaultBowl.getInstance() ) + .getOutputStream( template.toString(), false ) ) { wb.write( out ); } } @@ -229,7 +231,8 @@ public void testDataValidationExtension() throws Exception { runStep( meta, inputs, 4 ); // check validation got extended to last row - try ( InputStream in = KettleVFS.getInputStream( outFile + ".xlsx" ); XSSFWorkbook wb = new XSSFWorkbook( in ) ) { + try ( InputStream in = KettleVFS.getInstance( DefaultBowl.getInstance() ).getInputStream( outFile + ".xlsx" ); + XSSFWorkbook wb = new XSSFWorkbook( in ) ) { wb.setActiveSheet( 0 ); XSSFFormulaEvaluator evaluatorProvider = new XSSFFormulaEvaluator( wb ); DataValidationEvaluator evaluator = new DataValidationEvaluator( wb, evaluatorProvider ); @@ -306,7 +309,9 @@ public void testNullsBlank() throws Exception { new ValueMetaInteger( "int3" ) ), row( "a", null, 1L ), row( "b", "not null", null ), row( "c", null, 3L ) ); runStep( meta, inputs, 3 ); - try ( InputStream in = KettleVFS.getInputStream( outFile + ".xlsx" ); XSSFWorkbook wb = new XSSFWorkbook( in ) ) { + try ( InputStream in = KettleVFS.getInstance( DefaultBowl.getInstance() ) + .getInputStream( outFile + ".xlsx" ); + XSSFWorkbook wb = new XSSFWorkbook( in ) ) { XSSFSheet sheet1 = wb.getSheetAt( 0 ); assertEquals( CellType.BLANK, getCell( sheet1, "B1" ).getCellType() ); assertEquals( CellType.BLANK, getCell( sheet1, "C2" ).getCellType() ); @@ -342,7 +347,9 @@ public void testNullsEmptyStr() throws Exception { new ValueMetaInteger( "int3" ) ), row( "a", null, 1L ), row( "b", "not null", null ), row( "c", null, 3L ) ); runStep( meta, inputs, 3 ); - try ( InputStream in = KettleVFS.getInputStream( outFile + ".xlsx" ); XSSFWorkbook wb = new XSSFWorkbook( in ) ) { + try ( InputStream in = KettleVFS.getInstance( DefaultBowl.getInstance() ) + .getInputStream( outFile + ".xlsx" ); + XSSFWorkbook wb = new XSSFWorkbook( in ) ) { XSSFSheet sheet1 = wb.getSheetAt( 0 ); Cell b1 = getCell( sheet1, "B1" ); assertEquals( CellType.STRING, b1.getCellType() ); diff --git a/plugins/export-repository/impl/src/main/java/org/pentaho/di/job/entries/exportrepository/JobEntryExportRepository.java b/plugins/export-repository/impl/src/main/java/org/pentaho/di/job/entries/exportrepository/JobEntryExportRepository.java index 54398a757614..6e57b4071c7e 100644 --- a/plugins/export-repository/impl/src/main/java/org/pentaho/di/job/entries/exportrepository/JobEntryExportRepository.java +++ b/plugins/export-repository/impl/src/main/java/org/pentaho/di/job/entries/exportrepository/JobEntryExportRepository.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2023 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -471,7 +471,8 @@ public Result execute( Result previousResult, int nr ) { limitErr = Const.toInt( environmentSubstitute( getNrLimit() ), 10 ); try { - file = KettleVFS.getFileObject( realoutfilename, this ); + file = KettleVFS.getInstance( parentJobMeta.getBowl() ) + .getFileObject( realoutfilename, this ); if ( file.exists() ) { if ( export_type.equals( Export_All ) || export_type.equals( Export_Jobs ) || export_type.equals( Export_Trans ) @@ -490,7 +491,8 @@ public Result execute( Result previousResult, int nr ) { String parentFolder = KettleVFS.getFilename( file.getParent() ); String shortFilename = file.getName().getBaseName(); shortFilename = buildUniqueFilename( shortFilename ); - file = KettleVFS.getFileObject( parentFolder + Const.FILE_SEPARATOR + shortFilename, this ); + file = KettleVFS.getInstance( parentJobMeta.getBowl() ) + .getFileObject( parentFolder + Const.FILE_SEPARATOR + shortFilename, this ); if ( log.isDetailed() ) { logDetailed( BaseMessages.getString( PKG, "JobExportRepository.Log.NewFilename", file.toString() ) ); } @@ -696,14 +698,16 @@ private boolean processOneFolder( Job parentJob, Result result, LogChannelInterf String foldername = realoutfilename; if ( newfolder ) { foldername = realoutfilename + Const.FILE_SEPARATOR + filename; - this.file = KettleVFS.getFileObject( foldername, this ); + this.file = KettleVFS.getInstance( parentJobMeta.getBowl() ) + .getFileObject( foldername, this ); if ( !this.file.exists() ) { this.file.createFolder(); } } filename = foldername + Const.FILE_SEPARATOR + buildFilename( filename ) + ".xml"; - this.file = KettleVFS.getFileObject( filename, this ); + this.file = KettleVFS.getInstance( parentJobMeta.getBowl() ) + .getFileObject( filename, this ); if ( this.file.exists() ) { if ( iffileexists.equals( If_FileExists_Skip ) ) { @@ -787,7 +791,8 @@ private void connectRep( LogChannelInterface log, String realrepName, String rea private void addFileToResultFilenames( String fileaddentry, LogChannelInterface log, Result result, Job parentJob ) { try { ResultFile resultFile = - new ResultFile( ResultFile.FILE_TYPE_GENERAL, KettleVFS.getFileObject( fileaddentry, this ), parentJob + new ResultFile( ResultFile.FILE_TYPE_GENERAL, KettleVFS.getInstance( parentJobMeta.getBowl() ) + .getFileObject( fileaddentry, this ), parentJob .getJobname(), toString() ); result.getResultFiles().put( resultFile.getFile().toString(), resultFile ); if ( log.isDebug() ) { @@ -807,18 +812,18 @@ public boolean evaluates() { @Override public void check( List remarks, JobMeta jobMeta, VariableSpace space, Repository repository, IMetaStore metaStore ) { - JobEntryValidatorUtils.andValidator().validate( this, "repositoryname", remarks, + JobEntryValidatorUtils.andValidator().validate( jobMeta.getBowl(), this, "repositoryname", remarks, AndValidator.putValidators( JobEntryValidatorUtils.notBlankValidator() ) ); ValidatorContext ctx = new ValidatorContext(); AbstractFileValidator.putVariableSpace( ctx, getVariables() ); AndValidator.putValidators( ctx, JobEntryValidatorUtils.notBlankValidator(), JobEntryValidatorUtils.fileExistsValidator() ); - JobEntryValidatorUtils.andValidator().validate( this, "targetfilename", remarks, ctx ); + JobEntryValidatorUtils.andValidator().validate( jobMeta.getBowl(), this, "targetfilename", remarks, ctx ); - JobEntryValidatorUtils.andValidator().validate( this, "username", remarks, + JobEntryValidatorUtils.andValidator().validate( jobMeta.getBowl(), this, "username", remarks, AndValidator.putValidators( JobEntryValidatorUtils.notBlankValidator() ) ); - JobEntryValidatorUtils.andValidator().validate( this, "password", remarks, + JobEntryValidatorUtils.andValidator().validate( jobMeta.getBowl(), this, "password", remarks, AndValidator.putValidators( JobEntryValidatorUtils.notNullValidator() ) ); } } diff --git a/plugins/ftp-delete/impl/src/main/java/org/pentaho/di/job/entries/ftpdelete/JobEntryFTPDelete.java b/plugins/ftp-delete/impl/src/main/java/org/pentaho/di/job/entries/ftpdelete/JobEntryFTPDelete.java index bb7493cd4801..c027a7b7c535 100644 --- a/plugins/ftp-delete/impl/src/main/java/org/pentaho/di/job/entries/ftpdelete/JobEntryFTPDelete.java +++ b/plugins/ftp-delete/impl/src/main/java/org/pentaho/di/job/entries/ftpdelete/JobEntryFTPDelete.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2023 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -987,7 +987,8 @@ private void SSHConnect( String realservername, String realserverpassword, int r private void SFTPConnect( String realservername, String realusername, int realport, String realpassword, String realFTPDirectory ) throws Exception { // Create sftp client to host ... - sftpclient = new SFTPClient( InetAddress.getByName( realservername ), realport, realusername ); + sftpclient = new SFTPClient( parentJobMeta.getBowl(), InetAddress.getByName( realservername ), realport, + realusername ); // login to ftp host ... sftpclient.login( realpassword ); @@ -1006,7 +1007,8 @@ private void FTPSConnect( String realservername, String realusername, int realpo String realFTPDirectory, int realtimeout ) throws Exception { // Create ftps client to host ... ftpsclient = - new FTPSConnection( getFTPSConnectionType(), realservername, realport, realusername, realpassword ); + new FTPSConnection( parentJobMeta.getBowl(), getFTPSConnectionType(), realservername, realport, realusername, + realpassword ); if ( !Utils.isEmpty( proxyHost ) ) { String realProxy_host = environmentSubstitute( proxyHost ); @@ -1173,12 +1175,15 @@ public void setActiveConnection( boolean passive ) { public void check( List remarks, JobMeta jobMeta, VariableSpace space, Repository repository, IMetaStore metaStore ) { - JobEntryValidatorUtils.andValidator().validate( this, "serverName", remarks, AndValidator.putValidators( JobEntryValidatorUtils.notBlankValidator() ) ); - JobEntryValidatorUtils.andValidator().validate( + JobEntryValidatorUtils.andValidator().validate( jobMeta.getBowl(), this, "serverName", remarks, + AndValidator.putValidators( JobEntryValidatorUtils.notBlankValidator() ) ); + JobEntryValidatorUtils.andValidator().validate( jobMeta.getBowl(), this, "targetDirectory", remarks, AndValidator.putValidators( JobEntryValidatorUtils.notBlankValidator(), JobEntryValidatorUtils.fileExistsValidator() ) ); - JobEntryValidatorUtils.andValidator().validate( this, "userName", remarks, AndValidator.putValidators( JobEntryValidatorUtils.notBlankValidator() ) ); - JobEntryValidatorUtils.andValidator().validate( this, "password", remarks, AndValidator.putValidators( JobEntryValidatorUtils.notNullValidator() ) ); + JobEntryValidatorUtils.andValidator().validate( jobMeta.getBowl(), this, "userName", remarks, + AndValidator.putValidators( JobEntryValidatorUtils.notBlankValidator() ) ); + JobEntryValidatorUtils.andValidator().validate( jobMeta.getBowl(), this, "password", remarks, + AndValidator.putValidators( JobEntryValidatorUtils.notNullValidator() ) ); } public List getResourceDependencies( JobMeta jobMeta ) { diff --git a/plugins/ftp-delete/ui/src/main/java/org/pentaho/di/ui/job/entries/ftpdelete/JobEntryFTPDeleteDialog.java b/plugins/ftp-delete/ui/src/main/java/org/pentaho/di/ui/job/entries/ftpdelete/JobEntryFTPDeleteDialog.java index a00630ba2ff0..cdd40cd85880 100644 --- a/plugins/ftp-delete/ui/src/main/java/org/pentaho/di/ui/job/entries/ftpdelete/JobEntryFTPDeleteDialog.java +++ b/plugins/ftp-delete/ui/src/main/java/org/pentaho/di/ui/job/entries/ftpdelete/JobEntryFTPDeleteDialog.java @@ -1250,7 +1250,7 @@ private boolean connectToFTPS() { // Create ftp client to host:port ... ftpsclient = - new FTPSConnection( + new FTPSConnection( jobMeta.getBowl(), FTPSConnection.getConnectionTypeByDesc( wConnectionType.getText() ), realServername, port, realUsername, realPassword ); @@ -1301,7 +1301,8 @@ private boolean connectToSFTP() { if ( sftpclient == null ) { // Create sftp client to host ... sftpclient = - new SFTPClient( InetAddress.getByName( jobMeta.environmentSubstitute( wServerName.getText() ) ), Const + new SFTPClient( jobMeta.getBowl(), + InetAddress.getByName( jobMeta.environmentSubstitute( wServerName.getText() ) ), Const .toInt( jobMeta.environmentSubstitute( wPort.getText() ), 22 ), jobMeta .environmentSubstitute( wUserName.getText() ) ); diff --git a/plugins/ftps/impl/src/it/java/org/pentaho/di/job/entries/ftpsget/JobEntryFTPSGetIT.java b/plugins/ftps/impl/src/it/java/org/pentaho/di/job/entries/ftpsget/JobEntryFTPSGetIT.java index 4847a05648d4..ae5faa702d25 100644 --- a/plugins/ftps/impl/src/it/java/org/pentaho/di/job/entries/ftpsget/JobEntryFTPSGetIT.java +++ b/plugins/ftps/impl/src/it/java/org/pentaho/di/job/entries/ftpsget/JobEntryFTPSGetIT.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -31,6 +31,7 @@ import org.junit.Rule; import org.junit.Test; import org.junit.rules.TemporaryFolder; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.KettleEnvironment; import org.pentaho.di.core.Result; import org.pentaho.di.core.logging.LogLevel; @@ -95,11 +96,12 @@ public void downloadFile_WhenDestinationIsSetViaVariable() throws Exception { jobEntry.setVariable( myVar, outputFolder.getRoot().getAbsolutePath() ); jobEntry.setTargetDirectory( String.format( "${%s}", myVar ) ); - FileObject downloaded = KettleVFS.getFileObject( expectedDownloadedFilePath ); + FileObject downloaded = KettleVFS.getInstance( DefaultBowl.getInstance() ) + .getFileObject( expectedDownloadedFilePath ); assertFalse( downloaded.exists() ); try { jobEntry.execute( new Result(), 1 ); - downloaded = KettleVFS.getFileObject( expectedDownloadedFilePath ); + downloaded = KettleVFS.getInstance( DefaultBowl.getInstance() ).getFileObject( expectedDownloadedFilePath ); assertTrue( downloaded.exists() ); } finally { downloaded.delete(); @@ -112,11 +114,12 @@ public void downloadFile_WhenDestinationIsSetDirectly() throws Exception { jobEntry.setTargetDirectory( outputFolder.getRoot().getAbsolutePath() ); - FileObject downloaded = KettleVFS.getFileObject( expectedDownloadedFilePath ); + FileObject downloaded = KettleVFS.getInstance( DefaultBowl.getInstance() ) + .getFileObject( expectedDownloadedFilePath ); assertFalse( downloaded.exists() ); try { jobEntry.execute( new Result(), 1 ); - downloaded = KettleVFS.getFileObject( expectedDownloadedFilePath ); + downloaded = KettleVFS.getInstance( DefaultBowl.getInstance() ).getFileObject( expectedDownloadedFilePath ); assertTrue( downloaded.exists() ); } finally { downloaded.delete(); diff --git a/plugins/ftps/impl/src/main/java/org/pentaho/di/job/entries/ftpsget/FTPSConnection.java b/plugins/ftps/impl/src/main/java/org/pentaho/di/job/entries/ftpsget/FTPSConnection.java index 13e9c77c3257..d80983911d05 100644 --- a/plugins/ftps/impl/src/main/java/org/pentaho/di/job/entries/ftpsget/FTPSConnection.java +++ b/plugins/ftps/impl/src/main/java/org/pentaho/di/job/entries/ftpsget/FTPSConnection.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2023 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -31,6 +31,7 @@ import org.ftp4che.event.FTPListener; import org.ftp4che.exception.ConfigurationException; import org.ftp4che.util.ftpfile.FTPFile; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.core.logging.LogChannel; import org.pentaho.di.core.logging.LogChannelInterface; @@ -96,17 +97,18 @@ public class FTPSConnection implements FTPListener { private String proxyPassword; private int proxyPort; private VariableSpace nameSpace; + private Bowl bowl; /** * Please supply real namespace as it is required for proper VFS operation */ @Deprecated - public FTPSConnection( int connectionType, String hostname, int port, String username, String password ) { - this( connectionType, hostname, port, username, password, new Variables() ); + public FTPSConnection( Bowl bowl, int connectionType, String hostname, int port, String username, String password ) { + this( bowl, connectionType, hostname, port, username, password, new Variables() ); } - public FTPSConnection( int connectionType, String hostname, int port, String username, String password, - VariableSpace nameSpace ) { + public FTPSConnection( Bowl bowl, int connectionType, String hostname, int port, String username, String password, + VariableSpace nameSpace ) { this.hostName = hostname; this.portNumber = port; this.userName = username; @@ -114,6 +116,7 @@ public FTPSConnection( int connectionType, String hostname, int port, String use this.connectionType = connectionType; this.passiveMode = false; this.nameSpace = nameSpace; + this.bowl = bowl; this.logger = new LogChannel( this ); } @@ -443,7 +446,7 @@ public List getFileList( String folder ) throws KettleException { */ public void downloadFile( FTPFile file, String localFilename ) throws KettleException { try { - FileObject localFile = KettleVFS.getFileObject( localFilename, nameSpace ); + FileObject localFile = KettleVFS.getInstance( bowl ).getFileObject( localFilename, nameSpace ); writeToFile( connection.downloadStream( file ), localFile.getContent().getOutputStream(), localFilename ); } catch ( Exception e ) { throw new KettleException( e ); @@ -475,7 +478,7 @@ public void uploadFile( String localFileName, String shortFileName ) throws Kett FileObject file = null; try { - file = KettleVFS.getFileObject( localFileName, nameSpace ); + file = KettleVFS.getInstance( bowl ).getFileObject( localFileName, nameSpace ); this.connection.uploadStream( file.getContent().getInputStream(), new FTPFile( new File( shortFileName ) ) ); } catch ( Exception e ) { throw new KettleException( BaseMessages.getString( PKG, "JobFTPS.Error.UuploadingFile", localFileName ), e ); diff --git a/plugins/ftps/impl/src/main/java/org/pentaho/di/job/entries/ftpsget/JobEntryFTPSGet.java b/plugins/ftps/impl/src/main/java/org/pentaho/di/job/entries/ftpsget/JobEntryFTPSGet.java index 761c1781c818..a8c29c9b408b 100644 --- a/plugins/ftps/impl/src/main/java/org/pentaho/di/job/entries/ftpsget/JobEntryFTPSGet.java +++ b/plugins/ftps/impl/src/main/java/org/pentaho/di/job/entries/ftpsget/JobEntryFTPSGet.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2023 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -763,7 +763,8 @@ public Result execute( Result previousResult, int nr ) throws KettleException { String realPassword = Encr.decryptPasswordOptionallyEncrypted( environmentSubstitute( password ) ); int realPort = Const.toInt( environmentSubstitute( this.port ), 0 ); - connection = new FTPSConnection( getConnectionType(), realServername, realPort, realUsername, realPassword, this ); + connection = new FTPSConnection( parentJobMeta.getBowl(), getConnectionType(), realServername, realPort, + realUsername, realPassword, this ); this.buildFTPSConnection( connection ); @@ -946,7 +947,7 @@ private void addFilenameToResultFilenames( Result result, String filename ) thro if ( isaddresult ) { FileObject targetFile = null; try { - targetFile = KettleVFS.getFileObject( filename, this ); + targetFile = KettleVFS.getInstance( parentJobMeta.getBowl() ).getFileObject( filename, this ); // Add to the result files... ResultFile resultFile = @@ -1168,16 +1169,16 @@ public List getResourceDependencies( JobMeta jobMeta ) { @Override public void check( List remarks, JobMeta jobMeta, VariableSpace space, Repository repository, IMetaStore metaStore ) { - JobEntryValidatorUtils.andValidator().validate( this, "serverName", remarks, + JobEntryValidatorUtils.andValidator().validate( parentJobMeta.getBowl(), this, "serverName", remarks, AndValidator.putValidators( JobEntryValidatorUtils.notBlankValidator() ) ); - JobEntryValidatorUtils.andValidator().validate( + JobEntryValidatorUtils.andValidator().validate( parentJobMeta.getBowl(), this, "localDirectory", remarks, AndValidator.putValidators( JobEntryValidatorUtils.notBlankValidator(), JobEntryValidatorUtils.fileExistsValidator() ) ); - JobEntryValidatorUtils.andValidator().validate( this, "userName", remarks, + JobEntryValidatorUtils.andValidator().validate( parentJobMeta.getBowl(), this, "userName", remarks, AndValidator.putValidators( JobEntryValidatorUtils.notBlankValidator() ) ); - JobEntryValidatorUtils.andValidator().validate( this, "password", remarks, + JobEntryValidatorUtils.andValidator().validate( parentJobMeta.getBowl(), this, "password", remarks, AndValidator.putValidators( JobEntryValidatorUtils.notNullValidator() ) ); - JobEntryValidatorUtils.andValidator().validate( this, "serverPort", remarks, + JobEntryValidatorUtils.andValidator().validate( parentJobMeta.getBowl(), this, "serverPort", remarks, AndValidator.putValidators( JobEntryValidatorUtils.integerValidator() ) ); } diff --git a/plugins/ftps/impl/src/main/java/org/pentaho/di/job/entries/ftpsput/JobEntryFTPSPUT.java b/plugins/ftps/impl/src/main/java/org/pentaho/di/job/entries/ftpsput/JobEntryFTPSPUT.java index fdeeade6bb73..a2bc247b3527 100644 --- a/plugins/ftps/impl/src/main/java/org/pentaho/di/job/entries/ftpsput/JobEntryFTPSPUT.java +++ b/plugins/ftps/impl/src/main/java/org/pentaho/di/job/entries/ftpsput/JobEntryFTPSPUT.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2023 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -502,7 +502,8 @@ public Result execute( Result previousResult, int nr ) { // Create FTPS client to host:port ... int realPort = Const.toInt( environmentSubstitute( realServerPort ), 0 ); // Define a new connection - connection = new FTPSConnection( getConnectionType(), realServerName, realPort, realUsername, realPassword ); + connection = new FTPSConnection( parentJobMeta.getBowl(), getConnectionType(), realServerName, realPort, + realUsername, realPassword ); this.buildFTPSConnection( connection ); @@ -633,16 +634,16 @@ public List getResourceDependencies( JobMeta jobMeta ) { @Override public void check( List remarks, JobMeta jobMeta, VariableSpace space, Repository repository, IMetaStore metaStore ) { - JobEntryValidatorUtils.andValidator().validate( this, "serverName", remarks, + JobEntryValidatorUtils.andValidator().validate( jobMeta.getBowl(), this, "serverName", remarks, AndValidator.putValidators( JobEntryValidatorUtils.notBlankValidator() ) ); - JobEntryValidatorUtils.andValidator().validate( + JobEntryValidatorUtils.andValidator().validate( jobMeta.getBowl(), this, "localDirectory", remarks, AndValidator.putValidators( JobEntryValidatorUtils.notBlankValidator(), JobEntryValidatorUtils.fileExistsValidator() ) ); - JobEntryValidatorUtils.andValidator().validate( this, "userName", remarks, + JobEntryValidatorUtils.andValidator().validate( jobMeta.getBowl(), this, "userName", remarks, AndValidator.putValidators( JobEntryValidatorUtils.notBlankValidator() ) ); - JobEntryValidatorUtils.andValidator().validate( this, "password", remarks, + JobEntryValidatorUtils.andValidator().validate( jobMeta.getBowl(), this, "password", remarks, AndValidator.putValidators( JobEntryValidatorUtils.notNullValidator() ) ); - JobEntryValidatorUtils.andValidator().validate( this, "serverPort", remarks, + JobEntryValidatorUtils.andValidator().validate( jobMeta.getBowl(), this, "serverPort", remarks, AndValidator.putValidators( JobEntryValidatorUtils.integerValidator() ) ); } diff --git a/plugins/ftps/impl/src/test/java/org/pentaho/di/job/entries/ftpsget/FTPSConnectionTest.java b/plugins/ftps/impl/src/test/java/org/pentaho/di/job/entries/ftpsget/FTPSConnectionTest.java index 86763189b397..67eeeac86dfc 100644 --- a/plugins/ftps/impl/src/test/java/org/pentaho/di/job/entries/ftpsget/FTPSConnectionTest.java +++ b/plugins/ftps/impl/src/test/java/org/pentaho/di/job/entries/ftpsget/FTPSConnectionTest.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2023 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2023-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -34,6 +34,8 @@ import org.ftp4che.reply.Reply; import org.ftp4che.util.ftpfile.FTPFileFactory; import org.junit.Test; +import org.pentaho.di.core.bowl.Bowl; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.variables.VariableSpace; import org.pentaho.di.core.vfs.KettleVFS; import org.pentaho.di.job.entries.ftpsget.ftp4che.SecureDataFTPConnection; @@ -55,7 +57,7 @@ public class FTPSConnectionTest { @Test public void testEnforceProtP() throws Exception { FTPSTestConnection connection = spy( - new FTPSTestConnection( + new FTPSTestConnection( DefaultBowl.getInstance(), FTPSConnection.CONNECTION_TYPE_FTP_IMPLICIT_TLS_WITH_CRYPTED, "the.perfect.host", 2010, "warwickw", "julia", null ) ); connection.replies.put( "PWD", new Reply( Arrays.asList( "257 \"/la\" is current directory" ) ) ); @@ -67,11 +69,12 @@ public void testEnforceProtP() throws Exception { @Test public void testEnforceProtPOnPut() throws Exception { - FileObject file = KettleVFS.createTempFile( "FTPSConnectionTest_testEnforceProtPOnPut", KettleVFS.Suffix.TMP); + FileObject file = KettleVFS.getInstance( DefaultBowl.getInstance() ) + .createTempFile( "FTPSConnectionTest_testEnforceProtPOnPut", KettleVFS.Suffix.TMP); file.createFile(); try { FTPSTestConnection connection = spy( - new FTPSTestConnection( + new FTPSTestConnection( DefaultBowl.getInstance(), FTPSConnection.CONNECTION_TYPE_FTP_IMPLICIT_TLS_WITH_CRYPTED, "the.perfect.host", 2010, "warwickw", "julia", null ) ); connection.replies.put( "PWD", new Reply( Arrays.asList( "257 \"/la\" is current directory" ) ) ); @@ -89,9 +92,9 @@ static class FTPSTestConnection extends FTPSConnection { public SocketProvider connectionSocketProvider; public Map replies = new HashMap<>(); - public FTPSTestConnection( int connectionType, String hostname, int port, String username, String password, - VariableSpace nameSpace ) { - super( connectionType, hostname, port, username, password, nameSpace ); + public FTPSTestConnection( Bowl bowl, int connectionType, String hostname, int port, String username, + String password, VariableSpace nameSpace ) { + super( bowl, connectionType, hostname, port, username, password, nameSpace ); } @Override diff --git a/plugins/ftps/ui/src/main/java/org/pentaho/di/ui/job/entries/ftpsget/JobEntryFTPSGetDialog.java b/plugins/ftps/ui/src/main/java/org/pentaho/di/ui/job/entries/ftpsget/JobEntryFTPSGetDialog.java index 15596bc609bb..412a98b59d1b 100644 --- a/plugins/ftps/ui/src/main/java/org/pentaho/di/ui/job/entries/ftpsget/JobEntryFTPSGetDialog.java +++ b/plugins/ftps/ui/src/main/java/org/pentaho/di/ui/job/entries/ftpsget/JobEntryFTPSGetDialog.java @@ -1268,7 +1268,7 @@ private boolean connectToFTPS( boolean checkfolder, boolean checkmoveToFolder ) String realPassword = Utils.resolvePassword( jobMeta, wPassword.getText() ); connection = - new FTPSConnection( + new FTPSConnection( jobMeta.getBowl(), FTPSConnection.getConnectionTypeByDesc( wConnectionType.getText() ), realServername, port, realUsername, realPassword ); diff --git a/plugins/ftps/ui/src/main/java/org/pentaho/di/ui/job/entries/ftpsput/JobEntryFTPSPUTDialog.java b/plugins/ftps/ui/src/main/java/org/pentaho/di/ui/job/entries/ftpsput/JobEntryFTPSPUTDialog.java index bae8eecc18a0..c5a4f24d5a76 100644 --- a/plugins/ftps/ui/src/main/java/org/pentaho/di/ui/job/entries/ftpsput/JobEntryFTPSPUTDialog.java +++ b/plugins/ftps/ui/src/main/java/org/pentaho/di/ui/job/entries/ftpsput/JobEntryFTPSPUTDialog.java @@ -873,7 +873,7 @@ private boolean connectToFTP( boolean checkfolder, String remoteFoldername ) { if ( connection == null ) { // Create ftp client to host:port ... connection = - new FTPSConnection( + new FTPSConnection( jobMeta.getBowl(), FTPSConnection.getConnectionTypeByDesc( wConnectionType.getText() ), realServername, realPort, realUsername, realPassword ); diff --git a/plugins/get-file-sftp/impl/src/it/java/org/pentaho/di/job/entries/sftp/JobEntrySFTPIT.java b/plugins/get-file-sftp/impl/src/it/java/org/pentaho/di/job/entries/sftp/JobEntrySFTPIT.java index e17615ed1bcc..31fdf3ddc81e 100644 --- a/plugins/get-file-sftp/impl/src/it/java/org/pentaho/di/job/entries/sftp/JobEntrySFTPIT.java +++ b/plugins/get-file-sftp/impl/src/it/java/org/pentaho/di/job/entries/sftp/JobEntrySFTPIT.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -30,6 +30,7 @@ import org.junit.ClassRule; import org.junit.Test; import org.junit.rules.TemporaryFolder; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.KettleEnvironment; import org.pentaho.di.core.Result; import org.pentaho.di.core.logging.LogLevel; @@ -70,7 +71,7 @@ public static void stopServer() throws Exception { @Test public void getFile_WhenDestinationIsSetViaVariable() throws Exception { final String localDir = TestUtils.createTempDir(); - KettleVFS.getFileObject( localDir ).createFolder(); + KettleVFS.getInstance( DefaultBowl.getInstance() ).getFileObject( localDir ).createFolder(); final String myVar = "my-var"; @@ -96,7 +97,8 @@ public void getFile_WhenDestinationIsSetViaVariable() throws Exception { job.execute( new Result(), 1 ); - FileObject downloaded = KettleVFS.getFileObject( localDir + "/" + fileName ); + FileObject downloaded = KettleVFS.getInstance( DefaultBowl.getInstance() ) + .getFileObject( localDir + "/" + fileName ); assertTrue( downloaded.exists() ); downloaded.delete(); } diff --git a/plugins/get-file-sftp/impl/src/it/java/org/pentaho/di/job/entries/sftp/SFTPClientIT.java b/plugins/get-file-sftp/impl/src/it/java/org/pentaho/di/job/entries/sftp/SFTPClientIT.java index d29d332feb82..66cdb85bfb2f 100644 --- a/plugins/get-file-sftp/impl/src/it/java/org/pentaho/di/job/entries/sftp/SFTPClientIT.java +++ b/plugins/get-file-sftp/impl/src/it/java/org/pentaho/di/job/entries/sftp/SFTPClientIT.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -33,6 +33,7 @@ import org.junit.ClassRule; import org.junit.Test; import org.junit.rules.TemporaryFolder; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.KettleEnvironment; import org.pentaho.di.core.vfs.KettleVFS; @@ -119,9 +120,10 @@ public void getFile() throws Exception { channel.connect(); channel.put( new ByteArrayInputStream( data ), "downloaded.txt" ); - client.get( KettleVFS.getFileObject( "ram://downloaded.txt" ), "downloaded.txt" ); + client.get( KettleVFS.getInstance( DefaultBowl.getInstance() ) + .getFileObject( "ram://downloaded.txt" ), "downloaded.txt" ); - FileObject downloaded = KettleVFS.getFileObject( "ram://downloaded.txt" ); + FileObject downloaded = KettleVFS.getInstance( DefaultBowl.getInstance() ).getFileObject( "ram://downloaded.txt" ); assertTrue( downloaded.exists() ); assertTrue( IOUtils.contentEquals( downloaded.getContent().getInputStream(), new ByteArrayInputStream( data ) ) ); } diff --git a/plugins/get-file-sftp/impl/src/main/java/org/pentaho/di/job/entries/sftp/JobEntrySFTP.java b/plugins/get-file-sftp/impl/src/main/java/org/pentaho/di/job/entries/sftp/JobEntrySFTP.java index 683555c8ce4d..bf4691fa6a40 100644 --- a/plugins/get-file-sftp/impl/src/main/java/org/pentaho/di/job/entries/sftp/JobEntrySFTP.java +++ b/plugins/get-file-sftp/impl/src/main/java/org/pentaho/di/job/entries/sftp/JobEntrySFTP.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2023 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -589,7 +589,7 @@ public Result execute( Result previousResult, int nr ) { result.setNrErrors( 1 ); return result; } - if ( !KettleVFS.fileExists( realKeyFilename ) ) { + if ( !KettleVFS.getInstance( parentJobMeta.getBowl() ).fileExists( realKeyFilename ) ) { // Error.. can not reach keyfile logError( BaseMessages.getString( PKG, "JobSFTP.Error.KeyFileNotFound", realKeyFilename ) ); result.setNrErrors( 1 ); @@ -599,7 +599,7 @@ public Result execute( Result previousResult, int nr ) { } if ( !Utils.isEmpty( realTargetDirectory ) ) { - TargetFolder = KettleVFS.getFileObject( realTargetDirectory, this ); + TargetFolder = KettleVFS.getInstance( parentJobMeta.getBowl() ).getFileObject( realTargetDirectory, this ); boolean TargetFolderExists = TargetFolder.exists(); if ( TargetFolderExists ) { if ( log.isDetailed() ) { @@ -628,7 +628,7 @@ public Result execute( Result previousResult, int nr ) { // Create sftp client to host ... sftpclient = - new SFTPClient( + new SFTPClient( parentJobMeta.getBowl(), InetAddress.getByName( realServerName ), Const.toInt( realServerPort, DEFAULT_PORT ), realUsername, realKeyFilename, realPassPhrase ); if ( log.isDetailed() ) { @@ -709,9 +709,9 @@ realProxyHost, environmentSubstitute( getProxyPort() ), environmentSubstitute( g logDebug( BaseMessages.getString( PKG, "JobSFTP.Log.GettingFiles", filelist[i], realTargetDirectory ) ); } - FileObject targetFile = KettleVFS.getFileObject( + FileObject targetFile = KettleVFS.getInstance( parentJobMeta.getBowl() ).getFileObject( realTargetDirectory + Const.FILE_SEPARATOR + filelist[i], this ); - sftpclient.get( targetFile, filelist[i] ); + sftpclient.get( parentJobMeta.getBowl(), targetFile, filelist[i] ); filesRetrieved++; if ( isaddresult ) { @@ -794,16 +794,21 @@ public List getResourceDependencies( JobMeta jobMeta ) { @Override public void check( List remarks, JobMeta jobMeta, VariableSpace space, Repository repository, IMetaStore metaStore ) { - JobEntryValidatorUtils.andValidator().validate( this, "serverName", remarks, AndValidator.putValidators( JobEntryValidatorUtils.notBlankValidator() ) ); + JobEntryValidatorUtils.andValidator().validate( jobMeta.getBowl(), this, "serverName", remarks, + AndValidator.putValidators( JobEntryValidatorUtils.notBlankValidator() ) ); ValidatorContext ctx = new ValidatorContext(); AbstractFileValidator.putVariableSpace( ctx, getVariables() ); - AndValidator.putValidators( ctx, JobEntryValidatorUtils.notBlankValidator(), JobEntryValidatorUtils.fileExistsValidator() ); - JobEntryValidatorUtils.andValidator().validate( this, "targetDirectory", remarks, ctx ); - - JobEntryValidatorUtils.andValidator().validate( this, "userName", remarks, AndValidator.putValidators( JobEntryValidatorUtils.notBlankValidator() ) ); - JobEntryValidatorUtils.andValidator().validate( this, "password", remarks, AndValidator.putValidators( JobEntryValidatorUtils.notNullValidator() ) ); - JobEntryValidatorUtils.andValidator().validate( this, "serverPort", remarks, AndValidator.putValidators( JobEntryValidatorUtils.integerValidator() ) ); + AndValidator.putValidators( ctx, JobEntryValidatorUtils.notBlankValidator(), + JobEntryValidatorUtils.fileExistsValidator() ); + JobEntryValidatorUtils.andValidator().validate( jobMeta.getBowl(), this, "targetDirectory", remarks, ctx ); + + JobEntryValidatorUtils.andValidator().validate( jobMeta.getBowl(), this, "userName", remarks, + AndValidator.putValidators( JobEntryValidatorUtils.notBlankValidator() ) ); + JobEntryValidatorUtils.andValidator().validate( jobMeta.getBowl(), this, "password", remarks, + AndValidator.putValidators( JobEntryValidatorUtils.notNullValidator() ) ); + JobEntryValidatorUtils.andValidator().validate( jobMeta.getBowl(), this, "serverPort", remarks, + AndValidator.putValidators( JobEntryValidatorUtils.integerValidator() ) ); } public static void main( String[] args ) { diff --git a/plugins/get-file-sftp/ui/src/main/java/org/pentaho/di/ui/job/entries/sftp/JobEntrySFTPDialog.java b/plugins/get-file-sftp/ui/src/main/java/org/pentaho/di/ui/job/entries/sftp/JobEntrySFTPDialog.java index 0d980a09b25f..96dcc5a195a0 100644 --- a/plugins/get-file-sftp/ui/src/main/java/org/pentaho/di/ui/job/entries/sftp/JobEntrySFTPDialog.java +++ b/plugins/get-file-sftp/ui/src/main/java/org/pentaho/di/ui/job/entries/sftp/JobEntrySFTPDialog.java @@ -940,7 +940,7 @@ private boolean connectToSFTP( boolean checkFolder, String Remotefoldername ) { try { if ( sftpclient == null ) { // Create sftp client to host ... - sftpclient = new SFTPClient( + sftpclient = new SFTPClient( jobMeta.getBowl(), InetAddress.getByName( jobMeta.environmentSubstitute( wServerName.getText() ) ), Const.toInt( jobMeta.environmentSubstitute( wServerPort.getText() ), 22 ), jobMeta.environmentSubstitute( wUserName.getText() ), diff --git a/plugins/get-file-with-ftp/impl/src/main/java/org/pentaho/di/job/entries/ftp/JobEntryFTP.java b/plugins/get-file-with-ftp/impl/src/main/java/org/pentaho/di/job/entries/ftp/JobEntryFTP.java index c4284a3798bb..d0f4ddd88e57 100644 --- a/plugins/get-file-with-ftp/impl/src/main/java/org/pentaho/di/job/entries/ftp/JobEntryFTP.java +++ b/plugins/get-file-with-ftp/impl/src/main/java/org/pentaho/di/job/entries/ftp/JobEntryFTP.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2023 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -1174,7 +1174,8 @@ public Result execute( Result previousResult, int nr ) { private void downloadFile( FTPClient ftpclient, String filename, String realMoveToFolder, Job parentJob, Result result ) throws Exception { String localFilename = filename; - targetFilename = KettleVFS.getFilename( KettleVFS.getFileObject( returnTargetFilename( localFilename ) ) ); + targetFilename = KettleVFS.getFilename( KettleVFS.getInstance( parentJobMeta.getBowl() ) + .getFileObject( returnTargetFilename( localFilename ) ) ); if ( ( !onlyGettingNewFiles ) || ( onlyGettingNewFiles && needsDownload( targetFilename ) ) ) { if ( isDetailed() ) { @@ -1234,7 +1235,7 @@ private void addFilenameToResultFilenames( Result result, Job parentJob, String if ( isaddresult ) { FileObject targetFile = null; try { - targetFile = KettleVFS.getFileObject( filename, this ); + targetFile = KettleVFS.getInstance( parentJobMeta.getBowl() ).getFileObject( filename, this ); // Add to the result files... ResultFile resultFile = @@ -1434,14 +1435,14 @@ public void setActiveConnection( boolean passive ) { public void check( List remarks, JobMeta jobMeta, VariableSpace space, Repository repository, IMetaStore metaStore ) { - JobEntryValidatorUtils.andValidator().validate( this, "serverName", remarks, + JobEntryValidatorUtils.andValidator().validate( jobMeta.getBowl(), this, "serverName", remarks, AndValidator.putValidators( JobEntryValidatorUtils.notBlankValidator() ) ); - JobEntryValidatorUtils.andValidator().validate( + JobEntryValidatorUtils.andValidator().validate( jobMeta.getBowl(), this, "targetDirectory", remarks, AndValidator.putValidators( JobEntryValidatorUtils.notBlankValidator(), JobEntryValidatorUtils.fileExistsValidator() ) ); - JobEntryValidatorUtils.andValidator().validate( this, "userName", remarks, + JobEntryValidatorUtils.andValidator().validate( jobMeta.getBowl(), this, "userName", remarks, AndValidator.putValidators( JobEntryValidatorUtils.notBlankValidator() ) ); - JobEntryValidatorUtils.andValidator().validate( this, "password", remarks, + JobEntryValidatorUtils.andValidator().validate( jobMeta.getBowl(), this, "password", remarks, AndValidator.putValidators( JobEntryValidatorUtils.notNullValidator() ) ); } diff --git a/plugins/get-previous-row-field/core/src/main/java/org/pentaho/di/trans/steps/getpreviousrowfield/GetPreviousRowField.java b/plugins/get-previous-row-field/core/src/main/java/org/pentaho/di/trans/steps/getpreviousrowfield/GetPreviousRowField.java index bb8259e2386b..59d1b979bf81 100644 --- a/plugins/get-previous-row-field/core/src/main/java/org/pentaho/di/trans/steps/getpreviousrowfield/GetPreviousRowField.java +++ b/plugins/get-previous-row-field/core/src/main/java/org/pentaho/di/trans/steps/getpreviousrowfield/GetPreviousRowField.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -86,7 +86,8 @@ public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws data.inputRowMeta = getInputRowMeta(); data.NrPrevFields = data.inputRowMeta.size(); data.outputRowMeta = data.inputRowMeta.clone(); - meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); + meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository, + metaStore ); data.inStreamNrs = new int[meta.getFieldInStream().length]; for ( int i = 0; i < meta.getFieldInStream().length; i++ ) { diff --git a/plugins/get-previous-row-field/core/src/main/java/org/pentaho/di/trans/steps/getpreviousrowfield/GetPreviousRowFieldMeta.java b/plugins/get-previous-row-field/core/src/main/java/org/pentaho/di/trans/steps/getpreviousrowfield/GetPreviousRowFieldMeta.java index b6953012650e..2cf67f767a5c 100644 --- a/plugins/get-previous-row-field/core/src/main/java/org/pentaho/di/trans/steps/getpreviousrowfield/GetPreviousRowFieldMeta.java +++ b/plugins/get-previous-row-field/core/src/main/java/org/pentaho/di/trans/steps/getpreviousrowfield/GetPreviousRowFieldMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -29,6 +29,7 @@ import org.pentaho.di.core.Const; import org.pentaho.di.core.util.Utils; import org.pentaho.di.core.annotations.Step; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.database.DatabaseMeta; import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.core.exception.KettleStepException; @@ -222,8 +223,8 @@ public void saveRep( Repository rep, IMetaStore metaStore, ObjectId id_transform } @Override - public void getFields( RowMetaInterface inputRowMeta, String name, RowMetaInterface[] info, StepMeta nextStep, - VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { + public void getFields( Bowl bowl, RowMetaInterface inputRowMeta, String name, RowMetaInterface[] info, + StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { // Add new field? for ( int i = 0; i < fieldOutStream.length; i++ ) { diff --git a/plugins/get-repository-names/impl/src/main/java/org/pentaho/di/trans/steps/getrepositorynames/GetRepositoryNames.java b/plugins/get-repository-names/impl/src/main/java/org/pentaho/di/trans/steps/getrepositorynames/GetRepositoryNames.java index ae468ce72127..148873507fec 100644 --- a/plugins/get-repository-names/impl/src/main/java/org/pentaho/di/trans/steps/getrepositorynames/GetRepositoryNames.java +++ b/plugins/get-repository-names/impl/src/main/java/org/pentaho/di/trans/steps/getrepositorynames/GetRepositoryNames.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2023 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -26,6 +26,7 @@ import java.util.List; import org.apache.commons.lang.BooleanUtils; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.core.row.RowDataUtil; import org.pentaho.di.core.row.RowMeta; @@ -79,7 +80,8 @@ public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws first = false; data.outputRowMeta = new RowMeta(); - meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); + meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository, + metaStore ); } if ( data.filenr >= data.list.size() ) { diff --git a/plugins/get-repository-names/impl/src/main/java/org/pentaho/di/trans/steps/getrepositorynames/GetRepositoryNamesMeta.java b/plugins/get-repository-names/impl/src/main/java/org/pentaho/di/trans/steps/getrepositorynames/GetRepositoryNamesMeta.java index 40a726a34f1a..e926750397be 100644 --- a/plugins/get-repository-names/impl/src/main/java/org/pentaho/di/trans/steps/getrepositorynames/GetRepositoryNamesMeta.java +++ b/plugins/get-repository-names/impl/src/main/java/org/pentaho/di/trans/steps/getrepositorynames/GetRepositoryNamesMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2023 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -24,6 +24,7 @@ import java.util.List; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.CheckResult; import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.Const; @@ -135,7 +136,8 @@ public void setDefault() { } } - public void getFields( RowMetaInterface row, String origin, RowMetaInterface[] info, StepMeta nextStep, + @Override + public void getFields( Bowl bowl, RowMetaInterface row, String origin, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { // the directory and name of the object diff --git a/plugins/google-analytics/core/src/main/java/org/pentaho/di/trans/steps/googleanalytics/GaInputStep.java b/plugins/google-analytics/core/src/main/java/org/pentaho/di/trans/steps/googleanalytics/GaInputStep.java index 9c75b6137894..d15a9859faab 100644 --- a/plugins/google-analytics/core/src/main/java/org/pentaho/di/trans/steps/googleanalytics/GaInputStep.java +++ b/plugins/google-analytics/core/src/main/java/org/pentaho/di/trans/steps/googleanalytics/GaInputStep.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -69,7 +69,8 @@ public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws first = false; data.outputRowMeta = new RowMeta(); - meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); + meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository, + metaStore ); // stores the indices where to look for the key fields in the input rows data.conversionMeta = new ValueMetaInterface[ meta.getFieldsCount() ]; @@ -235,7 +236,8 @@ public boolean init( StepMetaInterface smi, StepDataInterface sdi ) { try { // Create an Analytics object, and fetch what we can for later (account name, e.g.) - analytics = GoogleAnalyticsApiFacade.createFor( appName, serviceAccount, OAuthKeyFile ).getAnalytics(); + analytics = GoogleAnalyticsApiFacade.createFor( getTransMeta().getBowl(), + appName, serviceAccount, OAuthKeyFile ).getAnalytics(); // There is necessarily an account name associated with this, so any NPEs or other exceptions mean bail out accountName = analytics.management().accounts().list().execute().getItems().iterator().next().getName(); } catch ( TokenResponseException tre ) { diff --git a/plugins/google-analytics/core/src/main/java/org/pentaho/di/trans/steps/googleanalytics/GaInputStepMeta.java b/plugins/google-analytics/core/src/main/java/org/pentaho/di/trans/steps/googleanalytics/GaInputStepMeta.java index 64795ced4121..004526de955a 100644 --- a/plugins/google-analytics/core/src/main/java/org/pentaho/di/trans/steps/googleanalytics/GaInputStepMeta.java +++ b/plugins/google-analytics/core/src/main/java/org/pentaho/di/trans/steps/googleanalytics/GaInputStepMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -30,6 +30,7 @@ import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.Const; import org.pentaho.di.core.annotations.Step; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.database.DatabaseMeta; import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.core.exception.KettlePluginException; @@ -374,7 +375,7 @@ public void allocate( int nrkeys ) { } @Override - public void getFields( RowMetaInterface r, String origin, RowMetaInterface[] info, StepMeta nextStep, + public void getFields( Bowl bowl, RowMetaInterface r, String origin, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) { // clear the output diff --git a/plugins/google-analytics/core/src/main/java/org/pentaho/di/trans/steps/googleanalytics/GoogleAnalyticsApiFacade.java b/plugins/google-analytics/core/src/main/java/org/pentaho/di/trans/steps/googleanalytics/GoogleAnalyticsApiFacade.java index 0daa18bd29f9..41353afefde3 100644 --- a/plugins/google-analytics/core/src/main/java/org/pentaho/di/trans/steps/googleanalytics/GoogleAnalyticsApiFacade.java +++ b/plugins/google-analytics/core/src/main/java/org/pentaho/di/trans/steps/googleanalytics/GoogleAnalyticsApiFacade.java @@ -1,7 +1,7 @@ /*! * HITACHI VANTARA PROPRIETARY AND CONFIDENTIAL * - * Copyright 2002 - 2017 Hitachi Vantara. All rights reserved. + * Copyright 2002 - 2024 Hitachi Vantara. All rights reserved. * * NOTICE: All information including source code contained herein is, and * remains the sole property of Hitachi Vantara and its licensors. The intellectual @@ -45,6 +45,7 @@ import com.google.api.client.http.HttpTransport; import com.google.api.client.json.JsonFactory; import com.google.api.client.json.jackson2.JacksonFactory; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.exception.KettleFileException; import org.pentaho.di.core.util.Assert; import org.pentaho.di.core.vfs.KettleVFS; @@ -57,7 +58,7 @@ public class GoogleAnalyticsApiFacade { private Analytics analytics; private final HttpTransport httpTransport; - public static GoogleAnalyticsApiFacade createFor( + public static GoogleAnalyticsApiFacade createFor( Bowl bowl, String application, String oauthServiceAccount, String oauthKeyFile ) throws GeneralSecurityException, IOException, KettleFileException { @@ -66,7 +67,7 @@ public static GoogleAnalyticsApiFacade createFor( JacksonFactory.getDefaultInstance(), application, oauthServiceAccount, - new File( KettleVFS.getFileObject( oauthKeyFile ).getURL().getPath() ) + new File( KettleVFS.getInstance( bowl ).getFileObject( oauthKeyFile ).getURL().getPath() ) ); } diff --git a/plugins/google-analytics/core/src/main/java/org/pentaho/di/ui/trans/steps/googleanalytics/GaInputStepDialog.java b/plugins/google-analytics/core/src/main/java/org/pentaho/di/ui/trans/steps/googleanalytics/GaInputStepDialog.java index d37cfba10075..57a0150d2e86 100644 --- a/plugins/google-analytics/core/src/main/java/org/pentaho/di/ui/trans/steps/googleanalytics/GaInputStepDialog.java +++ b/plugins/google-analytics/core/src/main/java/org/pentaho/di/ui/trans/steps/googleanalytics/GaInputStepDialog.java @@ -1598,6 +1598,7 @@ private Analytics getAnalytics() { try { getInfo( getInput() ); return GoogleAnalyticsApiFacade.createFor( + transMeta.getBowl(), transMeta.environmentSubstitute( wGaAppName.getText() ), transMeta.environmentSubstitute( wOauthAccount.getText() ), transMeta.environmentSubstitute( keyFilename.getText() ) diff --git a/plugins/google-analytics/core/src/test/java/org/pentaho/di/trans/steps/googleanalytics/GoogleAnalyticsApiFacadeTest.java b/plugins/google-analytics/core/src/test/java/org/pentaho/di/trans/steps/googleanalytics/GoogleAnalyticsApiFacadeTest.java index 223e7ef09630..636310410cae 100644 --- a/plugins/google-analytics/core/src/test/java/org/pentaho/di/trans/steps/googleanalytics/GoogleAnalyticsApiFacadeTest.java +++ b/plugins/google-analytics/core/src/test/java/org/pentaho/di/trans/steps/googleanalytics/GoogleAnalyticsApiFacadeTest.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -22,6 +22,8 @@ package org.pentaho.di.trans.steps.googleanalytics; +import org.pentaho.di.core.bowl.DefaultBowl; + import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; @@ -65,6 +67,6 @@ public GoogleAnalyticsApiFacadeTest( String path, Class expectedExcep @Test public void exceptionIsThrowsForNonExistingFiles() throws Exception { - GoogleAnalyticsApiFacade.createFor( "application-name", "account", path ); + GoogleAnalyticsApiFacade.createFor( DefaultBowl.getInstance(), "application-name", "account", path ); } } diff --git a/plugins/gp-bulk-loader/core/src/main/java/org/pentaho/di/trans/steps/gpbulkloader/GPBulkLoader.java b/plugins/gp-bulk-loader/core/src/main/java/org/pentaho/di/trans/steps/gpbulkloader/GPBulkLoader.java index 8e85b1a8cc1c..341f28f7e248 100644 --- a/plugins/gp-bulk-loader/core/src/main/java/org/pentaho/di/trans/steps/gpbulkloader/GPBulkLoader.java +++ b/plugins/gp-bulk-loader/core/src/main/java/org/pentaho/di/trans/steps/gpbulkloader/GPBulkLoader.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -319,7 +319,8 @@ public String createCommandLine( GPBulkLoaderMeta meta, boolean password ) throw if ( meta.getPsqlpath() != null ) { try { FileObject fileObject = - KettleVFS.getFileObject( environmentSubstitute( meta.getPsqlpath() ), getTransMeta() ); + KettleVFS.getInstance( getTransMeta().getBowl() ) + .getFileObject( environmentSubstitute( meta.getPsqlpath() ), getTransMeta() ); String psqlexec = KettleVFS.getFilename( fileObject ); sb.append( enclosure ).append( psqlexec ).append( enclosure ); } catch ( Exception ex ) { @@ -332,7 +333,8 @@ public String createCommandLine( GPBulkLoaderMeta meta, boolean password ) throw if ( meta.getControlFile() != null ) { try { FileObject fileObject = - KettleVFS.getFileObject( environmentSubstitute( meta.getControlFile() ), getTransMeta() ); + KettleVFS.getInstance( getTransMeta().getBowl() ) + .getFileObject( environmentSubstitute( meta.getControlFile() ), getTransMeta() ); sb.append( " -n -f " ); sb.append( enclosure ).append( KettleVFS.getFilename( fileObject ) ).append( enclosure ); @@ -346,7 +348,8 @@ public String createCommandLine( GPBulkLoaderMeta meta, boolean password ) throw if ( meta.getLogFile() != null ) { try { FileObject fileObject = - KettleVFS.getFileObject( environmentSubstitute( meta.getLogFile() ), getTransMeta() ); + KettleVFS.getInstance( getTransMeta().getBowl() ) + .getFileObject( environmentSubstitute( meta.getLogFile() ), getTransMeta() ); sb.append( " -o " ); sb.append( enclosure ).append( KettleVFS.getFilename( fileObject ) ).append( enclosure ); @@ -542,7 +545,8 @@ public void dispose( StepMetaInterface smi, StepDataInterface sdi ) { if ( meta.getControlFile() != null ) { try { - fileObject = KettleVFS.getFileObject( environmentSubstitute( meta.getControlFile() ), getTransMeta() ); + fileObject = KettleVFS.getInstance( getTransMeta().getBowl() ) + .getFileObject( environmentSubstitute( meta.getControlFile() ), getTransMeta() ); fileObject.delete(); fileObject.close(); } catch ( Exception ex ) { @@ -556,7 +560,8 @@ public void dispose( StepMetaInterface smi, StepDataInterface sdi ) { // In concurrent mode the data is written to the control file. if ( meta.getDataFile() != null ) { try { - fileObject = KettleVFS.getFileObject( environmentSubstitute( meta.getDataFile() ), getTransMeta() ); + fileObject = KettleVFS.getInstance( getTransMeta().getBowl() ) + .getFileObject( environmentSubstitute( meta.getDataFile() ), getTransMeta() ); fileObject.delete(); fileObject.close(); } catch ( Exception ex ) { diff --git a/plugins/gp-bulk-loader/core/src/main/java/org/pentaho/di/trans/steps/gpbulkloader/GPBulkLoaderMeta.java b/plugins/gp-bulk-loader/core/src/main/java/org/pentaho/di/trans/steps/gpbulkloader/GPBulkLoaderMeta.java index e75804318465..41924e0e8519 100644 --- a/plugins/gp-bulk-loader/core/src/main/java/org/pentaho/di/trans/steps/gpbulkloader/GPBulkLoaderMeta.java +++ b/plugins/gp-bulk-loader/core/src/main/java/org/pentaho/di/trans/steps/gpbulkloader/GPBulkLoaderMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2018 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -31,6 +31,7 @@ import org.pentaho.di.core.ProvidesDatabaseConnectionInformation; import org.pentaho.di.core.SQLStatement; import org.pentaho.di.core.annotations.Step; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.database.Database; import org.pentaho.di.core.database.DatabaseMeta; import org.pentaho.di.core.exception.KettleException; @@ -423,7 +424,7 @@ public void saveRep( Repository rep, IMetaStore metaStore, ObjectId id_transform } @Override - public void getFields( RowMetaInterface rowMeta, String origin, RowMetaInterface[] info, StepMeta nextStep, + public void getFields( Bowl bowl, RowMetaInterface rowMeta, String origin, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { // Default: nothing changes to rowMeta } diff --git a/plugins/gpload/core/src/main/java/org/pentaho/di/trans/steps/gpload/GPLoad.java b/plugins/gpload/core/src/main/java/org/pentaho/di/trans/steps/gpload/GPLoad.java index a9c4109686c1..42f9b5ed7742 100644 --- a/plugins/gpload/core/src/main/java/org/pentaho/di/trans/steps/gpload/GPLoad.java +++ b/plugins/gpload/core/src/main/java/org/pentaho/di/trans/steps/gpload/GPLoad.java @@ -12,7 +12,7 @@ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * - * Copyright (c) 2002-2019 Hitachi Vantara.. All rights reserved. + * Copyright (c) 2002-2024 Hitachi Vantara.. All rights reserved. */ package org.pentaho.di.trans.steps.gpload; @@ -457,7 +457,7 @@ private String getPath( String pathToFile, String exceptionMessage, boolean chec throw new KettleException( exceptionMessage ); } - FileObject fileObject = KettleVFS.getFileObject( pathToFile, getTransMeta() ); + FileObject fileObject = KettleVFS.getInstance( getTransMeta().getBowl() ).getFileObject( pathToFile, getTransMeta() ); try { // we either check the existence of the file if ( checkExistenceOfFile ) { @@ -684,7 +684,8 @@ public void dispose( StepMetaInterface smi, StepDataInterface sdi ) { if ( GPLoadMeta.METHOD_AUTO_END.equals( method ) ) { if ( meta.getControlFile() != null ) { try { - fileObject = KettleVFS.getFileObject( environmentSubstitute( meta.getControlFile() ), getTransMeta() ); + fileObject = KettleVFS.getInstance( getTransMeta().getBowl() ) + .getFileObject( environmentSubstitute( meta.getControlFile() ), getTransMeta() ); fileObject.delete(); fileObject.close(); } catch ( Exception ex ) { @@ -697,7 +698,8 @@ public void dispose( StepMetaInterface smi, StepDataInterface sdi ) { // In concurrent mode the data is written to the control file. if ( meta.getDataFile() != null ) { try { - fileObject = KettleVFS.getFileObject( environmentSubstitute( meta.getDataFile() ), getTransMeta() ); + fileObject = KettleVFS.getInstance( getTransMeta().getBowl() ) + .getFileObject( environmentSubstitute( meta.getDataFile() ), getTransMeta() ); fileObject.delete(); fileObject.close(); } catch ( Exception ex ) { diff --git a/plugins/gpload/core/src/main/java/org/pentaho/di/trans/steps/gpload/GPLoadMeta.java b/plugins/gpload/core/src/main/java/org/pentaho/di/trans/steps/gpload/GPLoadMeta.java index e9f8d1bae404..a89d04ad9f4a 100644 --- a/plugins/gpload/core/src/main/java/org/pentaho/di/trans/steps/gpload/GPLoadMeta.java +++ b/plugins/gpload/core/src/main/java/org/pentaho/di/trans/steps/gpload/GPLoadMeta.java @@ -12,7 +12,7 @@ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * - * Copyright (c) 2002-2017 Hitachi Vantara.. All rights reserved. + * Copyright (c) 2002-2024 Hitachi Vantara.. All rights reserved. */ package org.pentaho.di.trans.steps.gpload; @@ -26,6 +26,7 @@ import org.pentaho.di.core.util.Utils; import org.pentaho.di.core.SQLStatement; import org.pentaho.di.core.annotations.Step; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.database.Database; import org.pentaho.di.core.database.DatabaseMeta; import org.pentaho.di.core.exception.KettleException; @@ -542,7 +543,8 @@ public void saveRep( Repository rep, IMetaStore metaStore, ObjectId id_transform } } - public void getFields( RowMetaInterface rowMeta, String origin, RowMetaInterface[] info, StepMeta nextStep, + @Override + public void getFields( Bowl bowl, RowMetaInterface rowMeta, String origin, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { // Default: nothing changes to rowMeta } diff --git a/plugins/hl7/core/src/main/java/org/pentaho/di/trans/steps/hl7input/HL7Input.java b/plugins/hl7/core/src/main/java/org/pentaho/di/trans/steps/hl7input/HL7Input.java index fdd431ef034a..3b66c4aeef3b 100644 --- a/plugins/hl7/core/src/main/java/org/pentaho/di/trans/steps/hl7input/HL7Input.java +++ b/plugins/hl7/core/src/main/java/org/pentaho/di/trans/steps/hl7input/HL7Input.java @@ -12,7 +12,7 @@ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * - * Copyright (c) 2002-2017 Hitachi Vantara.. All rights reserved. + * Copyright (c) 2002-2024 Hitachi Vantara.. All rights reserved. */ package org.pentaho.di.trans.steps.hl7input; @@ -67,7 +67,8 @@ public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws } data.outputRowMeta = getInputRowMeta().clone(); - meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); + meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository, + metaStore ); data.parser = new GenericParser(); data.parser.setValidationContext( new NoValidation() ); diff --git a/plugins/hl7/core/src/main/java/org/pentaho/di/trans/steps/hl7input/HL7InputMeta.java b/plugins/hl7/core/src/main/java/org/pentaho/di/trans/steps/hl7input/HL7InputMeta.java index 1b4ec7869f19..846df6f2aa79 100644 --- a/plugins/hl7/core/src/main/java/org/pentaho/di/trans/steps/hl7input/HL7InputMeta.java +++ b/plugins/hl7/core/src/main/java/org/pentaho/di/trans/steps/hl7input/HL7InputMeta.java @@ -12,7 +12,7 @@ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * - * Copyright (c) 2002-2017 Hitachi Vantara.. All rights reserved. + * Copyright (c) 2002-2024 Hitachi Vantara.. All rights reserved. */ package org.pentaho.di.trans.steps.hl7input; @@ -22,6 +22,7 @@ import org.pentaho.di.core.CheckResult; import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.annotations.Step; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.database.DatabaseMeta; import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.core.exception.KettleStepException; @@ -94,7 +95,7 @@ public void saveRep( Repository rep, IMetaStore metaStore, ObjectId id_transform } @Override - public void getFields( RowMetaInterface rowMeta, String origin, RowMetaInterface[] info, StepMeta nextStep, + public void getFields( Bowl bowl, RowMetaInterface rowMeta, String origin, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { ValueMetaInterface valueMeta = new ValueMetaString( "ParentGroup" ); valueMeta.setOrigin( origin ); diff --git a/plugins/infobright-bulk-loader/impl/src/main/java/org/pentaho/di/trans/steps/infobrightoutput/InfobrightLoader.java b/plugins/infobright-bulk-loader/impl/src/main/java/org/pentaho/di/trans/steps/infobrightoutput/InfobrightLoader.java index 644190531f4c..dd0918714bab 100644 --- a/plugins/infobright-bulk-loader/impl/src/main/java/org/pentaho/di/trans/steps/infobrightoutput/InfobrightLoader.java +++ b/plugins/infobright-bulk-loader/impl/src/main/java/org/pentaho/di/trans/steps/infobrightoutput/InfobrightLoader.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2022 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -90,7 +90,8 @@ public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws if ( first ) { first = false; data.outputRowMeta = getInputRowMeta().clone(); - meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); + meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository, + metaStore ); data.insertRowMeta = getInputRowMeta().clone(); } diff --git a/plugins/ivw-bulk-loader/impl/src/main/java/org/pentaho/di/trans/steps/ivwloader/IngresVectorwiseLoader.java b/plugins/ivw-bulk-loader/impl/src/main/java/org/pentaho/di/trans/steps/ivwloader/IngresVectorwiseLoader.java index 8b943b19b2b1..a99631d30bcc 100644 --- a/plugins/ivw-bulk-loader/impl/src/main/java/org/pentaho/di/trans/steps/ivwloader/IngresVectorwiseLoader.java +++ b/plugins/ivw-bulk-loader/impl/src/main/java/org/pentaho/di/trans/steps/ivwloader/IngresVectorwiseLoader.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2022 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -315,7 +315,8 @@ public String createCommandLine( IngresVectorwiseLoaderMeta meta ) throws Kettle if ( !Utils.isEmpty( meta.getSqlPath() ) ) { try { - FileObject fileObject = KettleVFS.getFileObject( environmentSubstitute( meta.getSqlPath() ), getTransMeta() ); + FileObject fileObject = KettleVFS.getInstance( getTransMeta().getBowl() ) + .getFileObject( environmentSubstitute( meta.getSqlPath() ), getTransMeta() ); String sqlexec = Const.optionallyQuoteStringByOS( KettleVFS.getFilename( fileObject ) ); sb.append( sqlexec ); // sql @tc-dwh-test.timocom.net,tcp_ip,VW[ingres,pwd]::dwh diff --git a/plugins/json/core/src/main/java/org/pentaho/di/trans/steps/jsoninput/JsonInput.java b/plugins/json/core/src/main/java/org/pentaho/di/trans/steps/jsoninput/JsonInput.java index 6b3f30996e25..594b20524695 100644 --- a/plugins/json/core/src/main/java/org/pentaho/di/trans/steps/jsoninput/JsonInput.java +++ b/plugins/json/core/src/main/java/org/pentaho/di/trans/steps/jsoninput/JsonInput.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2021 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -193,7 +193,8 @@ protected void prepareToRowProcessing() throws KettleException { data.totalpreviousfields = data.inputRowMeta.size(); } } - meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); + meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository, + metaStore ); // Create convert meta-data objects that will contain Date & Number formatters data.convertRowMeta = data.outputRowMeta.cloneToType( ValueMetaInterface.TYPE_STRING ); diff --git a/plugins/json/core/src/main/java/org/pentaho/di/trans/steps/jsoninput/JsonInputMeta.java b/plugins/json/core/src/main/java/org/pentaho/di/trans/steps/jsoninput/JsonInputMeta.java index cbb6dc2597d9..09909a130b27 100644 --- a/plugins/json/core/src/main/java/org/pentaho/di/trans/steps/jsoninput/JsonInputMeta.java +++ b/plugins/json/core/src/main/java/org/pentaho/di/trans/steps/jsoninput/JsonInputMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2021 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -33,6 +33,7 @@ import org.pentaho.di.core.Const; import org.pentaho.di.core.util.Utils; import org.pentaho.di.core.annotations.Step; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.database.DatabaseMeta; import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.core.exception.KettleStepException; @@ -827,7 +828,7 @@ public void setDefault() { } @Override - public void getFields( RowMetaInterface rowMeta, String name, RowMetaInterface[] info, StepMeta nextStep, + public void getFields( Bowl bowl, RowMetaInterface rowMeta, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { if ( inFields && removeSourceField && !Utils.isEmpty( valueField ) ) { @@ -1003,9 +1004,10 @@ public void saveRep( Repository rep, IMetaStore metaStore, ObjectId id_transform } } - public FileInputList getFiles( VariableSpace space ) { + public FileInputList getFiles( Bowl bowl, VariableSpace space ) { return FileInputList.createFileList( - space, getFileName(), getFileMask(), getExcludeFileMask(), getFileRequired(), inputFiles.includeSubFolderBoolean() ); + bowl, space, getFileName(), getFileMask(), getExcludeFileMask(), getFileRequired(), + inputFiles.includeSubFolderBoolean() ); } @Override @@ -1049,7 +1051,7 @@ public void check( List remarks, TransMeta transMeta, Step remarks.add( cr ); } } else { - FileInputList fileInputList = getFiles( transMeta ); + FileInputList fileInputList = getFiles( transMeta.getBowl(), transMeta ); // String files[] = getFiles(); if ( fileInputList == null || fileInputList.getFiles().size() == 0 ) { cr = @@ -1099,7 +1101,7 @@ public boolean supportsErrorHandling() { * @return the filename of the exported resource */ @Override - public String exportResources( VariableSpace space, Map definitions, + public String exportResources( Bowl bowl, VariableSpace space, Map definitions, ResourceNamingInterface resourceNamingInterface, Repository repository, IMetaStore metaStore ) throws KettleException { try { // The object that we're modifying here is a copy of the original! @@ -1109,7 +1111,7 @@ public String exportResources( VariableSpace space, Map newFilenames = new ArrayList(); if ( !isInFields() ) { - FileInputList fileList = getFiles( space ); + FileInputList fileList = getFiles( bowl, space ); if ( fileList.getFiles().size() > 0 ) { for ( FileObject fileObject : fileList.getFiles() ) { // From : ${Internal.Transformation.Filename.Directory}/../foo/bar.xml diff --git a/plugins/json/core/src/main/java/org/pentaho/di/trans/steps/jsoninput/analyzer/JsonInputAnalyzer.java b/plugins/json/core/src/main/java/org/pentaho/di/trans/steps/jsoninput/analyzer/JsonInputAnalyzer.java index e8bff5378b97..8083080247bc 100644 --- a/plugins/json/core/src/main/java/org/pentaho/di/trans/steps/jsoninput/analyzer/JsonInputAnalyzer.java +++ b/plugins/json/core/src/main/java/org/pentaho/di/trans/steps/jsoninput/analyzer/JsonInputAnalyzer.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2018 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -85,7 +85,7 @@ protected Set getUsedFields( final JsonInputMeta meta ) { @Override public IMetaverseNode createResourceNode( final IExternalResourceInfo resource ) throws MetaverseException { - return createFileNode( resource.getName(), descriptor, DictionaryConst.NODE_TYPE_FILE ); + return createFileNode( parentTransMeta.getBowl(), resource.getName(), descriptor, DictionaryConst.NODE_TYPE_FILE ); } @Override diff --git a/plugins/json/core/src/main/java/org/pentaho/di/trans/steps/jsoninput/json/JsonSampler.java b/plugins/json/core/src/main/java/org/pentaho/di/trans/steps/jsoninput/json/JsonSampler.java index 83efc751e156..330bba4a80e6 100644 --- a/plugins/json/core/src/main/java/org/pentaho/di/trans/steps/jsoninput/json/JsonSampler.java +++ b/plugins/json/core/src/main/java/org/pentaho/di/trans/steps/jsoninput/json/JsonSampler.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2018-2022 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2018-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -29,6 +29,7 @@ import org.apache.commons.lang.StringUtils; import org.eclipse.swt.widgets.Tree; import org.eclipse.swt.widgets.TreeItem; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.exception.KettleFileException; import org.pentaho.di.core.vfs.KettleVFS; import org.pentaho.di.trans.steps.jsoninput.json.node.ArrayNode; @@ -52,6 +53,7 @@ public class JsonSampler { private int start = 0; + private Bowl bowl; private Configuration configuration; private JsonFactory jsonFactory = new MappingJsonFactory(); @@ -60,11 +62,13 @@ public class JsonSampler { * * @param configuration */ - public JsonSampler( Configuration configuration ) { + public JsonSampler( Bowl bowl, Configuration configuration ) { + this.bowl = bowl; this.configuration = configuration; } - public JsonSampler() { + public JsonSampler( Bowl bowl ) { + this.bowl = bowl; this.configuration = new Configuration(); } @@ -185,7 +189,7 @@ public Node sample( InputStream inputStream, Tree tree ) throws IOException { * @throws IOException */ public Node sample( String file, Tree tree ) throws IOException, KettleFileException { - return sample( KettleVFS.getInputStream( file ), tree ); + return sample( KettleVFS.getInstance( bowl ).getInputStream( file ), tree ); } /** diff --git a/plugins/json/core/src/main/java/org/pentaho/di/trans/steps/jsoninput/reader/InputsReader.java b/plugins/json/core/src/main/java/org/pentaho/di/trans/steps/jsoninput/reader/InputsReader.java index 36fe5b38bd7f..20e6d94bd60d 100644 --- a/plugins/json/core/src/main/java/org/pentaho/di/trans/steps/jsoninput/reader/InputsReader.java +++ b/plugins/json/core/src/main/java/org/pentaho/di/trans/steps/jsoninput/reader/InputsReader.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2016-2021 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2016-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -208,7 +208,8 @@ public FileNamesIterator( VariableSpace varSpace, ErrorHandler handler, Iterator @Override public FileObject tryNext() throws KettleFileException { String fileName = step.environmentSubstitute( inner.next() ); - return fileName == null ? null : KettleVFS.getFileObject( fileName, vars ); + return fileName == null ? null : KettleVFS.getInstance( step.getTransMeta().getBowl() ) + .getFileObject( fileName, vars ); } } diff --git a/plugins/json/core/src/main/java/org/pentaho/di/trans/steps/jsonoutput/JsonOutput.java b/plugins/json/core/src/main/java/org/pentaho/di/trans/steps/jsonoutput/JsonOutput.java index 036e37ea3e18..8dbb6ad71a25 100644 --- a/plugins/json/core/src/main/java/org/pentaho/di/trans/steps/jsonoutput/JsonOutput.java +++ b/plugins/json/core/src/main/java/org/pentaho/di/trans/steps/jsonoutput/JsonOutput.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2022 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -194,7 +194,8 @@ public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws data.inputRowMetaSize = data.inputRowMeta.size(); if ( data.outputValue ) { data.outputRowMeta = data.inputRowMeta.clone(); - meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); + meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository, + metaStore ); } // Cache the field name indexes @@ -325,7 +326,8 @@ private void createParentFolder( String filename ) throws KettleStepException { FileObject parentfolder = null; try { // Get parent folder - parentfolder = KettleVFS.getFileObject( filename, getTransMeta() ).getParent(); + parentfolder = KettleVFS.getInstance( getTransMeta().getBowl() ) + .getFileObject( filename, getTransMeta() ).getParent(); if ( !parentfolder.exists() ) { if ( log.isDebug() ) { logDebug( BaseMessages.getString( PKG, "JsonOutput.Error.ParentFolderNotExist", parentfolder.getName() ) ); @@ -365,14 +367,16 @@ public boolean openNewFile() { // Add this to the result file names... ResultFile resultFile = new ResultFile( - ResultFile.FILE_TYPE_GENERAL, KettleVFS.getFileObject( filename, getTransMeta() ), + ResultFile.FILE_TYPE_GENERAL, KettleVFS.getInstance( getTransMeta().getBowl() ) + .getFileObject( filename, getTransMeta() ), getTransMeta().getName(), getStepname() ); resultFile.setComment( BaseMessages.getString( PKG, "JsonOutput.ResultFilenames.Comment" ) ); addResultFile( resultFile ); } OutputStream outputStream; - OutputStream fos = KettleVFS.getOutputStream( filename, getTransMeta(), meta.isFileAppended() ); + OutputStream fos = KettleVFS.getInstance( getTransMeta().getBowl() ) + .getOutputStream( filename, getTransMeta(), meta.isFileAppended() ); outputStream = fos; if ( !Utils.isEmpty( meta.getEncoding() ) ) { diff --git a/plugins/json/core/src/main/java/org/pentaho/di/trans/steps/jsonoutput/JsonOutputMeta.java b/plugins/json/core/src/main/java/org/pentaho/di/trans/steps/jsonoutput/JsonOutputMeta.java index 98051032eb68..14151b85d50b 100644 --- a/plugins/json/core/src/main/java/org/pentaho/di/trans/steps/jsonoutput/JsonOutputMeta.java +++ b/plugins/json/core/src/main/java/org/pentaho/di/trans/steps/jsonoutput/JsonOutputMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2021 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -31,6 +31,7 @@ import org.pentaho.di.core.Const; import org.pentaho.di.core.util.Utils; import org.pentaho.di.core.annotations.Step; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.database.DatabaseMeta; import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.core.exception.KettleStepException; @@ -323,7 +324,8 @@ public void setDefault() { } } - public void getFields( RowMetaInterface row, String name, RowMetaInterface[] info, StepMeta nextStep, + @Override + public void getFields( Bowl bowl, RowMetaInterface row, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { if ( getOperationType() != OPERATION_TYPE_WRITE_TO_FILE ) { diff --git a/plugins/json/core/src/main/java/org/pentaho/di/trans/steps/jsonoutput/analyzer/JsonOutputAnalyzer.java b/plugins/json/core/src/main/java/org/pentaho/di/trans/steps/jsonoutput/analyzer/JsonOutputAnalyzer.java index 7599d246f736..6cc841f76358 100644 --- a/plugins/json/core/src/main/java/org/pentaho/di/trans/steps/jsonoutput/analyzer/JsonOutputAnalyzer.java +++ b/plugins/json/core/src/main/java/org/pentaho/di/trans/steps/jsonoutput/analyzer/JsonOutputAnalyzer.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2018 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2018-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -78,7 +78,7 @@ protected Set getUsedFields( final JsonOutputMeta meta ) { @Override public IMetaverseNode createResourceNode( final IExternalResourceInfo resource ) throws MetaverseException { - return createFileNode( resource.getName(), descriptor, DictionaryConst.NODE_TYPE_FILE ); + return createFileNode( parentTransMeta.getBowl(), resource.getName(), descriptor, DictionaryConst.NODE_TYPE_FILE ); } @Override diff --git a/plugins/json/core/src/main/java/org/pentaho/di/ui/trans/steps/jsoninput/JsonInputDialog.java b/plugins/json/core/src/main/java/org/pentaho/di/ui/trans/steps/jsoninput/JsonInputDialog.java index 9aa6b5420032..53c773f201f9 100644 --- a/plugins/json/core/src/main/java/org/pentaho/di/ui/trans/steps/jsoninput/JsonInputDialog.java +++ b/plugins/json/core/src/main/java/org/pentaho/di/ui/trans/steps/jsoninput/JsonInputDialog.java @@ -315,7 +315,7 @@ public void widgetSelected( SelectionEvent e ) { try { JsonInputMeta tfii = new JsonInputMeta(); getInfo( tfii ); - FileInputList fileInputList = tfii.getFiles( transMeta ); + FileInputList fileInputList = tfii.getFiles( transMeta.getBowl(), transMeta ); String[] files = fileInputList.getFileStrings(); if ( files != null && files.length > 0 ) { EnterSelectionDialog esd = new EnterSelectionDialog( shell, files, @@ -1456,7 +1456,7 @@ private void get() { paths.add( item.getText( 2 ) ); } - GetFieldsDialog getFieldsDialog = new GetFieldsDialog( shell ); + GetFieldsDialog getFieldsDialog = new GetFieldsDialog( shell, transMeta.getBowl() ); getFieldsDialog.open( filename, paths, wFields ); } diff --git a/plugins/json/core/src/main/java/org/pentaho/di/ui/trans/steps/jsoninput/getfields/GetFieldsDialog.java b/plugins/json/core/src/main/java/org/pentaho/di/ui/trans/steps/jsoninput/getfields/GetFieldsDialog.java index 2656a62f061f..3e3fdf9ebea4 100644 --- a/plugins/json/core/src/main/java/org/pentaho/di/ui/trans/steps/jsoninput/getfields/GetFieldsDialog.java +++ b/plugins/json/core/src/main/java/org/pentaho/di/ui/trans/steps/jsoninput/getfields/GetFieldsDialog.java @@ -1,5 +1,5 @@ /* - * Copyright 2018-2021 Hitachi Vantara. All rights reserved. + * Copyright 2018-2024 Hitachi Vantara. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -35,6 +35,7 @@ import org.eclipse.swt.widgets.Event; import org.eclipse.swt.widgets.MessageBox; import org.eclipse.swt.widgets.TableItem; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.Const; import org.pentaho.di.core.exception.KettleFileException; import org.pentaho.di.i18n.BaseMessages; @@ -57,15 +58,18 @@ public class GetFieldsDialog extends Dialog { private static final Class PKG = GetFieldsDialog.class; + private Bowl bowl; private List paths = new ArrayList<>(); protected Button ok; protected Button cancel; protected Button clearSelection; private PropsUI props; private static final Image LOGO = GUIResource.getInstance().getImageLogoSmall(); - public GetFieldsDialog( Shell parent ) { + + public GetFieldsDialog( Shell parent, Bowl bowl ) { super( parent, SWT.NONE ); this.props = PropsUI.getInstance(); + this.bowl = bowl; } public void open( String filename, List paths, TableView wFields ) { @@ -120,7 +124,7 @@ public void open( String filename, List paths, TableView wFields ) { props.setLook( tree ); tree.setLayoutData( new FormDataBuilder().top( labelSelectFields, Const.MARGIN ).left( 0, 0 ).right( 100, 0 ).bottom( 100, -85 ).result() ); - JsonSampler jsonSampler = new JsonSampler(); + JsonSampler jsonSampler = new JsonSampler( bowl ); jsonSampler.sample( filename, tree ); clearSelection = new Button( shell, SWT.PUSH ); diff --git a/plugins/json/core/src/test/java/org/pentaho/di/TestUtilities.java b/plugins/json/core/src/test/java/org/pentaho/di/TestUtilities.java index 09abb4796f27..4e34cf7bcaee 100644 --- a/plugins/json/core/src/test/java/org/pentaho/di/TestUtilities.java +++ b/plugins/json/core/src/test/java/org/pentaho/di/TestUtilities.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -36,6 +36,7 @@ import junit.framework.ComparisonFailure; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.util.Utils; import org.pentaho.di.core.RowMetaAndData; import org.pentaho.di.core.exception.KettleValueException; @@ -347,7 +348,7 @@ public static String getStringFromInput( InputStream in ) throws IOException { } public static Trans loadAndRunTransformation( String path, Object... parameters ) throws Exception { - TransMeta transMeta = new TransMeta( path ); + TransMeta transMeta = new TransMeta( DefaultBowl.getInstance(), path ); transMeta.setTransformationType( TransMeta.TransformationType.Normal ); Trans trans = new Trans( transMeta ); diff --git a/plugins/json/core/src/test/java/org/pentaho/di/trans/steps/jsoninput/JsonInputMetaTest.java b/plugins/json/core/src/test/java/org/pentaho/di/trans/steps/jsoninput/JsonInputMetaTest.java index f9253c800c5d..5ee4c91d62c9 100644 --- a/plugins/json/core/src/test/java/org/pentaho/di/trans/steps/jsoninput/JsonInputMetaTest.java +++ b/plugins/json/core/src/test/java/org/pentaho/di/trans/steps/jsoninput/JsonInputMetaTest.java @@ -27,6 +27,7 @@ import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.junit.MockitoJUnitRunner; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.Const; import org.pentaho.di.core.database.DatabaseMeta; import org.pentaho.di.core.exception.KettleXMLException; @@ -112,7 +113,7 @@ public void getFieldsRemoveSourceField() throws Exception { when( rowMeta.indexOfValue( DATA ) ).thenReturn( 0 ); - jsonInputMeta.getFields( rowMeta, NAME, info, nextStep, space, repository, metaStore ); + jsonInputMeta.getFields( DefaultBowl.getInstance(), rowMeta, NAME, info, nextStep, space, repository, metaStore ); verify( rowMeta ).removeValueMeta( 0 ); } diff --git a/plugins/json/core/src/test/java/org/pentaho/di/trans/steps/jsoninput/JsonInputTest.java b/plugins/json/core/src/test/java/org/pentaho/di/trans/steps/jsoninput/JsonInputTest.java index 7a75b34127c6..8b6aa3ff4808 100644 --- a/plugins/json/core/src/test/java/org/pentaho/di/trans/steps/jsoninput/JsonInputTest.java +++ b/plugins/json/core/src/test/java/org/pentaho/di/trans/steps/jsoninput/JsonInputTest.java @@ -39,6 +39,7 @@ import org.pentaho.di.core.KettleClientEnvironment; import org.pentaho.di.core.RowSet; import org.pentaho.di.core.bowl.Bowl; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.core.exception.KettleFileException; import org.pentaho.di.core.exception.KettleStepException; @@ -905,8 +906,10 @@ public void testFileList() throws Exception { final String input1 = getBasicTestJson(); final String input2 = "{ \"store\": { \"book\": [ { \"price\": 9.99 } ] } }"; - try ( FileObject fileObj1 = KettleVFS.getFileObject( BASE_RAM_DIR + "test1.json" ); - FileObject fileObj2 = KettleVFS.getFileObject( BASE_RAM_DIR + "test2.json" ) ) { + try ( FileObject fileObj1 = KettleVFS.getInstance( DefaultBowl.getInstance() ) + .getFileObject( BASE_RAM_DIR + "test1.json" ); + FileObject fileObj2 = KettleVFS.getInstance( DefaultBowl.getInstance() ) + .getFileObject( BASE_RAM_DIR + "test2.json" ) ) { try ( OutputStream out = fileObj1.getContent().getOutputStream() ) { out.write( input1.getBytes() ); } @@ -971,7 +974,8 @@ public void testZipFileInput() throws Exception { helper.redirectLog( err, LogLevel.ERROR ); final String input = getBasicTestJson(); - try ( FileObject fileObj = KettleVFS.getFileObject( BASE_RAM_DIR + "test.zip" ) ) { + try ( FileObject fileObj = KettleVFS.getInstance( DefaultBowl.getInstance() ) + .getFileObject( BASE_RAM_DIR + "test.zip" ) ) { fileObj.createFile(); try ( OutputStream out = fileObj.getContent().getOutputStream() ) { try ( ZipOutputStream zipOut = new ZipOutputStream( out ) ) { @@ -1015,8 +1019,10 @@ public void testExtraFileFields() throws Exception { final String input2 = "{ \"store\": { \"bicycle\": { \"color\": \"blue\" } } }"; final String path1 = BASE_RAM_DIR + "test1.json"; final String path2 = BASE_RAM_DIR + "test2.js"; - try ( FileObject fileObj1 = KettleVFS.getFileObject( path1 ); - FileObject fileObj2 = KettleVFS.getFileObject( path2 ) ) { + try ( FileObject fileObj1 = KettleVFS.getInstance( DefaultBowl.getInstance() ) + .getFileObject( path1 ); + FileObject fileObj2 = KettleVFS.getInstance( DefaultBowl.getInstance() ) + .getFileObject( path2 ) ) { try ( OutputStream out = fileObj1.getContent().getOutputStream() ) { out.write( input1.getBytes() ); } @@ -1077,7 +1083,8 @@ public boolean equals( Object expected, Object actual ) throws Exception { public void testZeroSizeFile() throws Exception { ByteArrayOutputStream log = new ByteArrayOutputStream(); helper.redirectLog( log, LogLevel.BASIC ); - try ( FileObject fileObj = KettleVFS.getFileObject( BASE_RAM_DIR + "test.json" ); + try ( FileObject fileObj = KettleVFS.getInstance( DefaultBowl.getInstance() ) + .getFileObject( BASE_RAM_DIR + "test.json" ); LocaleChange enUs = new LocaleChange( Locale.US ); ) { fileObj.createFile(); JsonInputField price = new JsonInputField(); @@ -1245,7 +1252,7 @@ protected JsonInputMeta createSimpleMeta( String inputColumn, JsonInputField... } private void deleteFiles() throws FileSystemException, KettleFileException { - try ( FileObject baseDir = KettleVFS.getFileObject( BASE_RAM_DIR ) ) { + try ( FileObject baseDir = KettleVFS.getInstance( DefaultBowl.getInstance() ).getFileObject( BASE_RAM_DIR ) ) { baseDir.deleteAll(); } } diff --git a/plugins/json/core/src/test/java/org/pentaho/di/trans/steps/jsoninput/analyzer/JsonInputAnalyzerTest.java b/plugins/json/core/src/test/java/org/pentaho/di/trans/steps/jsoninput/analyzer/JsonInputAnalyzerTest.java index 1463f5d62685..9dbb6229394e 100644 --- a/plugins/json/core/src/test/java/org/pentaho/di/trans/steps/jsoninput/analyzer/JsonInputAnalyzerTest.java +++ b/plugins/json/core/src/test/java/org/pentaho/di/trans/steps/jsoninput/analyzer/JsonInputAnalyzerTest.java @@ -29,6 +29,7 @@ import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.junit.MockitoJUnitRunner; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.KettleClientEnvironment; import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.core.exception.KettleValueException; @@ -106,8 +107,12 @@ public Set getInputStepNames( final JsonInputMeta meta, final String fie } }; analyzer.setMetaverseBuilder( mockBuilder ); + when( meta.getParentStepMeta() ).thenReturn( mockStepMeta ); + + when( transMeta.getBowl() ).thenReturn( DefaultBowl.getInstance() ); when( mockJsonInput.getStepMetaInterface() ).thenReturn( meta ); + when( mockJsonInput.getTransMeta() ).thenReturn( transMeta ); lenient().when( mockJsonInput.getStepMeta() ).thenReturn( mockStepMeta ); lenient().when( mockStepMeta.getStepMetaInterface() ).thenReturn( meta ); } @@ -177,23 +182,23 @@ public void testJsonInputExternalResourceConsumer() throws Exception { assertFalse( consumer.isDataDriven( meta ) ); - Collection resources = consumer.getResourcesFromMeta( meta ); + Collection resources = consumer.getResourcesFromMeta( DefaultBowl.getInstance(), meta ); assertTrue( resources.isEmpty() ); when( meta.writesToFile() ).thenReturn( true ); - resources = consumer.getResourcesFromMeta( meta ); + resources = consumer.getResourcesFromMeta( DefaultBowl.getInstance(), meta ); assertFalse( resources.isEmpty() ); assertEquals( 2, resources.size() ); when( meta.getFilePaths( false ) ).thenReturn( new String[]{ "/path/to/file1", "/another/path/to/file2", "/another/path/to/file3" } ); - resources = consumer.getResourcesFromMeta( meta ); + resources = consumer.getResourcesFromMeta( DefaultBowl.getInstance(), meta ); assertFalse( resources.isEmpty() ); assertEquals( 3, resources.size() ); when( meta.isAcceptingFilenames() ).thenReturn( true ); assertTrue( consumer.isDataDriven( meta ) ); - assertTrue( consumer.getResourcesFromMeta( meta ).isEmpty() ); + assertTrue( consumer.getResourcesFromMeta( DefaultBowl.getInstance(), meta ).isEmpty() ); when( mockJsonInput.environmentSubstitute( Mockito.any() ) ).thenReturn( "/path/to/row/file" ); when( mockJsonInput.getStepMetaInterface() ).thenReturn( meta ); diff --git a/plugins/json/core/src/test/java/org/pentaho/di/trans/steps/jsonoutput/analyzer/JsonOutputAnalyzerTest.java b/plugins/json/core/src/test/java/org/pentaho/di/trans/steps/jsonoutput/analyzer/JsonOutputAnalyzerTest.java index b178924a1b50..7bd0c18554a7 100644 --- a/plugins/json/core/src/test/java/org/pentaho/di/trans/steps/jsonoutput/analyzer/JsonOutputAnalyzerTest.java +++ b/plugins/json/core/src/test/java/org/pentaho/di/trans/steps/jsonoutput/analyzer/JsonOutputAnalyzerTest.java @@ -28,6 +28,7 @@ import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.junit.MockitoJUnitRunner; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.KettleClientEnvironment; import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.core.row.RowMetaInterface; @@ -94,6 +95,9 @@ public void setUp() throws Exception { analyzer = new JsonOutputAnalyzer() {}; analyzer.setMetaverseBuilder( mockBuilder ); + when( meta.getParentStepMeta() ).thenReturn( mockStepMeta ); + when( transMeta.getBowl() ).thenReturn( DefaultBowl.getInstance() ); + lenient().when( mockJsonOutput.getStepMetaInterface() ).thenReturn( meta ); lenient().when( mockJsonOutput.getStepMeta() ).thenReturn( mockStepMeta ); lenient().when( mockStepMeta.getStepMetaInterface() ).thenReturn( meta ); @@ -144,11 +148,11 @@ public void testJsonOutputExternalResourceConsumer() throws Exception { assertFalse( consumer.isDataDriven( meta ) ); - Collection resources = consumer.getResourcesFromMeta( meta ); + Collection resources = consumer.getResourcesFromMeta( DefaultBowl.getInstance(), meta ); assertTrue( resources.isEmpty() ); when( meta.writesToFile() ).thenReturn( true ); - resources = consumer.getResourcesFromMeta( meta ); + resources = consumer.getResourcesFromMeta( DefaultBowl.getInstance(), meta ); assertFalse( resources.isEmpty() ); assertTrue( resources.stream().anyMatch( eri -> eri.getName().endsWith( outputFilePaths[0] ) ) ); assertTrue( resources.stream().anyMatch( eri -> eri.getName().endsWith( outputFilePaths[1] ) ) ); diff --git a/plugins/json/core/src/test/java/org/pentaho/di/ui/trans/steps/jsoninput/getfields/JsonSamplerTest.java b/plugins/json/core/src/test/java/org/pentaho/di/ui/trans/steps/jsoninput/getfields/JsonSamplerTest.java index 8496e232b59f..e32f1e60f9c7 100644 --- a/plugins/json/core/src/test/java/org/pentaho/di/ui/trans/steps/jsoninput/getfields/JsonSamplerTest.java +++ b/plugins/json/core/src/test/java/org/pentaho/di/ui/trans/steps/jsoninput/getfields/JsonSamplerTest.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2018-2022 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2018-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -28,6 +28,7 @@ import org.junit.Assert; import org.junit.Ignore; import org.junit.Test; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.trans.steps.jsoninput.json.Configuration; import org.pentaho.di.trans.steps.jsoninput.json.JsonSampler; import org.pentaho.di.trans.steps.jsoninput.json.node.ArrayNode; @@ -50,7 +51,7 @@ public class JsonSamplerTest { @Test @Ignore("UI elements make this unit test unreliable.") public void testDedupeArray() throws Exception { - JsonSampler jsonSampler = new JsonSampler(); + JsonSampler jsonSampler = new JsonSampler( DefaultBowl.getInstance() ); InputStream inputStream = this.getClass().getResourceAsStream( "/org/pentaho/di/ui/trans/steps/jsoninput/getfields/dedupe-test.json" ); try { @@ -82,7 +83,7 @@ public void testDedupeArray() throws Exception { @Test @Ignore("UI elements make this unit test unreliable.") public void testDedupeObject() throws Exception { - JsonSampler jsonSampler = new JsonSampler(); + JsonSampler jsonSampler = new JsonSampler( DefaultBowl.getInstance() ); InputStream inputStream = this.getClass().getResourceAsStream( "/org/pentaho/di/ui/trans/steps/jsoninput/getfields/dedupe-test2.json" ); try { @@ -118,7 +119,7 @@ public void testDedupeObject() throws Exception { public void testDedupeLines() throws Exception { Configuration configuration = new Configuration(); configuration.setLines( 10 ); - JsonSampler jsonSampler = new JsonSampler( configuration ); + JsonSampler jsonSampler = new JsonSampler( DefaultBowl.getInstance(), configuration ); InputStream inputStream = this.getClass().getResourceAsStream( "/org/pentaho/di/ui/trans/steps/jsoninput/getfields/dedupe-test2.json" ); try { @@ -152,7 +153,7 @@ public void testDedupeLines() throws Exception { @Ignore("UI elements make this unit test unreliable.") public void testDedupeNestedArrays() throws Exception { Configuration configuration = new Configuration(); - JsonSampler jsonSampler = new JsonSampler( configuration ); + JsonSampler jsonSampler = new JsonSampler( DefaultBowl.getInstance(), configuration ); InputStream inputStream = this.getClass().getResourceAsStream( "/org/pentaho/di/ui/trans/steps/jsoninput/getfields/dedupe-test3.json" ); try { @@ -189,7 +190,7 @@ public void testDedupeNestedArrays() throws Exception { @Ignore("UI elements make this unit test unreliable.") public void testBigIntegerNode() throws Exception { Configuration configuration = new Configuration(); - JsonSampler jsonSampler = new JsonSampler( configuration ); + JsonSampler jsonSampler = new JsonSampler( DefaultBowl.getInstance(), configuration ); InputStream inputStream = this.getClass().getResourceAsStream( "/org/pentaho/di/ui/trans/steps/jsoninput/getfields/bigint-test.json" ); try { diff --git a/plugins/ldap/impl/src/main/java/org/pentaho/di/trans/steps/ldapinput/LDAPConnection.java b/plugins/ldap/impl/src/main/java/org/pentaho/di/trans/steps/ldapinput/LDAPConnection.java index 514d5404e454..07217d956176 100644 --- a/plugins/ldap/impl/src/main/java/org/pentaho/di/trans/steps/ldapinput/LDAPConnection.java +++ b/plugins/ldap/impl/src/main/java/org/pentaho/di/trans/steps/ldapinput/LDAPConnection.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2022 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -45,6 +45,7 @@ import javax.naming.ldap.PagedResultsResponseControl; import javax.naming.ldap.SortControl; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.Const; import org.pentaho.di.core.util.Utils; import org.pentaho.di.core.exception.KettleException; @@ -101,10 +102,10 @@ public class LDAPConnection { /** * Construct a new LDAP Connection */ - public LDAPConnection( LogChannelInterface logInterface, VariableSpace variableSpace, LdapMeta meta, + public LDAPConnection( Bowl bowl, LogChannelInterface logInterface, VariableSpace variableSpace, LdapMeta meta, Collection binaryAttributes ) throws KettleException { this.log = logInterface; - protocol = new LdapProtocolFactory( logInterface ).createLdapProtocol( variableSpace, meta, binaryAttributes ); + protocol = new LdapProtocolFactory( logInterface ).createLdapProtocol( bowl, variableSpace, meta, binaryAttributes ); this.sortingAttributes = new ArrayList(); } diff --git a/plugins/ldap/impl/src/main/java/org/pentaho/di/trans/steps/ldapinput/LDAPInput.java b/plugins/ldap/impl/src/main/java/org/pentaho/di/trans/steps/ldapinput/LDAPInput.java index 1ae95a570aec..97c5edaf3456 100644 --- a/plugins/ldap/impl/src/main/java/org/pentaho/di/trans/steps/ldapinput/LDAPInput.java +++ b/plugins/ldap/impl/src/main/java/org/pentaho/di/trans/steps/ldapinput/LDAPInput.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2022 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -70,9 +70,8 @@ public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws // Create the output row meta-data data.outputRowMeta = new RowMeta(); - meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); // get the - // metadata - // populated + meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository, + metaStore ); // Create convert meta-data objects that will contain Date & Number formatters // @@ -159,8 +158,8 @@ private boolean dynamicSearch() throws KettleException { // Create the output row meta-data data.nrIncomingFields = getInputRowMeta().size(); data.outputRowMeta = getInputRowMeta().clone(); - meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); // get the metadata - // populated + meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository, + metaStore ); // Create convert meta-data objects that will contain Date & Number formatters // @@ -358,7 +357,7 @@ private void connectServerLdap() throws KettleException { } // Define new LDAP connection - data.connection = new LDAPConnection( log, this, meta, data.attributesBinary ); + data.connection = new LDAPConnection( getTransMeta().getBowl(), log, this, meta, data.attributesBinary ); for ( int i = 0; i < data.attrReturned.length; i++ ) { LDAPInputField field = meta.getInputFields()[i]; diff --git a/plugins/ldap/impl/src/main/java/org/pentaho/di/trans/steps/ldapinput/LDAPInputMeta.java b/plugins/ldap/impl/src/main/java/org/pentaho/di/trans/steps/ldapinput/LDAPInputMeta.java index f1efcea31c85..557e507e0558 100644 --- a/plugins/ldap/impl/src/main/java/org/pentaho/di/trans/steps/ldapinput/LDAPInputMeta.java +++ b/plugins/ldap/impl/src/main/java/org/pentaho/di/trans/steps/ldapinput/LDAPInputMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2022 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -28,6 +28,7 @@ import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.Const; import org.pentaho.di.core.annotations.Step; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.util.Utils; import org.pentaho.di.core.database.DatabaseMeta; import org.pentaho.di.core.encryption.Encr; @@ -731,7 +732,7 @@ public void setDefault() { } @Override - public void getFields( RowMetaInterface r, String name, RowMetaInterface[] info, StepMeta nextStep, + public void getFields( Bowl bowl, RowMetaInterface r, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { int i; diff --git a/plugins/ldap/impl/src/main/java/org/pentaho/di/trans/steps/ldapinput/LdapProtocol.java b/plugins/ldap/impl/src/main/java/org/pentaho/di/trans/steps/ldapinput/LdapProtocol.java index 7d6a3b888f24..c355fb588b36 100644 --- a/plugins/ldap/impl/src/main/java/org/pentaho/di/trans/steps/ldapinput/LdapProtocol.java +++ b/plugins/ldap/impl/src/main/java/org/pentaho/di/trans/steps/ldapinput/LdapProtocol.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2022 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -33,6 +33,7 @@ import javax.naming.ldap.InitialLdapContext; import com.google.common.base.Joiner; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.Const; import org.pentaho.di.core.util.Utils; import org.pentaho.di.core.exception.KettleException; @@ -60,12 +61,15 @@ public class LdapProtocol { private final Set binaryAttributes; + protected Bowl bowl; + public InitialLdapContext getCtx() { return ctx; } - public LdapProtocol( LogChannelInterface log, VariableSpace variableSpace, LdapMeta meta, + public LdapProtocol( Bowl bowl, LogChannelInterface log, VariableSpace variableSpace, LdapMeta meta, Collection binaryAttributes ) { + this.bowl = bowl; this.log = log; hostname = variableSpace.environmentSubstitute( meta.getHost() ); port = Const.toInt( variableSpace.environmentSubstitute( meta.getPort() ), LDAPConnection.DEFAULT_PORT ); @@ -92,7 +96,8 @@ public static String getName() { return "LDAP"; } - protected void setupEnvironment( Map env, String username, String password ) throws KettleException { + protected void setupEnvironment( Map env, String username, String password ) + throws KettleException { env.put( Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory" ); env.put( "java.naming.ldap.derefAliases", derefAliases ); env.put( Context.REFERRAL, referral ); diff --git a/plugins/ldap/impl/src/main/java/org/pentaho/di/trans/steps/ldapinput/LdapProtocolFactory.java b/plugins/ldap/impl/src/main/java/org/pentaho/di/trans/steps/ldapinput/LdapProtocolFactory.java index aaeed613183c..4a9434fcc938 100644 --- a/plugins/ldap/impl/src/main/java/org/pentaho/di/trans/steps/ldapinput/LdapProtocolFactory.java +++ b/plugins/ldap/impl/src/main/java/org/pentaho/di/trans/steps/ldapinput/LdapProtocolFactory.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2022 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -26,6 +26,7 @@ import java.util.Collection; import java.util.List; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.core.logging.LogChannelInterface; import org.pentaho.di.core.variables.VariableSpace; @@ -87,7 +88,7 @@ public LdapProtocolFactory( LogChannelInterface log ) { * @return an LdapProtocol * @throws KettleException */ - public LdapProtocol createLdapProtocol( VariableSpace variableSpace, LdapMeta meta, + public LdapProtocol createLdapProtocol( Bowl bowl, VariableSpace variableSpace, LdapMeta meta, Collection binaryAttributes ) throws KettleException { String connectionType = variableSpace.environmentSubstitute( meta.getProtocol() ); @@ -96,10 +97,11 @@ public LdapProtocol createLdapProtocol( VariableSpace variableSpace, LdapMeta me if ( getName( protocol ).equals( connectionType ) ) { try { return protocol.getConstructor( + Bowl.class, LogChannelInterface.class, VariableSpace.class, LdapMeta.class, - Collection.class ).newInstance( log, variableSpace, meta, binaryAttributes ); + Collection.class ).newInstance( bowl, log, variableSpace, meta, binaryAttributes ); } catch ( Exception e ) { throw new KettleException( e ); } diff --git a/plugins/ldap/impl/src/main/java/org/pentaho/di/trans/steps/ldapinput/LdapSslProtocol.java b/plugins/ldap/impl/src/main/java/org/pentaho/di/trans/steps/ldapinput/LdapSslProtocol.java index ec1ac3bfe09e..eaf19d5ee32b 100644 --- a/plugins/ldap/impl/src/main/java/org/pentaho/di/trans/steps/ldapinput/LdapSslProtocol.java +++ b/plugins/ldap/impl/src/main/java/org/pentaho/di/trans/steps/ldapinput/LdapSslProtocol.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2022 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -25,6 +25,7 @@ import java.util.Collection; import java.util.Map; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.core.logging.LogChannelInterface; import org.pentaho.di.core.util.Utils; @@ -39,9 +40,9 @@ public class LdapSslProtocol extends LdapProtocol { private final String trustStorePassword; - public LdapSslProtocol( LogChannelInterface log, VariableSpace variableSpace, LdapMeta meta, + public LdapSslProtocol( Bowl bowl, LogChannelInterface log, VariableSpace variableSpace, LdapMeta meta, Collection binaryAttributes ) { - super( log, variableSpace, meta, binaryAttributes ); + super( bowl, log, variableSpace, meta, binaryAttributes ); String trustStorePath = null; String trustStorePassword = null; boolean trustAllCertificates = false; @@ -73,7 +74,8 @@ protected void configureSslEnvironment( Map env ) { } @Override - protected void setupEnvironment( Map env, String username, String password ) throws KettleException { + protected void setupEnvironment( Map env, String username, String password ) + throws KettleException { super.setupEnvironment( env, username, password ); configureSslEnvironment( env ); configureSocketFactory( trustAllCertificates, trustStorePath, trustStorePassword ); @@ -84,7 +86,7 @@ protected void configureSocketFactory( boolean trustAllCertificates, String trus if ( trustAllCertificates ) { CustomSocketFactory.configure(); } else { - CustomSocketFactory.configure( trustStorePath, trustStorePassword ); + CustomSocketFactory.configure( bowl, trustStorePath, trustStorePassword ); } } } diff --git a/plugins/ldap/impl/src/main/java/org/pentaho/di/trans/steps/ldapinput/LdapTlsProtocol.java b/plugins/ldap/impl/src/main/java/org/pentaho/di/trans/steps/ldapinput/LdapTlsProtocol.java index 53e832654707..3f10eb57c096 100644 --- a/plugins/ldap/impl/src/main/java/org/pentaho/di/trans/steps/ldapinput/LdapTlsProtocol.java +++ b/plugins/ldap/impl/src/main/java/org/pentaho/di/trans/steps/ldapinput/LdapTlsProtocol.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2022 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -30,6 +30,7 @@ import javax.naming.ldap.StartTlsRequest; import javax.naming.ldap.StartTlsResponse; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.core.logging.LogChannelInterface; import org.pentaho.di.core.variables.VariableSpace; @@ -38,9 +39,9 @@ public class LdapTlsProtocol extends LdapSslProtocol { private StartTlsResponse startTlsResponse; - public LdapTlsProtocol( LogChannelInterface log, VariableSpace variableSpace, LdapMeta meta, + public LdapTlsProtocol( Bowl bowl, LogChannelInterface log, VariableSpace variableSpace, LdapMeta meta, Collection binaryAttributes ) { - super( log, variableSpace, meta, binaryAttributes ); + super( bowl, log, variableSpace, meta, binaryAttributes ); } @Override diff --git a/plugins/ldap/impl/src/main/java/org/pentaho/di/trans/steps/ldapinput/store/CustomSocketFactory.java b/plugins/ldap/impl/src/main/java/org/pentaho/di/trans/steps/ldapinput/store/CustomSocketFactory.java index acb5051ae4fb..d81e86a6624c 100644 --- a/plugins/ldap/impl/src/main/java/org/pentaho/di/trans/steps/ldapinput/store/CustomSocketFactory.java +++ b/plugins/ldap/impl/src/main/java/org/pentaho/di/trans/steps/ldapinput/store/CustomSocketFactory.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2022 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -22,6 +22,7 @@ package org.pentaho.di.trans.steps.ldapinput.store; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.core.util.Utils; import org.pentaho.di.i18n.BaseMessages; @@ -86,7 +87,7 @@ public static CustomSocketFactory getDefault() { /** * Configures this SSLSocketFactory so that it uses the given keystore as its truststore. */ - public static synchronized void configure( String path, String password ) throws KettleException { + public static synchronized void configure( Bowl bowl, String path, String password ) throws KettleException { // Get the appropriate key-store based on the file path... // @@ -103,7 +104,7 @@ public static synchronized void configure( String path, String password ) throws PKG, "KettleTrustManager.Exception.CouldNotCreateCertStore" ), e ); } - trustManagers = new KettleTrustManager[] { new KettleTrustManager( keyStore, path, password ) }; + trustManagers = new KettleTrustManager[] { new KettleTrustManager( bowl, keyStore, path, password ) }; configured.set( true ); } diff --git a/plugins/ldap/impl/src/main/java/org/pentaho/di/trans/steps/ldapinput/store/KettleTrustManager.java b/plugins/ldap/impl/src/main/java/org/pentaho/di/trans/steps/ldapinput/store/KettleTrustManager.java index ba478e1072bb..ca34039c3234 100644 --- a/plugins/ldap/impl/src/main/java/org/pentaho/di/trans/steps/ldapinput/store/KettleTrustManager.java +++ b/plugins/ldap/impl/src/main/java/org/pentaho/di/trans/steps/ldapinput/store/KettleTrustManager.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2022 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -31,6 +31,7 @@ import javax.net.ssl.TrustManagerFactory; import javax.net.ssl.X509TrustManager; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.Const; import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.core.vfs.KettleVFS; @@ -56,14 +57,15 @@ public class KettleTrustManager implements X509TrustManager { * @param certPassword * @throws KettleException */ - public KettleTrustManager( KeyStore keyStore, String certFilename, String certPassword ) throws KettleException { + public KettleTrustManager( Bowl bowl, KeyStore keyStore, String certFilename, String certPassword ) + throws KettleException { try { // Load the CERT key from the file into the store using the provided // password if needed. // InputStream inputStream = null; try { - inputStream = KettleVFS.getInputStream( certFilename ); + inputStream = KettleVFS.getInstance( bowl ).getInputStream( certFilename ); keyStore.load( inputStream, Const.NVL( certPassword, "" ).toCharArray() ); } catch ( Exception e ) { throw new KettleException( BaseMessages.getString( diff --git a/plugins/ldap/impl/src/main/java/org/pentaho/di/trans/steps/ldapoutput/LDAPOutput.java b/plugins/ldap/impl/src/main/java/org/pentaho/di/trans/steps/ldapoutput/LDAPOutput.java index 1b5cc49c498f..9eb614d5752a 100644 --- a/plugins/ldap/impl/src/main/java/org/pentaho/di/trans/steps/ldapoutput/LDAPOutput.java +++ b/plugins/ldap/impl/src/main/java/org/pentaho/di/trans/steps/ldapoutput/LDAPOutput.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2022 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -306,7 +306,7 @@ public boolean init( StepMetaInterface smi, StepDataInterface sdi ) { if ( super.init( smi, sdi ) ) { try { // Define new LDAP connection - data.connection = new LDAPConnection( log, this, meta, null ); + data.connection = new LDAPConnection( getTransMeta().getBowl(), log, this, meta, null ); // connect if ( meta.UseAuthentication() ) { diff --git a/plugins/ldap/impl/src/test/java/org/pentaho/di/trans/steps/ldapinput/LdapMockProtocol.java b/plugins/ldap/impl/src/test/java/org/pentaho/di/trans/steps/ldapinput/LdapMockProtocol.java index 377d9e72b266..4b14775e16f5 100644 --- a/plugins/ldap/impl/src/test/java/org/pentaho/di/trans/steps/ldapinput/LdapMockProtocol.java +++ b/plugins/ldap/impl/src/test/java/org/pentaho/di/trans/steps/ldapinput/LdapMockProtocol.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2022 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -27,6 +27,7 @@ import javax.naming.ldap.InitialLdapContext; import org.mockito.Mockito; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.core.logging.LogChannelInterface; import org.pentaho.di.core.variables.VariableSpace; @@ -39,9 +40,9 @@ public class LdapMockProtocol extends LdapProtocol { public static InitialLdapContext mockContext; - public LdapMockProtocol( LogChannelInterface log, VariableSpace variableSpace, LdapMeta meta, + public LdapMockProtocol( Bowl bowl, LogChannelInterface log, VariableSpace variableSpace, LdapMeta meta, Collection binaryAttributes ) { - super( log, variableSpace, meta, binaryAttributes ); + super( bowl, log, variableSpace, meta, binaryAttributes ); } public static String getName() { diff --git a/plugins/ldap/impl/src/test/java/org/pentaho/di/trans/steps/ldapinput/LdapProtocolFactoryTest.java b/plugins/ldap/impl/src/test/java/org/pentaho/di/trans/steps/ldapinput/LdapProtocolFactoryTest.java index 05b904be63f0..dbef2fd9d22f 100644 --- a/plugins/ldap/impl/src/test/java/org/pentaho/di/trans/steps/ldapinput/LdapProtocolFactoryTest.java +++ b/plugins/ldap/impl/src/test/java/org/pentaho/di/trans/steps/ldapinput/LdapProtocolFactoryTest.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2022 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -24,6 +24,7 @@ import org.junit.Test; import org.mockito.Mockito; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.logging.LogChannelInterface; import org.pentaho.di.core.variables.VariableSpace; @@ -45,7 +46,7 @@ public void createLdapProtocol() throws Exception { Mockito.doReturn( host ).when( meta ).getHost(); Mockito.doReturn( host ).when( variableSpace ).environmentSubstitute( host ); - ldapProtocolFactory.createLdapProtocol( variableSpace, meta, Collections.emptyList() ); + ldapProtocolFactory.createLdapProtocol( DefaultBowl.getInstance(), variableSpace, meta, Collections.emptyList() ); Mockito.verify( variableSpace, Mockito.times( 1 ) ).environmentSubstitute( ldapVariable ); } diff --git a/plugins/ldap/ui/src/main/java/org/pentaho/di/ui/trans/steps/ldapinput/LDAPInputDialog.java b/plugins/ldap/ui/src/main/java/org/pentaho/di/ui/trans/steps/ldapinput/LDAPInputDialog.java index 5b825ee4ba4f..b607765cd50b 100644 --- a/plugins/ldap/ui/src/main/java/org/pentaho/di/ui/trans/steps/ldapinput/LDAPInputDialog.java +++ b/plugins/ldap/ui/src/main/java/org/pentaho/di/ui/trans/steps/ldapinput/LDAPInputDialog.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2022 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -1233,7 +1233,7 @@ private void test() { getInfo( meta ); // Defined a LDAP connection - connection = new LDAPConnection( log, transMeta, meta, null ); + connection = new LDAPConnection( transMeta.getBowl(), log, transMeta, meta, null ); // connect... if ( wusingAuthentication.getSelection() ) { @@ -1274,7 +1274,7 @@ private void get() { wFields.removeAll(); // Defined a LDAP connection - connection = new LDAPConnection( log, transMeta, meta, null ); + connection = new LDAPConnection( transMeta.getBowl(), log, transMeta, meta, null ); // connect ... if ( meta.UseAuthentication() ) { diff --git a/plugins/ldap/ui/src/main/java/org/pentaho/di/ui/trans/steps/ldapoutput/LDAPOutputDialog.java b/plugins/ldap/ui/src/main/java/org/pentaho/di/ui/trans/steps/ldapoutput/LDAPOutputDialog.java index d8cae75b0fc3..ce503fc884a5 100644 --- a/plugins/ldap/ui/src/main/java/org/pentaho/di/ui/trans/steps/ldapoutput/LDAPOutputDialog.java +++ b/plugins/ldap/ui/src/main/java/org/pentaho/di/ui/trans/steps/ldapoutput/LDAPOutputDialog.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2022 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -1183,7 +1183,7 @@ private void test() { getInfo( meta ); // Defined a LDAP connection - connection = new LDAPConnection( log, transMeta, meta, null ); + connection = new LDAPConnection( transMeta.getBowl(), log, transMeta, meta, null ); // connect... if ( wusingAuthentication.getSelection() ) { connection.connect( transMeta.environmentSubstitute( meta.getUserName() ), Encr @@ -1473,7 +1473,7 @@ public RowMetaInterface getLDAPFields() throws KettleException { LDAPOutputMeta meta = new LDAPOutputMeta(); getInfo( meta ); // Defined a LDAP connection - connection = new LDAPConnection( log, transMeta, meta, null ); + connection = new LDAPConnection( transMeta.getBowl(), log, transMeta, meta, null ); // connect ... if ( wusingAuthentication.getSelection() ) { String username = transMeta.environmentSubstitute( wUserName.getText() ); diff --git a/plugins/lucid-db-bulk-loader/src/org/pentaho/di/ui/trans/steps/luciddbbulkloader/LucidDBBulkLoader.java b/plugins/lucid-db-bulk-loader/src/org/pentaho/di/ui/trans/steps/luciddbbulkloader/LucidDBBulkLoader.java index 0db707635740..d94d468a81f8 100644 --- a/plugins/lucid-db-bulk-loader/src/org/pentaho/di/ui/trans/steps/luciddbbulkloader/LucidDBBulkLoader.java +++ b/plugins/lucid-db-bulk-loader/src/org/pentaho/di/ui/trans/steps/luciddbbulkloader/LucidDBBulkLoader.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -85,7 +85,8 @@ public boolean execute( LucidDBBulkLoaderMeta meta, boolean wait ) throws Kettle // 1) Set up the FIFO folder, create the directory and path to it... // String fifoVfsDirectory = environmentSubstitute( meta.getFifoDirectory() ); - FileObject directory = KettleVFS.getFileObject( fifoVfsDirectory, getTransMeta() ); + FileObject directory = KettleVFS.getInstance( getTransMeta().getBowl() ) + .getFileObject( fifoVfsDirectory, getTransMeta() ); directory.createFolder(); String fifoDirectory = KettleVFS.getFilename( directory ); diff --git a/plugins/lucid-db-bulk-loader/src/org/pentaho/di/ui/trans/steps/luciddbbulkloader/LucidDBBulkLoaderMeta.java b/plugins/lucid-db-bulk-loader/src/org/pentaho/di/ui/trans/steps/luciddbbulkloader/LucidDBBulkLoaderMeta.java index 9c7ae18f6388..35b486189d72 100644 --- a/plugins/lucid-db-bulk-loader/src/org/pentaho/di/ui/trans/steps/luciddbbulkloader/LucidDBBulkLoaderMeta.java +++ b/plugins/lucid-db-bulk-loader/src/org/pentaho/di/ui/trans/steps/luciddbbulkloader/LucidDBBulkLoaderMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -31,6 +31,7 @@ import org.pentaho.di.core.ProvidesDatabaseConnectionInformation; import org.pentaho.di.core.SQLStatement; import org.pentaho.di.core.annotations.Step; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.database.Database; import org.pentaho.di.core.database.DatabaseMeta; import org.pentaho.di.core.exception.KettleException; @@ -366,7 +367,8 @@ public void saveRep( Repository rep, IMetaStore metaStore, ObjectId id_transform } } - public void getFields( RowMetaInterface rowMeta, String origin, RowMetaInterface[] info, StepMeta nextStep, + @Override + public void getFields( Bowl bowl, RowMetaInterface rowMeta, String origin, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { // Default: nothing changes to rowMeta } diff --git a/plugins/lucid-db-streaming-loader/core/src/main/java/org/pentaho/di/trans/steps/luciddbstreamingloader/LucidDBStreamingLoaderMeta.java b/plugins/lucid-db-streaming-loader/core/src/main/java/org/pentaho/di/trans/steps/luciddbstreamingloader/LucidDBStreamingLoaderMeta.java index b21006e83498..6a43dd133a70 100644 --- a/plugins/lucid-db-streaming-loader/core/src/main/java/org/pentaho/di/trans/steps/luciddbstreamingloader/LucidDBStreamingLoaderMeta.java +++ b/plugins/lucid-db-streaming-loader/core/src/main/java/org/pentaho/di/trans/steps/luciddbstreamingloader/LucidDBStreamingLoaderMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2018 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -29,6 +29,7 @@ import org.pentaho.di.core.util.Utils; import org.pentaho.di.core.SQLStatement; import org.pentaho.di.core.annotations.Step; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.database.Database; import org.pentaho.di.core.database.DatabaseMeta; import org.pentaho.di.core.exception.KettleDatabaseException; @@ -386,7 +387,8 @@ public void saveRep( Repository rep, IMetaStore metaStore, ObjectId id_transform } } - public void getFields( RowMetaInterface rowMeta, String origin, RowMetaInterface[] info, StepMeta nextStep, + @Override + public void getFields( Bowl bowl, RowMetaInterface rowMeta, String origin, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { // Default: nothing changes to rowMeta } diff --git a/plugins/mail-job/impl/src/main/java/org/pentaho/di/job/entries/mail/JobEntryMail.java b/plugins/mail-job/impl/src/main/java/org/pentaho/di/job/entries/mail/JobEntryMail.java index d8c18f4c0ae0..2e703a3ee202 100644 --- a/plugins/mail-job/impl/src/main/java/org/pentaho/di/job/entries/mail/JobEntryMail.java +++ b/plugins/mail-job/impl/src/main/java/org/pentaho/di/job/entries/mail/JobEntryMail.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2023 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -1120,7 +1120,7 @@ public Result execute( Result result, int nr ) { } else { try { boolean found = false; - imageFile = KettleVFS.getFileObject( realImageFile, this ); + imageFile = KettleVFS.getInstance( parentJobMeta.getBowl() ).getFileObject( realImageFile, this ); if ( imageFile.exists() && imageFile.getType() == FileType.FILE ) { found = true; } else { @@ -1344,23 +1344,23 @@ public List getResourceDependencies( JobMeta jobMeta ) { public void check( List remarks, JobMeta jobMeta, VariableSpace space, Repository repository, IMetaStore metaStore ) { - JobEntryValidatorUtils.andValidator().validate( this, "server", remarks, + JobEntryValidatorUtils.andValidator().validate( jobMeta.getBowl(), this, "server", remarks, AndValidator.putValidators( JobEntryValidatorUtils.notBlankValidator() ) ); JobEntryValidatorUtils.andValidator() - .validate( this, "replyAddress", remarks, AndValidator.putValidators( + .validate( jobMeta.getBowl(), this, "replyAddress", remarks, AndValidator.putValidators( JobEntryValidatorUtils.notBlankValidator(), JobEntryValidatorUtils.emailValidator() ) ); - JobEntryValidatorUtils.andValidator().validate( this, "destination", remarks, + JobEntryValidatorUtils.andValidator().validate( jobMeta.getBowl(), this, "destination", remarks, AndValidator.putValidators( JobEntryValidatorUtils.notBlankValidator() ) ); if ( usingAuthentication ) { - JobEntryValidatorUtils.andValidator().validate( this, "authenticationUser", remarks, + JobEntryValidatorUtils.andValidator().validate( jobMeta.getBowl(), this, "authenticationUser", remarks, AndValidator.putValidators( JobEntryValidatorUtils.notBlankValidator() ) ); - JobEntryValidatorUtils.andValidator().validate( this, "authenticationPassword", remarks, + JobEntryValidatorUtils.andValidator().validate( jobMeta.getBowl(), this, "authenticationPassword", remarks, AndValidator.putValidators( JobEntryValidatorUtils.notNullValidator() ) ); } - JobEntryValidatorUtils.andValidator().validate( this, "port", remarks, + JobEntryValidatorUtils.andValidator().validate( jobMeta.getBowl(), this, "port", remarks, AndValidator.putValidators( JobEntryValidatorUtils.integerValidator() ) ); } diff --git a/plugins/mail-validator/impl/src/main/java/org/pentaho/di/job/entries/mailvalidator/JobEntryMailValidator.java b/plugins/mail-validator/impl/src/main/java/org/pentaho/di/job/entries/mailvalidator/JobEntryMailValidator.java index 6b523513d910..cbb1662be022 100644 --- a/plugins/mail-validator/impl/src/main/java/org/pentaho/di/job/entries/mailvalidator/JobEntryMailValidator.java +++ b/plugins/mail-validator/impl/src/main/java/org/pentaho/di/job/entries/mailvalidator/JobEntryMailValidator.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2023 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -289,13 +289,13 @@ public boolean evaluates() { public void check( List remarks, JobMeta jobMeta, VariableSpace space, Repository repository, IMetaStore metaStore ) { - JobEntryValidatorUtils.andValidator().validate( this, "emailAddress", remarks, + JobEntryValidatorUtils.andValidator().validate( jobMeta.getBowl(), this, "emailAddress", remarks, AndValidator.putValidators( JobEntryValidatorUtils.notBlankValidator() ) ); - JobEntryValidatorUtils.andValidator().validate( this, "emailSender", remarks, + JobEntryValidatorUtils.andValidator().validate( jobMeta.getBowl(), this, "emailSender", remarks, AndValidator.putValidators( JobEntryValidatorUtils.notBlankValidator(), JobEntryValidatorUtils.emailValidator() ) ); if ( isSMTPCheck() ) { - JobEntryValidatorUtils.andValidator().validate( this, "defaultSMTP", remarks, + JobEntryValidatorUtils.andValidator().validate( jobMeta.getBowl(), this, "defaultSMTP", remarks, AndValidator.putValidators( JobEntryValidatorUtils.notBlankValidator() ) ); } } diff --git a/plugins/mail-validator/impl/src/main/java/org/pentaho/di/trans/steps/mailvalidator/MailValidator.java b/plugins/mail-validator/impl/src/main/java/org/pentaho/di/trans/steps/mailvalidator/MailValidator.java index b2cddf54d086..86bcb2b8c4c4 100644 --- a/plugins/mail-validator/impl/src/main/java/org/pentaho/di/trans/steps/mailvalidator/MailValidator.java +++ b/plugins/mail-validator/impl/src/main/java/org/pentaho/di/trans/steps/mailvalidator/MailValidator.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2023 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -72,7 +72,8 @@ public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws data.previousRowMeta = getInputRowMeta().clone(); data.NrPrevFields = data.previousRowMeta.size(); data.outputRowMeta = getInputRowMeta().clone(); - meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); + meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository, + metaStore ); // check result fieldname data.realResultFieldName = environmentSubstitute( meta.getResultFieldName() ); diff --git a/plugins/mail-validator/impl/src/main/java/org/pentaho/di/trans/steps/mailvalidator/MailValidatorMeta.java b/plugins/mail-validator/impl/src/main/java/org/pentaho/di/trans/steps/mailvalidator/MailValidatorMeta.java index 458575281e1d..cbf16db0253a 100644 --- a/plugins/mail-validator/impl/src/main/java/org/pentaho/di/trans/steps/mailvalidator/MailValidatorMeta.java +++ b/plugins/mail-validator/impl/src/main/java/org/pentaho/di/trans/steps/mailvalidator/MailValidatorMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2023 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -50,6 +50,7 @@ import org.pentaho.metastore.api.IMetaStore; import org.w3c.dom.Node; import org.pentaho.di.core.annotations.Step; +import org.pentaho.di.core.bowl.Bowl; /* * Created on 03-Juin-2008 @@ -326,7 +327,8 @@ public void setDefault() { defaultSMTPField = null; } - public void getFields( RowMetaInterface r, String name, RowMetaInterface[] info, StepMeta nextStep, + @Override + public void getFields( Bowl bowl, RowMetaInterface r, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { String realResultFieldName = space.environmentSubstitute( resultfieldname ); diff --git a/plugins/mail/impl/src/main/java/org/pentaho/di/trans/steps/mail/Mail.java b/plugins/mail/impl/src/main/java/org/pentaho/di/trans/steps/mail/Mail.java index 391e786d1713..e1e96009d488 100644 --- a/plugins/mail/impl/src/main/java/org/pentaho/di/trans/steps/mail/Mail.java +++ b/plugins/mail/impl/src/main/java/org/pentaho/di/trans/steps/mail/Mail.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2023 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -217,7 +217,8 @@ private void checkEmbeddedImages( MailMeta meta, MailData data ) { for ( int i = 0; i < meta.getEmbeddedImages().length; i++ ) { String imageFile = environmentSubstitute( meta.getEmbeddedImages()[i] ); String contentID = environmentSubstitute( meta.getContentIds()[i] ); - image = KettleVFS.getFileObject( imageFile ); + image = KettleVFS.getInstance( getTransMeta().getBowl() ) + .getFileObject( imageFile ); if ( image.exists() && image.getType() == FileType.FILE ) { // Create part for the image @@ -813,7 +814,8 @@ void setAttachedFilesList( Object[] r, LogChannelInterface log ) throws Exceptio } if ( !Utils.isEmpty( realSourceFileFoldername ) ) { - sourcefile = KettleVFS.getFileObject( realSourceFileFoldername, getTransMeta() ); + sourcefile = KettleVFS.getInstance( getTransMeta().getBowl() ) + .getFileObject( realSourceFileFoldername, getTransMeta() ); if ( sourcefile.exists() ) { long FileSize = 0; FileObject[] list = null; @@ -835,7 +837,8 @@ void setAttachedFilesList( Object[] r, LogChannelInterface log ) throws Exceptio for ( int i = 0; i < list.length; i++ ) { - file = KettleVFS.getFileObject( KettleVFS.getFilename( list[i] ), getTransMeta() ); + file = KettleVFS.getInstance( getTransMeta().getBowl() ) + .getFileObject( KettleVFS.getFilename( list[i] ), getTransMeta() ); if ( zipFiles ) { @@ -875,7 +878,8 @@ void setAttachedFilesList( Object[] r, LogChannelInterface log ) throws Exceptio for ( int i = 0; i < list.length; i++ ) { - file = KettleVFS.getFileObject( KettleVFS.getFilename( list[i] ), getTransMeta() ); + file = KettleVFS.getInstance( getTransMeta().getBowl() ) + .getFileObject( KettleVFS.getFilename( list[i] ), getTransMeta() ); ZipEntry zipEntry = new ZipEntry( file.getName().getBaseName() ); zipOutputStream.putNextEntry( zipEntry ); @@ -893,7 +897,8 @@ void setAttachedFilesList( Object[] r, LogChannelInterface log ) throws Exceptio } if ( data.zipFileLimit > 0 && FileSize > data.zipFileLimit || data.zipFileLimit == 0 ) { - file = KettleVFS.getFileObject( masterZipfile.getAbsolutePath(), getTransMeta() ); + file = KettleVFS.getInstance( getTransMeta().getBowl() ) + .getFileObject( masterZipfile.getAbsolutePath(), getTransMeta() ); addAttachedFilePart( file ); } } diff --git a/plugins/meta-inject/impl/src/main/java/org/pentaho/di/trans/steps/metainject/MetaInject.java b/plugins/meta-inject/impl/src/main/java/org/pentaho/di/trans/steps/metainject/MetaInject.java index 667bc87abee4..9559cbbe459d 100644 --- a/plugins/meta-inject/impl/src/main/java/org/pentaho/di/trans/steps/metainject/MetaInject.java +++ b/plugins/meta-inject/impl/src/main/java/org/pentaho/di/trans/steps/metainject/MetaInject.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2022 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -290,7 +290,7 @@ void writeInjectedKtrToFs( String targetFilePath ) throws KettleException { generatedTransMeta.setName( transName ); // set transname on injectedtrans to be same as filename w/o extension } - os = KettleVFS.getOutputStream( targetFilePath, false ); + os = KettleVFS.getInstance( getTransMeta().getBowl() ).getOutputStream( targetFilePath, false ); os.write( XMLHandler.getXMLHeader().getBytes( Const.XML_ENCODING ) ); os.write( generatedTransMeta.getXML().getBytes( Const.XML_ENCODING ) ); } catch ( IOException e ) { @@ -843,7 +843,8 @@ static Set convertToUpperCaseSet( String[] array ) { * package-local visibility for testing purposes */ TransMeta loadTransformationMeta() throws KettleException { - return MetaInjectMeta.loadTransformationMeta( meta, getTrans().getRepository(), getTrans().getMetaStore(), this ); + return MetaInjectMeta.loadTransformationMeta( getTransMeta().getBowl(), meta, getTrans().getRepository(), + getTrans().getMetaStore(), this ); } } diff --git a/plugins/meta-inject/impl/src/main/java/org/pentaho/di/trans/steps/metainject/MetaInjectDialog.java b/plugins/meta-inject/impl/src/main/java/org/pentaho/di/trans/steps/metainject/MetaInjectDialog.java index b8060bd19876..e282ac7f6d0e 100644 --- a/plugins/meta-inject/impl/src/main/java/org/pentaho/di/trans/steps/metainject/MetaInjectDialog.java +++ b/plugins/meta-inject/impl/src/main/java/org/pentaho/di/trans/steps/metainject/MetaInjectDialog.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2023 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -727,7 +727,7 @@ private void loadRepositoryTrans( String transName, RepositoryDirectoryInterface injectTransMeta.clearChanged(); } private void loadFileTrans( String fname ) throws KettleException { - injectTransMeta = new TransMeta( transMeta.environmentSubstitute( fname ) ); + injectTransMeta = new TransMeta( transMeta.getBowl(), transMeta.environmentSubstitute( fname ) ); injectTransMeta.clearChanged(); } diff --git a/plugins/meta-inject/impl/src/main/java/org/pentaho/di/trans/steps/metainject/MetaInjectMeta.java b/plugins/meta-inject/impl/src/main/java/org/pentaho/di/trans/steps/metainject/MetaInjectMeta.java index cdfe54dfbd1e..1793d600f314 100644 --- a/plugins/meta-inject/impl/src/main/java/org/pentaho/di/trans/steps/metainject/MetaInjectMeta.java +++ b/plugins/meta-inject/impl/src/main/java/org/pentaho/di/trans/steps/metainject/MetaInjectMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2023 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -25,6 +25,7 @@ import org.pentaho.di.core.Const; import org.pentaho.di.core.ObjectLocationSpecificationMethod; import org.pentaho.di.core.annotations.Step; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.database.DatabaseMeta; import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.core.exception.KettlePluginException; @@ -372,7 +373,7 @@ public void saveRep( Repository rep, IMetaStore metaStore, ObjectId id_transform } @Override - public void getFields( RowMetaInterface rowMeta, String origin, RowMetaInterface[] info, StepMeta nextStep, + public void getFields( Bowl bowl, RowMetaInterface rowMeta, String origin, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { rowMeta.clear(); // No defined output is expected from this step. @@ -497,27 +498,28 @@ public void setSpecificationMethod( ObjectLocationSpecificationMethod specificat } @Override - public TransMeta fetchTransMeta( StepMetaInterface stepMeta, Repository rep, IMetaStore metastore, VariableSpace space ) throws KettleException { + public TransMeta fetchTransMeta( Bowl bowl, StepMetaInterface stepMeta, Repository rep, IMetaStore metastore, + VariableSpace space ) throws KettleException { return ( stepMeta != null && stepMeta instanceof MetaInjectMeta ) - ? loadTransformationMeta( (MetaInjectMeta) stepMeta, rep, metastore, space ) : null; + ? loadTransformationMeta( bowl, (MetaInjectMeta) stepMeta, rep, metastore, space ) : null; } @Deprecated - public static final synchronized TransMeta loadTransformationMeta( MetaInjectMeta mappingMeta, Repository rep, - VariableSpace space ) throws KettleException { - return loadTransformationMeta( mappingMeta, rep, null, space ); + public static final synchronized TransMeta loadTransformationMeta( Bowl bowl, MetaInjectMeta mappingMeta, + Repository rep, VariableSpace space ) throws KettleException { + return loadTransformationMeta( bowl, mappingMeta, rep, null, space ); } - public static final synchronized TransMeta loadTransformationMeta( MetaInjectMeta injectMeta, Repository rep, - IMetaStore metaStore, VariableSpace space ) + public static final synchronized TransMeta loadTransformationMeta( Bowl bowl, MetaInjectMeta injectMeta, + Repository rep, IMetaStore metaStore, VariableSpace space ) throws KettleException { TransMeta mappingTransMeta = null; CurrentDirectoryResolver resolver = new CurrentDirectoryResolver(); VariableSpace tmpSpace = - resolver.resolveCurrentDirectory( injectMeta.getSpecificationMethod(), space, rep, injectMeta - .getParentStepMeta(), injectMeta.getFileName() ); + resolver.resolveCurrentDirectory( bowl, + injectMeta.getSpecificationMethod(), space, rep, injectMeta.getParentStepMeta(), injectMeta.getFileName() ); switch ( injectMeta.getSpecificationMethod() ) { case FILENAME: @@ -552,7 +554,7 @@ public static final synchronized TransMeta loadTransformationMeta( MetaInjectMet } } if ( mappingTransMeta == null ) { - mappingTransMeta = new TransMeta( realFilename, metaStore, rep, false, tmpSpace, null ); + mappingTransMeta = new TransMeta( bowl, realFilename, metaStore, rep, false, tmpSpace, null ); mappingTransMeta.getLogChannel().logDetailed( "Loading Mapping from repository", "Mapping transformation was loaded from XML file [" + realFilename + "]" ); } @@ -589,13 +591,13 @@ public static final synchronized TransMeta loadTransformationMeta( MetaInjectMet } else { try { mappingTransMeta = - new TransMeta( realDirectory + "/" + realTransname, metaStore, rep, true, tmpSpace, null ); + new TransMeta( bowl, realDirectory + "/" + realTransname, metaStore, rep, true, tmpSpace, null ); } catch ( KettleException ke ) { try { // add .ktr extension and try again mappingTransMeta = - new TransMeta( realDirectory + "/" + realTransname + "." + Const.STRING_TRANS_DEFAULT_EXT, metaStore, - rep, true, tmpSpace, null ); + new TransMeta( bowl, realDirectory + "/" + realTransname + "." + Const.STRING_TRANS_DEFAULT_EXT, + metaStore, rep, true, tmpSpace, null ); } catch ( KettleException ke2 ) { throw new KettleException( BaseMessages.getString( PKG, "StepWithMappingMeta.Exception.UnableToLoadTrans", realTransname ) + realDirectory ); @@ -623,8 +625,8 @@ public static final synchronized TransMeta loadTransformationMeta( MetaInjectMet /** * package-local visibility for testing purposes */ - TransMeta loadTransformationMeta( Repository rep, VariableSpace space ) throws KettleException { - return MetaInjectMeta.loadTransformationMeta( this, rep, null, space ); + TransMeta loadTransformationMeta( Bowl bowl, Repository rep, VariableSpace space ) throws KettleException { + return MetaInjectMeta.loadTransformationMeta( bowl, this, rep, null, space ); } @Override @@ -650,7 +652,7 @@ public List getResourceDependencies( TransMeta transMeta, Ste } @Override - public String exportResources( VariableSpace space, Map definitions, + public String exportResources( Bowl bowl, VariableSpace space, Map definitions, ResourceNamingInterface resourceNamingInterface, Repository repository, IMetaStore metaStore ) throws KettleException { @@ -663,13 +665,13 @@ public String exportResources( VariableSpace space, Map definitions = Collections.emptyMap(); - doReturn( TEST_FILE_NAME ).when( transMeta ).exportResources( transMeta, definitions, resourceNamingInterface, - repository, metaStore ); - doReturn( transMeta ).when( injectMetaSpy ).loadTransformationMeta( repository, variableSpace ); + doReturn( TEST_FILE_NAME ).when( transMeta ).exportResources( DefaultBowl.getInstance(), transMeta, definitions, + resourceNamingInterface, repository, metaStore ); + doReturn( transMeta ).when( injectMetaSpy ).loadTransformationMeta( DefaultBowl.getInstance(), repository, + variableSpace ); String actualExportedFileName = - injectMetaSpy.exportResources( variableSpace, definitions, resourceNamingInterface, repository, metaStore ); + injectMetaSpy.exportResources( DefaultBowl.getInstance(), variableSpace, definitions, resourceNamingInterface, + repository, metaStore ); assertEquals( TEST_FILE_NAME, actualExportedFileName ); assertEquals( EXPORTED_FILE_NAME, injectMetaSpy.getFileName() ); - verify( transMeta ).exportResources( transMeta, definitions, resourceNamingInterface, repository, metaStore ); + verify( transMeta ).exportResources( DefaultBowl.getInstance(), transMeta, definitions, resourceNamingInterface, + repository, metaStore ); } @Test @@ -191,6 +195,11 @@ public void testLoadMappingMetaWhenConnectedToRep() throws Exception { MetaInjectMeta metaInjectMetaMock = mock( MetaInjectMeta.class ); when( metaInjectMetaMock.getSpecificationMethod() ).thenReturn( ObjectLocationSpecificationMethod.FILENAME ); when( metaInjectMetaMock.getFileName() ).thenReturn( "${" + variablePath + "}/" + fileName ); + StepMeta parentStepMeta = mock( StepMeta.class ); + TransMeta transMeta = mock( TransMeta.class ); + when( transMeta.getRepositoryDirectory() ).thenReturn( null ); + when( parentStepMeta.getParentTransMeta() ).thenReturn( transMeta ); + when( metaInjectMetaMock.getParentStepMeta() ).thenReturn( parentStepMeta ); // mock repo and answers Repository rep = mock( Repository.class ); @@ -198,19 +207,20 @@ public void testLoadMappingMetaWhenConnectedToRep() throws Exception { doAnswer( invocation -> { String originalArgument = (String) ( invocation.getArguments() )[ 0 ]; // be sure that the variable was replaced by real path - assertEquals( originalArgument, virtualDir ); + assertEquals( virtualDir, originalArgument ); return null; } ).when( rep ).findDirectory( anyString() ); doAnswer( invocation -> { String originalArgument = (String) ( invocation.getArguments() )[ 0 ]; // be sure that transformation name was resolved correctly - assertEquals( originalArgument, fileName ); + assertEquals( fileName, originalArgument ); return mock( TransMeta.class ); } ).when( rep ).loadTransformation( anyString(), nullable( RepositoryDirectoryInterface.class ), nullable( ProgressMonitorListener.class ), anyBoolean(), nullable( String.class ) ); - assertNotNull( MetaInjectMeta.loadTransformationMeta( metaInjectMetaMock, rep, null, variables ) ); + assertNotNull( MetaInjectMeta.loadTransformationMeta( DefaultBowl.getInstance(), metaInjectMetaMock, rep, null, + variables ) ); } diff --git a/plugins/meta-inject/impl/src/test/java/org/pentaho/di/trans/steps/metainject/MetaInjectTest.java b/plugins/meta-inject/impl/src/test/java/org/pentaho/di/trans/steps/metainject/MetaInjectTest.java index cc43db43d263..53f6a22073f5 100644 --- a/plugins/meta-inject/impl/src/test/java/org/pentaho/di/trans/steps/metainject/MetaInjectTest.java +++ b/plugins/meta-inject/impl/src/test/java/org/pentaho/di/trans/steps/metainject/MetaInjectTest.java @@ -620,14 +620,16 @@ public void writeInjectedKtrShouldWriteToFileSystemCompatibilityFlagTest() throw public void getRepositoryNotNullTest() { metaInject.setRepository( repository ); //If repository is set in the base step (Local Execution) TransMeta will not be required to get the repository + // But is required to get the Bowl for file I/O metaInject.getRepository(); - verify( metaInject, times( 0 ) ).getTransMeta(); + verify( metaInject, times( 1 ) ).getTransMeta(); } @Test public void getRepositoryNullTest() { metaInject.getRepository(); //If repository is not set in the base step (Remote Executions/Scheduling) Need to get the repository from TransMeta - verify( metaInject, times( 1 ) ).getTransMeta(); + // and is required to get the Bowl for file I/O + verify( metaInject, times( 2 ) ).getTransMeta(); } } diff --git a/plugins/mondrianinput/impl/src/main/java/org/pentaho/di/trans/steps/mondrianinput/MondrianInputMeta.java b/plugins/mondrianinput/impl/src/main/java/org/pentaho/di/trans/steps/mondrianinput/MondrianInputMeta.java index 362d82cdfb02..47dd80dc2666 100644 --- a/plugins/mondrianinput/impl/src/main/java/org/pentaho/di/trans/steps/mondrianinput/MondrianInputMeta.java +++ b/plugins/mondrianinput/impl/src/main/java/org/pentaho/di/trans/steps/mondrianinput/MondrianInputMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2022 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -56,6 +56,7 @@ import org.pentaho.metastore.api.IMetaStore; import org.w3c.dom.Node; import org.pentaho.di.core.annotations.Step; +import org.pentaho.di.core.bowl.Bowl; /* * Created on 2-jun-2003 @@ -156,7 +157,8 @@ public void setDefault() { variableReplacementActive = false; } - public void getFields( RowMetaInterface row, String origin, RowMetaInterface[] info, StepMeta nextStep, + @Override + public void getFields( Bowl bowl, RowMetaInterface row, String origin, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { if ( databaseMeta == null ) { return; // TODO: throw an exception here @@ -314,7 +316,8 @@ public void setRole( String role ) { * * @return the filename of the exported resource */ - public String exportResources( VariableSpace space, Map definitions, + @Override + public String exportResources( Bowl bowl, VariableSpace space, Map definitions, ResourceNamingInterface resourceNamingInterface, Repository repository, IMetaStore metaStore ) throws KettleException { try { // The object that we're modifying here is a copy of the original! @@ -325,7 +328,8 @@ public String exportResources( VariableSpace space, Map remarks, JobMeta jobMeta, VariableSpace space, Repository repository, IMetaStore metaStore ) { - boolean res = andValidator().validate( this, "arguments", remarks, putValidators( notNullValidator() ) ); + boolean res = andValidator().validate( jobMeta.getBowl(), this, "arguments", remarks, putValidators( notNullValidator() ) ); if ( res == false ) { return; @@ -569,7 +569,7 @@ public void check( List remarks, JobMeta jobMeta, Variable putValidators( ctx, notNullValidator(), fileExistsValidator() ); for ( int i = 0; i < source_filefolder.length; i++ ) { - andValidator().validate( this, "arguments[" + i + "]", remarks, ctx ); + andValidator().validate( jobMeta.getBowl(), this, "arguments[" + i + "]", remarks, ctx ); } } diff --git a/plugins/ms-access/impl/src/main/java/org/pentaho/di/trans/steps/accessinput/AccessInput.java b/plugins/ms-access/impl/src/main/java/org/pentaho/di/trans/steps/accessinput/AccessInput.java index 664835adec1f..6953a0a98f14 100644 --- a/plugins/ms-access/impl/src/main/java/org/pentaho/di/trans/steps/accessinput/AccessInput.java +++ b/plugins/ms-access/impl/src/main/java/org/pentaho/di/trans/steps/accessinput/AccessInput.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2018 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -250,7 +250,8 @@ private boolean openNextFile() { data.inputRowMeta = getInputRowMeta(); data.outputRowMeta = data.inputRowMeta.clone(); - meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); + meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository, + metaStore ); // Get total previous fields data.totalpreviousfields = data.inputRowMeta.size(); @@ -293,7 +294,7 @@ private boolean openNextFile() { .getDynamicFilenameField(), filename ) ); } - data.file = KettleVFS.getFileObject( filename, getTransMeta() ); + data.file = KettleVFS.getInstance( getTransMeta().getBowl() ).getFileObject( filename, getTransMeta() ); // Check if file exists! } // Add additional fields? @@ -410,15 +411,14 @@ public boolean init( StepMetaInterface smi, StepDataInterface sdi ) { } data.isTableSystem = ( data.tableName.startsWith( AccessInputMeta.PREFIX_SYSTEM ) ); if ( !meta.isFileField() ) { - data.files = meta.getFiles( this ); + data.files = meta.getFiles( getTransMeta().getBowl(), this ); try { handleMissingFiles(); // Create the output row meta-data data.outputRowMeta = new RowMeta(); - meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); // get the - // metadata - // populated + meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository, + metaStore ); // Create convert meta-data objects that will contain Date & Number formatters // For String to conversions, we allocate a conversion meta data row as well... diff --git a/plugins/ms-access/impl/src/main/java/org/pentaho/di/trans/steps/accessinput/AccessInputMeta.java b/plugins/ms-access/impl/src/main/java/org/pentaho/di/trans/steps/accessinput/AccessInputMeta.java index 8274374d5c72..5453c1af8b26 100644 --- a/plugins/ms-access/impl/src/main/java/org/pentaho/di/trans/steps/accessinput/AccessInputMeta.java +++ b/plugins/ms-access/impl/src/main/java/org/pentaho/di/trans/steps/accessinput/AccessInputMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2018 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -32,6 +32,7 @@ import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.Const; import org.pentaho.di.core.annotations.Step; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.util.Utils; import org.pentaho.di.core.database.DatabaseMeta; import org.pentaho.di.core.exception.KettleException; @@ -851,7 +852,7 @@ public void setDefault() { } @Override - public void getFields( RowMetaInterface r, String name, RowMetaInterface[] info, StepMeta nextStep, + public void getFields( Bowl bowl, RowMetaInterface r, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { int i; @@ -1101,9 +1102,9 @@ public void saveRep( Repository rep, IMetaStore metaStore, ObjectId id_transform } } - public FileInputList getFiles( VariableSpace space ) { + public FileInputList getFiles( Bowl bowl, VariableSpace space ) { return FileInputList.createFileList( - space, fileName, fileMask, excludeFileMask, fileRequired, includeSubFolderBoolean() ); + bowl, space, fileName, fileMask, excludeFileMask, fileRequired, includeSubFolderBoolean() ); } private boolean[] includeSubFolderBoolean() { @@ -1134,7 +1135,7 @@ public void check( List remarks, TransMeta transMeta, Step remarks.add( cr ); } - FileInputList fileInputList = getFiles( transMeta ); + FileInputList fileInputList = getFiles( transMeta.getBowl(), transMeta ); // String files[] = getFiles(); if ( fileInputList == null || fileInputList.getFiles().size() == 0 ) { cr = @@ -1209,8 +1210,10 @@ public boolean supportsErrorHandling() { * * @return the filename of the exported resource */ - public String exportResources( VariableSpace space, Map definitions, - ResourceNamingInterface resourceNamingInterface, Repository repository, IMetaStore metaStore ) throws KettleException { + @Override + public String exportResources( Bowl bowl, VariableSpace space, Map definitions, + ResourceNamingInterface resourceNamingInterface, Repository repository, IMetaStore metaStore ) + throws KettleException { try { // The object that we're modifying here is a copy of the original! // So let's change the filename from relative to absolute by grabbing the file object... @@ -1218,7 +1221,8 @@ public String exportResources( VariableSpace space, Map definitions, + @Override + public String exportResources( Bowl bowl, VariableSpace space, Map definitions, ResourceNamingInterface resourceNamingInterface, Repository repository, IMetaStore metaStore ) throws KettleException { try { // The object that we're modifying here is a copy of the original! // So let's change the filename from relative to absolute by grabbing the file object... // if ( !Utils.isEmpty( filename ) ) { - FileObject fileObject = KettleVFS.getFileObject( space.environmentSubstitute( filename ), space ); + FileObject fileObject = KettleVFS.getInstance( bowl ) + .getFileObject( space.environmentSubstitute( filename ), space ); filename = resourceNamingInterface.nameResource( fileObject, space, true ); } diff --git a/plugins/ms-access/ui/src/main/java/org/pentaho/di/ui/trans/steps/accessinput/AccessInputDialog.java b/plugins/ms-access/ui/src/main/java/org/pentaho/di/ui/trans/steps/accessinput/AccessInputDialog.java index 966741b7391c..5995e3f766c6 100644 --- a/plugins/ms-access/ui/src/main/java/org/pentaho/di/ui/trans/steps/accessinput/AccessInputDialog.java +++ b/plugins/ms-access/ui/src/main/java/org/pentaho/di/ui/trans/steps/accessinput/AccessInputDialog.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2022 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -999,7 +999,7 @@ public void widgetSelected( SelectionEvent e ) { try { AccessInputMeta tfii = new AccessInputMeta(); getInfo( tfii ); - FileInputList fileInputList = tfii.getFiles( transMeta ); + FileInputList fileInputList = tfii.getFiles( transMeta.getBowl(), transMeta ); String[] files = fileInputList.getFileStrings(); if ( files.length > 0 ) { @@ -1121,7 +1121,7 @@ private void get() { return; } - FileInputList inputList = meta.getFiles( transMeta ); + FileInputList inputList = meta.getFiles( transMeta.getBowl(), transMeta ); if ( inputList.getFiles().size() > 0 ) { // Open the file (only first file)... @@ -1518,7 +1518,7 @@ private void getTableName() { AccessInputMeta meta = new AccessInputMeta(); getInfo( meta ); - FileInputList fileInputList = meta.getFiles( transMeta ); + FileInputList fileInputList = meta.getFiles( transMeta.getBowl(), transMeta ); if ( fileInputList.nrOfFiles() > 0 ) { diff --git a/plugins/ms-access/ui/src/main/java/org/pentaho/di/ui/trans/steps/accessoutput/AccessOutputDialog.java b/plugins/ms-access/ui/src/main/java/org/pentaho/di/ui/trans/steps/accessoutput/AccessOutputDialog.java index f8d48aa5e0e1..79f7b8573a1b 100644 --- a/plugins/ms-access/ui/src/main/java/org/pentaho/di/ui/trans/steps/accessoutput/AccessOutputDialog.java +++ b/plugins/ms-access/ui/src/main/java/org/pentaho/di/ui/trans/steps/accessoutput/AccessOutputDialog.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2022 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -473,7 +473,7 @@ private void getTableName() { // New class: SelectTableDialog try { String realFilename = transMeta.environmentSubstitute( meta.getFilename() ); - FileObject fileObject = KettleVFS.getFileObject( realFilename, transMeta ); + FileObject fileObject = KettleVFS.getInstance( transMeta.getBowl() ).getFileObject( realFilename, transMeta ); File file = FileUtils.toFile( fileObject.getURL() ); if ( !file.exists() || !file.isFile() ) { diff --git a/plugins/mysql-bulk-loader/impl/src/main/java/org/pentaho/di/trans/steps/mysqlbulkloader/MySQLBulkLoaderMeta.java b/plugins/mysql-bulk-loader/impl/src/main/java/org/pentaho/di/trans/steps/mysqlbulkloader/MySQLBulkLoaderMeta.java index e8a37339d0e5..0dd377379642 100644 --- a/plugins/mysql-bulk-loader/impl/src/main/java/org/pentaho/di/trans/steps/mysqlbulkloader/MySQLBulkLoaderMeta.java +++ b/plugins/mysql-bulk-loader/impl/src/main/java/org/pentaho/di/trans/steps/mysqlbulkloader/MySQLBulkLoaderMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2022 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -28,6 +28,7 @@ import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.Const; import org.pentaho.di.core.annotations.Step; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.injection.AfterInjection; import org.pentaho.di.core.util.Utils; import org.pentaho.di.core.ProvidesDatabaseConnectionInformation; @@ -399,7 +400,8 @@ public void saveRep( Repository rep, IMetaStore metaStore, ObjectId id_transform } } - public void getFields( RowMetaInterface rowMeta, String origin, RowMetaInterface[] info, StepMeta nextStep, + @Override + public void getFields( Bowl bowl, RowMetaInterface rowMeta, String origin, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { // Default: nothing changes to rowMeta } diff --git a/plugins/oracle-bulk-loader/impl/src/main/java/org/pentaho/di/trans/steps/orabulkloader/OraBulkDataOutput.java b/plugins/oracle-bulk-loader/impl/src/main/java/org/pentaho/di/trans/steps/orabulkloader/OraBulkDataOutput.java index 3a6f09b04d81..d6c9f4f25c84 100644 --- a/plugins/oracle-bulk-loader/impl/src/main/java/org/pentaho/di/trans/steps/orabulkloader/OraBulkDataOutput.java +++ b/plugins/oracle-bulk-loader/impl/src/main/java/org/pentaho/di/trans/steps/orabulkloader/OraBulkDataOutput.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2022 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -22,16 +22,18 @@ package org.pentaho.di.trans.steps.orabulkloader; -import com.google.common.annotations.VisibleForTesting; -import org.apache.commons.vfs2.FileObject; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.Const; -import org.pentaho.di.core.exception.KettleFileException; -import org.pentaho.di.core.util.Utils; import org.pentaho.di.core.exception.KettleException; +import org.pentaho.di.core.exception.KettleFileException; import org.pentaho.di.core.row.RowMetaInterface; import org.pentaho.di.core.row.ValueMetaInterface; +import org.pentaho.di.core.util.Utils; import org.pentaho.di.core.variables.VariableSpace; import org.pentaho.di.core.vfs.KettleVFS; + +import com.google.common.annotations.VisibleForTesting; + import java.io.BufferedWriter; import java.io.File; import java.io.FileOutputStream; @@ -44,6 +46,8 @@ import java.text.SimpleDateFormat; import java.util.Date; +import org.apache.commons.vfs2.FileObject; + /** * Does the opening of the output "stream". It's either a file or inter process communication which is transparant to * users of this class. @@ -67,7 +71,7 @@ public OraBulkDataOutput( OraBulkLoaderMeta meta, String recTerm ) { this.recTerm = recTerm; } - public void open( VariableSpace space, Process sqlldrProcess ) throws KettleException { + public void open( Bowl bowl, VariableSpace space, Process sqlldrProcess ) throws KettleException { String loadMethod = meta.getLoadMethod(); try { OutputStream os; @@ -76,7 +80,7 @@ public void open( VariableSpace space, Process sqlldrProcess ) throws KettleExce os = sqlldrProcess.getOutputStream(); } else { // Else open the data file filled in. - String dataFilePath = getFilename( getFileObject( space.environmentSubstitute( meta.getDataFile() ), space ) ); + String dataFilePath = getFilename( getFileObject( bowl, space.environmentSubstitute( meta.getDataFile() ), space ) ); File dataFile = new File( dataFilePath ); // Make sure the parent directory exists dataFile.getParentFile().mkdirs(); @@ -247,7 +251,7 @@ String getFilename( FileObject fileObject ) { } @VisibleForTesting - FileObject getFileObject( String vfsFilename, VariableSpace space ) throws KettleFileException { - return KettleVFS.getFileObject( vfsFilename, space ); + FileObject getFileObject( Bowl bowl, String vfsFilename, VariableSpace space ) throws KettleFileException { + return KettleVFS.getInstance( bowl ).getFileObject( vfsFilename, space ); } } diff --git a/plugins/oracle-bulk-loader/impl/src/main/java/org/pentaho/di/trans/steps/orabulkloader/OraBulkLoader.java b/plugins/oracle-bulk-loader/impl/src/main/java/org/pentaho/di/trans/steps/orabulkloader/OraBulkLoader.java index 1a2b62f095aa..2125cd471ee6 100644 --- a/plugins/oracle-bulk-loader/impl/src/main/java/org/pentaho/di/trans/steps/orabulkloader/OraBulkLoader.java +++ b/plugins/oracle-bulk-loader/impl/src/main/java/org/pentaho/di/trans/steps/orabulkloader/OraBulkLoader.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2022 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -564,7 +564,7 @@ public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws if ( OraBulkLoaderMeta.METHOD_AUTO_CONCURRENT.equals( meta.getLoadMethod() ) ) { execute( meta, false ); } - output.open( this, sqlldrProcess ); + output.open( getTransMeta().getBowl(), this, sqlldrProcess ); } output.writeLine( getInputRowMeta(), r ); } @@ -686,6 +686,6 @@ String getFilename( FileObject fileObject ) { @VisibleForTesting FileObject getFileObject( String vfsFilename, VariableSpace space ) throws KettleFileException { - return KettleVFS.getFileObject( environmentSubstitute( vfsFilename ), space ); + return KettleVFS.getInstance( getTransMeta().getBowl() ).getFileObject( environmentSubstitute( vfsFilename ), space ); } } diff --git a/plugins/oracle-bulk-loader/impl/src/main/java/org/pentaho/di/trans/steps/orabulkloader/OraBulkLoaderMeta.java b/plugins/oracle-bulk-loader/impl/src/main/java/org/pentaho/di/trans/steps/orabulkloader/OraBulkLoaderMeta.java index fc45d02f31e8..bdf7ecba7a14 100644 --- a/plugins/oracle-bulk-loader/impl/src/main/java/org/pentaho/di/trans/steps/orabulkloader/OraBulkLoaderMeta.java +++ b/plugins/oracle-bulk-loader/impl/src/main/java/org/pentaho/di/trans/steps/orabulkloader/OraBulkLoaderMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2022 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -22,26 +22,25 @@ package org.pentaho.di.trans.steps.orabulkloader; -import java.util.List; - -import org.apache.commons.lang.StringUtils; +import org.pentaho.di.core.annotations.Step; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.CheckResult; import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.Const; -import org.pentaho.di.core.injection.AfterInjection; -import org.pentaho.di.core.util.Utils; -import org.pentaho.di.core.ProvidesDatabaseConnectionInformation; -import org.pentaho.di.core.SQLStatement; import org.pentaho.di.core.database.Database; import org.pentaho.di.core.database.DatabaseMeta; import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.core.exception.KettleStepException; import org.pentaho.di.core.exception.KettleXMLException; +import org.pentaho.di.core.injection.AfterInjection; import org.pentaho.di.core.injection.Injection; import org.pentaho.di.core.injection.InjectionSupported; +import org.pentaho.di.core.ProvidesDatabaseConnectionInformation; import org.pentaho.di.core.row.RowMeta; import org.pentaho.di.core.row.RowMetaInterface; import org.pentaho.di.core.row.ValueMetaInterface; +import org.pentaho.di.core.SQLStatement; +import org.pentaho.di.core.util.Utils; import org.pentaho.di.core.variables.VariableSpace; import org.pentaho.di.core.xml.XMLHandler; import org.pentaho.di.i18n.BaseMessages; @@ -49,16 +48,19 @@ import org.pentaho.di.repository.Repository; import org.pentaho.di.shared.SharedObjectInterface; import org.pentaho.di.trans.DatabaseImpact; -import org.pentaho.di.trans.Trans; -import org.pentaho.di.trans.TransMeta; import org.pentaho.di.trans.step.BaseStepMeta; import org.pentaho.di.trans.step.StepDataInterface; import org.pentaho.di.trans.step.StepInterface; import org.pentaho.di.trans.step.StepMeta; import org.pentaho.di.trans.step.StepMetaInterface; +import org.pentaho.di.trans.Trans; +import org.pentaho.di.trans.TransMeta; import org.pentaho.metastore.api.IMetaStore; + +import java.util.List; + +import org.apache.commons.lang.StringUtils; import org.w3c.dom.Node; -import org.pentaho.di.core.annotations.Step; /** * Created on 20-feb-2007 @@ -618,7 +620,8 @@ public void saveRep( Repository rep, IMetaStore metaStore, ObjectId id_transform } } - public void getFields( RowMetaInterface rowMeta, String origin, RowMetaInterface[] info, StepMeta nextStep, + @Override + public void getFields( Bowl bowl, RowMetaInterface rowMeta, String origin, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { // Default: nothing changes to rowMeta } diff --git a/plugins/oracle-bulk-loader/impl/src/test/java/org/pentaho/di/trans/steps/orabulkloader/OraBulkDataOutputTest.java b/plugins/oracle-bulk-loader/impl/src/test/java/org/pentaho/di/trans/steps/orabulkloader/OraBulkDataOutputTest.java index 62526c522628..e356d3049ec4 100644 --- a/plugins/oracle-bulk-loader/impl/src/test/java/org/pentaho/di/trans/steps/orabulkloader/OraBulkDataOutputTest.java +++ b/plugins/oracle-bulk-loader/impl/src/test/java/org/pentaho/di/trans/steps/orabulkloader/OraBulkDataOutputTest.java @@ -26,6 +26,7 @@ import org.junit.BeforeClass; import org.junit.ClassRule; import org.junit.Test; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.Const; import org.pentaho.di.core.KettleEnvironment; import org.pentaho.di.core.exception.KettleException; @@ -80,10 +81,10 @@ public void testOpen() { doReturn( dataFileVfsPath ).when( oraBulkLoaderMeta ).getDataFile(); doReturn( tempFilePath ).when( space ).environmentSubstitute( dataFileVfsPath ); - doReturn( tempFileObject ).when( oraBulkDataOutput ).getFileObject( tempFilePath, space ); + doReturn( tempFileObject ).when( oraBulkDataOutput ).getFileObject( DefaultBowl.getInstance(), tempFilePath, space ); doReturn( tempFilePath ).when( oraBulkDataOutput ).getFilename( tempFileObject ); - oraBulkDataOutput.open( space, sqlldrProcess ); + oraBulkDataOutput.open( DefaultBowl.getInstance(), space, sqlldrProcess ); oraBulkDataOutput.close(); } catch ( Exception ex ) { @@ -98,7 +99,7 @@ public void testOpenFileException() { // OraBulkDataOutput.open() is difficult to mock when( oraBulkLoaderMeta.getDataFile() ).thenAnswer( i -> { throw new IOException(); } ); try { - oraBulkDataOutput.open( space, sqlldrProcess ); + oraBulkDataOutput.open( DefaultBowl.getInstance(), space, sqlldrProcess ); fail( "An IOException was supposed to be thrown, failing test" ); } catch ( KettleException kex ) { assertTrue( kex.getMessage().contains( "IO exception occured:" ) ); diff --git a/plugins/palo/core/src/main/java/org/pentaho/di/trans/steps/palo/cellinput/PaloCellInputMeta.java b/plugins/palo/core/src/main/java/org/pentaho/di/trans/steps/palo/cellinput/PaloCellInputMeta.java index 63dc40f67249..9ef770290e2b 100644 --- a/plugins/palo/core/src/main/java/org/pentaho/di/trans/steps/palo/cellinput/PaloCellInputMeta.java +++ b/plugins/palo/core/src/main/java/org/pentaho/di/trans/steps/palo/cellinput/PaloCellInputMeta.java @@ -29,6 +29,7 @@ import org.pentaho.di.core.Const; import org.pentaho.di.core.util.Utils; import org.pentaho.di.core.annotations.Step; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.database.DatabaseMeta; import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.core.exception.KettleStepException; @@ -126,7 +127,7 @@ public void setDefault() { } @Override - public void getFields( final RowMetaInterface row, final String origin, final RowMetaInterface[] info, + public void getFields( Bowl bowl, final RowMetaInterface row, final String origin, final RowMetaInterface[] info, final StepMeta nextStep, final VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { if ( databaseMeta == null ) { diff --git a/plugins/palo/core/src/main/java/org/pentaho/di/trans/steps/palo/diminput/PaloDimInputMeta.java b/plugins/palo/core/src/main/java/org/pentaho/di/trans/steps/palo/diminput/PaloDimInputMeta.java index f8901a785969..4605c3cc5a5d 100644 --- a/plugins/palo/core/src/main/java/org/pentaho/di/trans/steps/palo/diminput/PaloDimInputMeta.java +++ b/plugins/palo/core/src/main/java/org/pentaho/di/trans/steps/palo/diminput/PaloDimInputMeta.java @@ -28,6 +28,7 @@ import org.pentaho.di.core.Const; import org.pentaho.di.core.util.Utils; import org.pentaho.di.core.annotations.Step; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.database.DatabaseMeta; import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.core.exception.KettleStepException; @@ -122,7 +123,8 @@ private void readData( final Node stepnode, final List getResourceDependencies( JobMeta jobMeta ) { @Override public void check( List remarks, JobMeta jobMeta, VariableSpace space, Repository repository, IMetaStore metaStore ) { - JobEntryValidatorUtils.andValidator().validate( this, "serverName", remarks, + JobEntryValidatorUtils.andValidator().validate( jobMeta.getBowl(), this, "serverName", remarks, AndValidator.putValidators( JobEntryValidatorUtils.notBlankValidator() ) ); - JobEntryValidatorUtils.andValidator().validate( + JobEntryValidatorUtils.andValidator().validate( jobMeta.getBowl(), this, "localDirectory", remarks, AndValidator.putValidators( JobEntryValidatorUtils.notBlankValidator(), JobEntryValidatorUtils.fileExistsValidator() ) ); - JobEntryValidatorUtils.andValidator().validate( this, "userName", remarks, + JobEntryValidatorUtils.andValidator().validate( jobMeta.getBowl(), this, "userName", remarks, AndValidator.putValidators( JobEntryValidatorUtils.notBlankValidator() ) ); - JobEntryValidatorUtils.andValidator().validate( this, "password", remarks, + JobEntryValidatorUtils.andValidator().validate( jobMeta.getBowl(), this, "password", remarks, AndValidator.putValidators( JobEntryValidatorUtils.notNullValidator() ) ); - JobEntryValidatorUtils.andValidator().validate( this, "serverPort", remarks, + JobEntryValidatorUtils.andValidator().validate( jobMeta.getBowl(), this, "serverPort", remarks, AndValidator.putValidators( JobEntryValidatorUtils.integerValidator() ) ); } diff --git a/plugins/put-file-sftp/impl/src/main/java/org/pentaho/di/job/entries/sftpput/JobEntrySFTPPUT.java b/plugins/put-file-sftp/impl/src/main/java/org/pentaho/di/job/entries/sftpput/JobEntrySFTPPUT.java index 8db22fb623e6..219bb6a131ba 100644 --- a/plugins/put-file-sftp/impl/src/main/java/org/pentaho/di/job/entries/sftpput/JobEntrySFTPPUT.java +++ b/plugins/put-file-sftp/impl/src/main/java/org/pentaho/di/job/entries/sftpput/JobEntrySFTPPUT.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2023 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -657,7 +657,7 @@ public Result execute( Result previousResult, int nr ) throws KettleException { // Get file names String file_previous = resultRow.getString( 0, null ); if ( !Utils.isEmpty( file_previous ) ) { - FileObject file = KettleVFS.getFileObject( file_previous, this ); + FileObject file = KettleVFS.getInstance( parentJobMeta.getBowl() ).getFileObject( file_previous, this ); if ( !file.exists() ) { logError( BaseMessages.getString( PKG, "JobSFTPPUT.Log.FilefromPreviousNotFound", file_previous ) ); } else { @@ -737,7 +737,7 @@ public Result execute( Result previousResult, int nr ) throws KettleException { } else { FileObject folder = null; try { - folder = KettleVFS.getFileObject( realDestinationFolder, this ); + folder = KettleVFS.getInstance( parentJobMeta.getBowl() ).getFileObject( realDestinationFolder, this ); // Let's check if folder exists... if ( !folder.exists() ) { // Do we need to create it? @@ -773,7 +773,7 @@ public Result execute( Result previousResult, int nr ) throws KettleException { result.setNrErrors( 1 ); return result; } - if ( !KettleVFS.fileExists( realKeyFilename ) ) { + if ( !KettleVFS.getInstance( parentJobMeta.getBowl() ).fileExists( realKeyFilename ) ) { // Error.. can not reach keyfile logError( BaseMessages.getString( PKG, "JobSFTP.Error.KeyFileNotFound" ) ); result.setNrErrors( 1 ); @@ -784,7 +784,7 @@ public Result execute( Result previousResult, int nr ) throws KettleException { // Create sftp client to host ... sftpclient = - new SFTPClient( + new SFTPClient( parentJobMeta.getBowl(), InetAddress.getByName( realServerName ), Const.toInt( realServerPort, 22 ), realUsername, realKeyFilename, realPassPhrase ); if ( log.isDetailed() ) { @@ -838,7 +838,8 @@ realProxyHost, environmentSubstitute( getProxyPort() ), environmentSubstitute( g // Get all the files in the local directory... myFileList = new ArrayList(); - FileObject localFiles = KettleVFS.getFileObject( realLocalDirectory, this ); + FileObject localFiles = KettleVFS.getInstance( parentJobMeta.getBowl() ) + .getFileObject( realLocalDirectory, this ); FileObject[] children = localFiles.getChildren(); if ( children != null ) { for ( int i = 0; i < children.length; i++ ) { @@ -916,7 +917,7 @@ realProxyHost, environmentSubstitute( getProxyPort() ), environmentSubstitute( g FileObject destination = null; try { destination = - KettleVFS.getFileObject( realDestinationFolder + KettleVFS.getInstance( parentJobMeta.getBowl() ).getFileObject( realDestinationFolder + Const.FILE_SEPARATOR + myFile.getName().getBaseName(), this ); myFile.moveTo( destination ); if ( log.isDetailed() ) { @@ -990,16 +991,16 @@ public List getResourceDependencies( JobMeta jobMeta ) { @Override public void check( List remarks, JobMeta jobMeta, VariableSpace space, Repository repository, IMetaStore metaStore ) { - JobEntryValidatorUtils.andValidator().validate( this, "serverName", remarks, + JobEntryValidatorUtils.andValidator().validate( jobMeta.getBowl(), this, "serverName", remarks, AndValidator.putValidators( JobEntryValidatorUtils.notBlankValidator() ) ); - JobEntryValidatorUtils.andValidator().validate( + JobEntryValidatorUtils.andValidator().validate( jobMeta.getBowl(), this, "localDirectory", remarks, AndValidator.putValidators( JobEntryValidatorUtils.notBlankValidator(), JobEntryValidatorUtils.fileExistsValidator() ) ); - JobEntryValidatorUtils.andValidator().validate( this, "userName", remarks, + JobEntryValidatorUtils.andValidator().validate( jobMeta.getBowl(), this, "userName", remarks, AndValidator.putValidators( JobEntryValidatorUtils.notBlankValidator() ) ); - JobEntryValidatorUtils.andValidator().validate( this, "password", remarks, + JobEntryValidatorUtils.andValidator().validate( jobMeta.getBowl(), this, "password", remarks, AndValidator.putValidators( JobEntryValidatorUtils.notNullValidator() ) ); - JobEntryValidatorUtils.andValidator().validate( this, "serverPort", remarks, + JobEntryValidatorUtils.andValidator().validate( jobMeta.getBowl(), this, "serverPort", remarks, AndValidator.putValidators( JobEntryValidatorUtils.integerValidator() ) ); } diff --git a/plugins/put-file-sftp/ui/src/main/java/org/pentaho/di/ui/job/entries/sftpput/JobEntrySFTPPUTDialog.java b/plugins/put-file-sftp/ui/src/main/java/org/pentaho/di/ui/job/entries/sftpput/JobEntrySFTPPUTDialog.java index e8d52674f1e0..f03a71992c85 100644 --- a/plugins/put-file-sftp/ui/src/main/java/org/pentaho/di/ui/job/entries/sftpput/JobEntrySFTPPUTDialog.java +++ b/plugins/put-file-sftp/ui/src/main/java/org/pentaho/di/ui/job/entries/sftpput/JobEntrySFTPPUTDialog.java @@ -1077,7 +1077,7 @@ private boolean connectToSFTP( boolean checkFolder, String Remotefoldername ) { try { if ( sftpclient == null ) { // Create sftp client to host ... - sftpclient = new SFTPClient( + sftpclient = new SFTPClient( jobMeta.getBowl(), InetAddress.getByName( jobMeta.environmentSubstitute( wServerName.getText() ) ), Const.toInt( jobMeta.environmentSubstitute( wServerPort.getText() ), 22 ), jobMeta.environmentSubstitute( wUserName.getText() ), diff --git a/plugins/random-cc-number-generator/impl/src/main/java/org/pentaho/di/trans/steps/randomccnumber/RandomCCNumberGenerator.java b/plugins/random-cc-number-generator/impl/src/main/java/org/pentaho/di/trans/steps/randomccnumber/RandomCCNumberGenerator.java index 3cfc8843a267..9a1742c63d30 100644 --- a/plugins/random-cc-number-generator/impl/src/main/java/org/pentaho/di/trans/steps/randomccnumber/RandomCCNumberGenerator.java +++ b/plugins/random-cc-number-generator/impl/src/main/java/org/pentaho/di/trans/steps/randomccnumber/RandomCCNumberGenerator.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2023 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -71,7 +71,8 @@ public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws if ( first ) { first = false; data.outputRowMeta = new RowMeta(); - meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); + meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository, + metaStore ); } for ( int i = 0; i < data.cardTypes.length && !isStopped(); i++ ) { diff --git a/plugins/random-cc-number-generator/impl/src/main/java/org/pentaho/di/trans/steps/randomccnumber/RandomCCNumberGeneratorMeta.java b/plugins/random-cc-number-generator/impl/src/main/java/org/pentaho/di/trans/steps/randomccnumber/RandomCCNumberGeneratorMeta.java index 8e2a50849f0a..4f469482a413 100644 --- a/plugins/random-cc-number-generator/impl/src/main/java/org/pentaho/di/trans/steps/randomccnumber/RandomCCNumberGeneratorMeta.java +++ b/plugins/random-cc-number-generator/impl/src/main/java/org/pentaho/di/trans/steps/randomccnumber/RandomCCNumberGeneratorMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2023 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -28,6 +28,7 @@ import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.Const; import org.pentaho.di.core.annotations.Step; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.util.Utils; import org.pentaho.di.core.database.DatabaseMeta; import org.pentaho.di.core.exception.KettleException; @@ -234,7 +235,8 @@ public void setDefault() { cardTypeFieldName = BaseMessages.getString( PKG, "RandomCCNumberGeneratorMeta.CardTypeField" ); } - public void getFields( RowMetaInterface row, String name, RowMetaInterface[] info, StepMeta nextStep, + @Override + public void getFields( Bowl bowl, RowMetaInterface row, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { ValueMetaInterface v = new ValueMetaString( cardNumberFieldName ); diff --git a/plugins/rest/core/src/main/java/org/pentaho/di/trans/steps/rest/Rest.java b/plugins/rest/core/src/main/java/org/pentaho/di/trans/steps/rest/Rest.java index 8c1941a4180a..f805bf032367 100644 --- a/plugins/rest/core/src/main/java/org/pentaho/di/trans/steps/rest/Rest.java +++ b/plugins/rest/core/src/main/java/org/pentaho/di/trans/steps/rest/Rest.java @@ -408,7 +408,8 @@ public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws first = false; data.inputRowMeta = getInputRowMeta(); data.outputRowMeta = data.inputRowMeta.clone(); - meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); + meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository, + metaStore ); // Let's set URL if ( meta.isUrlInField() ) { diff --git a/plugins/rest/core/src/main/java/org/pentaho/di/trans/steps/rest/RestMeta.java b/plugins/rest/core/src/main/java/org/pentaho/di/trans/steps/rest/RestMeta.java index 6de309c781ff..89144d7915ab 100644 --- a/plugins/rest/core/src/main/java/org/pentaho/di/trans/steps/rest/RestMeta.java +++ b/plugins/rest/core/src/main/java/org/pentaho/di/trans/steps/rest/RestMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2023 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -50,6 +50,7 @@ import org.pentaho.di.trans.step.StepMetaInterface; import org.pentaho.metastore.api.IMetaStore; import org.pentaho.di.core.annotations.Step; +import org.pentaho.di.core.bowl.Bowl; import org.w3c.dom.Node; import java.util.List; @@ -424,8 +425,8 @@ public void setDefault() { } @Override - public void getFields( RowMetaInterface inputRowMeta, String name, RowMetaInterface[] info, StepMeta nextStep, - VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { + public void getFields( Bowl bowl, RowMetaInterface inputRowMeta, String name, RowMetaInterface[] info, + StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { if ( !Utils.isEmpty( fieldName ) ) { ValueMetaInterface v = new ValueMetaString( space.environmentSubstitute( fieldName ) ); v.setOrigin( name ); diff --git a/plugins/rest/core/src/main/java/org/pentaho/di/trans/steps/rest/analyzer/RestClientExternalResourceConsumer.java b/plugins/rest/core/src/main/java/org/pentaho/di/trans/steps/rest/analyzer/RestClientExternalResourceConsumer.java index 37e944f6ee0e..31352adabb97 100644 --- a/plugins/rest/core/src/main/java/org/pentaho/di/trans/steps/rest/analyzer/RestClientExternalResourceConsumer.java +++ b/plugins/rest/core/src/main/java/org/pentaho/di/trans/steps/rest/analyzer/RestClientExternalResourceConsumer.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2023 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -25,6 +25,7 @@ import com.google.common.annotations.VisibleForTesting; import org.apache.commons.lang.ArrayUtils; import org.apache.commons.lang.StringUtils; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.exception.KettleValueException; import org.pentaho.di.core.row.RowMetaInterface; import org.pentaho.di.trans.steps.rest.Rest; @@ -64,7 +65,7 @@ public static RestClientExternalResourceConsumer getInstance() { private Logger log = LoggerFactory.getLogger( RestClientExternalResourceConsumer.class ); @Override - public Collection getResourcesFromMeta( RestMeta meta, IAnalysisContext context ) { + public Collection getResourcesFromMeta( Bowl bowl, RestMeta meta, IAnalysisContext context ) { List resources = new ArrayList<>(); diff --git a/plugins/rest/core/src/test/java/org/pentaho/di/trans/steps/rest/analyzer/RestClientExternalResourceConsumerTest.java b/plugins/rest/core/src/test/java/org/pentaho/di/trans/steps/rest/analyzer/RestClientExternalResourceConsumerTest.java index 5c9d7abb72ca..23a0ed258efd 100644 --- a/plugins/rest/core/src/test/java/org/pentaho/di/trans/steps/rest/analyzer/RestClientExternalResourceConsumerTest.java +++ b/plugins/rest/core/src/test/java/org/pentaho/di/trans/steps/rest/analyzer/RestClientExternalResourceConsumerTest.java @@ -27,6 +27,7 @@ import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.junit.MockitoJUnitRunner; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.row.RowMetaInterface; import org.pentaho.di.trans.steps.rest.Rest; import org.pentaho.di.trans.steps.rest.RestMeta; @@ -72,7 +73,8 @@ public void setUp() throws Exception { @Test public void testGetResourcesFromMeta() throws Exception { when( meta.getUrl() ).thenReturn( row[ 0 ].toString() ); - Collection resourcesFromMeta = consumer.getResourcesFromMeta( meta ); + Collection resourcesFromMeta = + consumer.getResourcesFromMeta( DefaultBowl.getInstance(), meta ); assertEquals( 1, resourcesFromMeta.size() ); assertEquals( row[ 0 ], resourcesFromMeta.toArray( new IExternalResourceInfo[ 1 ] )[ 0 ].getName() ); diff --git a/plugins/rss/impl/src/main/java/org/pentaho/di/trans/steps/rssinput/RssInput.java b/plugins/rss/impl/src/main/java/org/pentaho/di/trans/steps/rssinput/RssInput.java index 5b67d7d817a8..943eb6c8d152 100644 --- a/plugins/rss/impl/src/main/java/org/pentaho/di/trans/steps/rssinput/RssInput.java +++ b/plugins/rss/impl/src/main/java/org/pentaho/di/trans/steps/rssinput/RssInput.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2022 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -113,7 +113,8 @@ private boolean readNextUrl() throws Exception { first = false; data.inputRowMeta = getInputRowMeta(); data.outputRowMeta = data.inputRowMeta.clone(); - meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); + meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository, + metaStore ); // Get total previous fields data.totalpreviousfields = data.inputRowMeta.size(); @@ -414,7 +415,8 @@ public boolean init( StepMetaInterface smi, StepDataInterface sdi ) { // Create the output row meta-data data.outputRowMeta = new RowMeta(); - meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); + meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository, + metaStore ); // Create convert meta-data objects that will contain Date & Number formatters data.convertRowMeta = data.outputRowMeta.cloneToType( ValueMetaInterface.TYPE_STRING ); diff --git a/plugins/rss/impl/src/main/java/org/pentaho/di/trans/steps/rssinput/RssInputMeta.java b/plugins/rss/impl/src/main/java/org/pentaho/di/trans/steps/rssinput/RssInputMeta.java index 07b5e9986780..e808406463b6 100644 --- a/plugins/rss/impl/src/main/java/org/pentaho/di/trans/steps/rssinput/RssInputMeta.java +++ b/plugins/rss/impl/src/main/java/org/pentaho/di/trans/steps/rssinput/RssInputMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2022 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -52,6 +52,7 @@ import org.pentaho.metastore.api.IMetaStore; import org.w3c.dom.Node; import org.pentaho.di.core.annotations.Step; +import org.pentaho.di.core.bowl.Bowl; @Step( id = "RssInput", name = "BaseStep.TypeLongDesc.RssInput", description = "BaseStep.TypeTooltipDesc.RssInput", categoryDescription = "i18n:org.pentaho.di.trans.step:BaseStep.Category.Input", @@ -349,7 +350,8 @@ public void setDefault() { rowLimit = 0; } - public void getFields( RowMetaInterface r, String name, RowMetaInterface[] info, StepMeta nextStep, + @Override + public void getFields( Bowl bowl, RowMetaInterface r, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { int i; for ( i = 0; i < inputFields.length; i++ ) { diff --git a/plugins/rss/impl/src/main/java/org/pentaho/di/trans/steps/rssoutput/RssOutput.java b/plugins/rss/impl/src/main/java/org/pentaho/di/trans/steps/rssoutput/RssOutput.java index a7704b046cae..098f3f18a590 100644 --- a/plugins/rss/impl/src/main/java/org/pentaho/di/trans/steps/rssoutput/RssOutput.java +++ b/plugins/rss/impl/src/main/java/org/pentaho/di/trans/steps/rssoutput/RssOutput.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2022 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -125,7 +125,8 @@ public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws first = false; data.inputRowMeta = getInputRowMeta(); data.outputRowMeta = data.inputRowMeta.clone(); - meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); + meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository, + metaStore ); // Let's check for filename... if ( meta.isFilenameInField() ) { @@ -161,7 +162,8 @@ public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws FileObject parentfolder = null; try { // Get parent folder - parentfolder = KettleVFS.getFileObject( data.filename, getTransMeta() ).getParent(); + parentfolder = KettleVFS.getInstance( getTransMeta().getBowl() ) + .getFileObject( data.filename, getTransMeta() ).getParent(); if ( !parentfolder.exists() ) { if ( log.isDetailed() ) { logDetailed( BaseMessages.getString( PKG, "RssOutput.Log.ParentFolderExists", parentfolder @@ -577,7 +579,7 @@ public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws } public String buildFilename() throws KettleStepException { - return meta.buildFilename( this, getCopy() ); + return meta.buildFilename( getTransMeta().getBowl(), this, getCopy() ); } /** @@ -715,7 +717,8 @@ private boolean WriteToFile( String title, String link, String description, Date // Add this to the result file names... ResultFile resultFile = new ResultFile( - ResultFile.FILE_TYPE_GENERAL, KettleVFS.getFileObject( fileName, getTransMeta() ), getTransMeta() + ResultFile.FILE_TYPE_GENERAL, KettleVFS.getInstance( getTransMeta().getBowl() ) + .getFileObject( fileName, getTransMeta() ), getTransMeta() .getName(), getStepname() ); resultFile.setComment( "This file was created with a RSS Output step" ); addResultFile( resultFile ); diff --git a/plugins/rss/impl/src/main/java/org/pentaho/di/trans/steps/rssoutput/RssOutputMeta.java b/plugins/rss/impl/src/main/java/org/pentaho/di/trans/steps/rssoutput/RssOutputMeta.java index 352a8785d04a..57d23f3c6076 100644 --- a/plugins/rss/impl/src/main/java/org/pentaho/di/trans/steps/rssoutput/RssOutputMeta.java +++ b/plugins/rss/impl/src/main/java/org/pentaho/di/trans/steps/rssoutput/RssOutputMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2022 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -51,6 +51,7 @@ import org.pentaho.metastore.api.IMetaStore; import org.w3c.dom.Node; import org.pentaho.di.core.annotations.Step; +import org.pentaho.di.core.bowl.Bowl; /** * Output rows to RSS feed and create a file. @@ -536,7 +537,7 @@ public void setPartNrInFilename( boolean value ) { partNrInFilename = value; } - public String[] getFiles( VariableSpace space ) throws KettleStepException { + public String[] getFiles( Bowl bowl, VariableSpace space ) throws KettleStepException { int copies = 1; int parts = 1; @@ -558,7 +559,7 @@ public String[] getFiles( VariableSpace space ) throws KettleStepException { int i = 0; for ( int copy = 0; copy < copies; copy++ ) { for ( int part = 0; part < parts; part++ ) { - retval[i] = buildFilename( space, copy ); + retval[i] = buildFilename( bowl, space, copy ); i++; } } @@ -569,10 +570,10 @@ public String[] getFiles( VariableSpace space ) throws KettleStepException { return retval; } - private String getFilename( VariableSpace space ) throws KettleStepException { + private String getFilename( Bowl bowl, VariableSpace space ) throws KettleStepException { FileObject file = null; try { - file = KettleVFS.getFileObject( space.environmentSubstitute( getFileName() ) ); + file = KettleVFS.getInstance( bowl ).getFileObject( space.environmentSubstitute( getFileName() ) ); return KettleVFS.getFilename( file ); } catch ( Exception e ) { throw new KettleStepException( BaseMessages @@ -587,12 +588,12 @@ private String getFilename( VariableSpace space ) throws KettleStepException { } } - public String buildFilename( VariableSpace space, int stepnr ) throws KettleStepException { + public String buildFilename( Bowl bowl, VariableSpace space, int stepnr ) throws KettleStepException { SimpleDateFormat daf = new SimpleDateFormat(); // Replace possible environment variables... - String retval = getFilename( space ); + String retval = getFilename( bowl, space ); Date now = new Date(); diff --git a/plugins/rss/ui/src/main/java/org/pentaho/di/ui/trans/steps/rssoutput/RssOutputDialog.java b/plugins/rss/ui/src/main/java/org/pentaho/di/ui/trans/steps/rssoutput/RssOutputDialog.java index 86e1631f37a4..2fb8bef4c98c 100644 --- a/plugins/rss/ui/src/main/java/org/pentaho/di/ui/trans/steps/rssoutput/RssOutputDialog.java +++ b/plugins/rss/ui/src/main/java/org/pentaho/di/ui/trans/steps/rssoutput/RssOutputDialog.java @@ -1393,7 +1393,7 @@ public void widgetSelected( SelectionEvent e ) { RssOutputMeta tfoi = new RssOutputMeta(); getInfo( tfoi ); try { - String[] files = tfoi.getFiles( transMeta ); + String[] files = tfoi.getFiles( transMeta.getBowl(), transMeta ); if ( files != null && files.length > 0 ) { EnterSelectionDialog esd = new EnterSelectionDialog( shell, files, BaseMessages.getString( PKG, "RssOutputDialog.SelectOutputFiles.DialogTitle" ), diff --git a/plugins/s3csvinput/core/src/main/java/org/pentaho/di/trans/steps/s3csvinput/S3CsvInput.java b/plugins/s3csvinput/core/src/main/java/org/pentaho/di/trans/steps/s3csvinput/S3CsvInput.java index 134c2a891069..f05d1ad722c8 100644 --- a/plugins/s3csvinput/core/src/main/java/org/pentaho/di/trans/steps/s3csvinput/S3CsvInput.java +++ b/plugins/s3csvinput/core/src/main/java/org/pentaho/di/trans/steps/s3csvinput/S3CsvInput.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2018 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -64,7 +64,7 @@ public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws first = false; data.outputRowMeta = new RowMeta(); - meta.getFields( data.outputRowMeta, getStepname(), null, null, this ); + meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this ); if ( data.filenames == null ) { // We're expecting the list of filenames from the previous step(s)... diff --git a/plugins/s3csvinput/core/src/main/java/org/pentaho/di/trans/steps/s3csvinput/S3CsvInputMeta.java b/plugins/s3csvinput/core/src/main/java/org/pentaho/di/trans/steps/s3csvinput/S3CsvInputMeta.java index e8e47f71f9a0..10e931facd6e 100644 --- a/plugins/s3csvinput/core/src/main/java/org/pentaho/di/trans/steps/s3csvinput/S3CsvInputMeta.java +++ b/plugins/s3csvinput/core/src/main/java/org/pentaho/di/trans/steps/s3csvinput/S3CsvInputMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2019 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -39,6 +39,7 @@ import org.pentaho.di.core.util.StringUtil; import org.pentaho.di.core.util.Utils; import org.pentaho.di.core.annotations.Step; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.database.DatabaseMeta; import org.pentaho.di.core.encryption.Encr; import org.pentaho.di.core.exception.KettleException; @@ -320,7 +321,7 @@ public void saveRep( Repository rep, IMetaStore metaStore, ObjectId id_transform } @Override - public void getFields( RowMetaInterface rowMeta, String origin, RowMetaInterface[] info, StepMeta nextStep, + public void getFields( Bowl bowl, RowMetaInterface rowMeta, String origin, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { rowMeta.clear(); // Start with a clean slate, eats the input @@ -375,9 +376,9 @@ public void getFields( RowMetaInterface rowMeta, String origin, RowMetaInterface } @Override - public void getFields( RowMetaInterface rowMeta, String origin, RowMetaInterface[] info, StepMeta nextStep, + public void getFields( Bowl bowl, RowMetaInterface rowMeta, String origin, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space ) throws KettleStepException { - getFields( rowMeta, origin, info, nextStep, space, null, null ); + getFields( bowl, rowMeta, origin, info, nextStep, space, null, null ); } @Override diff --git a/plugins/s3csvinput/core/src/test/java/org/pentaho/di/trans/steps/s3csvinput/S3CsvInputMeta_GetFields_Test.java b/plugins/s3csvinput/core/src/test/java/org/pentaho/di/trans/steps/s3csvinput/S3CsvInputMeta_GetFields_Test.java index 5a56fe4bd563..ebe9e2c630ab 100644 --- a/plugins/s3csvinput/core/src/test/java/org/pentaho/di/trans/steps/s3csvinput/S3CsvInputMeta_GetFields_Test.java +++ b/plugins/s3csvinput/core/src/test/java/org/pentaho/di/trans/steps/s3csvinput/S3CsvInputMeta_GetFields_Test.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -23,6 +23,7 @@ package org.pentaho.di.trans.steps.s3csvinput; import org.junit.Test; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.row.RowMeta; import org.pentaho.di.trans.steps.textfileinput.TextFileInputField; @@ -36,14 +37,14 @@ public class S3CsvInputMeta_GetFields_Test { @Test public void getFields_PicksFields() throws Exception { RowMeta rowMeta = new RowMeta(); - createSampleMeta().getFields( rowMeta, "", null, null, null, null, null ); + createSampleMeta().getFields( DefaultBowl.getInstance(), rowMeta, "", null, null, null, null, null ); assertFieldsArePopulated( rowMeta ); } @Test public void getFields_DeprecatedAlsoPicksFields() throws Exception { RowMeta rowMeta = new RowMeta(); - createSampleMeta().getFields( rowMeta, "", null, null, null ); + createSampleMeta().getFields( DefaultBowl.getInstance(), rowMeta, "", null, null, null ); assertFieldsArePopulated( rowMeta ); } diff --git a/plugins/salesforce/core/src/main/java/org/pentaho/di/trans/steps/salesforcedelete/SalesforceDelete.java b/plugins/salesforce/core/src/main/java/org/pentaho/di/trans/steps/salesforcedelete/SalesforceDelete.java index 407dafa2108b..0e1d0f63d744 100644 --- a/plugins/salesforce/core/src/main/java/org/pentaho/di/trans/steps/salesforcedelete/SalesforceDelete.java +++ b/plugins/salesforce/core/src/main/java/org/pentaho/di/trans/steps/salesforcedelete/SalesforceDelete.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -74,7 +74,8 @@ public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws // Create the output row meta-data data.outputRowMeta = getInputRowMeta().clone(); - meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); + meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository, + metaStore ); // Check deleteKeyField String realFieldName = environmentSubstitute( meta.getDeleteField() ); diff --git a/plugins/salesforce/core/src/main/java/org/pentaho/di/trans/steps/salesforcedelete/SalesforceDeleteMeta.java b/plugins/salesforce/core/src/main/java/org/pentaho/di/trans/steps/salesforcedelete/SalesforceDeleteMeta.java index 4200c07ab3d7..3960c8ac5573 100644 --- a/plugins/salesforce/core/src/main/java/org/pentaho/di/trans/steps/salesforcedelete/SalesforceDeleteMeta.java +++ b/plugins/salesforce/core/src/main/java/org/pentaho/di/trans/steps/salesforcedelete/SalesforceDeleteMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2019 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -28,6 +28,7 @@ import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.Const; import org.pentaho.di.core.annotations.Step; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.database.DatabaseMeta; import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.core.exception.KettleStepException; @@ -160,7 +161,8 @@ public void setDefault() { } /* This function adds meta data to the rows being pushed out */ - public void getFields( RowMetaInterface r, String name, RowMetaInterface[] info, StepMeta nextStep, + @Override + public void getFields( Bowl bowl, RowMetaInterface r, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { } diff --git a/plugins/salesforce/core/src/main/java/org/pentaho/di/trans/steps/salesforceinput/SalesforceInput.java b/plugins/salesforce/core/src/main/java/org/pentaho/di/trans/steps/salesforceinput/SalesforceInput.java index 758d37e18d20..8296b2942c9d 100644 --- a/plugins/salesforce/core/src/main/java/org/pentaho/di/trans/steps/salesforceinput/SalesforceInput.java +++ b/plugins/salesforce/core/src/main/java/org/pentaho/di/trans/steps/salesforceinput/SalesforceInput.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -69,7 +69,8 @@ public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws // Create the output row meta-data data.outputRowMeta = new RowMeta(); - meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); + meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository, + metaStore ); // For String to conversions, we allocate a conversion meta data row as well... // diff --git a/plugins/salesforce/core/src/main/java/org/pentaho/di/trans/steps/salesforceinput/SalesforceInputMeta.java b/plugins/salesforce/core/src/main/java/org/pentaho/di/trans/steps/salesforceinput/SalesforceInputMeta.java index afbc805edf41..f5ac3b1f9bf6 100644 --- a/plugins/salesforce/core/src/main/java/org/pentaho/di/trans/steps/salesforceinput/SalesforceInputMeta.java +++ b/plugins/salesforce/core/src/main/java/org/pentaho/di/trans/steps/salesforceinput/SalesforceInputMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2019 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -31,6 +31,7 @@ import org.pentaho.di.core.injection.InjectionSupported; import org.pentaho.di.core.util.Utils; import org.pentaho.di.core.annotations.Step; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.database.DatabaseMeta; import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.core.exception.KettleStepException; @@ -605,7 +606,8 @@ public void setDefault() { setRowLimit( "0" ); } - public void getFields( RowMetaInterface r, String name, RowMetaInterface[] info, StepMeta nextStep, + @Override + public void getFields( Bowl bowl, RowMetaInterface r, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { int i; for ( i = 0; i < inputFields.length; i++ ) { diff --git a/plugins/salesforce/core/src/main/java/org/pentaho/di/trans/steps/salesforceinsert/SalesforceInsert.java b/plugins/salesforce/core/src/main/java/org/pentaho/di/trans/steps/salesforceinsert/SalesforceInsert.java index 235e797f98a7..83e72fec686c 100644 --- a/plugins/salesforce/core/src/main/java/org/pentaho/di/trans/steps/salesforceinsert/SalesforceInsert.java +++ b/plugins/salesforce/core/src/main/java/org/pentaho/di/trans/steps/salesforceinsert/SalesforceInsert.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -93,7 +93,8 @@ public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws // Create the output row meta-data data.inputRowMeta = getInputRowMeta().clone(); data.outputRowMeta = data.inputRowMeta.clone(); - meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); + meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository, + metaStore ); // Build the mapping of input position to field name data.fieldnrs = new int[meta.getUpdateStream().length]; diff --git a/plugins/salesforce/core/src/main/java/org/pentaho/di/trans/steps/salesforceinsert/SalesforceInsertMeta.java b/plugins/salesforce/core/src/main/java/org/pentaho/di/trans/steps/salesforceinsert/SalesforceInsertMeta.java index 3a33d05aa40d..bbf9894d7fcc 100644 --- a/plugins/salesforce/core/src/main/java/org/pentaho/di/trans/steps/salesforceinsert/SalesforceInsertMeta.java +++ b/plugins/salesforce/core/src/main/java/org/pentaho/di/trans/steps/salesforceinsert/SalesforceInsertMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2019 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -29,6 +29,7 @@ import org.pentaho.di.core.Const; import org.pentaho.di.core.util.Utils; import org.pentaho.di.core.annotations.Step; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.database.DatabaseMeta; import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.core.exception.KettleStepException; @@ -265,7 +266,8 @@ public void setDefault() { } /* This function adds meta data to the rows being pushed out */ - public void getFields( RowMetaInterface r, String name, RowMetaInterface[] info, StepMeta nextStep, + @Override + public void getFields( Bowl bowl, RowMetaInterface r, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { String realfieldname = space.environmentSubstitute( getSalesforceIDFieldName() ); if ( !Utils.isEmpty( realfieldname ) ) { diff --git a/plugins/salesforce/core/src/main/java/org/pentaho/di/trans/steps/salesforceupdate/SalesforceUpdate.java b/plugins/salesforce/core/src/main/java/org/pentaho/di/trans/steps/salesforceupdate/SalesforceUpdate.java index 7c1a8a07346e..db993c057439 100644 --- a/plugins/salesforce/core/src/main/java/org/pentaho/di/trans/steps/salesforceupdate/SalesforceUpdate.java +++ b/plugins/salesforce/core/src/main/java/org/pentaho/di/trans/steps/salesforceupdate/SalesforceUpdate.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -92,7 +92,8 @@ public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws // Create the output row meta-data data.inputRowMeta = getInputRowMeta().clone(); data.outputRowMeta = data.inputRowMeta.clone(); - meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); + meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository, + metaStore ); // Build the mapping of input position to field name data.fieldnrs = new int[meta.getUpdateStream().length]; diff --git a/plugins/salesforce/core/src/main/java/org/pentaho/di/trans/steps/salesforceupdate/SalesforceUpdateMeta.java b/plugins/salesforce/core/src/main/java/org/pentaho/di/trans/steps/salesforceupdate/SalesforceUpdateMeta.java index 7fa4b19399c1..2638dbb326e8 100644 --- a/plugins/salesforce/core/src/main/java/org/pentaho/di/trans/steps/salesforceupdate/SalesforceUpdateMeta.java +++ b/plugins/salesforce/core/src/main/java/org/pentaho/di/trans/steps/salesforceupdate/SalesforceUpdateMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2019 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -28,6 +28,7 @@ import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.Const; import org.pentaho.di.core.annotations.Step; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.database.DatabaseMeta; import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.core.exception.KettleStepException; @@ -249,7 +250,8 @@ public void setDefault() { } /* This function adds meta data to the rows being pushed out */ - public void getFields( RowMetaInterface r, String name, RowMetaInterface[] info, StepMeta nextStep, + @Override + public void getFields( Bowl bowl, RowMetaInterface r, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { } diff --git a/plugins/salesforce/core/src/main/java/org/pentaho/di/trans/steps/salesforceupsert/SalesforceUpsert.java b/plugins/salesforce/core/src/main/java/org/pentaho/di/trans/steps/salesforceupsert/SalesforceUpsert.java index decdae4cff6e..989f86ed1ece 100644 --- a/plugins/salesforce/core/src/main/java/org/pentaho/di/trans/steps/salesforceupsert/SalesforceUpsert.java +++ b/plugins/salesforce/core/src/main/java/org/pentaho/di/trans/steps/salesforceupsert/SalesforceUpsert.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2019 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -103,7 +103,8 @@ public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws // Create the output row meta-data data.inputRowMeta = getInputRowMeta().clone(); data.outputRowMeta = data.inputRowMeta.clone(); - meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); + meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository, + metaStore ); // Build the mapping of input position to field name data.fieldnrs = new int[meta.getUpdateStream().length]; diff --git a/plugins/salesforce/core/src/main/java/org/pentaho/di/trans/steps/salesforceupsert/SalesforceUpsertMeta.java b/plugins/salesforce/core/src/main/java/org/pentaho/di/trans/steps/salesforceupsert/SalesforceUpsertMeta.java index c838c68bd6c9..8222d56b32c8 100644 --- a/plugins/salesforce/core/src/main/java/org/pentaho/di/trans/steps/salesforceupsert/SalesforceUpsertMeta.java +++ b/plugins/salesforce/core/src/main/java/org/pentaho/di/trans/steps/salesforceupsert/SalesforceUpsertMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2019 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -29,6 +29,7 @@ import org.pentaho.di.core.Const; import org.pentaho.di.core.util.Utils; import org.pentaho.di.core.annotations.Step; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.database.DatabaseMeta; import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.core.exception.KettleStepException; @@ -286,7 +287,8 @@ public void setDefault() { } /* This function adds meta data to the rows being pushed out */ - public void getFields( RowMetaInterface r, String name, RowMetaInterface[] info, StepMeta nextStep, + @Override + public void getFields( Bowl bowl, RowMetaInterface r, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { String realfieldname = space.environmentSubstitute( getSalesforceIDFieldName() ); if ( !Utils.isEmpty( realfieldname ) ) { diff --git a/plugins/salesforce/core/src/test/java/org/pentaho/di/trans/steps/salesforcedelete/SalesforceDeleteMetaTest.java b/plugins/salesforce/core/src/test/java/org/pentaho/di/trans/steps/salesforcedelete/SalesforceDeleteMetaTest.java index 31e280c5cf3f..e82b40ec0a7d 100644 --- a/plugins/salesforce/core/src/test/java/org/pentaho/di/trans/steps/salesforcedelete/SalesforceDeleteMetaTest.java +++ b/plugins/salesforce/core/src/test/java/org/pentaho/di/trans/steps/salesforcedelete/SalesforceDeleteMetaTest.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -37,6 +37,7 @@ import org.junit.BeforeClass; import org.junit.ClassRule; import org.junit.Test; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.CheckResult; import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.Const; @@ -96,12 +97,12 @@ public void testGetFields() throws KettleStepException { SalesforceDeleteMeta meta = new SalesforceDeleteMeta(); meta.setDefault(); RowMetaInterface r = new RowMeta(); - meta.getFields( r, "thisStep", null, null, new Variables(), null, null ); + meta.getFields( DefaultBowl.getInstance(), r, "thisStep", null, null, new Variables(), null, null ); assertEquals( 0, r.size() ); r.clear(); r.addValueMeta( new ValueMetaString( "testString" ) ); - meta.getFields( r, "thisStep", null, null, new Variables(), null, null ); + meta.getFields( DefaultBowl.getInstance(), r, "thisStep", null, null, new Variables(), null, null ); assertEquals( 1, r.size() ); assertEquals( ValueMetaInterface.TYPE_STRING, r.getValueMeta( 0 ).getType() ); assertEquals( "testString", r.getValueMeta( 0 ).getName() ); diff --git a/plugins/salesforce/core/src/test/java/org/pentaho/di/trans/steps/salesforceinput/SalesforceInputMetaTest.java b/plugins/salesforce/core/src/test/java/org/pentaho/di/trans/steps/salesforceinput/SalesforceInputMetaTest.java index 7d24f9f16984..4bf9c4b0e86e 100644 --- a/plugins/salesforce/core/src/test/java/org/pentaho/di/trans/steps/salesforceinput/SalesforceInputMetaTest.java +++ b/plugins/salesforce/core/src/test/java/org/pentaho/di/trans/steps/salesforceinput/SalesforceInputMetaTest.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -37,6 +37,7 @@ import org.junit.BeforeClass; import org.junit.ClassRule; import org.junit.Test; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.CheckResult; import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.Const; @@ -118,12 +119,12 @@ public void testGetFields() throws KettleStepException { SalesforceInputMeta meta = new SalesforceInputMeta(); meta.setDefault(); RowMetaInterface r = new RowMeta(); - meta.getFields( r, "thisStep", null, null, new Variables(), null, null ); + meta.getFields( DefaultBowl.getInstance(), r, "thisStep", null, null, new Variables(), null, null ); assertEquals( 0, r.size() ); meta.setInputFields( new SalesforceInputField[]{ new SalesforceInputField( "field1" ) } ); r.clear(); - meta.getFields( r, "thisStep", null, null, new Variables(), null, null ); + meta.getFields( DefaultBowl.getInstance(), r, "thisStep", null, null, new Variables(), null, null ); assertEquals( 1, r.size() ); meta.setIncludeDeletionDate( true ); @@ -139,7 +140,7 @@ public void testGetFields() throws KettleStepException { meta.setIncludeTimestamp( true ); meta.setTimestampField( "TS" ); r.clear(); - meta.getFields( r, "thisStep", null, null, new Variables(), null, null ); + meta.getFields( DefaultBowl.getInstance(), r, "thisStep", null, null, new Variables(), null, null ); assertEquals( 7, r.size() ); assertTrue( r.indexOfValue( "field1" ) >= 0 ); assertTrue( r.indexOfValue( "DeletionDate" ) >= 0 ); diff --git a/plugins/salesforce/core/src/test/java/org/pentaho/di/trans/steps/salesforceinsert/SalesforceInsertMetaTest.java b/plugins/salesforce/core/src/test/java/org/pentaho/di/trans/steps/salesforceinsert/SalesforceInsertMetaTest.java index cb7f4dc5356a..6c3e4d7063bb 100644 --- a/plugins/salesforce/core/src/test/java/org/pentaho/di/trans/steps/salesforceinsert/SalesforceInsertMetaTest.java +++ b/plugins/salesforce/core/src/test/java/org/pentaho/di/trans/steps/salesforceinsert/SalesforceInsertMetaTest.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -35,6 +35,7 @@ import org.junit.BeforeClass; import org.junit.ClassRule; import org.junit.Test; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.CheckResult; import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.Const; @@ -126,13 +127,13 @@ public void testGetFields() throws KettleStepException { SalesforceInsertMeta meta = new SalesforceInsertMeta(); meta.setDefault(); RowMetaInterface r = new RowMeta(); - meta.getFields( r, "thisStep", null, null, new Variables(), null, null ); + meta.getFields( DefaultBowl.getInstance(), r, "thisStep", null, null, new Variables(), null, null ); assertEquals( 1, r.size() ); assertEquals( "Id", r.getFieldNames()[0] ); meta.setSalesforceIDFieldName( "id_field" ); r.clear(); - meta.getFields( r, "thisStep", null, null, new Variables(), null, null ); + meta.getFields( DefaultBowl.getInstance(), r, "thisStep", null, null, new Variables(), null, null ); assertEquals( 1, r.size() ); assertEquals( "id_field", r.getFieldNames()[0] ); } diff --git a/plugins/salesforce/core/src/test/java/org/pentaho/di/trans/steps/salesforceupdate/SalesforceUpdateMetaTest.java b/plugins/salesforce/core/src/test/java/org/pentaho/di/trans/steps/salesforceupdate/SalesforceUpdateMetaTest.java index 61b79ca0be36..ae73c25dc12d 100644 --- a/plugins/salesforce/core/src/test/java/org/pentaho/di/trans/steps/salesforceupdate/SalesforceUpdateMetaTest.java +++ b/plugins/salesforce/core/src/test/java/org/pentaho/di/trans/steps/salesforceupdate/SalesforceUpdateMetaTest.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -35,6 +35,7 @@ import org.junit.BeforeClass; import org.junit.ClassRule; import org.junit.Test; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.CheckResult; import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.Const; @@ -96,12 +97,12 @@ public void testGetFields() throws KettleStepException { SalesforceUpdateMeta meta = new SalesforceUpdateMeta(); meta.setDefault(); RowMetaInterface r = new RowMeta(); - meta.getFields( r, "thisStep", null, null, new Variables(), null, null ); + meta.getFields( DefaultBowl.getInstance(), r, "thisStep", null, null, new Variables(), null, null ); assertEquals( 0, r.size() ); r.clear(); r.addValueMeta( new ValueMetaString( "testString" ) ); - meta.getFields( r, "thisStep", null, null, new Variables(), null, null ); + meta.getFields( DefaultBowl.getInstance(), r, "thisStep", null, null, new Variables(), null, null ); assertEquals( 1, r.size() ); assertEquals( ValueMetaInterface.TYPE_STRING, r.getValueMeta( 0 ).getType() ); assertEquals( "testString", r.getValueMeta( 0 ).getName() ); diff --git a/plugins/salesforce/core/src/test/java/org/pentaho/di/trans/steps/salesforceupsert/SalesforceUpsertMetaTest.java b/plugins/salesforce/core/src/test/java/org/pentaho/di/trans/steps/salesforceupsert/SalesforceUpsertMetaTest.java index 7657f9db97cf..5b1f1ae874ab 100644 --- a/plugins/salesforce/core/src/test/java/org/pentaho/di/trans/steps/salesforceupsert/SalesforceUpsertMetaTest.java +++ b/plugins/salesforce/core/src/test/java/org/pentaho/di/trans/steps/salesforceupsert/SalesforceUpsertMetaTest.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -35,6 +35,7 @@ import org.junit.BeforeClass; import org.junit.ClassRule; import org.junit.Test; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.CheckResult; import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.Const; @@ -94,13 +95,13 @@ public void testGetFields() throws KettleStepException { SalesforceUpsertMeta meta = new SalesforceUpsertMeta(); meta.setDefault(); RowMetaInterface r = new RowMeta(); - meta.getFields( r, "thisStep", null, null, new Variables(), null, null ); + meta.getFields( DefaultBowl.getInstance(), r, "thisStep", null, null, new Variables(), null, null ); assertEquals( 1, r.size() ); assertEquals( "Id", r.getFieldNames()[0] ); meta.setSalesforceIDFieldName( "id_field" ); r.clear(); - meta.getFields( r, "thisStep", null, null, new Variables(), null, null ); + meta.getFields( DefaultBowl.getInstance(), r, "thisStep", null, null, new Variables(), null, null ); assertEquals( 1, r.size() ); assertEquals( "id_field", r.getFieldNames()[0] ); } diff --git a/plugins/sap/core/src/main/java/org/pentaho/di/trans/steps/sapinput/SapInput.java b/plugins/sap/core/src/main/java/org/pentaho/di/trans/steps/sapinput/SapInput.java index 71ba4d12349a..7e2883b2d70a 100644 --- a/plugins/sap/core/src/main/java/org/pentaho/di/trans/steps/sapinput/SapInput.java +++ b/plugins/sap/core/src/main/java/org/pentaho/di/trans/steps/sapinput/SapInput.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -73,7 +73,8 @@ public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws // Determine the output row metadata of this step // data.outputRowMeta = new RowMeta(); - meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); + meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository, + metaStore ); // Pre-calculate the indexes of the parameters for performance reasons... // diff --git a/plugins/sap/core/src/main/java/org/pentaho/di/trans/steps/sapinput/SapInputMeta.java b/plugins/sap/core/src/main/java/org/pentaho/di/trans/steps/sapinput/SapInputMeta.java index c361e7e6ee31..732629ce7c43 100644 --- a/plugins/sap/core/src/main/java/org/pentaho/di/trans/steps/sapinput/SapInputMeta.java +++ b/plugins/sap/core/src/main/java/org/pentaho/di/trans/steps/sapinput/SapInputMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2018 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -30,6 +30,7 @@ import org.pentaho.di.core.Const; import org.pentaho.di.core.util.Utils; import org.pentaho.di.core.annotations.Step; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.database.DatabaseMeta; import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.core.exception.KettleStepException; @@ -136,7 +137,8 @@ public void setDefault() { } - public void getFields( RowMetaInterface row, String origin, RowMetaInterface[] info, StepMeta nextStep, + @Override + public void getFields( Bowl bowl, RowMetaInterface row, String origin, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { row.clear(); // TODO: add an option to also include the input data... diff --git a/plugins/sftpput/impl/src/main/java/org/pentaho/di/trans/steps/sftpput/SFTPPut.java b/plugins/sftpput/impl/src/main/java/org/pentaho/di/trans/steps/sftpput/SFTPPut.java index cbfe52964a07..a7138dac1f40 100644 --- a/plugins/sftpput/impl/src/main/java/org/pentaho/di/trans/steps/sftpput/SFTPPut.java +++ b/plugins/sftpput/impl/src/main/java/org/pentaho/di/trans/steps/sftpput/SFTPPut.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2023 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -101,7 +101,7 @@ public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws logError( BaseMessages.getString( PKG, "SFTPPut.Error.KeyFileMissing" ) ); return false; } - if ( !KettleVFS.fileExists( realKeyFilename ) ) { + if ( !KettleVFS.getInstance( getTransMeta().getBowl() ).fileExists( realKeyFilename ) ) { // Error.. can not reach keyfile logError( BaseMessages.getString( PKG, "SFTPPut.Error.KeyFileNotFound", realKeyFilename ) ); return false; @@ -180,7 +180,7 @@ realProxyHost, environmentSubstitute( meta.getProxyPort() ), environmentSubstitu } else { // source data is a file // let's check file - file = KettleVFS.getFileObject( sourceData ); + file = KettleVFS.getInstance( getTransMeta().getBowl() ).getFileObject( sourceData ); if ( !file.exists() ) { // We can not find file @@ -203,7 +203,7 @@ realProxyHost, environmentSubstitute( meta.getProxyPort() ), environmentSubstitu PKG, "SFTPPut.Error.MoveToDestinationFolderIsEmpty" ) ); } - destinationFolder = KettleVFS.getFileObject( realDestationFolder ); + destinationFolder = KettleVFS.getInstance( getTransMeta().getBowl() ).getFileObject( realDestationFolder ); if ( !destinationFolder.exists() ) { // We can not find folder @@ -336,7 +336,7 @@ void checkDestinationFolderField( String realDestinationFoldernameFieldName, SFT SFTPClient createSftpClient( String realServerName, String realServerPort, String realUsername, String realKeyFilename, String realPassPhrase ) throws KettleJobException, UnknownHostException { - return new SFTPClient( + return new SFTPClient( getTransMeta().getBowl(), InetAddress.getByName( realServerName ), Const.toInt( realServerPort, 22 ), realUsername, realKeyFilename, realPassPhrase ); } @@ -358,7 +358,7 @@ protected void finishTheJob( FileObject file, String sourceData, FileObject dest FileObject destination = null; try { destination = - KettleVFS.getFileObject( destinationFolder.getName().getBaseName() + KettleVFS.getInstance( getTransMeta().getBowl() ).getFileObject( destinationFolder.getName().getBaseName() + Const.FILE_SEPARATOR + file.getName().getBaseName(), this ); file.moveTo( destination ); if ( isDetailed() ) { diff --git a/plugins/sftpput/impl/src/main/java/org/pentaho/di/trans/steps/sftpput/SFTPPutMeta.java b/plugins/sftpput/impl/src/main/java/org/pentaho/di/trans/steps/sftpput/SFTPPutMeta.java index 13f4f44d28f5..4ac38930dbda 100644 --- a/plugins/sftpput/impl/src/main/java/org/pentaho/di/trans/steps/sftpput/SFTPPutMeta.java +++ b/plugins/sftpput/impl/src/main/java/org/pentaho/di/trans/steps/sftpput/SFTPPutMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2023 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -22,6 +22,7 @@ package org.pentaho.di.trans.steps.sftpput; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.CheckResult; import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.Const; @@ -276,7 +277,8 @@ public void saveRep( Repository rep, IMetaStore metaStore, ObjectId id_transform } } - public void getFields( RowMetaInterface rowMeta, String origin, RowMetaInterface[] info, StepMeta nextStep, + @Override + public void getFields( Bowl bowl, RowMetaInterface rowMeta, String origin, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { // Default: nothing changes to rowMeta } diff --git a/plugins/sftpput/ui/src/main/java/org/pentaho/di/ui/trans/steps/sftpput/SFTPPutDialog.java b/plugins/sftpput/ui/src/main/java/org/pentaho/di/ui/trans/steps/sftpput/SFTPPutDialog.java index 8fb56a861b54..458f1ba78e6d 100644 --- a/plugins/sftpput/ui/src/main/java/org/pentaho/di/ui/trans/steps/sftpput/SFTPPutDialog.java +++ b/plugins/sftpput/ui/src/main/java/org/pentaho/di/ui/trans/steps/sftpput/SFTPPutDialog.java @@ -1131,7 +1131,7 @@ boolean connectToSFTP( boolean checkFolder, String Remotefoldername ) { SFTPClient createSFTPClient() throws UnknownHostException, KettleJobException { // Create sftp client to host ... sftpclient = - new SFTPClient( + new SFTPClient( transMeta.getBowl(), InetAddress.getByName( transMeta.environmentSubstitute( wServerName.getText() ) ), Const.toInt( transMeta.environmentSubstitute( wServerPort.getText() ), 22 ), diff --git a/plugins/shapefilereader/core/src/main/java/org/pentaho/di/shapefilereader/ShapeFileReader.java b/plugins/shapefilereader/core/src/main/java/org/pentaho/di/shapefilereader/ShapeFileReader.java index 408a780c5237..90b9eeb754c5 100755 --- a/plugins/shapefilereader/core/src/main/java/org/pentaho/di/shapefilereader/ShapeFileReader.java +++ b/plugins/shapefilereader/core/src/main/java/org/pentaho/di/shapefilereader/ShapeFileReader.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2019 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -74,7 +74,8 @@ public synchronized boolean processRow( StepMetaInterface smi, StepDataInterface first = false; data.outputRowMeta = new RowMeta(); - meta.getFields( data.outputRowMeta, getStepname(), null, null, this ); + meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository, + metaStore ); } // building new row diff --git a/plugins/shapefilereader/core/src/main/java/org/pentaho/di/shapefilereader/ShapeFileReaderMeta.java b/plugins/shapefilereader/core/src/main/java/org/pentaho/di/shapefilereader/ShapeFileReaderMeta.java index c6460842f310..fbdd8b440508 100755 --- a/plugins/shapefilereader/core/src/main/java/org/pentaho/di/shapefilereader/ShapeFileReaderMeta.java +++ b/plugins/shapefilereader/core/src/main/java/org/pentaho/di/shapefilereader/ShapeFileReaderMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2019 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -27,6 +27,7 @@ import org.apache.commons.lang.StringUtils; import org.pentaho.di.core.annotations.Step; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.CheckResult; import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.Counter; @@ -155,7 +156,8 @@ public void setDefault() { encoding = ""; } - public void getFields( RowMetaInterface row, String name, RowMetaInterface[] info, StepMeta nextStep, + @Override + public void getFields( Bowl bowl, RowMetaInterface row, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space ) throws KettleStepException { // The filename... diff --git a/plugins/ssh2/src/org/pentaho/di/job/entries/ssh2get/JobEntrySSH2GET.java b/plugins/ssh2/src/org/pentaho/di/job/entries/ssh2get/JobEntrySSH2GET.java index a8097592c919..2d071c909eef 100644 --- a/plugins/ssh2/src/org/pentaho/di/job/entries/ssh2get/JobEntrySSH2GET.java +++ b/plugins/ssh2/src/org/pentaho/di/job/entries/ssh2get/JobEntrySSH2GET.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -937,7 +937,7 @@ public boolean FileExists( String filename ) { FileObject file = null; try { - file = KettleVFS.getFileObject( filename, this ); + file = KettleVFS.getInstance( parentJobMeta.getBowl() ).getFileObject( filename, this ); if ( !file.exists() ) { return false; } else { @@ -1258,7 +1258,7 @@ private void copyFile( String sourceLocation, String targetLocation, SFTPv3Clien private boolean CreateFolder( String filefolder ) { FileObject folder = null; try { - folder = KettleVFS.getFileObject( filefolder, this ); + folder = KettleVFS.getInstance( parentJobMeta.getBowl() ).getFileObject( filefolder, this ); if ( !folder.exists() ) { if ( createtargetfolder ) { diff --git a/plugins/ssh2/src/org/pentaho/di/job/entries/ssh2put/JobEntrySSH2PUT.java b/plugins/ssh2/src/org/pentaho/di/job/entries/ssh2put/JobEntrySSH2PUT.java index 3780b13f8974..b69b90ba6b89 100644 --- a/plugins/ssh2/src/org/pentaho/di/job/entries/ssh2put/JobEntrySSH2PUT.java +++ b/plugins/ssh2/src/org/pentaho/di/job/entries/ssh2put/JobEntrySSH2PUT.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -700,7 +700,7 @@ public Result execute( Result previousResult, int nr ) { } else { FileObject folder = null; try { - folder = KettleVFS.getFileObject( realDestinationFolder, this ); + folder = KettleVFS.getInstance( parentJobMeta.getBowl() ).getFileObject( realDestinationFolder, this ); // Let's check if folder exists... if ( !folder.exists() ) { // Do we need to create it? @@ -1075,7 +1075,7 @@ private List getFiles( String localfolder ) throws KettleFileExcepti // Get all the files in the local directory... - FileObject localFiles = KettleVFS.getFileObject( localfolder, this ); + FileObject localFiles = KettleVFS.getInstance( parentJobMeta.getBowl() ).getFileObject( localfolder, this ); FileObject[] children = localFiles.getChildren(); if ( children != null ) { for ( int i = 0; i < children.length; i++ ) { @@ -1112,7 +1112,7 @@ private boolean deleteOrMoveFiles( FileObject file, String destinationFolder ) t FileObject source = null; try { destination = - KettleVFS.getFileObject( + KettleVFS.getInstance( parentJobMeta.getBowl() ).getFileObject( destinationFolder + Const.FILE_SEPARATOR + file.getName().getBaseName(), this ); file.moveTo( destination ); retval = true; diff --git a/plugins/star-modeler/src/org/pentaho/di/starmodeler/StarModelerPerspective.java b/plugins/star-modeler/src/org/pentaho/di/starmodeler/StarModelerPerspective.java index 2b3e66b32675..50df9ec2ea8a 100644 --- a/plugins/star-modeler/src/org/pentaho/di/starmodeler/StarModelerPerspective.java +++ b/plugins/star-modeler/src/org/pentaho/di/starmodeler/StarModelerPerspective.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * -* Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com +* Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -289,11 +289,11 @@ public void importFile(String filename) { open(null, filename, true); } - public boolean exportFile(EngineMetaInterface meta, String filename) { + public boolean exportFile( Bowl bowl, EngineMetaInterface meta, String filename ) { try { String xml = meta.getXML(); - OutputStream outputStream = KettleVFS.getOutputStream(filename, false); + OutputStream outputStream = KettleVFS.getInstance( bowl ).getOutputStream(filename, false); outputStream.write(xml.getBytes(Const.XML_ENCODING)); outputStream.close(); diff --git a/plugins/streaming/impls/jms/src/test/java/org/pentaho/di/trans/step/jms/JmsConsumerMetaTest.java b/plugins/streaming/impls/jms/src/test/java/org/pentaho/di/trans/step/jms/JmsConsumerMetaTest.java index b60ddbcbc559..da21b552631f 100644 --- a/plugins/streaming/impls/jms/src/test/java/org/pentaho/di/trans/step/jms/JmsConsumerMetaTest.java +++ b/plugins/streaming/impls/jms/src/test/java/org/pentaho/di/trans/step/jms/JmsConsumerMetaTest.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2018 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -23,6 +23,7 @@ import org.junit.BeforeClass; import org.junit.Test; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.KettleClientEnvironment; import org.pentaho.di.core.Props; import org.pentaho.di.core.exception.KettleMissingPluginsException; @@ -56,7 +57,7 @@ public static void init() throws Exception { @Test public void withVariablesGetsNewObjectFromRegistry() throws KettleXMLException, KettleMissingPluginsException { String path = getClass().getResource( "/jms-consumer.ktr" ).getPath(); - TransMeta transMeta = new TransMeta( path, new Variables() ); + TransMeta transMeta = new TransMeta( DefaultBowl.getInstance(), path, new Variables() ); StepMeta step = transMeta.getStep( 0 ); JmsConsumerMeta jmsMeta = (JmsConsumerMeta) step.getStepMetaInterface(); assertEquals( "${testOne}", jmsMeta.jmsDelegate.amqUrl ); diff --git a/plugins/streaming/impls/jms/src/test/java/org/pentaho/di/trans/step/jms/JmsProducerTest.java b/plugins/streaming/impls/jms/src/test/java/org/pentaho/di/trans/step/jms/JmsProducerTest.java index 3e735d92bb59..81701f48e8ca 100644 --- a/plugins/streaming/impls/jms/src/test/java/org/pentaho/di/trans/step/jms/JmsProducerTest.java +++ b/plugins/streaming/impls/jms/src/test/java/org/pentaho/di/trans/step/jms/JmsProducerTest.java @@ -31,6 +31,7 @@ import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.junit.MockitoJUnitRunner; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.core.logging.KettleLogStore; import org.pentaho.di.core.logging.LogChannelInterface; @@ -246,7 +247,8 @@ public void testInit() { @Test public void jmsContextClosedOnStop() throws Exception { - TransMeta transMeta = new TransMeta( getClass().getResource( "/jms-generate-produce.ktr" ).getPath() ); + TransMeta transMeta = new TransMeta( DefaultBowl.getInstance(), + getClass().getResource( "/jms-generate-produce.ktr" ).getPath() ); Trans trans = new Trans( transMeta ); trans.prepareExecution( new String[] {} ); diff --git a/plugins/streaming/impls/jms/src/test/java/org/pentaho/di/trans/step/jms/context/ActiveMQProviderTest.java b/plugins/streaming/impls/jms/src/test/java/org/pentaho/di/trans/step/jms/context/ActiveMQProviderTest.java index cac96c5ac64b..c349dae0b39d 100644 --- a/plugins/streaming/impls/jms/src/test/java/org/pentaho/di/trans/step/jms/context/ActiveMQProviderTest.java +++ b/plugins/streaming/impls/jms/src/test/java/org/pentaho/di/trans/step/jms/context/ActiveMQProviderTest.java @@ -30,6 +30,7 @@ import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.junit.MockitoJUnitRunner; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.core.logging.KettleLogStore; import org.pentaho.di.core.logging.LogChannelInterface; @@ -106,12 +107,14 @@ public void setUp() { @Test public void testFullCircle() throws KettleException, InterruptedException, TimeoutException, ExecutionException { - TransMeta consumerMeta = new TransMeta( getClass().getResource( "/amq-consumer.ktr" ).getPath() ); + TransMeta consumerMeta = new TransMeta( DefaultBowl.getInstance(), + getClass().getResource( "/amq-consumer.ktr" ).getPath() ); Trans consumerTrans = new Trans( consumerMeta ); consumerTrans.prepareExecution( new String[] {} ); consumerTrans.startThreads(); - TransMeta producerMeta = new TransMeta( getClass().getResource( "/amq-producer.ktr" ).getPath() ); + TransMeta producerMeta = new TransMeta( DefaultBowl.getInstance(), + getClass().getResource( "/amq-producer.ktr" ).getPath() ); Trans producerTrans = new Trans( producerMeta ); producerTrans.prepareExecution( new String[] {} ); producerTrans.startThreads(); diff --git a/plugins/streaming/impls/mqtt/src/test/java/org/pentaho/di/trans/step/mqtt/MQTTConsumerMetaTest.java b/plugins/streaming/impls/mqtt/src/test/java/org/pentaho/di/trans/step/mqtt/MQTTConsumerMetaTest.java index e750983d18b3..8ec1fbfde234 100644 --- a/plugins/streaming/impls/mqtt/src/test/java/org/pentaho/di/trans/step/mqtt/MQTTConsumerMetaTest.java +++ b/plugins/streaming/impls/mqtt/src/test/java/org/pentaho/di/trans/step/mqtt/MQTTConsumerMetaTest.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2021 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -245,7 +245,8 @@ public void testRetrieveOptions() { @Test public void testCheckDefaults() { List remarks = new ArrayList<>(); - meta.check( remarks, null, null, null, null, null, null, new Variables(), null, null ); + TransMeta transMeta = mock( TransMeta.class ); + meta.check( remarks, transMeta, null, null, null, null, null, new Variables(), null, null ); assertEquals( 0, remarks.size() ); } @@ -259,7 +260,8 @@ public void testCheckFailAll() { meta.setCleanSession( "asdf" ); meta.setAutomaticReconnect( "adsf" ); meta.setMqttVersion( "9" ); - meta.check( remarks, null, null, null, null, null, null, new Variables(), null, null ); + TransMeta transMeta = mock( TransMeta.class ); + meta.check( remarks, transMeta, null, null, null, null, null, new Variables(), null, null ); assertEquals( 6, remarks.size() ); assertEquals( BaseMessages diff --git a/plugins/streaming/impls/mqtt/src/test/java/org/pentaho/di/trans/step/mqtt/MQTTConsumerTest.java b/plugins/streaming/impls/mqtt/src/test/java/org/pentaho/di/trans/step/mqtt/MQTTConsumerTest.java index 597f42023cf6..4449755c0c8b 100644 --- a/plugins/streaming/impls/mqtt/src/test/java/org/pentaho/di/trans/step/mqtt/MQTTConsumerTest.java +++ b/plugins/streaming/impls/mqtt/src/test/java/org/pentaho/di/trans/step/mqtt/MQTTConsumerTest.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2019-2022 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2019-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -27,6 +27,7 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.junit.MockitoJUnitRunner; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.Props; import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.core.plugins.PluginRegistry; @@ -58,7 +59,8 @@ public static void setupClass() throws Exception { @Before public void setup() throws Exception { - TransMeta transMeta = new TransMeta( getClass().getResource( "/ConsumeRows.ktr" ).getPath() ); + TransMeta transMeta = new TransMeta( DefaultBowl.getInstance(), + getClass().getResource( "/ConsumeRows.ktr" ).getPath() ); trans = new Trans( transMeta ); trans.setVariable( "mqttServer", "127.0.0.1:1883" ); trans.setVariable( "topic", "TestWinning" ); diff --git a/plugins/streaming/impls/mqtt/src/test/java/org/pentaho/di/trans/step/mqtt/MQTTProducerTest.java b/plugins/streaming/impls/mqtt/src/test/java/org/pentaho/di/trans/step/mqtt/MQTTProducerTest.java index 63442fc1c4e7..3abe0156de9a 100644 --- a/plugins/streaming/impls/mqtt/src/test/java/org/pentaho/di/trans/step/mqtt/MQTTProducerTest.java +++ b/plugins/streaming/impls/mqtt/src/test/java/org/pentaho/di/trans/step/mqtt/MQTTProducerTest.java @@ -35,6 +35,7 @@ import org.mockito.Mockito; import org.mockito.junit.MockitoJUnitRunner; import org.pentaho.di.core.annotations.Step; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.logging.KettleLogStore; import org.pentaho.di.core.logging.LogChannelInterface; import org.pentaho.di.core.logging.LogChannelInterfaceFactory; @@ -84,7 +85,8 @@ public void setup() throws Exception { when( logChannelFactory.create( any(), any() ) ).thenReturn( logChannel ); lenient().when( logChannelFactory.create( any() ) ).thenReturn( logChannel ); - TransMeta transMeta = new TransMeta( getClass().getResource( "/ProduceFourRows.ktr" ).getPath() ); + TransMeta transMeta = new TransMeta( DefaultBowl.getInstance(), + getClass().getResource( "/ProduceFourRows.ktr" ).getPath() ); trans = new Trans( transMeta ); trans.setVariable( "mqttServer", "127.0.0.1:1883" ); trans.setVariable( "clientId", "client1" ); @@ -117,7 +119,8 @@ public void testSendRowToProducer() throws Exception { @Test public void testSendBinaryToProducer() throws Exception { - TransMeta transMeta = new TransMeta( getClass().getResource( "/ProduceFourBinaryRows.ktr" ).getPath() ); + TransMeta transMeta = new TransMeta( DefaultBowl.getInstance(), + getClass().getResource( "/ProduceFourBinaryRows.ktr" ).getPath() ); Trans binaryTrans = new Trans( transMeta ); binaryTrans.prepareExecution( new String[] {} ); when( mqttClient.isConnected() ).thenReturn( true ); diff --git a/plugins/terafast-bulk-loader/impl/src/main/java/org/pentaho/di/trans/steps/terafastbulkloader/TeraFast.java b/plugins/terafast-bulk-loader/impl/src/main/java/org/pentaho/di/trans/steps/terafastbulkloader/TeraFast.java index 3bd4cb46e86e..15028f645678 100644 --- a/plugins/terafast-bulk-loader/impl/src/main/java/org/pentaho/di/trans/steps/terafastbulkloader/TeraFast.java +++ b/plugins/terafast-bulk-loader/impl/src/main/java/org/pentaho/di/trans/steps/terafastbulkloader/TeraFast.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2022 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -112,7 +112,8 @@ public String createCommandLine() throws KettleException { final StringBuilder builder = new StringBuilder(); try { final FileObject fileObject = - KettleVFS.getFileObject( environmentSubstitute( this.meta.getFastloadPath().getValue() ) ); + KettleVFS.getInstance( getTransMeta().getBowl() ) + .getFileObject( environmentSubstitute( this.meta.getFastloadPath().getValue() ) ); final String fastloadExec = KettleVFS.getFilename( fileObject ); builder.append( fastloadExec ); } catch ( Exception e ) { @@ -122,7 +123,8 @@ public String createCommandLine() throws KettleException { if ( StringUtils.isNotBlank( this.meta.getLogFile().getValue() ) ) { try { FileObject fileObject = - KettleVFS.getFileObject( environmentSubstitute( this.meta.getLogFile().getValue() ) ); + KettleVFS.getInstance( getTransMeta().getBowl() ) + .getFileObject( environmentSubstitute( this.meta.getLogFile().getValue() ) ); builder.append( " -e " ); builder.append( "\"" + KettleVFS.getFilename( fileObject ) + "\"" ); } catch ( Exception e ) { @@ -465,7 +467,8 @@ public void dispose( final StepMetaInterface smi, final StepDataInterface sdi ) * ... */ private String resolveFileName( final String fileName ) throws KettleException { - final FileObject fileObject = KettleVFS.getFileObject( environmentSubstitute( fileName ) ); + final FileObject fileObject = KettleVFS.getInstance( getTransMeta().getBowl() ) + .getFileObject( environmentSubstitute( fileName ) ); return KettleVFS.getFilename( fileObject ); } } diff --git a/plugins/terafast-bulk-loader/impl/src/main/java/org/pentaho/di/trans/steps/terafastbulkloader/TeraFastMeta.java b/plugins/terafast-bulk-loader/impl/src/main/java/org/pentaho/di/trans/steps/terafastbulkloader/TeraFastMeta.java index 99ee4e67abe1..207da44884ea 100644 --- a/plugins/terafast-bulk-loader/impl/src/main/java/org/pentaho/di/trans/steps/terafastbulkloader/TeraFastMeta.java +++ b/plugins/terafast-bulk-loader/impl/src/main/java/org/pentaho/di/trans/steps/terafastbulkloader/TeraFastMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2022 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -48,6 +48,7 @@ import org.pentaho.di.trans.step.StepMeta; import org.pentaho.metastore.api.IMetaStore; import org.pentaho.di.core.annotations.Step; +import org.pentaho.di.core.bowl.Bowl; /** * @author Michael Gugerell(asc145) @@ -293,8 +294,9 @@ public void setDefault() { * org.pentaho.di.core.variables.VariableSpace) */ @Override - public void getFields( final RowMetaInterface inputRowMeta, final String name, final RowMetaInterface[] info, - final StepMeta nextStep, final VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { + public void getFields( Bowl bowl, final RowMetaInterface inputRowMeta, final String name, + final RowMetaInterface[] info, final StepMeta nextStep, final VariableSpace space, Repository repository, + IMetaStore metaStore ) throws KettleStepException { // Default: nothing changes to rowMeta } diff --git a/plugins/xml-input-stream/core/src/main/java/org/pentaho/di/trans/steps/xmlinputsax/XMLInputSax.java b/plugins/xml-input-stream/core/src/main/java/org/pentaho/di/trans/steps/xmlinputsax/XMLInputSax.java index c53675d7c92b..3cc4bc049dd1 100644 --- a/plugins/xml-input-stream/core/src/main/java/org/pentaho/di/trans/steps/xmlinputsax/XMLInputSax.java +++ b/plugins/xml-input-stream/core/src/main/java/org/pentaho/di/trans/steps/xmlinputsax/XMLInputSax.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -56,7 +56,8 @@ public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws first = false; data.outputRowMeta = new RowMeta(); - meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); + meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository, + metaStore ); // For String to conversions, we allocate a conversion meta data row as well... // @@ -162,7 +163,7 @@ public boolean init( StepMetaInterface smi, StepDataInterface sdi ) { data = (XMLInputSaxData) sdi; if ( super.init( smi, sdi ) ) { - data.files = meta.getFilePaths( getTransMeta() ); + data.files = meta.getFilePaths( getTransMeta().getBowl(), getTransMeta() ); if ( data.files == null || data.files.length == 0 ) { logError( "No file(s) specified! Stop processing." ); return false; diff --git a/plugins/xml-input-stream/core/src/main/java/org/pentaho/di/trans/steps/xmlinputsax/XMLInputSaxMeta.java b/plugins/xml-input-stream/core/src/main/java/org/pentaho/di/trans/steps/xmlinputsax/XMLInputSaxMeta.java index f28baff44d52..2b858926342a 100644 --- a/plugins/xml-input-stream/core/src/main/java/org/pentaho/di/trans/steps/xmlinputsax/XMLInputSaxMeta.java +++ b/plugins/xml-input-stream/core/src/main/java/org/pentaho/di/trans/steps/xmlinputsax/XMLInputSaxMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -32,6 +32,7 @@ import org.pentaho.di.core.Const; import org.pentaho.di.core.util.Utils; import org.pentaho.di.core.annotations.Step; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.database.DatabaseMeta; import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.core.exception.KettleStepException; @@ -396,7 +397,8 @@ public void setDefault() { rowLimit = 0L; } - public void getFields( RowMetaInterface row, String name, RowMetaInterface[] info, StepMeta nextStep, + @Override + public void getFields( Bowl bowl, RowMetaInterface row, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { for ( int i = 0; i < inputFields.length; i++ ) { XMLInputSaxField field = inputFields[i]; @@ -540,20 +542,20 @@ public void saveRep( Repository rep, IMetaStore metaStore, ObjectId id_transform } } - public String[] getFilePaths( VariableSpace space ) { + public String[] getFilePaths( Bowl bowl, VariableSpace space ) { String[] fileRequired = new String[fileName.length]; for ( int i = 0; i < fileRequired.length; i++ ) { fileRequired[i] = "N"; } - return FileInputList.createFilePathList( space, fileName, fileMask, new String[] { null }, fileRequired ); + return FileInputList.createFilePathList( bowl, space, fileName, fileMask, new String[] { null }, fileRequired ); } - public FileInputList getTextFileList( VariableSpace space ) { + public FileInputList getTextFileList( Bowl bowl, VariableSpace space ) { String[] fileRequired = new String[fileName.length]; for ( int i = 0; i < fileRequired.length; i++ ) { fileRequired[i] = "N"; } - return FileInputList.createFileList( space, fileName, fileMask, new String[] { null }, fileRequired ); + return FileInputList.createFileList( bowl, space, fileName, fileMask, new String[] { null }, fileRequired ); } public void check( List remarks, TransMeta transMeta, StepMeta stepMeta, @@ -574,7 +576,7 @@ public void check( List remarks, TransMeta transMeta, Step remarks.add( cr ); } - String[] files = getFilePaths( transMeta ); + String[] files = getFilePaths( transMeta.getBowl(), transMeta ); if ( files == null || files.length == 0 ) { cr = new CheckResult( CheckResultInterface.TYPE_RESULT_ERROR, "No files can be found to read.", stepMeta ); remarks.add( cr ); @@ -708,7 +710,7 @@ public List getResourceDependencies( TransMeta transMeta, Ste ResourceReference reference = new ResourceReference( stepInfo ); references.add( reference ); - String[] textFiles = getFilePaths( transMeta ); + String[] textFiles = getFilePaths( transMeta.getBowl(), transMeta ); if ( textFiles != null ) { for ( int i = 0; i < textFiles.length; i++ ) { reference.getEntries().add( new ResourceEntry( textFiles[i], ResourceType.FILE ) ); @@ -734,14 +736,16 @@ public List getResourceDependencies( TransMeta transMeta, Ste * * @return the filename of the exported resource */ - public String exportResources( VariableSpace space, Map definitions, + @Override + public String exportResources( Bowl bowl, VariableSpace space, Map definitions, ResourceNamingInterface resourceNamingInterface, Repository repository, IMetaStore metaStore ) throws KettleException { try { // The object that we're modifying here is a copy of the original! // So let's change the filename from relative to absolute by grabbing the file object... // for ( int i = 0; i < fileName.length; i++ ) { - FileObject fileObject = KettleVFS.getFileObject( space.environmentSubstitute( fileName[i] ), space ); + FileObject fileObject = KettleVFS.getInstance( bowl ) + .getFileObject( space.environmentSubstitute( fileName[i] ), space ); fileName[i] = resourceNamingInterface.nameResource( fileObject, space, Utils.isEmpty( fileMask[i] ) ); } return null; diff --git a/plugins/xml-input-stream/core/src/main/java/org/pentaho/di/ui/trans/steps/xmlinputsax/XMLInputSaxDialog.java b/plugins/xml-input-stream/core/src/main/java/org/pentaho/di/ui/trans/steps/xmlinputsax/XMLInputSaxDialog.java index 83b3fe21cd08..35c7d1cbdf74 100644 --- a/plugins/xml-input-stream/core/src/main/java/org/pentaho/di/ui/trans/steps/xmlinputsax/XMLInputSaxDialog.java +++ b/plugins/xml-input-stream/core/src/main/java/org/pentaho/di/ui/trans/steps/xmlinputsax/XMLInputSaxDialog.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -716,7 +716,7 @@ public void widgetSelected( SelectionEvent e ) { try { XMLInputSaxMeta tfii = new XMLInputSaxMeta(); getInfo( tfii ); - String[] files = tfii.getFilePaths( transMeta ); + String[] files = tfii.getFilePaths( transMeta.getBowl(), transMeta ); if ( files != null && files.length > 0 ) { EnterSelectionDialog esd = new EnterSelectionDialog( shell, files, BaseMessages.getString( PKG, "XMLInputSaxDialog.Dialog.FilesRead.Title" ), @@ -1034,7 +1034,7 @@ private void get() { // Keep the list of positions - String[] filePaths = meta.getFilePaths( transMeta ); + String[] filePaths = meta.getFilePaths( transMeta.getBowl(), transMeta ); if ( meta.getInputPosition().length == 0 ) { // error diff --git a/plugins/xml-input/core/src/main/java/org/pentaho/di/trans/steps/xmlinput/XMLInput.java b/plugins/xml-input/core/src/main/java/org/pentaho/di/trans/steps/xmlinput/XMLInput.java index afe2189be150..8f27a0d94d47 100644 --- a/plugins/xml-input/core/src/main/java/org/pentaho/di/trans/steps/xmlinput/XMLInput.java +++ b/plugins/xml-input/core/src/main/java/org/pentaho/di/trans/steps/xmlinput/XMLInput.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -68,7 +68,8 @@ public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws first = false; data.outputRowMeta = new RowMeta(); - meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); + meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository, + metaStore ); // For String to conversions, we allocate a conversion meta data row as well... // @@ -316,7 +317,7 @@ public boolean init( StepMetaInterface smi, StepDataInterface sdi ) { data = (XMLInputData) sdi; if ( super.init( smi, sdi ) ) { - data.files = meta.getFiles( this ).getFiles(); + data.files = meta.getFiles( getTransMeta().getBowl(), this ).getFiles(); if ( data.files == null || data.files.size() == 0 ) { logError( BaseMessages.getString( PKG, "XMLInput.Log.NoFiles" ) ); return false; diff --git a/plugins/xml-input/core/src/main/java/org/pentaho/di/trans/steps/xmlinput/XMLInputMeta.java b/plugins/xml-input/core/src/main/java/org/pentaho/di/trans/steps/xmlinput/XMLInputMeta.java index 53346638b409..41952da14f02 100644 --- a/plugins/xml-input/core/src/main/java/org/pentaho/di/trans/steps/xmlinput/XMLInputMeta.java +++ b/plugins/xml-input/core/src/main/java/org/pentaho/di/trans/steps/xmlinput/XMLInputMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -32,6 +32,7 @@ import org.pentaho.di.core.Const; import org.pentaho.di.core.util.Utils; import org.pentaho.di.core.annotations.Step; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.database.DatabaseMeta; import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.core.exception.KettleStepException; @@ -399,7 +400,8 @@ public void setDefault() { nrRowsToSkip = 0; } - public void getFields( RowMetaInterface r, String name, RowMetaInterface[] info, StepMeta nextStep, + @Override + public void getFields( Bowl bowl, RowMetaInterface r, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { for ( int i = 0; i < inputFields.length; i++ ) { XMLInputField field = inputFields[i]; @@ -537,13 +539,13 @@ public void saveRep( Repository rep, IMetaStore metaStore, ObjectId id_transform } } - public FileInputList getFiles( VariableSpace space ) { + public FileInputList getFiles( Bowl bowl, VariableSpace space ) { String[] required = new String[fileName.length]; boolean[] subdirs = new boolean[fileName.length]; // boolean arrays are defaulted to false. for ( int i = 0; i < required.length; i++ ) { required[i] = "Y"; } - return FileInputList.createFileList( space, fileName, fileMask, required, subdirs ); + return FileInputList.createFileList( bowl, space, fileName, fileMask, required, subdirs ); /* * // Replace possible environment variables... final String realfile[] = @@ -593,7 +595,7 @@ public void check( List remarks, TransMeta transMeta, Step remarks.add( cr ); } - FileInputList fileInputList = getFiles( transMeta ); + FileInputList fileInputList = getFiles( transMeta.getBowl(), transMeta ); // String files[] = getFiles(); if ( fileInputList == null || fileInputList.getFiles().size() == 0 ) { cr = @@ -639,7 +641,7 @@ public List getResourceDependencies( TransMeta transMeta, Ste required[i] = "N"; } String[] textFiles = - FileInputList.createFilePathList( transMeta, fileName, fileMask, new String[] { null }, required, subdirs ); + FileInputList.createFilePathList( transMeta.getBowl(), transMeta, fileName, fileMask, new String[] { null }, required, subdirs ); if ( textFiles != null ) { for ( int i = 0; i < textFiles.length; i++ ) { @@ -719,7 +721,8 @@ public void setNamespaceAware( boolean namespaceAware ) { * * @return the filename of the exported resource */ - public String exportResources( VariableSpace space, Map definitions, + @Override + public String exportResources( Bowl bowl, VariableSpace space, Map definitions, ResourceNamingInterface resourceNamingInterface, Repository repository, IMetaStore metaStore ) throws KettleException { try { // The object that we're modifying here is a copy of the original! @@ -728,7 +731,8 @@ public String exportResources( VariableSpace space, Map 0 ) { EnterSelectionDialog esd = new EnterSelectionDialog( shell, files, @@ -1137,7 +1137,7 @@ private void get() { // Keep the list of positions List path = new ArrayList(); // ArrayList of XMLInputFieldPosition - FileInputList inputList = meta.getFiles( transMeta ); + FileInputList inputList = meta.getFiles( transMeta.getBowl(), transMeta ); for ( int f = 0; f < inputList.getFiles().size() && !finished; f++ ) { // Open the file... diff --git a/plugins/xml/core/src/main/java/org/pentaho/di/job/entries/dtdvalidator/DTDValidator.java b/plugins/xml/core/src/main/java/org/pentaho/di/job/entries/dtdvalidator/DTDValidator.java index 12e8d21750ab..35f60a81f1dd 100644 --- a/plugins/xml/core/src/main/java/org/pentaho/di/job/entries/dtdvalidator/DTDValidator.java +++ b/plugins/xml/core/src/main/java/org/pentaho/di/job/entries/dtdvalidator/DTDValidator.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -23,6 +23,7 @@ package org.pentaho.di.job.entries.dtdvalidator; import org.apache.commons.vfs2.FileObject; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.Const; import org.pentaho.di.core.logging.LogChannelInterface; import org.pentaho.di.core.vfs.KettleVFS; @@ -51,9 +52,11 @@ public class DTDValidator { private String errormessage; private int errorscount; + private Bowl bowl; private LogChannelInterface log; - public DTDValidator( LogChannelInterface log ) { + public DTDValidator( Bowl bowl, LogChannelInterface log ) { + this.bowl = bowl; this.log = log; this.xmlfilename = null; this.xsdfilename = null; @@ -112,7 +115,7 @@ public boolean validate() { try { if ( xmlfilename != null && ( ( getDTDFilename() != null && !isInternDTD() ) || ( isInternDTD() ) ) ) { - xmlFileObject = KettleVFS.getFileObject( getXMLFilename() ); + xmlFileObject = KettleVFS.getInstance( bowl ).getFileObject( getXMLFilename() ); if ( xmlFileObject.exists() ) { @@ -163,7 +166,7 @@ public boolean validate() { } else { // DTD in external document // If we find an intern declaration, we remove it - dtdFileObject = KettleVFS.getFileObject( getDTDFilename() ); + dtdFileObject = KettleVFS.getInstance( bowl ).getFileObject( getDTDFilename() ); if ( dtdFileObject.exists() ) { if ( xmlStartDTD != -1 ) { diff --git a/plugins/xml/core/src/main/java/org/pentaho/di/job/entries/dtdvalidator/JobEntryDTDValidator.java b/plugins/xml/core/src/main/java/org/pentaho/di/job/entries/dtdvalidator/JobEntryDTDValidator.java index bf981fe72b45..3efee728d0a0 100644 --- a/plugins/xml/core/src/main/java/org/pentaho/di/job/entries/dtdvalidator/JobEntryDTDValidator.java +++ b/plugins/xml/core/src/main/java/org/pentaho/di/job/entries/dtdvalidator/JobEntryDTDValidator.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -150,7 +150,7 @@ public Result execute( Result previousResult, int nr ) { String realDTDfilename = getRealDTDfilename(); // Define a new DTD validator instance - DTDValidator validator = new DTDValidator( log ); + DTDValidator validator = new DTDValidator( parentJobMeta.getBowl(), log ); // Set XML filename validator.setXMLFilename( realxmlfilename ); if ( dtdintern ) { @@ -221,7 +221,7 @@ public void check( List remarks, JobMeta jobMeta, Variable ValidatorContext ctx = new ValidatorContext(); putVariableSpace( ctx, getVariables() ); putValidators( ctx, notBlankValidator(), fileExistsValidator() ); - andValidator().validate( this, "dtdfilename", remarks, ctx ); - andValidator().validate( this, "xmlFilename", remarks, ctx ); + andValidator().validate( jobMeta.getBowl(), this, "dtdfilename", remarks, ctx ); + andValidator().validate( jobMeta.getBowl(), this, "xmlFilename", remarks, ctx ); } } diff --git a/plugins/xml/core/src/main/java/org/pentaho/di/job/entries/xmlwellformed/JobEntryXMLWellFormed.java b/plugins/xml/core/src/main/java/org/pentaho/di/job/entries/xmlwellformed/JobEntryXMLWellFormed.java index 654af4441211..210d82947fd6 100644 --- a/plugins/xml/core/src/main/java/org/pentaho/di/job/entries/xmlwellformed/JobEntryXMLWellFormed.java +++ b/plugins/xml/core/src/main/java/org/pentaho/di/job/entries/xmlwellformed/JobEntryXMLWellFormed.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -399,7 +399,8 @@ private boolean processFileFolder( String sourcefilefoldername, String wildcard, String realWildcard = environmentSubstitute( wildcard ); try { - sourcefilefolder = KettleVFS.getFileObject( realSourceFilefoldername, this ); + sourcefilefolder = KettleVFS.getInstance( parentJobMeta.getBowl() ) + .getFileObject( realSourceFilefoldername, this ); if ( sourcefilefolder.exists() ) { if ( log.isDetailed() ) { @@ -548,8 +549,8 @@ private void updateBadFormed() { private void addFileToResultFilenames( String fileaddentry, Result result, Job parentJob ) { try { ResultFile resultFile = - new ResultFile( ResultFile.FILE_TYPE_GENERAL, KettleVFS.getFileObject( fileaddentry, this ), parentJob - .getJobname(), toString() ); + new ResultFile( ResultFile.FILE_TYPE_GENERAL, KettleVFS.getInstance( parentJobMeta.getBowl() ) + .getFileObject( fileaddentry, this ), parentJob.getJobname(), toString() ); result.getResultFiles().put( resultFile.getFile().toString(), resultFile ); if ( log.isDetailed() ) { @@ -647,7 +648,8 @@ public boolean evaluates() { public void check( List remarks, JobMeta jobMeta, VariableSpace space, Repository repository, IMetaStore metaStore ) { - boolean res = andValidator().validate( this, "arguments", remarks, putValidators( notNullValidator() ) ); + boolean res = andValidator().validate( jobMeta.getBowl(), this, "arguments", remarks, + putValidators( notNullValidator() ) ); if ( res == false ) { return; @@ -658,7 +660,7 @@ public void check( List remarks, JobMeta jobMeta, Variable putValidators( ctx, notNullValidator(), fileExistsValidator() ); for ( int i = 0; i < source_filefolder.length; i++ ) { - andValidator().validate( this, "arguments[" + i + "]", remarks, ctx ); + andValidator().validate( jobMeta.getBowl(), this, "arguments[" + i + "]", remarks, ctx ); } } diff --git a/plugins/xml/core/src/main/java/org/pentaho/di/job/entries/xsdvalidator/JobEntryXSDValidator.java b/plugins/xml/core/src/main/java/org/pentaho/di/job/entries/xsdvalidator/JobEntryXSDValidator.java index af553db2c39b..13a8b520ba21 100644 --- a/plugins/xml/core/src/main/java/org/pentaho/di/job/entries/xsdvalidator/JobEntryXSDValidator.java +++ b/plugins/xml/core/src/main/java/org/pentaho/di/job/entries/xsdvalidator/JobEntryXSDValidator.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2019 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -174,8 +174,8 @@ public Result execute( Result previousResult, int nr ) { try { if ( xmlfilename != null && xsdfilename != null ) { - xmlfile = KettleVFS.getFileObject( realxmlfilename, this ); - xsdfile = KettleVFS.getFileObject( realxsdfilename, this ); + xmlfile = KettleVFS.getInstance( parentJobMeta.getBowl() ).getFileObject( realxmlfilename, this ); + xsdfile = KettleVFS.getInstance( parentJobMeta.getBowl() ).getFileObject( realxsdfilename, this ); if ( xmlfile.exists() && xsdfile.exists() ) { @@ -306,8 +306,8 @@ public void check( List remarks, JobMeta jobMeta, Variable ValidatorContext ctx = new ValidatorContext(); putVariableSpace( ctx, getVariables() ); putValidators( ctx, notBlankValidator(), fileExistsValidator() ); - andValidator().validate( this, "xsdFilename", remarks, ctx ); - andValidator().validate( this, "xmlFilename", remarks, ctx ); + andValidator().validate( jobMeta.getBowl(), this, "xsdFilename", remarks, ctx ); + andValidator().validate( jobMeta.getBowl(), this, "xmlFilename", remarks, ctx ); } } diff --git a/plugins/xml/core/src/main/java/org/pentaho/di/job/entries/xslt/JobEntryXSLT.java b/plugins/xml/core/src/main/java/org/pentaho/di/job/entries/xslt/JobEntryXSLT.java index 8f99d4b31a38..fd2aad1e19ed 100644 --- a/plugins/xml/core/src/main/java/org/pentaho/di/job/entries/xslt/JobEntryXSLT.java +++ b/plugins/xml/core/src/main/java/org/pentaho/di/job/entries/xslt/JobEntryXSLT.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -57,6 +57,7 @@ import org.pentaho.di.core.exception.KettleXMLException; import org.pentaho.di.core.util.StringUtil; import org.pentaho.di.core.variables.VariableSpace; +import org.pentaho.di.core.vfs.IKettleVFS; import org.pentaho.di.core.vfs.KettleVFS; import org.pentaho.di.core.xml.XMLHandler; import org.pentaho.di.i18n.BaseMessages; @@ -424,9 +425,10 @@ private boolean processOneXMLFile( String xmlfilename, String xslfilename, Strin FileObject outputfile = null; try { - xmlfile = KettleVFS.getFileObject( xmlfilename, this ); - xslfile = KettleVFS.getFileObject( xslfilename, this ); - outputfile = KettleVFS.getFileObject( outputfilename, this ); + IKettleVFS vfs = KettleVFS.getInstance( parentJobMeta.getBowl() ); + xmlfile = vfs.getFileObject( xmlfilename, this ); + xslfile = vfs.getFileObject( xslfilename, this ); + outputfile = vfs.getFileObject( outputfilename, this ); if ( xmlfile.exists() && xslfile.exists() ) { if ( outputfile.exists() && iffileexists == 2 ) { @@ -511,7 +513,7 @@ private boolean processOneXMLFile( String xmlfilename, String xslfilename, Strin // Prepare the input and output files Source source = new StreamSource( xmlInputStream ); - os = KettleVFS.getOutputStream( outputfile, false ); + os = vfs.getOutputStream( outputfile, false ); StreamResult resultat = new StreamResult( os ); // Apply the xsl file to the source file and write the result to the output file @@ -520,7 +522,7 @@ private boolean processOneXMLFile( String xmlfilename, String xslfilename, Strin if ( isAddFileToResult() ) { // Add output filename to output files ResultFile resultFile = - new ResultFile( ResultFile.FILE_TYPE_GENERAL, KettleVFS.getFileObject( outputfilename, this ), + new ResultFile( ResultFile.FILE_TYPE_GENERAL, vfs.getFileObject( outputfilename, this ), parentJob.getJobname(), toString() ); result.getResultFiles().put( resultFile.getFile().toString(), resultFile ); } @@ -639,10 +641,10 @@ public void check( List remarks, JobMeta jobMeta, Variable ValidatorContext ctx = new ValidatorContext(); putVariableSpace( ctx, getVariables() ); putValidators( ctx, notBlankValidator(), fileExistsValidator() ); - andValidator().validate( this, "xmlFilename", remarks, ctx ); - andValidator().validate( this, "xslFilename", remarks, ctx ); + andValidator().validate( jobMeta.getBowl(), this, "xmlFilename", remarks, ctx ); + andValidator().validate( jobMeta.getBowl(), this, "xslFilename", remarks, ctx ); - andValidator().validate( this, "outputFilename", remarks, putValidators( notBlankValidator() ) ); + andValidator().validate( jobMeta.getBowl(), this, "outputFilename", remarks, putValidators( notBlankValidator() ) ); } /** diff --git a/plugins/xml/core/src/main/java/org/pentaho/di/trans/steps/addxml/AddXML.java b/plugins/xml/core/src/main/java/org/pentaho/di/trans/steps/addxml/AddXML.java index 10f789be516c..ccf55b2f1827 100644 --- a/plugins/xml/core/src/main/java/org/pentaho/di/trans/steps/addxml/AddXML.java +++ b/plugins/xml/core/src/main/java/org/pentaho/di/trans/steps/addxml/AddXML.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -89,7 +89,8 @@ public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws first = false; data.outputRowMeta = getInputRowMeta().clone(); - meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); + meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository, + metaStore ); // Cache the field name indexes // diff --git a/plugins/xml/core/src/main/java/org/pentaho/di/trans/steps/addxml/AddXMLMeta.java b/plugins/xml/core/src/main/java/org/pentaho/di/trans/steps/addxml/AddXMLMeta.java index ec9b5d6c2698..a9745ee20a08 100644 --- a/plugins/xml/core/src/main/java/org/pentaho/di/trans/steps/addxml/AddXMLMeta.java +++ b/plugins/xml/core/src/main/java/org/pentaho/di/trans/steps/addxml/AddXMLMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -28,6 +28,7 @@ import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.Const; import org.pentaho.di.core.annotations.Step; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.database.DatabaseMeta; import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.core.exception.KettleStepException; @@ -228,7 +229,8 @@ public void setDefault() { } } - public void getFields( RowMetaInterface row, String name, RowMetaInterface[] info, StepMeta nextStep, + @Override + public void getFields( Bowl bowl, RowMetaInterface row, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { ValueMetaInterface v = new ValueMeta( this.getValueName(), ValueMetaInterface.TYPE_STRING ); diff --git a/plugins/xml/core/src/main/java/org/pentaho/di/trans/steps/getxmldata/GetXMLData.java b/plugins/xml/core/src/main/java/org/pentaho/di/trans/steps/getxmldata/GetXMLData.java index f04dc4800381..92e073918e9e 100644 --- a/plugins/xml/core/src/main/java/org/pentaho/di/trans/steps/getxmldata/GetXMLData.java +++ b/plugins/xml/core/src/main/java/org/pentaho/di/trans/steps/getxmldata/GetXMLData.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2020 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -165,7 +165,7 @@ public void onEnd( ElementPath path ) { // read string to parse data.document = reader.read( new StringReader( StringXML ) ); } else if ( readurl && KettleVFS.startsWithScheme( StringXML ) ) { - data.document = reader.read( KettleVFS.getInputStream( StringXML ) ); + data.document = reader.read( KettleVFS.getInstance( getTransMeta().getBowl() ).getInputStream( StringXML ) ); } else if ( readurl ) { // read url as source HttpClient client = HttpClientManager.getInstance().createDefaultClient(); @@ -353,7 +353,8 @@ private boolean ReadNextString() { data.nrReadRow = getInputRowMeta().size(); data.inputRowMeta = getInputRowMeta(); data.outputRowMeta = data.inputRowMeta.clone(); - meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); + meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository, + metaStore ); // Get total previous fields data.totalpreviousfields = data.inputRowMeta.size(); @@ -399,7 +400,8 @@ private boolean ReadNextString() { FileObject file = null; try { // XML source is a file. - file = KettleVFS.getFileObject( environmentSubstitute( Fieldvalue ), getTransMeta() ); + file = KettleVFS.getInstance( getTransMeta().getBowl() ) + .getFileObject( environmentSubstitute( Fieldvalue ), getTransMeta() ); if ( meta.isIgnoreEmptyFile() && file.getContent().getSize() == 0 ) { logBasic( BaseMessages.getString( PKG, "GetXMLData.Error.FileSizeZero", "" + file.getName() ) ); @@ -637,7 +639,7 @@ public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws if ( first && !meta.isInFields() ) { first = false; - data.files = meta.getFiles( this ); + data.files = meta.getFiles( getTransMeta().getBowl(), this ); if ( !meta.isdoNotFailIfNoFile() && data.files.nrOfFiles() == 0 ) { throw new KettleException( BaseMessages.getString( PKG, "GetXMLData.Log.NoFiles" ) ); @@ -648,7 +650,8 @@ public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws // Create the output row meta-data data.outputRowMeta = new RowMeta(); - meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); + meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository, + metaStore ); // Create convert meta-data objects that will contain Date & Number formatters // For String to conversions, we allocate a conversion meta data row as well... diff --git a/plugins/xml/core/src/main/java/org/pentaho/di/trans/steps/getxmldata/GetXMLDataExternalResourceConsumer.java b/plugins/xml/core/src/main/java/org/pentaho/di/trans/steps/getxmldata/GetXMLDataExternalResourceConsumer.java index 31f5b764ecdb..5ceac76f9ebf 100644 --- a/plugins/xml/core/src/main/java/org/pentaho/di/trans/steps/getxmldata/GetXMLDataExternalResourceConsumer.java +++ b/plugins/xml/core/src/main/java/org/pentaho/di/trans/steps/getxmldata/GetXMLDataExternalResourceConsumer.java @@ -1,7 +1,7 @@ /* * ****************************************************************************** * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * * ****************************************************************************** * @@ -21,6 +21,7 @@ package org.pentaho.di.trans.steps.getxmldata; import org.apache.commons.vfs2.FileObject; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.util.Utils; import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.core.exception.KettleFileException; @@ -48,7 +49,7 @@ public boolean isDataDriven( GetXMLDataMeta meta ) { } @Override - public Collection getResourcesFromMeta( GetXMLDataMeta meta, IAnalysisContext context ) { + public Collection getResourcesFromMeta( Bowl bowl, GetXMLDataMeta meta, IAnalysisContext context ) { Collection resources = Collections.emptyList(); // We only need to collect these resources if we're not data-driven and there are no used variables in the @@ -67,7 +68,7 @@ public Collection getResourcesFromMeta( GetXMLDataMeta me try { IExternalResourceInfo resource = ExternalResourceInfoFactory - .createFileResource( KettleVFS.getFileObject( path ), true ); + .createFileResource( KettleVFS.getInstance( bowl ).getFileObject( path ), true ); if ( resource != null ) { resources.add( resource ); } else { @@ -99,7 +100,8 @@ public Collection getResourcesFromRow( if ( meta.getIsAFile() ) { String filename = ( meta == null ) ? null : rowMeta.getString( row, meta.getXMLField(), null ); if ( !Utils.isEmpty( filename ) ) { - FileObject fileObject = KettleVFS.getFileObject( filename ); + FileObject fileObject = KettleVFS.getInstance( textFileInput.getTransMeta().getBowl() ) + .getFileObject( filename ); resources.add( ExternalResourceInfoFactory.createFileResource( fileObject, true ) ); } } diff --git a/plugins/xml/core/src/main/java/org/pentaho/di/trans/steps/getxmldata/GetXMLDataMeta.java b/plugins/xml/core/src/main/java/org/pentaho/di/trans/steps/getxmldata/GetXMLDataMeta.java index 8e453b94364b..4fc3eaaba9be 100644 --- a/plugins/xml/core/src/main/java/org/pentaho/di/trans/steps/getxmldata/GetXMLDataMeta.java +++ b/plugins/xml/core/src/main/java/org/pentaho/di/trans/steps/getxmldata/GetXMLDataMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2020 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -28,6 +28,7 @@ import org.apache.commons.vfs2.FileObject; import org.pentaho.di.core.annotations.Step; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.CheckResult; import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.Const; @@ -928,7 +929,8 @@ public void setDefault() { prunePath = ""; } - public void getFields( RowMetaInterface r, String name, RowMetaInterface[] info, StepMeta nextStep, + @Override + public void getFields( Bowl bowl, RowMetaInterface r, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { int i; for ( i = 0; i < inputFields.length; i++ ) { @@ -1163,8 +1165,8 @@ public void saveRep( Repository rep, IMetaStore metaStore, ObjectId id_transform } } - public FileInputList getFiles( VariableSpace space ) { - return FileInputList.createFileList( space, fileName, fileMask, excludeFileMask, fileRequired, + public FileInputList getFiles( Bowl bowl, VariableSpace space ) { + return FileInputList.createFileList( bowl, space, fileName, fileMask, excludeFileMask, fileRequired, includeSubFolderBoolean() ); } @@ -1222,7 +1224,7 @@ public void check( List remarks, TransMeta transMeta, Step remarks.add( cr ); } } else { - FileInputList fileInputList = getFiles( transMeta ); + FileInputList fileInputList = getFiles( transMeta.getBowl(), transMeta ); // String files[] = getFiles(); if ( fileInputList == null || fileInputList.getFiles().size() == 0 ) { cr = @@ -1268,7 +1270,8 @@ public boolean supportsErrorHandling() { * * @return the filename of the exported resource */ - public String exportResources( VariableSpace space, Map definitions, + @Override + public String exportResources( Bowl bowl, VariableSpace space, Map definitions, ResourceNamingInterface resourceNamingInterface, Repository repository, IMetaStore metaStore ) throws KettleException { try { @@ -1279,7 +1282,7 @@ public String exportResources( VariableSpace space, Map newFilenames = new ArrayList(); if ( !isInFields() ) { - FileInputList fileList = getFiles( space ); + FileInputList fileList = getFiles( bowl, space ); if ( fileList.getFiles().size() > 0 ) { for ( FileObject fileObject : fileList.getFiles() ) { // From : ${Internal.Transformation.Filename.Directory}/../foo/bar.xml diff --git a/plugins/xml/core/src/main/java/org/pentaho/di/trans/steps/getxmldata/GetXMLDataStepAnalyzer.java b/plugins/xml/core/src/main/java/org/pentaho/di/trans/steps/getxmldata/GetXMLDataStepAnalyzer.java index 743514a008ac..7a5bd651bdbd 100644 --- a/plugins/xml/core/src/main/java/org/pentaho/di/trans/steps/getxmldata/GetXMLDataStepAnalyzer.java +++ b/plugins/xml/core/src/main/java/org/pentaho/di/trans/steps/getxmldata/GetXMLDataStepAnalyzer.java @@ -1,7 +1,7 @@ /* * ****************************************************************************** * - * Copyright (C) 2002-2018 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * * ****************************************************************************** * @@ -158,7 +158,7 @@ protected void customAnalyze( GetXMLDataMeta meta, IMetaverseNode node ) throws @Override public IMetaverseNode createResourceNode( IExternalResourceInfo resource ) throws MetaverseException { - return createFileNode( resource.getName(), descriptor ); + return createFileNode( parentTransMeta.getBowl(), resource.getName(), descriptor ); } @Override diff --git a/plugins/xml/core/src/main/java/org/pentaho/di/trans/steps/xmlinputstream/XMLInputStream.java b/plugins/xml/core/src/main/java/org/pentaho/di/trans/steps/xmlinputstream/XMLInputStream.java index d4cc3e0e1449..413365ed164f 100644 --- a/plugins/xml/core/src/main/java/org/pentaho/di/trans/steps/xmlinputstream/XMLInputStream.java +++ b/plugins/xml/core/src/main/java/org/pentaho/di/trans/steps/xmlinputstream/XMLInputStream.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2019 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -171,7 +171,8 @@ private void prepareProcessPreviousFields() { } else { data.previousFieldsNumber = getInputRowMeta().size(); data.finalOutputRowMeta = getInputRowMeta().clone(); - meta.getFields( data.finalOutputRowMeta, getStepname(), null, null, this, repository, metaStore ); + meta.getFields( getTransMeta().getBowl(), data.finalOutputRowMeta, getStepname(), null, null, this, repository, + metaStore ); } } @@ -181,7 +182,8 @@ private boolean openNextFile() throws KettleException { if ( data.filenr >= data.filenames.length ) { return false; } - data.fileObject = KettleVFS.getFileObject( data.filenames[data.filenr], getTransMeta() ); + data.fileObject = KettleVFS.getInstance( getTransMeta().getBowl() ) + .getFileObject( data.filenames[data.filenr], getTransMeta() ); data.inputStream = KettleVFS.getInputStream( data.fileObject ); data.xmlEventReader = data.staxInstance.createXMLEventReader( data.inputStream, data.encoding ); } catch ( IOException e ) { @@ -632,7 +634,8 @@ public boolean init( StepMetaInterface smi, StepDataInterface sdi ) { data.encoding = this.environmentSubstitute( meta.getEncoding() ); data.outputRowMeta = new RowMeta(); - meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); + meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository, + metaStore ); // get and save field positions data.pos_xml_filename = data.outputRowMeta.indexOfValue( meta.getFilenameField() ); diff --git a/plugins/xml/core/src/main/java/org/pentaho/di/trans/steps/xmlinputstream/XMLInputStreamMeta.java b/plugins/xml/core/src/main/java/org/pentaho/di/trans/steps/xmlinputstream/XMLInputStreamMeta.java index cec64d8d8231..845d6c670bc1 100644 --- a/plugins/xml/core/src/main/java/org/pentaho/di/trans/steps/xmlinputstream/XMLInputStreamMeta.java +++ b/plugins/xml/core/src/main/java/org/pentaho/di/trans/steps/xmlinputstream/XMLInputStreamMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2019 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -28,6 +28,7 @@ import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.Const; import org.pentaho.di.core.annotations.Step; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.database.DatabaseMeta; import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.core.exception.KettleStepException; @@ -134,7 +135,7 @@ public XMLInputStreamMeta() { } @Override - public void getFields( RowMetaInterface r, String name, RowMetaInterface[] info, StepMeta nextStep, + public void getFields( Bowl bowl, RowMetaInterface r, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) { int defaultStringLenNameValueElements = Const.toInt( space.environmentSubstitute( defaultStringLen ), new Integer( DEFAULT_STRING_LEN ) ); diff --git a/plugins/xml/core/src/main/java/org/pentaho/di/trans/steps/xmljoin/XMLJoin.java b/plugins/xml/core/src/main/java/org/pentaho/di/trans/steps/xmljoin/XMLJoin.java index a11dbc30fd07..4371f0618899 100644 --- a/plugins/xml/core/src/main/java/org/pentaho/di/trans/steps/xmljoin/XMLJoin.java +++ b/plugins/xml/core/src/main/java/org/pentaho/di/trans/steps/xmljoin/XMLJoin.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2018 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -111,8 +111,8 @@ public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws } data.outputRowMeta = data.TargetRowSet.getRowMeta().clone(); - meta.getFields( data.outputRowMeta, getStepname(), new RowMetaInterface[] { data.TargetRowSet.getRowMeta() }, - null, getTransMeta(), repository, metaStore ); + meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), + new RowMetaInterface[] { data.TargetRowSet.getRowMeta() }, null, getTransMeta(), repository, metaStore ); data.outputRowData = rTarget.clone(); // get the target xml structure and create a DOM diff --git a/plugins/xml/core/src/main/java/org/pentaho/di/trans/steps/xmljoin/XMLJoinMeta.java b/plugins/xml/core/src/main/java/org/pentaho/di/trans/steps/xmljoin/XMLJoinMeta.java index ef05993d65f1..68313869b61f 100644 --- a/plugins/xml/core/src/main/java/org/pentaho/di/trans/steps/xmljoin/XMLJoinMeta.java +++ b/plugins/xml/core/src/main/java/org/pentaho/di/trans/steps/xmljoin/XMLJoinMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2019 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -26,6 +26,7 @@ import java.util.List; import org.pentaho.di.core.annotations.Step; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.CheckResult; import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.Const; @@ -150,7 +151,8 @@ public void setDefault() { encoding = Const.XML_ENCODING; } - public void getFields( RowMetaInterface row, String name, RowMetaInterface[] info, StepMeta nextStep, + @Override + public void getFields( Bowl bowl, RowMetaInterface row, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { ValueMetaInterface v = new ValueMeta( this.getValueXMLfield(), ValueMetaInterface.TYPE_STRING ); diff --git a/plugins/xml/core/src/main/java/org/pentaho/di/trans/steps/xmloutput/XMLOutput.java b/plugins/xml/core/src/main/java/org/pentaho/di/trans/steps/xmloutput/XMLOutput.java index f794f09900fc..33abbd971e29 100644 --- a/plugins/xml/core/src/main/java/org/pentaho/di/trans/steps/xmloutput/XMLOutput.java +++ b/plugins/xml/core/src/main/java/org/pentaho/di/trans/steps/xmloutput/XMLOutput.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2021 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -122,7 +122,8 @@ public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws writeRowToFile( getInputRowMeta(), r ); data.outputRowMeta = getInputRowMeta().clone(); - meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); + meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository, + metaStore ); putRow( data.outputRowMeta, r ); // in case we want it to go further... if ( checkFeedback( getLinesOutput() ) ) { @@ -307,7 +308,8 @@ public boolean openNewFile() { data.writer.writeCharacters( EOL ); } else { - FileObject file = KettleVFS.getFileObject( buildFilename( true ), getTransMeta() ); + FileObject file = KettleVFS.getInstance( getTransMeta().getBowl() ) + .getFileObject( buildFilename( true ), getTransMeta() ); if ( meta.isAddToResultFiles() ) { // Add this to the result file names... @@ -318,7 +320,7 @@ public boolean openNewFile() { } if ( meta.isZipped() ) { - OutputStream fos = KettleVFS.getOutputStream( file, false ); + OutputStream fos = KettleVFS.getInstance( getTransMeta().getBowl() ).getOutputStream( file, false ); data.zip = new ZipOutputStream( fos ); File entry = new File( buildFilename( false ) ); ZipEntry zipentry = new ZipEntry( entry.getName() ); @@ -326,7 +328,7 @@ public boolean openNewFile() { data.zip.putNextEntry( zipentry ); outputStream = data.zip; } else { - outputStream = KettleVFS.getOutputStream( file, false ); + outputStream = KettleVFS.getInstance( getTransMeta().getBowl() ).getOutputStream( file, false ); } if ( meta.getEncoding() != null && meta.getEncoding().length() > 0 ) { logBasic( "Opening output stream in encoding: " + meta.getEncoding() ); diff --git a/plugins/xml/core/src/main/java/org/pentaho/di/trans/steps/xmloutput/XMLOutputExternalResourceConsumer.java b/plugins/xml/core/src/main/java/org/pentaho/di/trans/steps/xmloutput/XMLOutputExternalResourceConsumer.java index de22698b51b7..6a1d99c002da 100644 --- a/plugins/xml/core/src/main/java/org/pentaho/di/trans/steps/xmloutput/XMLOutputExternalResourceConsumer.java +++ b/plugins/xml/core/src/main/java/org/pentaho/di/trans/steps/xmloutput/XMLOutputExternalResourceConsumer.java @@ -1,7 +1,7 @@ /* * ****************************************************************************** * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * * ****************************************************************************** * @@ -20,6 +20,7 @@ package org.pentaho.di.trans.steps.xmloutput; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.util.Utils; import org.pentaho.di.core.exception.KettleFileException; import org.pentaho.di.core.vfs.KettleVFS; @@ -44,7 +45,8 @@ public boolean isDataDriven( XMLOutputMeta meta ) { } @Override - public Collection getResourcesFromMeta( XMLOutputMeta meta, IAnalysisContext context ) { + public Collection getResourcesFromMeta( Bowl bowl, XMLOutputMeta meta, + IAnalysisContext context ) { Collection resources = Collections.emptyList(); // We only need to collect these resources if we're not data-driven and there are no used variables in the @@ -63,7 +65,7 @@ public Collection getResourcesFromMeta( XMLOutputMeta met try { IExternalResourceInfo resource = ExternalResourceInfoFactory - .createFileResource( KettleVFS.getFileObject( path ), false ); + .createFileResource( KettleVFS.getInstance( bowl ).getFileObject( path ), false ); if ( resource != null ) { resources.add( resource ); } else { diff --git a/plugins/xml/core/src/main/java/org/pentaho/di/trans/steps/xmloutput/XMLOutputMeta.java b/plugins/xml/core/src/main/java/org/pentaho/di/trans/steps/xmloutput/XMLOutputMeta.java index 8a8b56e5aa90..c60386abf3e7 100644 --- a/plugins/xml/core/src/main/java/org/pentaho/di/trans/steps/xmloutput/XMLOutputMeta.java +++ b/plugins/xml/core/src/main/java/org/pentaho/di/trans/steps/xmloutput/XMLOutputMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -34,6 +34,7 @@ import org.pentaho.di.core.Const; import org.pentaho.di.core.util.Utils; import org.pentaho.di.core.annotations.Step; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.database.DatabaseMeta; import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.core.exception.KettleXMLException; @@ -520,7 +521,8 @@ public String buildFilename( VariableSpace space, int stepnr, int splitnr, boole return retval; } - public void getFields( RowMetaInterface row, String name, RowMetaInterface[] info, StepMeta nextStep, + @Override + public void getFields( Bowl bowl, RowMetaInterface row, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) { // No values are added to the row in this type of step @@ -838,7 +840,8 @@ public void setServletOutput( boolean servletOutput ) { * * @return the filename of the exported resource */ - public String exportResources( VariableSpace space, Map definitions, + @Override + public String exportResources( Bowl bowl, VariableSpace space, Map definitions, ResourceNamingInterface resourceNamingInterface, Repository repository, IMetaStore metaStore ) throws KettleException { try { @@ -846,7 +849,8 @@ public String exportResources( VariableSpace space, Map> getSupportedSteps() { @Override public IMetaverseNode createResourceNode( IExternalResourceInfo resource ) throws MetaverseException { - return createFileNode( resource.getName(), getDescriptor() ); + return createFileNode( parentTransMeta.getBowl(), resource.getName(), getDescriptor() ); } @Override diff --git a/plugins/xml/core/src/main/java/org/pentaho/di/trans/steps/xsdvalidator/XsdValidator.java b/plugins/xml/core/src/main/java/org/pentaho/di/trans/steps/xsdvalidator/XsdValidator.java index 9fc9a5e1b740..6400cadc3689 100644 --- a/plugins/xml/core/src/main/java/org/pentaho/di/trans/steps/xsdvalidator/XsdValidator.java +++ b/plugins/xml/core/src/main/java/org/pentaho/di/trans/steps/xsdvalidator/XsdValidator.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2019 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -88,7 +88,8 @@ public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws if ( first ) { first = false; data.outputRowMeta = getInputRowMeta().clone(); - meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); + meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository, + metaStore ); // Check if XML stream is given if ( meta.getXMLStream() != null ) { @@ -119,7 +120,7 @@ public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws // Is XSD file exists ? FileObject xsdfile = null; try { - xsdfile = KettleVFS.getFileObject( environmentSubstitute( meta.getXSDFilename() ), getTransMeta() ); + xsdfile = KettleVFS.getInstance( getTransMeta().getBowl() ).getFileObject( environmentSubstitute( meta.getXSDFilename() ), getTransMeta() ); if ( !xsdfile.exists() ) { logError( BaseMessages.getString( PKG, "XsdValidator.Log.Error.XSDFileNotExists" ) ); throw new KettleStepException( BaseMessages.getString( PKG, "XsdValidator.Exception.XSDFileNotExists" ) ); @@ -191,7 +192,7 @@ public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws SchemaFactory factoryXSDValidator = SchemaFactory.newInstance( XMLConstants.W3C_XML_SCHEMA_NS_URI ); - xsdfile = KettleVFS.getFileObject( xsdfilename, getTransMeta() ); + xsdfile = KettleVFS.getInstance( getTransMeta().getBowl() ).getFileObject( xsdfilename, getTransMeta() ); // Get XML stream Source sourceXML = new StreamSource( new StringReader( XMLFieldvalue ) ); @@ -200,7 +201,7 @@ public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws // We deal with XML file // Get XML File - FileObject xmlfileValidator = KettleVFS.getFileObject( XMLFieldvalue ); + FileObject xmlfileValidator = KettleVFS.getInstance( getTransMeta().getBowl() ).getFileObject( XMLFieldvalue ); if ( xmlfileValidator == null || !xmlfileValidator.exists() ) { logError( BaseMessages.getString( PKG, "XsdValidator.Log.Error.XMLfileMissing", XMLFieldvalue ) ); throw new KettleStepException( BaseMessages.getString( PKG, "XsdValidator.Exception.XMLfileMissing", diff --git a/plugins/xml/core/src/main/java/org/pentaho/di/trans/steps/xsdvalidator/XsdValidatorMeta.java b/plugins/xml/core/src/main/java/org/pentaho/di/trans/steps/xsdvalidator/XsdValidatorMeta.java index 6cbdc794162b..ba1b36337c4b 100644 --- a/plugins/xml/core/src/main/java/org/pentaho/di/trans/steps/xsdvalidator/XsdValidatorMeta.java +++ b/plugins/xml/core/src/main/java/org/pentaho/di/trans/steps/xsdvalidator/XsdValidatorMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2019 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -28,6 +28,7 @@ import org.apache.commons.vfs2.FileObject; import org.pentaho.di.core.Const; import org.pentaho.di.core.annotations.Step; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.CheckResult; import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.util.Utils; @@ -244,7 +245,8 @@ public void setDefault() { allowExternalEntities = Boolean.valueOf( System.getProperties().getProperty( Const.ALLOW_EXTERNAL_ENTITIES_FOR_XSD_VALIDATION, Const.ALLOW_EXTERNAL_ENTITIES_FOR_XSD_VALIDATION_DEFAULT ) ); } - public void getFields( RowMetaInterface inputRowMeta, String name, RowMetaInterface[] info, StepMeta nextStep, + @Override + public void getFields( Bowl bowl, RowMetaInterface inputRowMeta, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { if ( !Utils.isEmpty( resultFieldname ) ) { if ( outputStringField ) { @@ -435,7 +437,8 @@ public boolean supportsErrorHandling() { * * @return the filename of the exported resource */ - public String exportResources( VariableSpace space, Map definitions, + @Override + public String exportResources( Bowl bowl, VariableSpace space, Map definitions, ResourceNamingInterface resourceNamingInterface, Repository repository, IMetaStore metaStore ) throws KettleException { try { @@ -448,7 +451,8 @@ public String exportResources( VariableSpace space, Map 0 ) { EnterSelectionDialog esd = @@ -1397,7 +1397,7 @@ private void getLoopPathList() { } } else { - FileInputList fileinputList = meta.getFiles( transMeta ); + FileInputList fileinputList = meta.getFiles( transMeta.getBowl(), transMeta ); if ( fileinputList.nrOfFiles() > 0 ) { // Check the first file @@ -1483,7 +1483,7 @@ private void get() { } } else { - FileInputList inputList = meta.getFiles( transMeta ); + FileInputList inputList = meta.getFiles( transMeta.getBowl(), transMeta ); if ( inputList.getFiles().size() > 0 ) { populateFields( meta, KettleVFS.getFilename( inputList.getFile( 0 ) ), false, false, clearFields ); @@ -2036,7 +2036,7 @@ private void populateLoopPaths( GetXMLDataMeta meta, String XMLSource, boolean d .getEncoding() ); } if ( pd != null ) { - list_xpath = pd.open(); + list_xpath = pd.open( transMeta.getBowl() ); if ( list_xpath != null ) { EnterSelectionDialog s = new EnterSelectionDialog( shell, list_xpath, BaseMessages.getString( PKG, @@ -2070,7 +2070,7 @@ private void populateFields( GetXMLDataMeta meta, String XMLSource, boolean dyna .getEncoding(), transMeta.environmentSubstitute( meta.getLoopXPath() ) ); } if ( prd != null ) { - fields = prd.open(); + fields = prd.open( transMeta.getBowl() ); if ( fields != null ) { if ( clearFields == SWT.YES ) { wFields.clearAll( false ); diff --git a/plugins/xml/core/src/main/java/org/pentaho/di/ui/trans/steps/getxmldata/LoopNodesImportProgressDialog.java b/plugins/xml/core/src/main/java/org/pentaho/di/ui/trans/steps/getxmldata/LoopNodesImportProgressDialog.java index 82b1cc512f7a..ff7986122b38 100644 --- a/plugins/xml/core/src/main/java/org/pentaho/di/ui/trans/steps/getxmldata/LoopNodesImportProgressDialog.java +++ b/plugins/xml/core/src/main/java/org/pentaho/di/ui/trans/steps/getxmldata/LoopNodesImportProgressDialog.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -37,6 +37,7 @@ import org.eclipse.jface.dialogs.ProgressMonitorDialog; import org.eclipse.jface.operation.IRunnableWithProgress; import org.eclipse.swt.widgets.Shell; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.util.Utils; import org.pentaho.di.core.vfs.KettleVFS; import org.pentaho.di.core.xml.XMLParserFactoryProducer; @@ -101,11 +102,11 @@ public LoopNodesImportProgressDialog( Shell shell, GetXMLDataMeta meta, String x } } - public String[] open() { + public String[] open( Bowl bowl ) { IRunnableWithProgress op = new IRunnableWithProgress() { public void run( IProgressMonitor monitor ) throws InvocationTargetException, InterruptedException { try { - Xpaths = doScan( monitor ); + Xpaths = doScan( bowl, monitor ); } catch ( Exception e ) { e.printStackTrace(); throw new InvocationTargetException( e, BaseMessages.getString( PKG, @@ -131,7 +132,7 @@ public void run( IProgressMonitor monitor ) throws InvocationTargetException, In } @SuppressWarnings( "unchecked" ) - private String[] doScan( IProgressMonitor monitor ) throws Exception { + private String[] doScan( Bowl bowl, IProgressMonitor monitor ) throws Exception { monitor.beginTask( BaseMessages.getString( PKG, "GetXMLDateLoopNodesImportProgressDialog.Task.ScanningFile", filename ), 1 ); @@ -158,7 +159,7 @@ private String[] doScan( IProgressMonitor monitor ) throws Exception { try { Document document = null; if ( !Utils.isEmpty( filename ) ) { - is = KettleVFS.getInputStream( filename ); + is = KettleVFS.getInstance( bowl ).getInputStream( filename ); document = reader.read( is, encoding ); } else { if ( !Utils.isEmpty( xml ) ) { diff --git a/plugins/xml/core/src/main/java/org/pentaho/di/ui/trans/steps/getxmldata/XMLInputFieldsImportProgressDialog.java b/plugins/xml/core/src/main/java/org/pentaho/di/ui/trans/steps/getxmldata/XMLInputFieldsImportProgressDialog.java index 015a127814eb..c54b3509059e 100644 --- a/plugins/xml/core/src/main/java/org/pentaho/di/ui/trans/steps/getxmldata/XMLInputFieldsImportProgressDialog.java +++ b/plugins/xml/core/src/main/java/org/pentaho/di/ui/trans/steps/getxmldata/XMLInputFieldsImportProgressDialog.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -41,6 +41,7 @@ import org.eclipse.jface.operation.IRunnableWithProgress; import org.eclipse.swt.widgets.Shell; import org.pentaho.di.compatibility.Value; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.util.Utils; import org.pentaho.di.core.RowMetaAndData; import org.pentaho.di.core.vfs.KettleVFS; @@ -121,11 +122,11 @@ public XMLInputFieldsImportProgressDialog( Shell shell, GetXMLDataMeta meta, Str } } - public RowMetaAndData[] open() { + public RowMetaAndData[] open( Bowl bowl ) { IRunnableWithProgress op = new IRunnableWithProgress() { public void run( IProgressMonitor monitor ) throws InvocationTargetException, InterruptedException { try { - fields = doScan( monitor ); + fields = doScan( bowl, monitor ); } catch ( Exception e ) { e.printStackTrace(); throw new InvocationTargetException( e, BaseMessages.getString( PKG, @@ -151,7 +152,7 @@ public void run( IProgressMonitor monitor ) throws InvocationTargetException, In } @SuppressWarnings( "unchecked" ) - private RowMetaAndData[] doScan( IProgressMonitor monitor ) throws Exception { + private RowMetaAndData[] doScan( Bowl bowl, IProgressMonitor monitor ) throws Exception { monitor.beginTask( BaseMessages.getString( PKG, "GetXMLDateLoopNodesImportProgressDialog.Task.ScanningFile", filename ), 1 ); @@ -179,7 +180,7 @@ private RowMetaAndData[] doScan( IProgressMonitor monitor ) throws Exception { Document document = null; if ( !Utils.isEmpty( filename ) ) { - is = KettleVFS.getInputStream( filename ); + is = KettleVFS.getInstance( bowl ).getInputStream( filename ); document = reader.read( is, encoding ); } else { if ( !Utils.isEmpty( xml ) ) { diff --git a/plugins/xml/core/src/test/java/org/pentaho/di/trans/steps/getxmldata/GetXMLDataStepAnalyzerTest.java b/plugins/xml/core/src/test/java/org/pentaho/di/trans/steps/getxmldata/GetXMLDataStepAnalyzerTest.java index a0772334a294..5edd1bd322a2 100644 --- a/plugins/xml/core/src/test/java/org/pentaho/di/trans/steps/getxmldata/GetXMLDataStepAnalyzerTest.java +++ b/plugins/xml/core/src/test/java/org/pentaho/di/trans/steps/getxmldata/GetXMLDataStepAnalyzerTest.java @@ -27,6 +27,7 @@ import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.junit.MockitoJUnitRunner; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.exception.KettleValueException; import org.pentaho.di.core.row.RowMeta; import org.pentaho.di.core.row.RowMetaInterface; @@ -104,6 +105,11 @@ public void setUp() throws Exception { analyzer.setRootNode( node ); analyzer.setParentTransMeta( parentTransMeta ); analyzer.setParentStepMeta( parentStepMeta ); + + when( meta.getParentStepMeta() ).thenReturn( parentStepMeta ); + when( parentStepMeta.getParentTransMeta() ).thenReturn( parentTransMeta ); + when( parentTransMeta.getBowl() ).thenReturn( DefaultBowl.getInstance() ); + when( data.getTransMeta() ).thenReturn( parentTransMeta ); } @Test @@ -311,7 +317,7 @@ public void testGetXMLDataExternalResourceConsumer() throws Exception { when( parentTransMeta.environmentSubstitute( any( String[].class ) ) ).thenReturn( filePaths ); assertFalse( consumer.isDataDriven( meta ) ); - Collection resources = consumer.getResourcesFromMeta( meta ); + Collection resources = consumer.getResourcesFromMeta( DefaultBowl.getInstance(), meta ); assertFalse( resources.isEmpty() ); assertEquals( 2, resources.size() ); @@ -319,7 +325,7 @@ public void testGetXMLDataExternalResourceConsumer() throws Exception { when( meta.isInFields() ).thenReturn( true ); when( meta.getIsAFile() ).thenReturn( true ); assertTrue( consumer.isDataDriven( meta ) ); - assertTrue( consumer.getResourcesFromMeta( meta ).isEmpty() ); + assertTrue( consumer.getResourcesFromMeta( DefaultBowl.getInstance(), meta ).isEmpty() ); when( rmi.getString( Mockito.any( Object[].class ), any(), any() ) ) .thenReturn( "/path/to/row/file" ); resources = consumer.getResourcesFromRow( data, rmi, new String[]{ "id", "name" } ); diff --git a/plugins/xml/core/src/test/java/org/pentaho/di/trans/steps/xmljoin/XmlJoinMetaGetFieldsTest.java b/plugins/xml/core/src/test/java/org/pentaho/di/trans/steps/xmljoin/XmlJoinMetaGetFieldsTest.java index 3dea32040b29..8b854d8cb7da 100644 --- a/plugins/xml/core/src/test/java/org/pentaho/di/trans/steps/xmljoin/XmlJoinMetaGetFieldsTest.java +++ b/plugins/xml/core/src/test/java/org/pentaho/di/trans/steps/xmljoin/XmlJoinMetaGetFieldsTest.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2016-2019 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2016-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -23,6 +23,7 @@ import org.junit.Before; import org.junit.Test; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.row.RowMeta; import org.pentaho.di.core.row.ValueMeta; import org.pentaho.di.core.row.ValueMetaInterface; @@ -69,7 +70,7 @@ public void testGetFieldsReturnTargetStepFieldsPlusResultXmlField() throws Excep rowMeta.addValueMeta( keepValueMeta ); rowMeta.addValueMeta( removeValueMeta ); - xmlJoinMeta.getFields( rowMeta, "testStepName", null, null, transMeta, null, null ); + xmlJoinMeta.getFields( DefaultBowl.getInstance(), rowMeta, "testStepName", null, null, transMeta, null, null ); assertEquals( 2, rowMeta.size() ); String[] strings = rowMeta.getFieldNames(); assertEquals( targetStepField, strings[0] ); @@ -129,7 +130,7 @@ public void testGetFieldsReturnTargetStepFieldsWithDuplicates() throws Exception rowMeta.addValueMeta( keepValueMeta2 ); // Get output fields - xmlJoinMeta.getFields( rowMeta, "testStepName", null, null, transMeta, null, null ); + xmlJoinMeta.getFields( DefaultBowl.getInstance(), rowMeta, "testStepName", null, null, transMeta, null, null ); assertEquals( 3, rowMeta.size() ); String[] strings = rowMeta.getFieldNames(); assertEquals( "b", strings[0] ); diff --git a/plugins/xml/core/src/test/java/org/pentaho/di/trans/steps/xmloutput/XMLOutputMetaTest.java b/plugins/xml/core/src/test/java/org/pentaho/di/trans/steps/xmloutput/XMLOutputMetaTest.java index 98391f3c2b4d..23b6a3a1a5f4 100644 --- a/plugins/xml/core/src/test/java/org/pentaho/di/trans/steps/xmloutput/XMLOutputMetaTest.java +++ b/plugins/xml/core/src/test/java/org/pentaho/di/trans/steps/xmloutput/XMLOutputMetaTest.java @@ -26,6 +26,7 @@ import org.junit.BeforeClass; import org.junit.Test; import org.mockito.Mockito; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.CheckResultInterface; import org.pentaho.di.core.Const; import org.pentaho.di.core.KettleClientEnvironment; @@ -425,7 +426,8 @@ public void testGetFields() throws Exception { IMetaStore metastore = mock( IMetaStore.class ); ValueMetaInterface vmi = mock( ValueMetaInterface.class ); when( row.searchValueMeta( "aField" ) ).thenReturn( vmi ); - xmlOutputMeta.getFields( row, "", new RowMetaInterface[] { rmi }, nextStep, new Variables(), repo, metastore ); + xmlOutputMeta.getFields( DefaultBowl.getInstance(), row, "", new RowMetaInterface[] { rmi }, nextStep, + new Variables(), repo, metastore ); verify( vmi ).setLength( 10, 3 ); } @@ -492,11 +494,17 @@ public void testGetRequiredFields() throws Exception { public void testExportResources() throws Exception { XMLOutputMeta xmlOutputMeta = new XMLOutputMeta(); xmlOutputMeta.setDefault(); + + StepMeta stepMeta = mock( StepMeta.class ); + TransMeta transMeta = mock( TransMeta.class ); + when( stepMeta.getParentTransMeta() ).thenReturn( transMeta ); + when( transMeta.getBowl() ).thenReturn( DefaultBowl.getInstance() ); + xmlOutputMeta.setParentStepMeta( stepMeta ); ResourceNamingInterface resourceNamingInterface = mock( ResourceNamingInterface.class ); Variables space = new Variables(); when( resourceNamingInterface.nameResource( any( FileObject.class ), eq( space ), eq( true ) ) ).thenReturn( "exportFile" ); - xmlOutputMeta.exportResources( space, null, resourceNamingInterface, null, null ); + xmlOutputMeta.exportResources( DefaultBowl.getInstance(), space, null, resourceNamingInterface, null, null ); assertEquals( "exportFile", xmlOutputMeta.getFileName() ); } diff --git a/plugins/xml/core/src/test/java/org/pentaho/di/trans/steps/xmloutput/XMLOutputStepAnalyzerTest.java b/plugins/xml/core/src/test/java/org/pentaho/di/trans/steps/xmloutput/XMLOutputStepAnalyzerTest.java index 7333e97faedb..fd1f3fae5915 100644 --- a/plugins/xml/core/src/test/java/org/pentaho/di/trans/steps/xmloutput/XMLOutputStepAnalyzerTest.java +++ b/plugins/xml/core/src/test/java/org/pentaho/di/trans/steps/xmloutput/XMLOutputStepAnalyzerTest.java @@ -26,6 +26,7 @@ import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.junit.MockitoJUnitRunner; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.variables.VariableSpace; import org.pentaho.di.trans.TransMeta; import org.pentaho.di.trans.step.BaseStepMeta; @@ -101,6 +102,7 @@ public void setUp() throws Exception { lenient().when( meta.getParentStepMeta() ).thenReturn( parentStepMeta ); lenient().when( parentStepMeta.getStepMetaInterface() ).thenReturn( meta ); lenient().when( parentStepMeta.getParentTransMeta() ).thenReturn( mockTransMeta ); + lenient().when( mockTransMeta.getBowl() ).thenReturn( DefaultBowl.getInstance() ); lenient().when( parentStepMeta.getName() ).thenReturn( "test" ); lenient().when( parentStepMeta.getStepID() ).thenReturn( "XmlOutputStep" ); } @@ -159,7 +161,7 @@ public void testXMLOutputExternalResourceConsumer() throws Exception { when( this.meta.getFiles( Mockito.any( VariableSpace.class ) ) ).thenReturn( filePaths ); assertFalse( consumer.isDataDriven( this.meta ) ); - Collection resources = consumer.getResourcesFromMeta( this.meta ); + Collection resources = consumer.getResourcesFromMeta( DefaultBowl.getInstance(), this.meta ); assertFalse( resources.isEmpty() ); assertEquals( 2, resources.size() ); diff --git a/plugins/xml/core/src/test/java/org/pentaho/di/trans/steps/xmloutput/XMLOutputTest.java b/plugins/xml/core/src/test/java/org/pentaho/di/trans/steps/xmloutput/XMLOutputTest.java index aeea3a3d73a5..23c8cf0ff020 100644 --- a/plugins/xml/core/src/test/java/org/pentaho/di/trans/steps/xmloutput/XMLOutputTest.java +++ b/plugins/xml/core/src/test/java/org/pentaho/di/trans/steps/xmloutput/XMLOutputTest.java @@ -28,6 +28,7 @@ import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.Const; import org.pentaho.di.core.RowSet; import org.pentaho.di.core.exception.KettleException; @@ -303,7 +304,8 @@ private XMLOutputTestHandler createXmlOutputTestHandler() { } public Document parseXml( String filePath ) throws Exception { - String xml = IOUtils.toString( KettleVFS.getInputStream( filePath ), StandardCharsets.UTF_8 ); + String xml = IOUtils.toString( KettleVFS.getInstance( DefaultBowl.getInstance() ) + .getInputStream( filePath ), StandardCharsets.UTF_8 ); return XMLHandler.loadXMLString( xml ); } diff --git a/plugins/xml/core/src/test/java/org/pentaho/di/trans/steps/xsdvalidator/XsdValidatorIntTest.java b/plugins/xml/core/src/test/java/org/pentaho/di/trans/steps/xsdvalidator/XsdValidatorIntTest.java index b9496d57f20a..cd243705829d 100644 --- a/plugins/xml/core/src/test/java/org/pentaho/di/trans/steps/xsdvalidator/XsdValidatorIntTest.java +++ b/plugins/xml/core/src/test/java/org/pentaho/di/trans/steps/xsdvalidator/XsdValidatorIntTest.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -38,6 +38,7 @@ import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.KettleEnvironment; import org.pentaho.di.core.RowMetaAndData; import org.pentaho.di.core.exception.KettleException; @@ -124,7 +125,7 @@ private String getDataFileUrl( String filename ) throws Exception { private FileObject loadRamFile( String filename ) throws Exception { String targetUrl = RAMDIR + "/" + filename; try ( InputStream source = getFileInputStream( filename ) ) { - FileObject fileObject = KettleVFS.getFileObject( targetUrl ); + FileObject fileObject = KettleVFS.getInstance( DefaultBowl.getInstance() ).getFileObject( targetUrl ); try ( OutputStream targetStream = fileObject.getContent().getOutputStream() ) { IOUtils.copy( source, targetStream ); } @@ -135,8 +136,8 @@ private FileObject loadRamFile( String filename ) throws Exception { private void testVfsFileTypes( String dataFilename, String schemaFilename, boolean expected ) throws Exception { assertNotNull( dataFilename ); assertNotNull( schemaFilename ); - assertTrue( KettleVFS.getFileObject( dataFilename ).exists() ); - assertTrue( KettleVFS.getFileObject( schemaFilename ).exists() ); + assertTrue( KettleVFS.getInstance( DefaultBowl.getInstance() ).getFileObject( dataFilename ).exists() ); + assertTrue( KettleVFS.getInstance( DefaultBowl.getInstance() ).getFileObject( schemaFilename ).exists() ); RowMetaInterface inputRowMeta = new RowMeta(); inputRowMeta.addValueMeta( new ValueMetaString( "DataFile" ) ); diff --git a/plugins/yaml-input/impl/src/main/java/org/pentaho/di/trans/steps/yamlinput/YamlInput.java b/plugins/yaml-input/impl/src/main/java/org/pentaho/di/trans/steps/yamlinput/YamlInput.java index 740e4cd3e80b..7d2feb4ce943 100644 --- a/plugins/yaml-input/impl/src/main/java/org/pentaho/di/trans/steps/yamlinput/YamlInput.java +++ b/plugins/yaml-input/impl/src/main/java/org/pentaho/di/trans/steps/yamlinput/YamlInput.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2022 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -103,7 +103,8 @@ private boolean readNextString() { // Get total previous fields data.totalPreviousFields = data.outputRowMeta.size(); data.totalOutFields = data.totalPreviousFields + data.nrInputFields; - meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); + meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository, + metaStore ); // Check is Yaml field is provided if ( Utils.isEmpty( meta.getYamlField() ) ) { @@ -134,13 +135,14 @@ private boolean readNextString() { // source is a file. - data.yaml = new YamlReader(); - data.yaml.loadFile( KettleVFS.getFileObject( Fieldvalue, getTransMeta() ) ); + data.yaml = new YamlReader( getTransMeta().getBowl() ); + data.yaml.loadFile( KettleVFS.getInstance( getTransMeta().getBowl() ) + .getFileObject( Fieldvalue, getTransMeta() ) ); addFileToResultFilesname( data.yaml.getFile() ); } else { - data.yaml = new YamlReader(); + data.yaml = new YamlReader( getTransMeta().getBowl() ); data.yaml.loadString( Fieldvalue ); } } catch ( Exception e ) { @@ -193,7 +195,7 @@ private boolean openNextFile() { // We have a file // define a Yaml reader and load file - data.yaml = new YamlReader(); + data.yaml = new YamlReader( getTransMeta().getBowl() ); data.yaml.loadFile( data.file ); addFileToResultFilesname( data.file ); @@ -217,7 +219,7 @@ public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws if ( first && !meta.isInFields() ) { first = false; - data.files = meta.getFiles( this ); + data.files = meta.getFiles( getTransMeta().getBowl(), this ); if ( !meta.isdoNotFailIfNoFile() && data.files.nrOfFiles() == 0 ) { throw new KettleException( BaseMessages.getString( PKG, "YamlInput.Log.NoFiles" ) ); @@ -229,7 +231,8 @@ public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws data.outputRowMeta = new RowMeta(); data.totalPreviousFields = 0; data.totalOutFields = data.totalPreviousFields + data.nrInputFields; - meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); + meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository, + metaStore ); data.totalOutStreamFields = data.outputRowMeta.size(); } diff --git a/plugins/yaml-input/impl/src/main/java/org/pentaho/di/trans/steps/yamlinput/YamlInputMeta.java b/plugins/yaml-input/impl/src/main/java/org/pentaho/di/trans/steps/yamlinput/YamlInputMeta.java index a6db5a826969..2e2aaca9cb6c 100644 --- a/plugins/yaml-input/impl/src/main/java/org/pentaho/di/trans/steps/yamlinput/YamlInputMeta.java +++ b/plugins/yaml-input/impl/src/main/java/org/pentaho/di/trans/steps/yamlinput/YamlInputMeta.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2022 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -32,6 +32,7 @@ import org.pentaho.di.core.Const; import org.pentaho.di.core.util.Utils; import org.pentaho.di.core.annotations.Step; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.database.DatabaseMeta; import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.core.exception.KettlePluginException; @@ -565,7 +566,7 @@ public void setDefault() { } @Override - public void getFields( RowMetaInterface r, String name, RowMetaInterface[] info, StepMeta nextStep, + public void getFields( Bowl bowl, RowMetaInterface r, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { int i; for ( i = 0; i < inputFields.length; i++ ) { @@ -711,8 +712,8 @@ public void saveRep( Repository rep, IMetaStore metaStore, ObjectId id_transform } } - public FileInputList getFiles( VariableSpace space ) { - return FileInputList.createFileList( space, fileName, fileMask, fileRequired, includeSubFolderBoolean() ); + public FileInputList getFiles( Bowl bowl, VariableSpace space ) { + return FileInputList.createFileList( bowl, space, fileName, fileMask, fileRequired, includeSubFolderBoolean() ); } private boolean[] includeSubFolderBoolean() { @@ -763,7 +764,7 @@ public void check( List remarks, TransMeta transMeta, Step remarks.add( cr ); } } else { - FileInputList fileInputList = getFiles( transMeta ); + FileInputList fileInputList = getFiles( transMeta.getBowl(), transMeta ); // String files[] = getFiles(); if ( fileInputList == null || fileInputList.getFiles().size() == 0 ) { cr = @@ -813,7 +814,7 @@ public boolean supportsErrorHandling() { * @return the filename of the exported resource */ @Override - public String exportResources( VariableSpace space, Map definitions, + public String exportResources( Bowl bowl, VariableSpace space, Map definitions, ResourceNamingInterface resourceNamingInterface, Repository repository, IMetaStore metaStore ) throws KettleException { try { // The object that we're modifying here is a copy of the original! @@ -823,7 +824,7 @@ public String exportResources( VariableSpace space, Map newFilenames = new ArrayList(); if ( !isInFields() ) { - FileInputList fileList = getFiles( space ); + FileInputList fileList = getFiles( bowl, space ); if ( fileList.getFiles().size() > 0 ) { for ( FileObject fileObject : fileList.getFiles() ) { // From : ${Internal.Transformation.Filename.Directory}/../foo/bar.xml diff --git a/plugins/yaml-input/impl/src/main/java/org/pentaho/di/trans/steps/yamlinput/YamlReader.java b/plugins/yaml-input/impl/src/main/java/org/pentaho/di/trans/steps/yamlinput/YamlReader.java index ccdf4d87bb34..7d4d7ee2900b 100644 --- a/plugins/yaml-input/impl/src/main/java/org/pentaho/di/trans/steps/yamlinput/YamlReader.java +++ b/plugins/yaml-input/impl/src/main/java/org/pentaho/di/trans/steps/yamlinput/YamlReader.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2022 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -33,6 +33,7 @@ import java.util.Map; import org.apache.commons.vfs2.FileObject; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.Const; import org.pentaho.di.core.util.Utils; import org.pentaho.di.core.exception.KettleException; @@ -76,8 +77,9 @@ public class YamlReader { private boolean useMap; private Yaml yaml; + private Bowl bowl; - public YamlReader() { + public YamlReader( Bowl bowl ) { this.filename = null; this.string = null; this.file = null; @@ -85,6 +87,7 @@ public YamlReader() { this.useMap = true; this.dataList = null; this.yaml = new Yaml(); + this.bowl = bowl; } public void loadFile( FileObject file ) throws Exception { @@ -95,7 +98,7 @@ public void loadFile( FileObject file ) throws Exception { public void loadFile( String filename ) throws Exception { this.filename = filename; - this.file = KettleVFS.getFileObject( filename ); + this.file = KettleVFS.getInstance( bowl ).getFileObject( filename ); InputStream is = null; try { diff --git a/plugins/yaml-input/ui/src/main/java/org/pentaho/di/ui/trans/steps/yamlinput/YamlInputDialog.java b/plugins/yaml-input/ui/src/main/java/org/pentaho/di/ui/trans/steps/yamlinput/YamlInputDialog.java index 6b46ab295fea..ae86809a69af 100644 --- a/plugins/yaml-input/ui/src/main/java/org/pentaho/di/ui/trans/steps/yamlinput/YamlInputDialog.java +++ b/plugins/yaml-input/ui/src/main/java/org/pentaho/di/ui/trans/steps/yamlinput/YamlInputDialog.java @@ -894,7 +894,7 @@ public void widgetSelected( SelectionEvent e ) { try { YamlInputMeta tfii = new YamlInputMeta(); getInfo( tfii ); - FileInputList fileInputList = tfii.getFiles( transMeta ); + FileInputList fileInputList = tfii.getFiles( transMeta.getBowl(), transMeta ); String[] files = fileInputList.getFileStrings(); if ( files != null && files.length > 0 ) { EnterSelectionDialog esd = new EnterSelectionDialog( shell, files, @@ -1043,12 +1043,12 @@ private void get() { YamlInputMeta meta = new YamlInputMeta(); getInfo( meta ); - FileInputList inputList = meta.getFiles( transMeta ); + FileInputList inputList = meta.getFiles( transMeta.getBowl(), transMeta ); if ( inputList.getFiles().size() > 0 ) { wFields.removeAll(); - yaml = new YamlReader(); + yaml = new YamlReader( transMeta.getBowl() ); yaml.loadFile( inputList.getFile( 0 ) ); RowMeta row = yaml.getFields(); diff --git a/ui/src/main/java/org/pentaho/di/core/vfs/KettleVfsDelegatingResolver.java b/ui/src/main/java/org/pentaho/di/core/vfs/KettleVfsDelegatingResolver.java index 9f288553afeb..0e0d73b40e42 100644 --- a/ui/src/main/java/org/pentaho/di/core/vfs/KettleVfsDelegatingResolver.java +++ b/ui/src/main/java/org/pentaho/di/core/vfs/KettleVfsDelegatingResolver.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -24,6 +24,7 @@ import org.apache.commons.vfs2.FileObject; import org.apache.commons.vfs2.FileSystemOptions; +import org.pentaho.di.core.bowl.Bowl; import org.pentaho.di.core.exception.KettleFileException; import org.pentaho.vfs.ui.VfsResolver; @@ -32,10 +33,17 @@ */ public class KettleVfsDelegatingResolver implements VfsResolver { + private Bowl bowl; + + public KettleVfsDelegatingResolver( Bowl bowl ) { + this.bowl = bowl; + } + + @Override public FileObject resolveFile( String vfsUrl ) { try { - return KettleVFS.getFileObject( vfsUrl ); + return KettleVFS.getInstance( bowl ).getFileObject( vfsUrl ); } catch ( KettleFileException e ) { throw new RuntimeException( e ); } @@ -44,7 +52,7 @@ public FileObject resolveFile( String vfsUrl ) { @Override public FileObject resolveFile( String vfsUrl, FileSystemOptions fsOptions ) { try { - return KettleVFS.getFileObject( vfsUrl, fsOptions ); + return KettleVFS.getInstance( bowl ).getFileObject( vfsUrl, fsOptions ); } catch ( KettleFileException e ) { throw new RuntimeException( e ); } diff --git a/ui/src/main/java/org/pentaho/di/ui/core/events/dialog/SelectionAdapterFileDialog.java b/ui/src/main/java/org/pentaho/di/ui/core/events/dialog/SelectionAdapterFileDialog.java index 4ef8aac65d68..f594fecc7ae2 100644 --- a/ui/src/main/java/org/pentaho/di/ui/core/events/dialog/SelectionAdapterFileDialog.java +++ b/ui/src/main/java/org/pentaho/di/ui/core/events/dialog/SelectionAdapterFileDialog.java @@ -147,7 +147,7 @@ private void widgetSelectedHelper( ) { try { // Attempt to set up initial conditions, if fails browse will fallback to default path. initialFilePath = resolveFile( meta, getText() ); - initialFile = KettleVFS.getFileObject( initialFilePath ); + initialFile = KettleVFS.getInstance( options.getBowl() ).getFileObject( initialFilePath ); // In cases where filePath is empty set it to the default path returned by kettleVFS. if ( Utils.isEmpty( initialFilePath ) && initialFile != null ) { @@ -403,7 +403,8 @@ String applyRelativePathEnvVar( String path ) { // If no match, attempt to compare to kettleVFS object if ( Utils.isEmpty( parentFolder ) ) { try { - FileObject parentFileObj = KettleVFS.getFileObject( currentFile ).getParent(); + FileObject parentFileObj = KettleVFS.getInstance( options.getBowl() ) + .getFileObject( currentFile ).getParent(); // Non-local files should include the schema i.e. pvfs:// parentFolder = ( parentFileObj instanceof LocalFile ) ? parentFileObj.getName().getPath() diff --git a/ui/src/main/java/org/pentaho/di/ui/core/widget/VFSFileSelection.java b/ui/src/main/java/org/pentaho/di/ui/core/widget/VFSFileSelection.java index e8cc297a2419..d838afe4f2fd 100644 --- a/ui/src/main/java/org/pentaho/di/ui/core/widget/VFSFileSelection.java +++ b/ui/src/main/java/org/pentaho/di/ui/core/widget/VFSFileSelection.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2019 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -117,7 +117,8 @@ private Optional promptForFile() { FileObject root; try { - root = KettleVFS.getFileObject( curFile != null ? curFile : Const.getUserHomeDirectory() ); + root = KettleVFS.getInstance( abstractMeta.getBowl() ) + .getFileObject( curFile != null ? curFile : Const.getUserHomeDirectory() ); VfsFileChooserDialog vfsFileChooser = Spoon.getInstance().getVfsFileChooserDialog( root.getParent(), root ); if ( StringUtil.isEmpty( initialScheme ) ) { initialScheme = "file"; @@ -142,7 +143,8 @@ private String getRelativePath( String filePath ) { String parentFolder = null; try { parentFolder = - KettleVFS.getFileObject( abstractMeta.environmentSubstitute( abstractMeta.getFilename() ) ).getParent().toString(); + KettleVFS.getInstance( abstractMeta.getBowl() ) + .getFileObject( abstractMeta.environmentSubstitute( abstractMeta.getFilename() ) ).getParent().toString(); } catch ( Exception e ) { // Take no action } diff --git a/ui/src/main/java/org/pentaho/di/ui/core/widget/VfsFileChooserControls.java b/ui/src/main/java/org/pentaho/di/ui/core/widget/VfsFileChooserControls.java index b39b880604d1..70d6d3067119 100644 --- a/ui/src/main/java/org/pentaho/di/ui/core/widget/VfsFileChooserControls.java +++ b/ui/src/main/java/org/pentaho/di/ui/core/widget/VfsFileChooserControls.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2018 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -82,14 +82,15 @@ public VfsFileChooserControls( VariableSpace space, Composite composite, int i, protected FileObject getInitialFile( String filePath ) throws KettleFileException { FileObject initialFile = null; + Spoon spoon = Spoon.getInstance(); if ( filePath != null && !filePath.isEmpty() ) { String fileName = space.environmentSubstitute( filePath ); if ( fileName != null && !fileName.isEmpty() ) { - initialFile = KettleVFS.getFileObject( fileName ); + initialFile = KettleVFS.getInstance( spoon.getExecutionBowl() ).getFileObject( fileName ); } } if ( initialFile == null ) { - initialFile = KettleVFS.getFileObject( Spoon.getInstance().getLastFileOpened() ); + initialFile = KettleVFS.getInstance( spoon.getExecutionBowl() ).getFileObject( spoon.getLastFileOpened() ); } return initialFile; } diff --git a/ui/src/main/java/org/pentaho/di/ui/i18n/MessagesSourceCrawler.java b/ui/src/main/java/org/pentaho/di/ui/i18n/MessagesSourceCrawler.java index 5554cbfb8a6c..d3e997ed9ff8 100644 --- a/ui/src/main/java/org/pentaho/di/ui/i18n/MessagesSourceCrawler.java +++ b/ui/src/main/java/org/pentaho/di/ui/i18n/MessagesSourceCrawler.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2019 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -26,6 +26,8 @@ import org.apache.commons.vfs2.FileObject; import org.apache.commons.vfs2.FileSelectInfo; import org.apache.commons.vfs2.FileSelector; +import org.pentaho.di.core.bowl.Bowl; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.Const; import org.pentaho.di.core.exception.KettleXMLException; import org.pentaho.di.core.fileinput.FileInputList; @@ -215,16 +217,16 @@ public void addKeyOccurrence( KeyOccurrence occ ) { } } - public void crawl() throws Exception { + public void crawl( Bowl bowl ) throws Exception { crawlSourceDirectories(); // Also search for keys in the XUL files... - crawlXmlFolders(); + crawlXmlFolders( bowl ); } public void crawlSourceDirectories() throws Exception { for ( final String sourceDirectory : sourceDirectories ) { - FileObject folder = KettleVFS.getFileObject( sourceDirectory ); + FileObject folder = KettleVFS.getInstance( DefaultBowl.getInstance() ).getFileObject( sourceDirectory ); FileObject[] javaFiles = folder.findFiles( new FileSelector() { @Override public boolean traverseDescendents( FileSelectInfo info ) throws Exception { @@ -248,7 +250,7 @@ public boolean includeFile( FileSelectInfo info ) throws Exception { } } - protected void crawlXmlFolders() throws Exception { + protected void crawlXmlFolders( Bowl bowl ) throws Exception { for ( SourceCrawlerXMLFolder xmlFolder : xmlFolders ) { String[] xmlDirs = { xmlFolder.getFolder() }; @@ -257,7 +259,7 @@ protected void crawlXmlFolders() throws Exception { boolean[] xmlSubdirs = { true }; // search sub-folders too FileInputList xulFileInputList = - FileInputList.createFileList( new Variables(), xmlDirs, xmlMasks, xmlReq, xmlSubdirs ); + FileInputList.createFileList( bowl, new Variables(), xmlDirs, xmlMasks, xmlReq, xmlSubdirs ); for ( FileObject fileObject : xulFileInputList.getFiles() ) { try { Document doc = XMLHandler.loadXMLFile( fileObject ); diff --git a/ui/src/main/java/org/pentaho/di/ui/i18n/editor/Translator2.java b/ui/src/main/java/org/pentaho/di/ui/i18n/editor/Translator2.java index b46578d82340..c6e7b5cc70f6 100644 --- a/ui/src/main/java/org/pentaho/di/ui/i18n/editor/Translator2.java +++ b/ui/src/main/java/org/pentaho/di/ui/i18n/editor/Translator2.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2019 by Hitachi Vantara : http://www.hitachivantara.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.hitachivantara.com * ******************************************************************************* * @@ -45,6 +45,7 @@ import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.TableItem; import org.eclipse.swt.widgets.Text; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.Const; import org.pentaho.di.core.KettleClientEnvironment; import org.pentaho.di.core.Props; @@ -175,7 +176,7 @@ public void readFiles() throws KettleFileException { crawler = new MessagesSourceCrawler( log, rootDirectories, singleMessagesFile, xmlFolders ); crawler.setScanPhrases( scanPhrases ); crawler.setFilesToAvoid( filesToAvoid ); - crawler.crawl(); + crawler.crawl( DefaultBowl.getInstance() ); store = new TranslationsStore( log, localeList, referenceLocale, crawler.getSourcePackageOccurrences() ); store.read( rootDirectories ); @@ -269,7 +270,7 @@ public void loadConfiguration( String configFile, String sourceFolder ) throws E filesToAvoid = new ArrayList<>(); xmlFolders = new ArrayList<>(); - FileObject file = KettleVFS.getFileObject( configFile ); + FileObject file = KettleVFS.getInstance( DefaultBowl.getInstance() ).getFileObject( configFile ); if ( file.exists() ) { try { Document doc = XMLHandler.loadXMLFile( file ); diff --git a/ui/src/main/java/org/pentaho/di/ui/imp/ImportRulesDialog.java b/ui/src/main/java/org/pentaho/di/ui/imp/ImportRulesDialog.java index 255f6f3c66fb..0ce791196868 100644 --- a/ui/src/main/java/org/pentaho/di/ui/imp/ImportRulesDialog.java +++ b/ui/src/main/java/org/pentaho/di/ui/imp/ImportRulesDialog.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -50,6 +50,7 @@ import org.eclipse.swt.widgets.TableColumn; import org.eclipse.swt.widgets.TableItem; import org.eclipse.swt.widgets.ToolBar; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.Const; import org.pentaho.di.core.KettleEnvironment; import org.pentaho.di.core.exception.KettleException; @@ -375,7 +376,8 @@ protected void importRules() { ImportRules newRules = new ImportRules(); try { - newRules.loadXML( XMLHandler.getSubNode( XMLHandler.loadXMLFile( filename ), ImportRules.XML_TAG ) ); + newRules.loadXML( XMLHandler.getSubNode( XMLHandler.loadXMLFile( DefaultBowl.getInstance(), + filename ), ImportRules.XML_TAG ) ); importRules = newRules; // Re-load the dialog. @@ -507,7 +509,7 @@ public static void main( String[] args ) throws Exception { ImportRules importRules = new ImportRules(); importRules.loadXML( XMLHandler.getSubNode( - XMLHandler.loadXMLFile( "bin/import-rules.xml" ), ImportRules.XML_TAG ) ); + XMLHandler.loadXMLFile( DefaultBowl.getInstance(), "bin/import-rules.xml" ), ImportRules.XML_TAG ) ); ImportRulesDialog dialog = new ImportRulesDialog( shell, importRules ); if ( dialog.open() ) { diff --git a/ui/src/main/java/org/pentaho/di/ui/job/entries/copyfiles/JobEntryCopyFilesDialog.java b/ui/src/main/java/org/pentaho/di/ui/job/entries/copyfiles/JobEntryCopyFilesDialog.java index 1a9ba8d660a2..5532a4bbed2d 100644 --- a/ui/src/main/java/org/pentaho/di/ui/job/entries/copyfiles/JobEntryCopyFilesDialog.java +++ b/ui/src/main/java/org/pentaho/di/ui/job/entries/copyfiles/JobEntryCopyFilesDialog.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2018 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -467,14 +467,15 @@ public void widgetSelected( SelectionEvent e ) { if ( fileName != null && !fileName.equals( "" ) ) { try { - initialFile = KettleVFS.getFileObject( fileName ); + initialFile = KettleVFS.getInstance( jobMeta.getBowl() ).getFileObject( fileName ); } catch ( KettleException ex ) { - initialFile = KettleVFS.getFileObject( "" ); + initialFile = KettleVFS.getInstance( jobMeta.getBowl() ).getFileObject( "" ); } - defaultInitialFile = KettleVFS.getFileObject( "file:///c:/" ); + defaultInitialFile = KettleVFS.getInstance( jobMeta.getBowl() ).getFileObject( "file:///c:/" ); rootFile = initialFile.getFileSystem().getRoot(); } else { - defaultInitialFile = KettleVFS.getFileObject( Spoon.getInstance().getLastFileOpened() ); + defaultInitialFile = KettleVFS.getInstance( jobMeta.getBowl() ) + .getFileObject( Spoon.getInstance().getLastFileOpened() ); } } diff --git a/ui/src/main/java/org/pentaho/di/ui/job/entries/trans/JobEntryBaseDialog.java b/ui/src/main/java/org/pentaho/di/ui/job/entries/trans/JobEntryBaseDialog.java index 71ab857f6ab4..34e5d256a84b 100644 --- a/ui/src/main/java/org/pentaho/di/ui/job/entries/trans/JobEntryBaseDialog.java +++ b/ui/src/main/java/org/pentaho/di/ui/job/entries/trans/JobEntryBaseDialog.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2020 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -647,7 +647,7 @@ protected void selectLogFile( String[] filters ) { String filename = dialog.getFilterPath() + Const.FILE_SEPARATOR + dialog.getFileName(); FileObject file = null; try { - file = KettleVFS.getFileObject( filename ); + file = KettleVFS.getInstance( jobMeta.getBowl() ).getFileObject( filename ); // Set file extension .. wLogext.setText( file.getName().getExtension() ); // Set filename without extension ... diff --git a/ui/src/main/java/org/pentaho/di/ui/repository/dialog/RepositoryExportProgressDialog.java b/ui/src/main/java/org/pentaho/di/ui/repository/dialog/RepositoryExportProgressDialog.java index 9bfd33a26d86..39f628ffe85c 100644 --- a/ui/src/main/java/org/pentaho/di/ui/repository/dialog/RepositoryExportProgressDialog.java +++ b/ui/src/main/java/org/pentaho/di/ui/repository/dialog/RepositoryExportProgressDialog.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -34,6 +34,7 @@ import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.MessageBox; import org.eclipse.swt.widgets.Shell; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.Const; import org.pentaho.di.core.ProgressMonitorAdapter; import org.pentaho.di.core.exception.KettleException; @@ -196,7 +197,7 @@ public static MessageBox checkIsFileIsAcceptable( Shell shell, LogChannelInterfa // check if file is exists try { // check if file is not empty - FileObject output = KettleVFS.getFileObject( filename ); + FileObject output = KettleVFS.getInstance( DefaultBowl.getInstance() ).getFileObject( filename ); if ( output.exists() ) { if ( !output.isWriteable() ) { box = new MessageBox( shell, SWT.ICON_QUESTION | SWT.APPLICATION_MODAL | SWT.SHEET | SWT.OK | SWT.CANCEL ); diff --git a/ui/src/main/java/org/pentaho/di/ui/spoon/Spoon.java b/ui/src/main/java/org/pentaho/di/ui/spoon/Spoon.java index 44187719df46..2f2a4d9cc37e 100644 --- a/ui/src/main/java/org/pentaho/di/ui/spoon/Spoon.java +++ b/ui/src/main/java/org/pentaho/di/ui/spoon/Spoon.java @@ -1089,7 +1089,8 @@ public static Spoon getInstance() { public VfsFileChooserDialog getVfsFileChooserDialog( FileObject rootFile, FileObject initialFile ) { if ( vfsFileChooserDialog == null ) { - vfsFileChooserDialog = new VfsFileChooserDialog( shell, new KettleVfsDelegatingResolver(), rootFile, initialFile ); + vfsFileChooserDialog = new VfsFileChooserDialog( shell, new KettleVfsDelegatingResolver( executionBowl ), + rootFile, initialFile ); } vfsFileChooserDialog.setRootFile( rootFile ); vfsFileChooserDialog.setInitialFile( initialFile ); @@ -1823,7 +1824,8 @@ public void changing( LocationEvent event ) { } else if ( event.location.contains( "samples/transformations" ) || event.location.contains( "samples/jobs" ) || event.location.contains( "samples/mapping" ) ) { try { - FileObject fileObject = KettleVFS.getFileObject( event.location ); + FileObject fileObject = KettleVFS.getInstance( DefaultBowl.getInstance() ) + .getFileObject( event.location ); if ( fileObject.exists() ) { if ( event.location.endsWith( ".ktr" ) || event.location.endsWith( ".kjb" ) ) { openFile( event.location, false ); @@ -4616,7 +4618,7 @@ public void createCmdLineFile() { // See if the file already exists... int id = SWT.YES; try { - FileObject f = KettleVFS.getFileObject( filename ); + FileObject f = KettleVFS.getInstance( DefaultBowl.getInstance() ).getFileObject( filename ); if ( f.exists() ) { MessageBox mb = new MessageBox( shell, SWT.NO | SWT.YES | SWT.ICON_WARNING ); mb.setMessage( BaseMessages.getString( PKG, "ExportCmdLineShFiles.FileExistsReplace", filename ) ); @@ -5984,7 +5986,7 @@ public void exportAllXMLFile() { lastFileOpened = zipFilename; lastFileOpenedConnection = null; lastFileOpenedProvider = fileDialogOperation.getProvider(); - FileObject zipFileObject = KettleVFS.getFileObject(zipFilename); + FileObject zipFileObject = KettleVFS.getInstance( DefaultBowl.getInstance() ).getFileObject(zipFilename); if (zipFileObject.exists()) { MessageBox box = new MessageBox(shell, SWT.YES | SWT.NO | SWT.CANCEL); box.setMessage(BaseMessages.getString(PKG, "Spoon.ExportResourceZipFileExists.Message", zipFilename)); @@ -6000,7 +6002,7 @@ public void exportAllXMLFile() { if (!Utils.isEmpty(zipFilename)) { // Export the resources linked to the currently loaded file... TopLevelResource topLevelResource = - ResourceUtil.serializeResourceExportInterface( + ResourceUtil.serializeResourceExportInterface( DefaultBowl.getInstance(), zipFilename, resourceExportInterface, (VariableSpace) resourceExportInterface, rep, metaStoreSupplier.get() ); String message = ResourceUtil.getExplanation(zipFilename, topLevelResource.getResourceName(), resourceExportInterface); @@ -6050,7 +6052,7 @@ public void exportAllFileRepository() { if ( dialog.open() != null ) { lastDirOpened = dialog.getFilterPath(); zipFilename = dialog.getFilterPath() + Const.FILE_SEPARATOR + dialog.getFileName(); - FileObject zipFileObject = KettleVFS.getFileObject( zipFilename ); + FileObject zipFileObject = KettleVFS.getInstance( DefaultBowl.getInstance() ).getFileObject( zipFilename ); if ( zipFileObject.exists() ) { MessageBox box = new MessageBox( shell, SWT.YES | SWT.NO | SWT.CANCEL ); box @@ -6073,7 +6075,7 @@ public void exportAllFileRepository() { // Export the resources linked to the currently loaded file... // TopLevelResource topLevelResource = - ResourceUtil.serializeResourceExportInterface( + ResourceUtil.serializeResourceExportInterface( DefaultBowl.getInstance(), zipFilename, resourceExportInterface, (VariableSpace) resourceExportInterface, rep, metaStoreSupplier.get() ); String message = ResourceUtil.getExplanation( zipFilename, topLevelResource.getResourceName(), resourceExportInterface ); diff --git a/ui/src/main/java/org/pentaho/di/ui/spoon/delegates/SpoonTabsDelegate.java b/ui/src/main/java/org/pentaho/di/ui/spoon/delegates/SpoonTabsDelegate.java index 66fa4233230f..be13d8d90be0 100644 --- a/ui/src/main/java/org/pentaho/di/ui/spoon/delegates/SpoonTabsDelegate.java +++ b/ui/src/main/java/org/pentaho/di/ui/spoon/delegates/SpoonTabsDelegate.java @@ -409,9 +409,9 @@ public TabMapEntry findTabForTransformation( TransMeta trans ) throws KettleFile if ( entry != null && !entry.getTabItem().isDisposed() ) { if ( trans.getFilename() != null && entry.getFilename() != null ) { // If the entry has a file name it is the same as trans iff. they originated from the same files - FileObject entryFile = KettleVFS.getFileObject( entry.getFilename() ); + FileObject entryFile = KettleVFS.getInstance( trans.getBowl() ).getFileObject( entry.getFilename() ); if ( transFile == null ) { - transFile = KettleVFS.getFileObject( trans.getFilename() ); + transFile = KettleVFS.getInstance( trans.getBowl() ).getFileObject( trans.getFilename() ); } if ( entryFile.equals( transFile ) ) { return entry; diff --git a/ui/src/main/java/org/pentaho/di/ui/spoon/job/JobGraph.java b/ui/src/main/java/org/pentaho/di/ui/spoon/job/JobGraph.java index 4381f32ccd7a..83809a9f4f77 100644 --- a/ui/src/main/java/org/pentaho/di/ui/spoon/job/JobGraph.java +++ b/ui/src/main/java/org/pentaho/di/ui/spoon/job/JobGraph.java @@ -2521,7 +2521,8 @@ public void launchStuff() { protected void loadReferencedObject( JobEntryCopy jobEntryCopy, int index ) { try { Object referencedMeta = - jobEntryCopy.getEntry().loadReferencedObject( index, spoon.rep, spoon.getMetaStore(), jobMeta ); + jobEntryCopy.getEntry().loadReferencedObject( jobMeta.getBowl(), index, spoon.rep, spoon.getMetaStore(), + jobMeta ); if ( referencedMeta == null ) { // Compatible re-try for older plugins. referencedMeta = @@ -2588,7 +2589,7 @@ protected void loadReferencedObject( JobEntryCopy jobEntryCopy, int index ) { @SuppressWarnings( "deprecation" ) private Object compatibleJobEntryLoadReferencedObject( JobEntryInterface entry, int index, Repository rep, JobMeta jobMeta2 ) throws KettleException { - return entry.loadReferencedObject( index, spoon.rep, jobMeta ); + return entry.loadReferencedObject( jobMeta.getBowl(), index, spoon.rep, jobMeta ); } protected void openTransformation( JobEntryTrans entry, JobEntryCopy jobEntryCopy ) { @@ -2608,8 +2609,8 @@ protected void openTransformation( JobEntryTrans entry, JobEntryCopy jobEntryCop // Open the file or create a new one! // - if ( KettleVFS.fileExists( exactFilename ) ) { - launchTransMeta = new TransMeta( exactFilename ); + if ( KettleVFS.getInstance( jobMeta.getBowl() ).fileExists( exactFilename ) ) { + launchTransMeta = new TransMeta( jobMeta.getBowl(), exactFilename ); } else { launchTransMeta = new TransMeta(); } @@ -2638,7 +2639,7 @@ protected void openTransformation( JobEntryTrans entry, JobEntryCopy jobEntryCop boolean exists = spoon.rep.getTransformationID( exactTransname, repositoryDirectoryInterface ) != null; if ( !exists ) { - launchTransMeta = new TransMeta( null, exactTransname ); + launchTransMeta = new TransMeta( (String)null, exactTransname ); } else { launchTransMeta = spoon.rep.loadTransformation( exactTransname, spoon.rep.findDirectory( jobMeta @@ -2711,8 +2712,9 @@ public void openJob( JobEntryJob entry, JobEntryCopy jobEntryCopy ) { // Open the file or create a new one! // - if ( KettleVFS.fileExists( exactFilename ) ) { - launchJobMeta = new JobMeta( jobMeta, exactFilename, spoon.rep, spoon.getMetaStore(), null ); + if ( KettleVFS.getInstance( jobMeta.getBowl() ).fileExists( exactFilename ) ) { + launchJobMeta = new JobMeta( jobMeta.getBowl(), jobMeta, exactFilename, spoon.rep, spoon.getMetaStore(), + null ); } else { launchJobMeta = new JobMeta(); } @@ -3498,7 +3500,8 @@ public synchronized void startJob( JobExecutionConfiguration executionConfigurat if ( spoon.rep != null ) { runJobMeta = spoon.rep.loadJob( jobMeta.getName(), jobMeta.getRepositoryDirectory(), null, null ); } else { - runJobMeta = new JobMeta( null, jobMeta.getFilename(), null, jobMeta.getMetaStore(), null ); + runJobMeta = new JobMeta( jobMeta.getBowl(), null, jobMeta.getFilename(), null, jobMeta.getMetaStore(), + null ); } String spoonObjectId = UUID.randomUUID().toString(); diff --git a/ui/src/main/java/org/pentaho/di/ui/spoon/trans/TransGraph.java b/ui/src/main/java/org/pentaho/di/ui/spoon/trans/TransGraph.java index 9c188bbb2a1d..7f247d214aab 100644 --- a/ui/src/main/java/org/pentaho/di/ui/spoon/trans/TransGraph.java +++ b/ui/src/main/java/org/pentaho/di/ui/spoon/trans/TransGraph.java @@ -4495,7 +4495,8 @@ public void openMapping( StepMeta stepMeta, int index ) { } else { StepMetaInterface meta = stepMeta.getStepMetaInterface(); if ( !Utils.isEmpty( meta.getReferencedObjectDescriptions() ) ) { - referencedMeta = meta.loadReferencedObject( index, spoon.rep, spoon.getMetaStore(), transMeta ); + referencedMeta = meta.loadReferencedObject( transMeta.getBowl(), index, spoon.rep, spoon.getMetaStore(), + transMeta ); } } if ( referencedMeta == null ) { @@ -5064,7 +5065,7 @@ public Trans getTrans() { private Trans createLegacyTrans() { try { - return new Trans( transMeta, spoon.rep, transMeta.getName(), + return new Trans( transMeta.getBowl(), transMeta, spoon.rep, transMeta.getName(), transMeta.getRepositoryDirectory().getPath(), transMeta.getFilename(), transMeta); } catch ( KettleException e ) { diff --git a/ui/src/main/java/org/pentaho/di/ui/trans/step/BaseStreamingDialog.java b/ui/src/main/java/org/pentaho/di/ui/trans/step/BaseStreamingDialog.java index 55933e9472ba..9c832338f17d 100644 --- a/ui/src/main/java/org/pentaho/di/ui/trans/step/BaseStreamingDialog.java +++ b/ui/src/main/java/org/pentaho/di/ui/trans/step/BaseStreamingDialog.java @@ -342,7 +342,8 @@ protected void createNewSubtrans() { saved = spoonInstance.saveXMLFile( newSubTransMeta, false ); if ( saved ) { try { - path = getRelativePath( KettleVFS.getFileObject( newSubTransMeta.getFilename() ).toString() ); + path = getRelativePath( KettleVFS.getInstance( transMeta.getBowl() ) + .getFileObject( newSubTransMeta.getFilename() ).toString() ); } catch ( KettleFileException e ) { new ErrorDialog( shell, BaseMessages.getString( PKG, "BaseStreamingDialog.File.Save.Fail.Title" ), BaseMessages.getString( @@ -593,7 +594,7 @@ protected void populateSubSteps( Event event ) { private TransMeta getMappingMeta() throws KettleException { BaseStreamStepMeta baseMeta = (BaseStreamStepMeta) meta.clone(); updateMeta( baseMeta ); - return loadMappingMeta( baseMeta, getRepository(), getMetaStore(), transMeta ); + return loadMappingMeta( transMeta.getBowl(), baseMeta, getRepository(), getMetaStore(), transMeta ); } private Image getImage() { @@ -671,8 +672,8 @@ protected String getRepositoryRelativePath( String path ) { protected String getRelativePath( String filePath ) { String parentFolder = null; try { - parentFolder = - KettleVFS.getFileObject( transMeta.environmentSubstitute( transMeta.getFilename() ) ).getParent().toString(); + parentFolder = KettleVFS.getInstance( transMeta.getBowl() ) + .getFileObject( transMeta.environmentSubstitute( transMeta.getFilename() ) ).getParent().toString(); } catch ( Exception e ) { // Take no action } diff --git a/ui/src/main/java/org/pentaho/di/ui/trans/steps/csvinput/CsvInputDialog.java b/ui/src/main/java/org/pentaho/di/ui/trans/steps/csvinput/CsvInputDialog.java index ea7b66fd8c7d..5829278e404c 100644 --- a/ui/src/main/java/org/pentaho/di/ui/trans/steps/csvinput/CsvInputDialog.java +++ b/ui/src/main/java/org/pentaho/di/ui/trans/steps/csvinput/CsvInputDialog.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2022 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -897,7 +897,7 @@ private InputStreamReader getReader( final CsvInputMeta meta, final InputStream try { String filename = transMeta.environmentSubstitute( meta.getFilename() ); - FileObject fileObject = KettleVFS.getFileObject( filename ); + FileObject fileObject = KettleVFS.getInstance( transMeta.getBowl() ).getFileObject( filename ); if ( !( fileObject instanceof LocalFile ) ) { // We can only use NIO on local files at the moment, so that's what we // limit ourselves to. @@ -926,7 +926,7 @@ private InputStream getInputStream( final CsvInputMeta meta ) { try { final String filename = transMeta.environmentSubstitute( meta.getFilename() ); - final FileObject fileObject = KettleVFS.getFileObject( filename ); + final FileObject fileObject = KettleVFS.getInstance( transMeta.getBowl() ).getFileObject( filename ); if ( !( fileObject instanceof LocalFile ) ) { // We can only use NIO on local files at the moment, so that's what we // limit ourselves to. @@ -1034,7 +1034,7 @@ protected void updatePreview() { try { - meta.getFields( rowMeta, stepname, null, null, transMeta, repository, metaStore ); + meta.getFields( transMeta.getBowl(), rowMeta, stepname, null, null, transMeta, repository, metaStore ); TransMeta previewTransMeta = TransPreviewFactory.generatePreviewTransformation( transMeta, meta, stepname ); final Trans trans = new Trans( previewTransMeta ); diff --git a/ui/src/main/java/org/pentaho/di/ui/trans/steps/fileinput/text/TextFileCSVImportProgressDialog.java b/ui/src/main/java/org/pentaho/di/ui/trans/steps/fileinput/text/TextFileCSVImportProgressDialog.java index 276a39104b41..a65c623fed5c 100644 --- a/ui/src/main/java/org/pentaho/di/ui/trans/steps/fileinput/text/TextFileCSVImportProgressDialog.java +++ b/ui/src/main/java/org/pentaho/di/ui/trans/steps/fileinput/text/TextFileCSVImportProgressDialog.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2021 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -185,7 +185,7 @@ private String doScan( IProgressMonitor monitor, final boolean failOnParseError int nrfields = meta.inputFields.length; RowMetaInterface outputRowMeta = new RowMeta(); - meta.getFields( outputRowMeta, null, null, null, transMeta, null, null ); + meta.getFields( transMeta.getBowl(), outputRowMeta, null, null, null, transMeta, null, null ); // Remove the storage meta-data (don't go for lazy conversion during scan) for ( ValueMetaInterface valueMeta : outputRowMeta.getValueMetaList() ) { @@ -307,7 +307,7 @@ private String doScan( IProgressMonitor monitor, final boolean failOnParseError debug = "convert line #" + linenr + " to row"; } RowMetaInterface rowMeta = new RowMeta(); - meta.getFields( rowMeta, "stepname", null, null, transMeta, null, null ); + meta.getFields( transMeta.getBowl(), rowMeta, "stepname", null, null, transMeta, null, null ); // Remove the storage meta-data (don't go for lazy conversion during scan) for ( ValueMetaInterface valueMeta : rowMeta.getValueMetaList() ) { valueMeta.setStorageMetadata( null ); @@ -319,10 +319,11 @@ private String doScan( IProgressMonitor monitor, final boolean failOnParseError String escapeCharacter = transMeta.environmentSubstitute( meta.content.escapeCharacter ); Object[] r = TextFileInputUtils.convertLineToRow( log, new TextFileLine( line, fileLineNumber, null ), strinfo, null, 0, - outputRowMeta, convertRowMeta, FileInputList.createFilePathList( transMeta, meta.inputFiles.fileName, - meta.inputFiles.fileMask, meta.inputFiles.excludeFileMask, meta.inputFiles.fileRequired, meta - .inputFiles.includeSubFolderBoolean() )[0], rownumber, delimiter, enclosure, escapeCharacter, null, - new BaseFileInputAdditionalField(), null, null, false, null, null, null, null, null, failOnParseError ); + outputRowMeta, convertRowMeta, FileInputList.createFilePathList( transMeta.getBowl(), transMeta, + meta.inputFiles.fileName, meta.inputFiles.fileMask, meta.inputFiles.excludeFileMask, + meta.inputFiles.fileRequired, meta.inputFiles.includeSubFolderBoolean() )[0], + rownumber, delimiter, enclosure, escapeCharacter, null, new BaseFileInputAdditionalField(), null, null, + false, null, null, null, null, null, failOnParseError ); if ( r == null ) { errorFound = true; diff --git a/ui/src/main/java/org/pentaho/di/ui/trans/steps/getfilesrowscount/GetFilesRowsCountDialog.java b/ui/src/main/java/org/pentaho/di/ui/trans/steps/getfilesrowscount/GetFilesRowsCountDialog.java index 5a5bbb76551c..a08e9e735c47 100644 --- a/ui/src/main/java/org/pentaho/di/ui/trans/steps/getfilesrowscount/GetFilesRowsCountDialog.java +++ b/ui/src/main/java/org/pentaho/di/ui/trans/steps/getfilesrowscount/GetFilesRowsCountDialog.java @@ -819,7 +819,7 @@ public void widgetSelected( SelectionEvent e ) { try { GetFilesRowsCountMeta tfii = new GetFilesRowsCountMeta(); getInfo( tfii ); - FileInputList fileInputList = tfii.getFiles( transMeta ); + FileInputList fileInputList = tfii.getFiles( transMeta.getBowl(), transMeta ); String[] files = fileInputList.getFileStrings(); if ( files.length > 0 ) { diff --git a/ui/src/main/java/org/pentaho/di/ui/trans/steps/jobexecutor/JobExecutorDialog.java b/ui/src/main/java/org/pentaho/di/ui/trans/steps/jobexecutor/JobExecutorDialog.java index e51a6f305ee0..3c141f58bee5 100644 --- a/ui/src/main/java/org/pentaho/di/ui/trans/steps/jobexecutor/JobExecutorDialog.java +++ b/ui/src/main/java/org/pentaho/di/ui/trans/steps/jobexecutor/JobExecutorDialog.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2022 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -357,7 +357,7 @@ private void loadRepositoryJob( String transName, RepositoryDirectoryInterface r executorJobMeta.clearChanged(); } private void loadFileJob( String fname ) throws KettleException { - executorJobMeta = new JobMeta( transMeta.environmentSubstitute( fname ), repository ); + executorJobMeta = new JobMeta( transMeta.getBowl(), transMeta.environmentSubstitute( fname ), repository ); executorJobMeta.clearChanged(); } diff --git a/ui/src/main/java/org/pentaho/di/ui/trans/steps/ldifinput/LDIFInputDialog.java b/ui/src/main/java/org/pentaho/di/ui/trans/steps/ldifinput/LDIFInputDialog.java index e66fdb81c865..c37bdae7195f 100644 --- a/ui/src/main/java/org/pentaho/di/ui/trans/steps/ldifinput/LDIFInputDialog.java +++ b/ui/src/main/java/org/pentaho/di/ui/trans/steps/ldifinput/LDIFInputDialog.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -978,7 +978,7 @@ public void widgetSelected( SelectionEvent e ) { try { LDIFInputMeta tfii = new LDIFInputMeta(); getInfo( tfii ); - FileInputList fileInputList = tfii.getFiles( transMeta ); + FileInputList fileInputList = tfii.getFiles( transMeta.getBowl(), transMeta ); String[] files = fileInputList.getFileStrings(); if ( files != null && files.length > 0 ) { EnterSelectionDialog esd = @@ -1161,7 +1161,7 @@ private void get() { LDIFInputMeta meta = new LDIFInputMeta(); getInfo( meta ); - FileInputList inputList = meta.getFiles( transMeta ); + FileInputList inputList = meta.getFiles( transMeta.getBowl(), transMeta ); // Clear Fields Grid wFields.removeAll(); diff --git a/ui/src/main/java/org/pentaho/di/ui/trans/steps/loadfileinput/LoadFileInputDialog.java b/ui/src/main/java/org/pentaho/di/ui/trans/steps/loadfileinput/LoadFileInputDialog.java index 5327ca227824..51891647736f 100644 --- a/ui/src/main/java/org/pentaho/di/ui/trans/steps/loadfileinput/LoadFileInputDialog.java +++ b/ui/src/main/java/org/pentaho/di/ui/trans/steps/loadfileinput/LoadFileInputDialog.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -989,7 +989,7 @@ public void widgetSelected( SelectionEvent e ) { try { LoadFileInputMeta tfii = new LoadFileInputMeta(); getInfo( tfii ); - FileInputList fileInputList = tfii.getFiles( transMeta ); + FileInputList fileInputList = tfii.getFiles( transMeta.getBowl(), transMeta ); String[] files = fileInputList.getFileStrings(); if ( files != null && files.length > 0 ) { EnterSelectionDialog esd = new EnterSelectionDialog( shell, files, diff --git a/ui/src/main/java/org/pentaho/di/ui/trans/steps/mapping/MappingDialog.java b/ui/src/main/java/org/pentaho/di/ui/trans/steps/mapping/MappingDialog.java index a7c2d8444bf4..24ae712a0469 100644 --- a/ui/src/main/java/org/pentaho/di/ui/trans/steps/mapping/MappingDialog.java +++ b/ui/src/main/java/org/pentaho/di/ui/trans/steps/mapping/MappingDialog.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2022 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -410,7 +410,7 @@ private void loadRepositoryTrans( String transName, RepositoryDirectoryInterface } private void loadFileTrans( String fname ) throws KettleException { - mappingTransMeta = new TransMeta( transMeta.environmentSubstitute( fname ) ); + mappingTransMeta = new TransMeta( transMeta.getBowl(), transMeta.environmentSubstitute( fname ) ); mappingTransMeta.clearChanged(); } diff --git a/ui/src/main/java/org/pentaho/di/ui/trans/steps/parallelgzipcsv/ParGzipCsvInputDialog.java b/ui/src/main/java/org/pentaho/di/ui/trans/steps/parallelgzipcsv/ParGzipCsvInputDialog.java index 8e3039192a9c..8843a7284bf2 100644 --- a/ui/src/main/java/org/pentaho/di/ui/trans/steps/parallelgzipcsv/ParGzipCsvInputDialog.java +++ b/ui/src/main/java/org/pentaho/di/ui/trans/steps/parallelgzipcsv/ParGzipCsvInputDialog.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2019 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -754,7 +754,7 @@ private void getCSV() { String filename = transMeta.environmentSubstitute( meta.getFilename() ); - FileObject fileObject = KettleVFS.getFileObject( filename ); + FileObject fileObject = KettleVFS.getInstance( transMeta.getBowl() ).getFileObject( filename ); if ( !( fileObject instanceof LocalFile ) ) { // We can only use NIO on local files at the moment, so that's what we limit ourselves to. // diff --git a/ui/src/main/java/org/pentaho/di/ui/trans/steps/propertyinput/PropertyInputDialog.java b/ui/src/main/java/org/pentaho/di/ui/trans/steps/propertyinput/PropertyInputDialog.java index fe8ba432f1fd..80a967e15315 100644 --- a/ui/src/main/java/org/pentaho/di/ui/trans/steps/propertyinput/PropertyInputDialog.java +++ b/ui/src/main/java/org/pentaho/di/ui/trans/steps/propertyinput/PropertyInputDialog.java @@ -1113,7 +1113,7 @@ public void widgetSelected( SelectionEvent e ) { try { PropertyInputMeta tfii = new PropertyInputMeta(); getInfo( tfii ); - FileInputList fileInputList = tfii.getFiles( transMeta ); + FileInputList fileInputList = tfii.getFiles( transMeta.getBowl(), transMeta ); String[] files = fileInputList.getFileStrings(); if ( files.length > 0 ) { @@ -1278,7 +1278,7 @@ private void get() { PropertyInputMeta meta = new PropertyInputMeta(); getInfo( meta ); - FileInputList inputList = meta.getFiles( transMeta ); + FileInputList inputList = meta.getFiles( transMeta.getBowl(), transMeta ); if ( inputList.getFiles().size() > 0 ) { @@ -1643,7 +1643,7 @@ private void getSections() { try { getInfo( meta ); - FileInputList fileInputList = meta.getFiles( transMeta ); + FileInputList fileInputList = meta.getFiles( transMeta.getBowl(), transMeta ); if ( fileInputList.nrOfFiles() > 0 ) { // Check the first file diff --git a/ui/src/main/java/org/pentaho/di/ui/trans/steps/simplemapping/SimpleMappingDialog.java b/ui/src/main/java/org/pentaho/di/ui/trans/steps/simplemapping/SimpleMappingDialog.java index 81c6cd90f5a9..85f9b180c634 100644 --- a/ui/src/main/java/org/pentaho/di/ui/trans/steps/simplemapping/SimpleMappingDialog.java +++ b/ui/src/main/java/org/pentaho/di/ui/trans/steps/simplemapping/SimpleMappingDialog.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2022 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -373,7 +373,7 @@ private void loadRepositoryTrans( String transName, RepositoryDirectoryInterface private void loadFileTrans( String fname ) throws KettleException { - mappingTransMeta = new TransMeta( transMeta.environmentSubstitute( fname ) ); + mappingTransMeta = new TransMeta( transMeta.getBowl(), transMeta.environmentSubstitute( fname ) ); mappingTransMeta.clearChanged(); } diff --git a/ui/src/main/java/org/pentaho/di/ui/trans/steps/singlethreader/SingleThreaderDialog.java b/ui/src/main/java/org/pentaho/di/ui/trans/steps/singlethreader/SingleThreaderDialog.java index 4564db06dc57..ce1e4742d2fb 100644 --- a/ui/src/main/java/org/pentaho/di/ui/trans/steps/singlethreader/SingleThreaderDialog.java +++ b/ui/src/main/java/org/pentaho/di/ui/trans/steps/singlethreader/SingleThreaderDialog.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2022 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -509,7 +509,7 @@ private void loadRepositoryTrans( String transName, RepositoryDirectoryInterface } private void loadFileTrans( String fname ) throws KettleException { - mappingTransMeta = new TransMeta( transMeta.environmentSubstitute( fname ) ); + mappingTransMeta = new TransMeta( transMeta.getBowl(), transMeta.environmentSubstitute( fname ) ); mappingTransMeta.clearChanged(); } @@ -744,7 +744,8 @@ protected void getParameters( TransMeta mappingTransMeta ) { if ( mappingTransMeta == null ) { SingleThreaderMeta jet = new SingleThreaderMeta(); getInfo( jet ); - mappingTransMeta = SingleThreaderMeta.loadSingleThreadedTransMeta( jet, repository, transMeta ); + mappingTransMeta = SingleThreaderMeta.loadSingleThreadedTransMeta( transMeta.getBowl(), jet, repository, + transMeta ); } String[] parameters = mappingTransMeta.listParameters(); diff --git a/ui/src/main/java/org/pentaho/di/ui/trans/steps/ssh/SSHDialog.java b/ui/src/main/java/org/pentaho/di/ui/trans/steps/ssh/SSHDialog.java index 1de5071f3926..adfcf657502e 100644 --- a/ui/src/main/java/org/pentaho/di/ui/trans/steps/ssh/SSHDialog.java +++ b/ui/src/main/java/org/pentaho/di/ui/trans/steps/ssh/SSHDialog.java @@ -865,7 +865,7 @@ private void test() { Connection conn = null; try { conn = - SSHData.OpenConnection( + SSHData.OpenConnection( transMeta.getBowl(), servername, nrPort, username, password, wUseKey.getSelection(), keyFilename, passphrase, timeOut, transMeta, proxyhost, proxyport, proxyusername, proxypassword ); testOK = true; diff --git a/ui/src/main/java/org/pentaho/di/ui/trans/steps/textfileinput/TextFileCSVImportProgressDialog.java b/ui/src/main/java/org/pentaho/di/ui/trans/steps/textfileinput/TextFileCSVImportProgressDialog.java index 7b0cdc30da8f..dbe9a3ffea56 100644 --- a/ui/src/main/java/org/pentaho/di/ui/trans/steps/textfileinput/TextFileCSVImportProgressDialog.java +++ b/ui/src/main/java/org/pentaho/di/ui/trans/steps/textfileinput/TextFileCSVImportProgressDialog.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2021 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -186,7 +186,7 @@ private String doScan( IProgressMonitor monitor, final boolean failOnParseError int nrfields = meta.getInputFields().length; RowMetaInterface outputRowMeta = new RowMeta(); - meta.getFields( outputRowMeta, null, null, null, transMeta, null, null ); + meta.getFields( transMeta.getBowl(), outputRowMeta, null, null, null, transMeta, null, null ); // Remove the storage meta-data (don't go for lazy conversion during scan) for ( ValueMetaInterface valueMeta : outputRowMeta.getValueMetaList() ) { @@ -307,7 +307,7 @@ private String doScan( IProgressMonitor monitor, final boolean failOnParseError debug = "convert line #" + linenr + " to row"; } RowMetaInterface rowMeta = new RowMeta(); - meta.getFields( rowMeta, "stepname", null, null, transMeta, null, null ); + meta.getFields( transMeta.getBowl(), rowMeta, "stepname", null, null, transMeta, null, null ); // Remove the storage meta-data (don't go for lazy conversion during scan) for ( ValueMetaInterface valueMeta : rowMeta.getValueMetaList() ) { valueMeta.setStorageMetadata( null ); diff --git a/ui/src/main/java/org/pentaho/di/ui/trans/steps/transexecutor/TransExecutorDialog.java b/ui/src/main/java/org/pentaho/di/ui/trans/steps/transexecutor/TransExecutorDialog.java index 16357e91e9d7..3aff72382ecf 100644 --- a/ui/src/main/java/org/pentaho/di/ui/trans/steps/transexecutor/TransExecutorDialog.java +++ b/ui/src/main/java/org/pentaho/di/ui/trans/steps/transexecutor/TransExecutorDialog.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2022 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -356,7 +356,7 @@ private void loadRepositoryTrans( String transName, RepositoryDirectoryInterface } private void loadFileTrans( String fname ) throws KettleException { - executorTransMeta = new TransMeta( transMeta.environmentSubstitute( fname ), repository ); + executorTransMeta = new TransMeta( transMeta.getBowl(), transMeta.environmentSubstitute( fname ), repository ); executorTransMeta.clearChanged(); } diff --git a/ui/src/main/java/org/pentaho/di/ui/util/ImageUtil.java b/ui/src/main/java/org/pentaho/di/ui/util/ImageUtil.java index e63c2db0967b..5f369c2b9c67 100644 --- a/ui/src/main/java/org/pentaho/di/ui/util/ImageUtil.java +++ b/ui/src/main/java/org/pentaho/di/ui/util/ImageUtil.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -48,6 +48,7 @@ import org.eclipse.swt.graphics.PaletteData; import org.eclipse.swt.graphics.RGB; import org.eclipse.swt.widgets.Display; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.vfs.KettleVFS; public class ImageUtil { @@ -139,7 +140,7 @@ public static Image getImage( Display display, ClassLoader classLoader, String f public static Image getImage( Display display, String location ) { // TODO: find other instances of getImage (plugin, steps) and transition them to new model through an laf manager try { - InputStream is = KettleVFS.getInputStream( location ); + InputStream is = KettleVFS.getInstance( DefaultBowl.getInstance() ).getInputStream( location ); Image im = new Image( display, is ); is.close(); return im; diff --git a/ui/src/main/java/org/pentaho/di/ui/util/SwtSvgImageUtil.java b/ui/src/main/java/org/pentaho/di/ui/util/SwtSvgImageUtil.java index de07aeeb202a..09082abb4f6e 100644 --- a/ui/src/main/java/org/pentaho/di/ui/util/SwtSvgImageUtil.java +++ b/ui/src/main/java/org/pentaho/di/ui/util/SwtSvgImageUtil.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2002-2021 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2002-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -34,6 +34,7 @@ import org.eclipse.swt.graphics.GC; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.widgets.Display; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.Const; import org.pentaho.di.core.SwtUniversalImage; import org.pentaho.di.core.SwtUniversalImageBitmap; @@ -274,7 +275,7 @@ private static SwtUniversalImage loadFromBasedVFS( Display display, String locat */ private static SwtUniversalImage loadFromSimpleVFS( Display display, String location ) { try { - InputStream s = KettleVFS.getInputStream( location ); + InputStream s = KettleVFS.getInstance( DefaultBowl.getInstance() ).getInputStream( location ); if ( s == null ) { return null; } diff --git a/ui/src/test/java/org/pentaho/di/ui/i18n/MessagesSourceCrawlerTest.java b/ui/src/test/java/org/pentaho/di/ui/i18n/MessagesSourceCrawlerTest.java index 9f9de6f12c4b..7015cca98564 100644 --- a/ui/src/test/java/org/pentaho/di/ui/i18n/MessagesSourceCrawlerTest.java +++ b/ui/src/test/java/org/pentaho/di/ui/i18n/MessagesSourceCrawlerTest.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2019 by Hitachi Vantara : http://www.hitachivantara.com + * Copyright (C) 2019-2024 by Hitachi Vantara : http://www.hitachivantara.com * ******************************************************************************* * @@ -31,6 +31,7 @@ import org.junit.Test; import org.junit.rules.TemporaryFolder; import org.mockito.internal.verification.Times; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.logging.LogChannelInterface; import org.pentaho.di.core.vfs.KettleVFS; @@ -167,15 +168,15 @@ public void testCrawl() throws Exception { MessagesSourceCrawler messagesSourceCrawler = mock( MessagesSourceCrawler.class ); doNothing().when( messagesSourceCrawler ).crawlSourceDirectories(); - doNothing().when( messagesSourceCrawler ).crawlXmlFolders(); - doCallRealMethod().when( messagesSourceCrawler ).crawl(); + doNothing().when( messagesSourceCrawler ).crawlXmlFolders( DefaultBowl.getInstance() ); + doCallRealMethod().when( messagesSourceCrawler ).crawl( DefaultBowl.getInstance() ); // Test - messagesSourceCrawler.crawl(); + messagesSourceCrawler.crawl( DefaultBowl.getInstance() ); // Check results verify( messagesSourceCrawler ).crawlSourceDirectories(); - verify( messagesSourceCrawler ).crawlXmlFolders(); + verify( messagesSourceCrawler ).crawlXmlFolders( DefaultBowl.getInstance() ); } @Test @@ -292,7 +293,8 @@ private FileObject createFileObjectFromResource( String resourceName ) throws Ex InputStream fileScenarios = getClass().getResourceAsStream( resourceName ); FileUtils.copyInputStreamToFile( fileScenarios, tempFile ); - FileObject folder = KettleVFS.getFileObject( temporaryFolder.getRoot().getAbsolutePath() ); + FileObject folder = KettleVFS.getInstance( DefaultBowl.getInstance() ) + .getFileObject( temporaryFolder.getRoot().getAbsolutePath() ); FileObject[] javaFiles = folder.findFiles( new FileSelector() { @Override public boolean traverseDescendents( FileSelectInfo info ) throws Exception { diff --git a/ui/src/test/java/org/pentaho/di/ui/spoon/SharedObjectSyncUtilTest.java b/ui/src/test/java/org/pentaho/di/ui/spoon/SharedObjectSyncUtilTest.java index 099e84621dbf..47a8335512da 100644 --- a/ui/src/test/java/org/pentaho/di/ui/spoon/SharedObjectSyncUtilTest.java +++ b/ui/src/test/java/org/pentaho/di/ui/spoon/SharedObjectSyncUtilTest.java @@ -41,6 +41,7 @@ import org.pentaho.di.base.AbstractMeta; import org.pentaho.di.cluster.ClusterSchema; import org.pentaho.di.cluster.SlaveServer; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.KettleEnvironment; import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.core.exception.KettleXMLException; @@ -108,7 +109,8 @@ public void setUp() { @After public void tearDown() throws Exception { - FileObject sharedObjectsFile = KettleVFS.getFileObject( SHARED_OBJECTS_FILE ); + FileObject sharedObjectsFile = KettleVFS.getInstance( DefaultBowl.getInstance() ) + .getFileObject( SHARED_OBJECTS_FILE ); if ( sharedObjectsFile.exists() ) { sharedObjectsFile.delete(); } diff --git a/ui/src/test/java/org/pentaho/di/ui/trans/steps/fileinput/text/TextFileInputDialogTest.java b/ui/src/test/java/org/pentaho/di/ui/trans/steps/fileinput/text/TextFileInputDialogTest.java index d0a87bf9e93a..f80640459f8c 100644 --- a/ui/src/test/java/org/pentaho/di/ui/trans/steps/fileinput/text/TextFileInputDialogTest.java +++ b/ui/src/test/java/org/pentaho/di/ui/trans/steps/fileinput/text/TextFileInputDialogTest.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2016-2021 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2016-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -43,6 +43,7 @@ import org.junit.ClassRule; import org.junit.Test; import org.pentaho.di.core.BlockingRowSet; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.KettleEnvironment; import org.pentaho.di.core.Props; import org.pentaho.di.core.RowSet; @@ -110,13 +111,14 @@ private static Field getPropsField() { @Test public void testMinimalWidth_PDI_14253() throws Exception { final String virtualFile = "ram://pdi-14253.txt"; - KettleVFS.getFileObject( virtualFile ).createFile(); + KettleVFS.getInstance( DefaultBowl.getInstance() ).getFileObject( virtualFile ).createFile(); final String content = "r1c1, r1c2\nr2c1 , r2c2 "; ByteArrayOutputStream bos = new ByteArrayOutputStream(); bos.write( content.getBytes() ); - OutputStream os = KettleVFS.getFileObject( virtualFile ).getContent().getOutputStream(); + OutputStream os = KettleVFS.getInstance( DefaultBowl.getInstance() ) + .getFileObject( virtualFile ).getContent().getOutputStream(); IOUtils.copy( new ByteArrayInputStream( bos.toByteArray() ), os ); os.close(); @@ -135,7 +137,8 @@ public void testMinimalWidth_PDI_14253() throws Exception { TextFileInputData data = new TextFileInputData(); data.files = new FileInputList(); - data.files.addFile( KettleVFS.getFileObject( virtualFile ) ); + data.files.addFile( KettleVFS.getInstance( DefaultBowl.getInstance() ) + .getFileObject( virtualFile ) ); data.outputRowMeta = new RowMeta(); data.outputRowMeta.addValueMeta( new ValueMetaString( "col1" ) ); @@ -168,7 +171,7 @@ public void testMinimalWidth_PDI_14253() throws Exception { Object[] row2 = output.getRowImmediate(); assertRow( row2, "r2c1", "r2c2" ); - KettleVFS.getFileObject( virtualFile ).delete(); + KettleVFS.getInstance( DefaultBowl.getInstance() ).getFileObject( virtualFile ).delete(); } diff --git a/ui/src/test/java/org/pentaho/di/ui/trans/steps/fileinput/text/TextFileInputTextCSVImportProgressDialogTest.java b/ui/src/test/java/org/pentaho/di/ui/trans/steps/fileinput/text/TextFileInputTextCSVImportProgressDialogTest.java index 83e7663d6398..1cb6c5ff1648 100644 --- a/ui/src/test/java/org/pentaho/di/ui/trans/steps/fileinput/text/TextFileInputTextCSVImportProgressDialogTest.java +++ b/ui/src/test/java/org/pentaho/di/ui/trans/steps/fileinput/text/TextFileInputTextCSVImportProgressDialogTest.java @@ -29,6 +29,8 @@ import org.junit.BeforeClass; import org.junit.Test; import org.mockito.MockedStatic; +import org.pentaho.di.core.bowl.Bowl; +import org.pentaho.di.core.bowl.DefaultBowl; import org.pentaho.di.core.KettleClientEnvironment; import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.core.fileinput.FileInputList; @@ -77,6 +79,7 @@ public void setup() { shell = mock( Shell.class ); meta = mock( TextFileInputMeta.class ); transMeta = mock( TransMeta.class ); + when( transMeta.getBowl() ).thenReturn( DefaultBowl.getInstance() ); monitor = mock( IProgressMonitor.class ); content = mock( TextFileInputMeta.Content.class ); baseFileInputFiles = mock( BaseFileInputFiles.class ); @@ -183,12 +186,12 @@ private void initiateVariables( String fileContent, BaseFileField[] baseFileFiel setInternalState( baseFileInputFiles, "excludeFileMask", new String[]{} ); setInternalState( baseFileInputFiles, "fileRequired", new String[]{} ); when( baseFileInputFiles.includeSubFolderBoolean() ).thenReturn( new boolean[] {} ); - when( FileInputList.createFilePathList( any( VariableSpace.class ), + when( FileInputList.createFilePathList( any( Bowl.class), any( VariableSpace.class ), any( String[].class ), any( String[].class ), any( String[].class ), any( String[].class ), any( boolean[].class ) ) ).thenReturn( new String[]{""} ); //meta when( meta.getInputFields() ).thenReturn( baseFileFields ); - doCallRealMethod().when( meta ).getFields( any(), any(), any(), any(), any(), any(), any() ); + doCallRealMethod().when( meta ).getFields( any(), any(), any(), any(), any(), any(), any(), any() ); setInternalState( meta, "inputFields", baseFileFields ); setInternalState( meta, "content", content ); when( meta.clone() ).thenReturn( meta ); diff --git a/ui/src/test/java/org/pentaho/di/ui/trans/steps/textfileinput/TextFileInputCSVImportProgressDialogTest.java b/ui/src/test/java/org/pentaho/di/ui/trans/steps/textfileinput/TextFileInputCSVImportProgressDialogTest.java index 21a630a9969e..e70e3120b3f1 100644 --- a/ui/src/test/java/org/pentaho/di/ui/trans/steps/textfileinput/TextFileInputCSVImportProgressDialogTest.java +++ b/ui/src/test/java/org/pentaho/di/ui/trans/steps/textfileinput/TextFileInputCSVImportProgressDialogTest.java @@ -153,7 +153,7 @@ private void initiateVariables( String fileContent, TextFileInputField[] inputFi reader = new InputStreamReader( new ByteArrayInputStream( fileContent.getBytes( StandardCharsets.UTF_8 ) ) ); //meta when( meta.getInputFields() ).thenReturn( inputFileFields ); - doCallRealMethod().when( meta ).getFields( any(), any(), any(), any(), any(), any(), any() ); + doCallRealMethod().when( meta ).getFields( any(), any(), any(), any(), any(), any(), any(), any() ); setInternalState( meta, "inputFields", inputFileFields ); when( meta.hasHeader() ).thenReturn( true ); when( meta.getNrHeaderLines() ).thenReturn( 1 );