Application Startup and Shutdown

www.altova.com このトピックを印刷 前のページ 1つ上のレベル 次のページ

ホーム >  プログラマーの レファレンス > Application API > Overview > Programming Languages > Java >

Application Startup and Shutdown

The code listings below show how the application can be started up and shut down.

 

 

Application startup

Before starting up the application, the appropriate classes must be imported (see below).

 

01 // Access general JAVA-COM bridge classes

02 import com.altova.automation.libs.*;

03

04 // Access StyleVision Java-COM bridge

05 import com.altova.automation.StyleVision.*;

06 import com.altova.automation.StyleVision.Enums.ENUMApplicationStatus;

07

08 /**

09  * A simple example that starts the COM server and performs a View operations on it.

10  * Feel free to extend.

11  */

12 public class RunStyleVision

13 {

14   public static void main(String[] args)

15   {

16     // An instance of the application.

17     Application stylevision = null;

18

19     // Instead of COM error-handling, use Java exception mechanism.

20     try

21     {

22       // Start StyleVision as COM server.

23       stylevision = new Application();

24      

25       ENUMApplicationStatus status = ENUMApplicationStatus.eApplicationRunning;

26       do{

27         // Check the application status

28         status = stylevision.getStatus();

29         System.out.println("status : " + status + "\n");

30       } while (status != ENUMApplicationStatus.eApplicationRunning);

31

32       // COM servers start up invisible, so we make the server visible

33       stylevision.setVisible(true);

34      

35 ...

36     }

37   }  

38 }

39

 

 

 

Application shutdown

The application can be shut down as shown below.

 

1 {

2       // Make sure that StyleVision can shut down properly.

3       if (stylevision != null)

4         stylevision.dispose();

5

6       // Since the COM server was made visible and still is visible, it will keep running

7       // and needs to be closed manually.

8       System.out.println("Now close StyleVision!");

9 }

 


(C) 2019 Altova GmbH