Sparx Systems Forum
Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: analia on February 05, 2013, 01:45:35 am
-
In order to have an easily accessible daily backup of our DBMS repository we would like to have a batch process that automatically transfers the DMBS repository to an .eap.
Any suggestions on how to do this?
Thank you very much for your help.
-
Have a look in the project inteface ProjectTransfer method.
q.
-
In version 10 you can access Project Transfer via Tools>Data Management>Project Transfer. In the dialog select DBMS to EAP and fill in the appropriate info in the fields.
Note that EAP files are really just MS Access so if you have a really big model you may start hitting limits of Access. You can look up limits of MS Access on Google.
Hope that helps. :)
-
You can write a small program to
- Open the (DBMS) repository
- Transfer to .eap file using the ProjectTransfer method as suggested by qwerty
- Close the (DBMS) repository
And then you can schedule that program to run every night.
Should be about 10 to 50 lines of code.
Geert
-
Had to do this as part of my daily html generator. It was far faster to transfer and generate HTML off the local copy. Here is an exceprt in C#.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using EA;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
EA.Repository repo = new EA.Repository();
// PARAMETERS
String conn = "Enterprise_Architect --- ACCESS STRING";
String output_directory = "C:\\TEMP\\ea_temp\\";
String project_directory = "aamc_lwmotf\\";
String username = "username";
String password = "good pass";
//Transfer DBMS to EAP
repo.OpenFile2(conn, username, password);
String eapfile = output_directory + project_directory + "model.eap";
String eaplog = output_directory + project_directory + "transfer.log";
repo.GetProjectInterface().ProjectTransfer(conn, eapfile, eaplog);
repo.CloseFile();
}}}
-
Thank you very much to you all for your help.
We wrote a program as indicated and managed to automatically transfer a small DBMS repository to .eap.
When we transfer our production environment though, we get a pop up window reporting a "transfer error". When transferring manually we just checked "Ignore All errors". Is there a way to tell the automation interface to do that?
-
I guess not and you should report a bug (link bottom right). I haven't noticed such an "Ignore all errors" options in the transfer. Does it pop up after a first error? However, I guess it's in no way a good idea to ignore errors. The transfer should run without any. Else I'd expect the target to be defect in some way.
q.
-
I tried to write a similiar script to transfer from .eap to .eap but I get the following error in the transfer log file:
Data Transfer Failed due to any of the following reasons
1. Source File is not existing
2. Target File is already existing
3. Target File is not an EAP File because Target should be an EAP in AI
What is strange is that I was able to perform the transfer -- using the exact same source and target files --- using the EA client application
Here is the C# code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using EA;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
EA.Repository repo = new EA.Repository();
EA.Package package = null;
String mySourceFile = "C:\\TEMP\\MyFirst.eap";
String myTargetFile = "C:\\TEMP\\TargetFile.eap";
String myLogFile = "C:\\TEMP\\MyFirstTransfer.log";
repo.GetProjectInterface().ProjectTransfer(mySourceFile, myTargetFile, myLogFile);
}
}
}
Any suggestions would be much appreciated.
Ed K.
-
My guess would be reason number two.
q.
-
That was it! Thank you very much Q.
What confused me was that the EA application requires that the target file exists before you do the transfer.
Thanks again.
Ed
-
Typical EAUI. If you issue this very command via the GUI (Tools/Data Management/Project Transfer) the target must exist and will be overwritten. The API just creates a new EAP. Orthogonality?
I wonder what would happen if you transfer to a RDBMS instead of an EAP.
q.
[edit] Here's the help:In automation, the target file [highlight]does not have to exist[/highlight]; the file path is enough. Enterprise Architect creates a new, empty Base.EAP file and transfers the source project into it.
Obviously this is wrong wording. It should read [highlight]must not exist[/highlight]