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

JAVA API

yrudloff
MEGA
MEGA

Hi,

 

I saw that some functions of MEGA JAVA API are deprecated when developing in MEGA 2009 SP5.

Considering this, I have 3 questions:

  - Are these functions going to be deleted in some coming version of MEGA ?

  - Is the new Java API the standard for java development in MEGA ?

  - Where can I found some new documentation on the new API to be used in the development ?

 

Thanks in advance for your help,

Yannick RUDLOFF
7 Replies

ColruytTeam
Honored Contributor

Hi Jerome,

We are planning to write our future Macros in Java instead of VBScript. 

We have performance issues in VBScript Macros with huge business logic. Does the development of these macrs on java improves the performance?

 

We have :

1. Macros that run on on some events (meta commands)

2. Macros that run for 1 or 2 minutes (for ex:  bulk users creation)

3. Macros that run for more than 5 to 6 hours (Website generation scripts)

 

Which is more preferabale language to above three types of scripts.

From your above reply I have few questions:

1. Is java convinient only for external developments outside Mega (developing external tools connecting to Mega from outside) ?

2. In which scenarios you suggest Java development?

 

Thanks in advance.

 

Venky

ColruytTeam.

 

Colruyt Team

BDelperier
Contributor

I saw into your screenshot that you don't have the JavaDoc into your Eclipse.

That's so sad Smiley Tongue

 

Here are the steps to have it :

 

1)      Change the javadoc ZIP file provided by mega  (into your Mega installation foolder/java/doc/mj_api.doc.zip) because you need  to have files 'index.html' and package-list at the root of the ZIP file.

See attachments "mj_api.init.zip" and "mj_api.zip".

 

2)      Set the JavaDoc for the jar "mj_api.jar" into Eclipse

=> Right click on the jar and then Properties,

=> Select the menu JavaDoc Location

=> Select the button "JavaDoc in archive"

=> set the zip file location « mj_api.zip »

=> click on OK once all is OK.

 steps

 

 

Once all is done :

 result.png

Easier for development

 

Ok, so i will check the Mega Javadoc to find all the deprecated methods and their replacement.

 

Thanks for helping

Yannick RUDLOFF

I can confirm the Method Item is deprecated for MegaCollection in Java code

It is recommended to use the method   #Get() instead

 

See Javadoc provided by MEGA

Page Interface MegaCollection

Method item

item(java.lang.Object index)
          Deprecated. Since Mega 2009 SP5. Use #get()

Jerome

OK I will confirm if the Method Item on GetCollection is deprecated and what is the recommended code.

 

Note that the search of an object from a string is NOT reliable.

It is highly recommended to search from an object ID (idabs) or the object iself

 

 

Code example (VB script)

 

NOT recommended

 

Set lApp = GetCollection("~MrUiM9B5iyM0[Application]")
Set oApp = lApp.Item("MyApplication")
Print oApp.Name

 Recommended

 

Set lApp = GetCollection("~MrUiM9B5iyM0[Application]")
Set oApp = lApp.Item("~hWt27kGeF5TL[MyApplication]")
Print oApp.Name

 

Jerome

Hi Jérôme,

 

Thanks for your quick answer.

 

Ok for the recommandation of Java over VB. 

For the deprecated methods, you will find in attachments a script I made for a client, which worked fine in 2009 SP4.

But since the migration from SP4 to SP5CP4, some of the methods are said to be deprecated.

 

My final question is to know if i have to migrate also these scripts to a newer version of the Java API, and if i have, where i can found some information about it.

 

Thank you

Yannick RUDLOFF

jhorber
MEGA
MEGA

Hi Yannick

 

Regarding your questions 

 

Are these functions going to be deleted in some coming version of MEGA ?

--> Yes. These methods/functions may not be available in future versions of MEGA

This is why it is not recommended to used them any longer

 

Is the new Java API the standard for java development in MEGA ?

--> As you probably know Visual Basic 6.0 that was often used in the past is not longer  supported by Microsoft.

MEGA Script APIs can be used in multiple contexts (Java, VB Net, VB script, VBA., Javascript...)

MEGA will focus on Java Development environment rather that Visual .Net

It is therefore recommended use Java development environment for significant development projects.

 

Where can I found some new documentation on the new API to be used in the development ?

--> Please specify the API function that you are thinking about and which is deprecated?

Jerome