Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Viking

Pages: 1 [2] 3 4 ... 15
16
Hi,
since release 13 EA supports so called Hypbrid Scripting (see: http://www.sparxsystems.com/resources/user-guides/automation/hybrid-scripting.pdf).
The benefit is: You can generate, build, deploy and run by EA your little Java Program which can access a Repository. Maybe it's of use.
Regards, Helmut
Thank you very much for the hint. I did not know.

17
Hi,
The dll needs to be on your PATH AND the eaapi.jar needs to be on your Java classpath. It looks like a config issue so check both are OK.
Regards,
Jon.
I imported the eaapi.jar into eclipse. I think it is the link to the dll. Path in windows or in eclipse? I have to check this.

18
Hi,
I want to access EA from Eclipse using java. I turned into 32 bit.

I am using following code:

package com.sparxea.explore;
import org.sparx.Repository;
public class Explore {
   public static void main(String[] args) {
      String db = "EntArchDB_PROD --- DBType=1;Connect=Provider=SQLOLEDB;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=EntArchDB;Data Source=ldbisprd1,4042;LazyLoad=1;";      
      // System.out.println("Start Connection!");
      System.loadLibrary("SSJavaCOM");
      Repository rep = new Repository();
      rep.OpenFile(db);
   }
}

I am not allowed to put the SSJavaCOM.dll into the system-folder. So I used an Environment variable: %ProgramFiles(x86)%\Sparx Systems\EA\Java API

I get following Exception from "new Repository()", because the dll cannot be found:

java.lang.Exception: Failed to construct object. Error code: 0x80040154
   at org.sparx.Repository.comConstructor(Native Method)
   at org.sparx.Repository.<init>(Repository.java:190)

Any ideas? Is the reason the environment variable? Is there an alternative?

Many thanks in advance, V.

19
Thank you, DarrenDickens. Good points.

Java and JavaScript are not similar.

21
Hello together,

I am looking for possibilities to access the Sparx API from "outside". I want to run "scripts" in Java, Visual Basic or something else (that works) and manipulate content in EA via the Sparx API. So to say I want to run a script which also could be excecuted inside EA. Most welcome would be Java inside Eclipse as container.

The database for our EA environment is MSSQL-server. I saw a lot of possiblities to access EA (e.g. Scripting Enterprise Architect, from there I used the subject-title). But these possibilities are EAP-based and sometimes I have the impression, that they are outdated (e.g. I did not find a complete example using Java API).

Are there any summaries available?

Many thanks in advance, V.



22
You can also run VBScript outside of EA, but then you'll have to create the Repository as I showed you here.
When running inside EA it is added to the context for you by EA.
The code in VBA or VB is almost exactly the same.

Geert

Thank you, Geert. I get an Microsoft VBScript runtime error "ActiveX component can't create object: 'EA.Repository'". That's why I was asking, if I have to link EA.tlb (or something else) and if can access EA via VBS from a DOS-box.

Another question is, if I can access EA from Ecplise and Java. I read an anwser from Simon and my understanding is that he said, that the EA-API is not accessible from Eclipse.

Best regards, V.

23
Do you want to use VB, or VBScript?

The key to connecting to the running instance in a VBScript is to use the following:

Code: [Select]
    dim repository
    set repository = CreateObject("EA.Repository")

An example of VB(A) using EA is to be found in my Excel importer: https://bellekens.com/2015/10/24/simple-vba-excel-to-ea-importer-v4/

Geert

I want to access EA from outside. My understanding is that VBScript does only make sense for Scripting inside EA. We are not allowed using MS Script Debuger. That's why we are looking for alternatives.

24
Hi,

I refer to http://sparxsystems.com/forums/smf/index.php?topic=5268.0.

I never used Visual Basic in my life. I want to access EA via VB. I do not want to install a tool. So I want to run it (with cscript) from a DOS-box.

The document mentioned above says that I have to use "Enterprise Architect Object Model" resp. EA.tlb. Can I link this library inside the script or as part of the cscript-command. Probably this is more a VB question. I hope that somebody can tell me the solution anyway.

Many thanks in advance, V.

25
How is EA setup on your machine? -> it's getting installed via DSM.
Is it installed locally? -> yes.
What operating system are you running? -> Win 7 Enterprise
You mentioned "The script works fine in another environment". What other environment? -> private computer with Win 10.
Was this an installation of EA on another PC? -> yes.
Any differences you are aware of between these installations? Win 7 vs Win 10. The EA with problems has been installed by
What version of EA is installed? -> V13
Is it the same as yours? -> Yes.
Were they both installed the same way? -> No. IT department (with problems) vs. me.
For example - if your EA was setup using the "Zero Configuration Client" method described on the following page, scripting will not work. See: http://sparxsystems.com/enterprise_architect_user_guide/13.0/introduction/zero_config_support.html -> no

Isn't there any way to find out how EA has been installed and which features has been installed?

Another solution would be to replace MS Script Debugger with a supported component.

26
Any ideas ?  :)

27
Usage of println() would probably depend on the Javascript engine that you are using. The engine that EA uses is based on Mozilla SpiderMonkey (version 1.8 I think), which doesn't seem to know about this function.

The equivilent in EA would be to call Session.Output().  E.g. Session.Output("test");

If you like the style of having println() in your code though, you could just write a little wrapper function like this:

Code: [Select]
function println(message)
{
Session.Output(message);
}

EA still says "Session undefined".

[78862640]      Stack recording threshold set to 3 frames
[78862716]      Default Directory is C:\Program Files (x86)\Sparx Systems\EA
[78862716]      Agent dll found: C:\Program Files (x86)\Sparx Systems\EA\vea\x86\SSScriptAgent32.DLL
[78862716]      Default Directory is C:\Program Files (x86)\Sparx Systems\EA
[78862717]      Agent: Started
[78862768]      Session is undefined

28
Hi, because I am not allowed to use MS Script debugger (out of MS-support), I wanted to switch to Javascript. To test the environment I tried a simple script (see below), but EA says, that println is not defined. The script works fine in another environment.

function main() {
       println('Test');
}
main();

So my question is, what are the prerequisites of JS? Can it be disabled and how? Many thanks in advance, V.

29
Automation Interface, Add-Ins and Tools / Re: Data Modeling
« on: May 15, 2017, 09:13:39 pm »
1) When you create a table, before you can create columns you need to tell EA what DBMS you are modelling. EA is not opening a database connection, it's just trying to find out what you're doing.
2) The list of available types will depend on the DBMS you are modelling. That's why you need to let EA know.
3) Right-click a package in the Project Browser, Add Diagram, Select From: Extended, Diagram Types: Data Modeling. If Extended isn't available, open the MDG Technologies dialog and enable "Core Extensions".
Thank you very much. Very helpful.

30
Automation Interface, Add-Ins and Tools / Re: Data Modeling
« on: May 15, 2017, 09:12:36 pm »
This is really a database model or at a pinch a physical data model.  The answer to your question all depends on what sort of data model you want to produce.  You can easily produce a conceptual data model using a class diagram.
Yes, at the beginning I wanted to switch to UML class model. Than I found Data Modeling and liked the elements like Table and Function. Actually it is based on UML Class Diagram. What would you prefer, Data Modeling or UML Class and why?

Pages: 1 [2] 3 4 ... 15