Author Topic: open a Repository with the Java API  (Read 3695 times)

HorstKargl

  • EA Novice
  • *
  • Posts: 6
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
open a Repository with the Java API
« on: September 15, 2008, 11:30:02 pm »
hi,

I use the eaapi.jar to access the EA repository with Java. I did the configuration as described in the help file:
http://www.sparxsystems.com.au/EAUserGuide/index.html?setup.htm

However, when I try to acces an existing model I always get null for the requested elements. For instance the following code do not deliver a collections for authors and for the models:
         ....
         org.sparx.Repository r = new org.sparx.Repository();
         boolean opened = r.OpenFile("E:\\eaTest.eap");
         Collection<Author> authors = r.GetAuthors();
         Collection<org.sparx.Package> models = r.GetModels();
         ....

Has anyone  a suggestion what I have done wrong?

PS: the eaTest.EAP contains a root package with subpackages and two authors!

thx, horst

jkorman

  • EA User
  • **
  • Posts: 99
  • Karma: +0/-0
    • View Profile
Re: open a Repository with the Java API
« Reply #1 on: September 16, 2008, 02:18:46 am »
Horst, Are you checking to ensure that you actually did open the file

Code: [Select]
boolean opened = r.OpenFile("E:\\eaTest.eap");
if(opened) {
   // do stuff
}

That problem has been seen before.

Jim

HorstKargl

  • EA Novice
  • *
  • Posts: 6
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: open a Repository with the Java API
« Reply #2 on: September 16, 2008, 07:08:01 am »
yes, for sure!
I have debugged the code and and the variable "opened" was true.
Furthermore, I have tried some other methodes from the Repository object r. For instance:

         System.out.println("Instance GUID: "+r.GetInstanceGUID());
         boolean isSecurity = r.GetIsSecurityEnabled();

Both methodes work well, so far I can see.



HorstKargl

  • EA Novice
  • *
  • Posts: 6
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: open a Repository with the Java API
« Reply #3 on: September 16, 2008, 07:23:43 am »
... naybe there is somthing wrong with my configuration!?
I use Eclipe 3.3.0 (EclipseEurope). The eaapi.jar is included as external Jar in my eclipse project. The SSJavaCOM.dll is in my system32 directory.


jkorman

  • EA User
  • **
  • Posts: 99
  • Karma: +0/-0
    • View Profile
Re: open a Repository with the Java API
« Reply #4 on: September 16, 2008, 07:49:51 am »
I am using both Europa and Ganymede with Java 1.6 using  EA 7.1 b832 and have not had any problems.

I also include the eaapi.jar as an external jar in the project. I do keep the SSJavaCOM.dll in my JAVA_HOME/bin directory. You may want to check to ensure that the eaapi.jar and the "dll" are the same version. I have my doubts whether that is the problem because other bad stuff seems to happen if they are out of sync.

Have you tried to point at the supplied EAExample.eap to see what happens?

Jim

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8083
  • Karma: +118/-20
    • View Profile
Re: open a Repository with the Java API
« Reply #5 on: September 16, 2008, 07:58:38 am »
It sounds like a problem that we had with the Java API early in 7.1.  Try again after upgrading to the latest build.

HorstKargl

  • EA Novice
  • *
  • Posts: 6
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: open a Repository with the Java API
« Reply #6 on: September 16, 2008, 08:19:33 pm »
thx a lot  ;)

The problem was the Version of the eaapi.jar and SSJavaCOM.dll

The problems are solved with the new files from build 832.