Show in Frame No Frame
Up Previous Next Title Page Contents Search

5.1.1 Visual Debugging with Java

As explained in Section 2.6, visual debugging uses the MetaEdit+ API to access the models during the application execution. To make this possible, a few additions on the code generator side are required. First we need the following three additions to ensure that we have a working connection to the API and the required information to make the animation calls:
1)Master init: initializes the variable holding a port on the MetaEditAPI SOAP service
2)AbstractWatchApplication constructor: makes an MEOop reference for this graph
3)AbstractWatchApplication addStateOop: makes an MEOop reference for this state object

->The MEOop mentioned above is a data type for a variable holding a reference to a model instance in MetaEdit+. For more information about API-specific data types and the API in general, please refer to Section 8 in ‘MetaEdit+ Workbench User’s Guide’.

To make the actual animation calls to MetaEdit+, a further set of three additions are needed:
4)AbstractWatchApplication handleEvent: handles the event of moving to a new state, calls animate
5)AbstractWatchApplication animate: calls Master animate with the graph and state MEOop
6)Master animate: calls port.animate

These are the modifications required for the generated Java code. However, the Autobuild process itself also requires a few modifications. To be able to establish the connection with MetaEdit+ API, two things are needed: a Web Service Description Language (WSDL) file that defines the interface for the available API commands, and a running API server at the MetaEdit+ end. Both of these needs are fulfilled by the ‘_prebuild for Java: API’ subgenerator by internally executing a few MetaEdit+ start-up commands. It will first use saveWSDL: to write out the WSDL file, then ensure that the API server is running by executing stopAPI and startAPI.

Finally, the build process must be changed to ensure that we link in the SOAP framework that will interface the Java code with the MetaEdit+ API. The makeWatch.bat file is augmented with commands that take care of building the SOAP interface for Java from the generated WSDL file using the Apache Xerces2 XML parser and Apache Axis SOAP library, as shown in Listing 3.
if "%cd%"=="" set cd=..
set wsdlFile="%cd%\MetaEditAPI.wsdl"
cd /D reports\WatchModels\src\
@if exist *.class del *.class
@del ..\bin\com\metacase\API\*.class
 
set classpath=C:\Java\axis-1_4\lib\*;C:\Java\xerces-2_12_2\*;.
 
"C:\Program Files\Java\jdk-25\bin\java" org.apache.axis.wsdl.WSDL2Java -p com.metacase.API %wsdlFile%
@echo on
 
"C:\Program Files\Java\jdk-25\bin\javac" -d ..\bin com\metacase\API\*.java
@cd /D reports\WatchModels\src\
@if exist *.class del *.class
@echo on
"C:\Program Files\Java\jdk-25\bin\javac" -d ..\bin @javaFiles
@cd ..\bin
"C:\Program Files\Java\jdk-25\bin\javaw" com.metacase.watch.generated._WatchModels
exit

Listing 3. makeWatch.bat for visual debugging


Show in Frame No Frame
Up Previous Next Title Page Contents Search