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

File Import From Java

MEGA Partner

File Import From Java

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 ( 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 :






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.


Tags (2)