« Back to University of Vienna - OMILAB

Calling the ALL2ABL service within ADOxx

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Dear ADOxx-team,

I am wondering whether and how it would be possible to call the ALL2ABL service within a local installation of ADOxx.
Any help would be highly appreciated.
Thank you.

RE: Calling the ALL2ABL service within ADOxx
Answer
8/5/14 6:44 AM as a reply to Anonymous.
All development services provided at http://www.adoxx.org/live/adoxx-development-tools are made available in 2 interaction formats: as a web-application hosted by ADOxx.org including a user interface and as a web-service client using SOAP-based messaging mechanisms to be used for programmatical interaction. The clients for interacting with the web-service is implemented in JAVA and provided as an open development project.

To use the ALL2ABL Service please consider the development project in the SVN at http://www.adoxx.org/live/all2abl-soap-client (or directly at https://www.adoxx.org/svn/devtools/ALL2ABLSOAPClient/). This project contains the client source code, the binary JAR file as well as an integration example for AdoScript (AdoScript functionality to call the client implemented in JAVA from AdoScript). The sample AdoScript can be found online at https://www.adoxx.org/svn/devtools/ALL2ABLSOAPClient/AdoScript%20Integration/silentTransformJAVA.asc and below:

 1# create the path variables for the transformation
 2# HINT: Replace PATH accordingly
 3SET pathToJar: ("\"%PATH2JAR%\\ALL2ABLJavaClient.jar\"")
 4SET pathToAll: ("\"%PATH2ALL%\\specification.all\"")
 5SET patchToMain: ("org.adoxx.all2abl.service.webservice.javaclient.ALL2ABLJavaClient")
 6# create the input values for the transformation
 7SET version: ("\"v40\"")
 8SET allFileDescription: ("\"allDescriptiveText\"")
 9# create the SYSTEM call
10SET calling: ("java -cp " +pathToJar+ " " +patchToMain+ " " +pathToAll+ " " +version+ " " +allFileDescription)
11
12# create a temporary file for batch transformation
13CC "AdoScript" GET_TEMP_FILENAME
14SETL sBatchFile: (filename + ".bat")
15CC "AdoScript" FWRITE file: (sBatchFile) text: (calling)
16# run transformation
17SYSTEM (sBatchFile)
18# delete temporary batch file
19CC "AdoScript" DELETE_FILES (sBatchFile)

This AdoScript based implementation has been provided by Domenik Bork from the University of Vienna! Thank you for sharing your code snipplet with the community! Feel free to discuss/update this idea/implementation here or directly with him!

RE: Calling the ALL2ABL service within ADOxx
Answer
8/5/14 7:00 AM as a reply to Wilfrid Utz.
Works perfect.
Thank you very much!!

RE: Calling the ALL2ABL service within ADOxx
Answer
8/6/14 5:37 AM as a reply to Wilfrid Utz.
As an add-on: Is there any chance to include the .jar file into the working directory of ADOxx, i.e., into the abl file of the method while creating the installer so that the functionality of calling the ALL2ABL jar is executable on any machine that has installed the modeling toolkit or imported the jar file?
Is the solution to copy the file from the ADOxx databse to the working directory during initialisation or is there a "smarter" way?

Thank you very much in advance!

RE: Calling the ALL2ABL service within ADOxx
Answer
8/6/14 6:43 AM as a reply to Anonymous.
The integration of the JAR in the library can be achieved through the proposal in your questions.
1) Import of files to the library
The import of the JAR in the library can be achieved by adding the file to the library following the video tutorial available online here: https://www.youtube.com/watch?v=ILI1FPyRMuI

2) Running files from the
Since the execution of the JAR using the AdoScript SYSTEM call needs to be done from the local file system, an "initialization" step is needed here, to prepare the file system accordingly. Different approaches are possible:

a) Copy the JAR file into the temporary folder of the Windows system

This approach would mean that during each export, the JAR is written to the file system, executed, and then deleted again. The advantage is that always the most up-to-date executable is used during execution and no modification of the ADOxx installation is performed.

1CC "AdoScript" GET_TEMP_FILENAME
2#--> RESULT filename:strValue
3SETL sJARFilePath:(filename + ".jar")
4CC "AdoSript" FILE_COPY from: ("db:\\jarFileToCopy.jar") to: (sJARFilePath)
5# perform SYSTEM call, all interaction needed
6# ...
7# clean up temp folder
8CC "AdoScript" FILE_DELETE file: (sJARFilePath)

b) Copy the JAR during the initialization task
This approach would copy the file ones during the initialization. Specific consideration is needed for updates (another startup of the tool) to clean/replace/ignore the already copied file. The same snipplet as of above can be used.

 1ON_EVENT "AppInitialized" {
 2  # returns the ADOxx installation directory
 3  CC "Application" GET_PATH append-delimiter
 4  SETL sJARFilePath: (path + "jarFile.jar")
 5  # clean up, if existing
 6  CC "AdoScript" FILE_EXISTS file: (sJARFilePath)
 7  IF (exists) {
 8    CC "AdoScript" FILE_DELETE file: (sJARFilePath)
 9  }
10  # copy JAR to installation directory
11  CC "AdoSript" FILE_COPY from: ("db:\\jarFileToCopy.jar") to: (sJARFilePath)
12}

Further details on the AdoScript commands and events used in the code fragments are available in the AdoScript Online Documentation: http://www.adoxx.org/live/adoscript-documentation

c) Integration in the outcome product
During compilation of the ADOxx-based product, the JAR can be added to the installation routine, and will be part of the product release. Using the product development service available online at http://www.adoxx.org/live/autopdp-packaging-service, add-on programs can be uploaded to be integrated in the build job.