Mercurial > mxd2map
comparison src/java/de/intevation/mxd/ArcGISInitializer.java @ 43:ef7ca23c4233
Added comments, done some code styling and removed typos.
author | Raimund Renkert <rrenkert@intevation.de> |
---|---|
date | Fri, 15 Apr 2011 15:44:54 +0200 |
parents | c51376f8e24c |
children | 163d474165b0 |
comparison
equal
deleted
inserted
replaced
42:395307e8b7ee | 43:ef7ca23c4233 |
---|---|
10 /** | 10 /** |
11 * Initializes the ArcGIS Engine and Objects. | 11 * Initializes the ArcGIS Engine and Objects. |
12 * | 12 * |
13 * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a> | 13 * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a> |
14 */ | 14 */ |
15 public class ArcGISInitializer{ | 15 public class ArcGISInitializer { |
16 | 16 |
17 //Member | 17 /** |
18 * Private member. | |
19 */ | |
18 private AoInitialize aoInit; | 20 private AoInitialize aoInit; |
19 private String engineInstallDir = ""; | 21 private String engineInstallDir = ""; |
20 | 22 |
21 | 23 |
22 //Methods | |
23 /** | 24 /** |
24 * Init ArcGIS Java Objects. | 25 * Init ArcGIS Java Objects. |
25 */ | 26 */ |
26 public boolean initArcGIS () throws IOException{ | 27 public boolean initArcGIS () |
28 throws IOException { | |
27 EngineInitializer.initializeEngine(); | 29 EngineInitializer.initializeEngine(); |
28 aoInit = new AoInitialize(); | 30 aoInit = new AoInitialize(); |
29 engineInstallDir = System.getenv("AGSENGINEJAVA"); | 31 engineInstallDir = System.getenv("AGSENGINEJAVA"); |
30 return true; | 32 return true; |
31 } | 33 } |
32 | 34 |
33 /** | 35 /** |
34 * Init ArcGIS License. | 36 * Init ArcGIS License. |
35 */ | 37 */ |
36 public void initArcGISLicenses() throws IOException{ | 38 public void initArcGISLicenses() |
39 throws IOException { | |
37 if(aoInit.isProductCodeAvailable | 40 if(aoInit.isProductCodeAvailable |
38 (esriLicenseProductCode.esriLicenseProductCodeEngine) == | 41 (esriLicenseProductCode.esriLicenseProductCodeEngine) == |
39 esriLicenseStatus.esriLicenseAvailable){ | 42 esriLicenseStatus.esriLicenseAvailable) { |
40 aoInit.initialize | 43 aoInit.initialize |
41 (esriLicenseProductCode.esriLicenseProductCodeEngine); | 44 (esriLicenseProductCode.esriLicenseProductCodeEngine); |
42 } | 45 } |
43 else if (aoInit.isProductCodeAvailable | 46 else if (aoInit.isProductCodeAvailable |
44 (esriLicenseProductCode.esriLicenseProductCodeArcView) == | 47 (esriLicenseProductCode.esriLicenseProductCodeArcView) == |
45 esriLicenseStatus.esriLicenseAvailable){ | 48 esriLicenseStatus.esriLicenseAvailable) { |
46 aoInit.initialize | 49 aoInit.initialize |
47 (esriLicenseProductCode.esriLicenseProductCodeArcView); | 50 (esriLicenseProductCode.esriLicenseProductCodeArcView); |
48 } | 51 } |
49 else{ | 52 else { |
50 System.err.println("Engine Runtime or ArcView license not initialized."); | 53 System.err.println("Engine Runtime or ArcView" + |
54 " license not initialized."); | |
51 System.err.println("Exiting application."); | 55 System.err.println("Exiting application."); |
52 System.exit(-1); | 56 System.exit(-1); |
53 } | 57 } |
54 } | 58 } |
55 | 59 |
56 /** | 60 /** |
57 * Shutdown the ArcGIS Objects. | 61 * Shutdown the ArcGIS Objects. |
58 */ | 62 */ |
59 public boolean shutdownArcGIS() throws IOException{ | 63 public boolean shutdownArcGIS() |
60 if(aoInit != null){ | 64 throws IOException { |
65 if(aoInit != null) { | |
61 aoInit.shutdown(); | 66 aoInit.shutdown(); |
62 return true; | 67 return true; |
63 } | 68 } |
64 else{ | 69 else { |
65 return false; | 70 return false; |
66 } | 71 } |
67 } | 72 } |
68 | 73 |
69 /** | 74 /** |
70 * Get the ArcGIS Engine Directory. | 75 * Get the ArcGIS Engine Directory. |
71 */ | 76 */ |
72 public String getEngineDirectory() throws Exception{ | 77 public String getEngineDirectory() |
73 if(engineInstallDir == "") | 78 throws Exception { |
79 if(engineInstallDir == "") { | |
74 throw new Exception("Call initArcGIS() first!"); | 80 throw new Exception("Call initArcGIS() first!"); |
75 else | 81 } |
82 else { | |
76 return engineInstallDir; | 83 return engineInstallDir; |
84 } | |
77 } | 85 } |
78 } | 86 } |