Mercurial > mxd2map
annotate src/java/de/intevation/mxd/Converter.java @ 106:609c234e8e23
merged with reimunds changes
author | Stephan Holl <stephan.holl@intevation.de> |
---|---|
date | Tue, 07 Jun 2011 15:50:43 +0200 |
parents | c285ed08b72c |
children | 39957898c694 |
rev | line source |
---|---|
33
c51376f8e24c
Separated converter components into packages.
Raimund Renkert <rrenkert@intevation.de>
parents:
28
diff
changeset
|
1 package de.intevation.mxd; |
24
c0060abb7457
Added source directory and an initial entry class for a MXD converter tool.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
2 |
25
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
24
diff
changeset
|
3 import java.io.File; |
55
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
4 import java.io.FileInputStream; |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
5 import java.io.BufferedInputStream; |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
6 import java.util.Properties; |
25
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
24
diff
changeset
|
7 |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
24
diff
changeset
|
8 import org.apache.log4j.Logger; |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
24
diff
changeset
|
9 import org.apache.log4j.PropertyConfigurator; |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
24
diff
changeset
|
10 |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
24
diff
changeset
|
11 import java.net.MalformedURLException; |
24
c0060abb7457
Added source directory and an initial entry class for a MXD converter tool.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
12 |
33
c51376f8e24c
Separated converter components into packages.
Raimund Renkert <rrenkert@intevation.de>
parents:
28
diff
changeset
|
13 import de.intevation.mxd.reader.IReader; |
c51376f8e24c
Separated converter components into packages.
Raimund Renkert <rrenkert@intevation.de>
parents:
28
diff
changeset
|
14 import de.intevation.mxd.reader.MXDReader; |
41
60ed2164035a
Introduced MapScript writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
34
diff
changeset
|
15 import de.intevation.mxd.writer.IWriter; |
60ed2164035a
Introduced MapScript writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
34
diff
changeset
|
16 import de.intevation.mxd.writer.MapScriptWriter; |
24
c0060abb7457
Added source directory and an initial entry class for a MXD converter tool.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
17 /** |
c0060abb7457
Added source directory and an initial entry class for a MXD converter tool.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
18 * The entry point of the MXD converter tool. |
c0060abb7457
Added source directory and an initial entry class for a MXD converter tool.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
19 * |
c0060abb7457
Added source directory and an initial entry class for a MXD converter tool.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
20 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> |
c0060abb7457
Added source directory and an initial entry class for a MXD converter tool.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
21 */ |
c0060abb7457
Added source directory and an initial entry class for a MXD converter tool.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
22 public class Converter { |
c0060abb7457
Added source directory and an initial entry class for a MXD converter tool.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
23 |
25
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
24
diff
changeset
|
24 /** |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
24
diff
changeset
|
25 * The logging is done via Log4j. To configure the logging |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
24
diff
changeset
|
26 * a file 'log4j.properties' is search in the configuration |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
24
diff
changeset
|
27 * directory. |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
24
diff
changeset
|
28 */ |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
24
diff
changeset
|
29 public static final String LOG4J_PROPERTIES = "log4j.properties"; |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
24
diff
changeset
|
30 |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
24
diff
changeset
|
31 /** |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
24
diff
changeset
|
32 * |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
24
diff
changeset
|
33 * The path of the configuration directory. |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
24
diff
changeset
|
34 */ |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
24
diff
changeset
|
35 public static final String CONFIG_PATH = System.getProperty("config.dir", |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
24
diff
changeset
|
36 "conf"); |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
24
diff
changeset
|
37 |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
24
diff
changeset
|
38 |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
24
diff
changeset
|
39 /** |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
24
diff
changeset
|
40 * The logger used in this class. |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
24
diff
changeset
|
41 */ |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
24
diff
changeset
|
42 private static Logger logger; |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
24
diff
changeset
|
43 |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
24
diff
changeset
|
44 static { |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
24
diff
changeset
|
45 configureLogging(); |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
24
diff
changeset
|
46 logger = Logger.getLogger(Converter.class); |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
24
diff
changeset
|
47 } |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
24
diff
changeset
|
48 |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
24
diff
changeset
|
49 |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
24
diff
changeset
|
50 /** |
55
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
51 * Entrypoint for the application. |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
52 */ |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
53 public static void main(String[] args) { |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
54 try{ |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
55 String mxdfile = ""; |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
56 String mapfile = ""; |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
57 String maptemplate = ""; |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
58 int ndx = 0; |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
59 if (args.length > 0) { |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
60 if (args[0].equals("-mxd") && args.length >= 2) { |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
61 mxdfile = args[1]; |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
62 ndx = 2; |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
63 } |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
64 } |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
65 if (args.length >= ndx + 2) { |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
66 if (args[ndx].equals("-map")) { |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
67 mapfile = args[ndx+1]; |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
68 ndx += 2; |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
69 } |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
70 } |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
71 if (args.length >= ndx + 2) { |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
72 if (args[ndx].equals("-template")) { |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
73 maptemplate = args[ndx+1]; |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
74 ndx += 2; |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
75 } |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
76 } |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
77 |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
78 if(mxdfile.equals("")) { |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
79 try { |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
80 mxdfile = readProperty("mxd"); |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
81 } |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
82 catch(Exception e) { |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
83 e.printStackTrace (); |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
84 } |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
85 } |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
86 if(mapfile.equals("")) { |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
87 try { |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
88 mapfile = readProperty("map"); |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
89 } |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
90 catch(Exception e) { |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
91 e.printStackTrace (); |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
92 } |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
93 } |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
94 if(maptemplate.equals("")) { |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
95 try { |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
96 maptemplate = readProperty("map-template"); |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
97 } |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
98 catch(Exception e) { |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
99 e.printStackTrace (); |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
100 } |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
101 } |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
102 |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
103 IReader reader = new MXDReader(); |
86
e19c5eb43099
Instantiate the mapscript writer before loading the MXD file.
Raimund Renkert <rrenkert@intevation.de>
parents:
55
diff
changeset
|
104 IWriter writer = new MapScriptWriter(maptemplate, mapfile); |
e19c5eb43099
Instantiate the mapscript writer before loading the MXD file.
Raimund Renkert <rrenkert@intevation.de>
parents:
55
diff
changeset
|
105 |
55
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
106 reader.init(); |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
107 reader.setFilename(mxdfile); |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
108 reader.read(); |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
109 |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
110 writer.write(reader.getMapDocument()); |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
111 reader.shutdown(); |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
112 } |
86
e19c5eb43099
Instantiate the mapscript writer before loading the MXD file.
Raimund Renkert <rrenkert@intevation.de>
parents:
55
diff
changeset
|
113 catch(Exception e) { |
55
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
114 e.printStackTrace(); |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
115 } |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
116 } |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
117 |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
118 private static String readProperty (String key) |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
119 throws Exception { |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
120 Properties properties = new Properties(); |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
121 BufferedInputStream stream = |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
122 new BufferedInputStream( |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
123 new FileInputStream("converter.properties") |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
124 ); |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
125 properties.load(stream); |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
126 stream.close(); |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
127 return properties.getProperty(key); |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
128 } |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
129 /** |
25
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
24
diff
changeset
|
130 * Trys to load the Log4j configuration |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
24
diff
changeset
|
131 * from ${config.dir}/log4j.properties. |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
24
diff
changeset
|
132 */ |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
24
diff
changeset
|
133 public static final void configureLogging() { |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
24
diff
changeset
|
134 File configDir = new File(CONFIG_PATH); |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
24
diff
changeset
|
135 File propFile = new File(configDir, LOG4J_PROPERTIES); |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
24
diff
changeset
|
136 if (propFile.isFile() && propFile.canRead()) { |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
24
diff
changeset
|
137 try { |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
24
diff
changeset
|
138 PropertyConfigurator.configure(propFile.toURI().toURL()); |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
24
diff
changeset
|
139 } |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
24
diff
changeset
|
140 catch (MalformedURLException mue) { |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
24
diff
changeset
|
141 mue.printStackTrace(System.err); |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
24
diff
changeset
|
142 } |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
24
diff
changeset
|
143 } |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
24
diff
changeset
|
144 } |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
24
diff
changeset
|
145 |
24
c0060abb7457
Added source directory and an initial entry class for a MXD converter tool.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
146 } |
c0060abb7457
Added source directory and an initial entry class for a MXD converter tool.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
147 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |