When creating a new repository in Kettle using the Java SDK, at one point we need to connect to it. So we would have code like (here in Scala code):

repositories.addDatabase(databaseMeta)

val repositoryMeta = new KettleDatabaseRepositoryMeta("KettleDatabaseRepository", repositoryName, repositoryDescription, databaseMeta)
repositories.addRepository(repositoryMeta)
repositories.writeData()
val newrepository = new KettleDatabaseRepository()
newrepository.init(repositoryMeta)
newrepository.connectionDelegate.connect(true, true)

For some reason I can only get it to work when using this statement:

newrepository.connectionDelegate.connect(true, true)

If I use the following statement instead

newrepository.connect("admin", "admin")

I get the error:

Error connecting to the repository!
[info] No repository exists on the specified connection.




I am confused, as I would find it more natural just to call new repository.connect. I have no idea what connectionDelegate does and the JavaDoc is not really helping here as
it does not at all offer a description of that member.

Please advise

I am using Kettle 6.1 towards a PostgreSQL database.