cancel
Showing results forĀ 
ShowĀ Ā onlyĀ  | Search instead forĀ 
Did you mean:Ā 

File Import From Java

DMHolling
Super Contributor

I access the repository via the Java API and connect via a MegaApplication instance and creating the programmatic variables down the causality chain MegaApplication -> MegaEnvironments -> MegaEnvironment -> new MegaTransaction (oMegaTransactions.create()) -> MegaDatabase -> MegaRoot (oMegaDatabase.open()). I set the environment administrator parameters with  valid user (Mega) and password prior to creating a new transaction.

 

Prior to running fileImport I do the following :

 

oMegaRoot.megaRollback();

oMegaRoot.close();

oMegaTransaction.abort();

 

then recreate the oMegaDatabase variable on which I invoke the fileImport method on the MegaDatabase variable. I receive the following error:

 

MEGA Error 0x80020009(MegaDatabase.Import) : The 'Mega' user cannot access the 'Sandbox' repository in 'Administration'

 

If I do not create a new transaction, then the programme works without problem using the same user, password, repository etc.

 

I've tried all kinds of variations including a) invoking fileImport whilst the original transaction is still active, b) closing the transaction without running a rollback, c) closing the root prior to aborting the transaction, and d) recreating a new MegaEnvironment instance or reusing the original one, all of which result in different errors that are not present if I run the import without using a transaction (which is not ideal as the repository is locked for other users in this case).

 

Can someone enlighten me, explain the assumptions behind the collective programmatic use of the MegaRoot, MegaTransaction, MegaEnvironment and MegaApplication for the correct use of fileImport, or point to where the correct order of functions is properly documented?

 

Thanks in advance.

 

0 Replies