Just get a handle on it via SSJS or Java I would guess. No different the LotusScript really.
Create a new var for the foreign database and then once it's instantiated use the replicate method.
Something like this maybe:
var myDB:NotesDatabase = session.getDatabase(database.getServer(), "foreignDB.nsf");
Dave