Mercurial > mxd2map
annotate src/java/de/intevation/mxd/Converter.java @ 67:5ed9e720b6cd
Read the hash symbol in the hash line symbol reader.
author | Raimund Renkert <rrenkert@intevation.de> |
---|---|
date | Wed, 25 May 2011 15:48:55 +0200 |
parents | f0c02ff120d6 |
children | e19c5eb43099 |
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.IOException; |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
24
diff
changeset
|
4 import java.io.File; |
55
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
5 import java.io.FileInputStream; |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
6 import java.io.BufferedInputStream; |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
7 import java.util.Properties; |
25
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
24
diff
changeset
|
8 |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
24
diff
changeset
|
9 import org.apache.log4j.Logger; |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
24
diff
changeset
|
10 import org.apache.log4j.PropertyConfigurator; |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
24
diff
changeset
|
11 |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
24
diff
changeset
|
12 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
|
13 |
33
c51376f8e24c
Separated converter components into packages.
Raimund Renkert <rrenkert@intevation.de>
parents:
28
diff
changeset
|
14 import de.intevation.mxd.reader.IReader; |
c51376f8e24c
Separated converter components into packages.
Raimund Renkert <rrenkert@intevation.de>
parents:
28
diff
changeset
|
15 import de.intevation.mxd.reader.MXDReader; |
41
60ed2164035a
Introduced MapScript writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
34
diff
changeset
|
16 import de.intevation.mxd.writer.IWriter; |
60ed2164035a
Introduced MapScript writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
34
diff
changeset
|
17 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
|
18 /** |
c0060abb7457
Added source directory and an initial entry class for a MXD converter tool.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
19 * 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
|
20 * |
c0060abb7457
Added source directory and an initial entry class for a MXD converter tool.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
21 * @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
|
22 */ |
c0060abb7457
Added source directory and an initial entry class for a MXD converter tool.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
23 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
|
24 |
25
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
24
diff
changeset
|
25 /** |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
24
diff
changeset
|
26 * 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
|
27 * 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
|
28 * directory. |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
24
diff
changeset
|
29 */ |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
24
diff
changeset
|
30 public static final String LOG4J_PROPERTIES = "log4j.properties"; |
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 * |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
24
diff
changeset
|
34 * The path of the configuration directory. |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
24
diff
changeset
|
35 */ |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
24
diff
changeset
|
36 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
|
37 "conf"); |
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 /** |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
24
diff
changeset
|
41 * The logger used in this class. |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
24
diff
changeset
|
42 */ |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
24
diff
changeset
|
43 private static Logger logger; |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
24
diff
changeset
|
44 |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
24
diff
changeset
|
45 static { |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
24
diff
changeset
|
46 configureLogging(); |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
24
diff
changeset
|
47 logger = Logger.getLogger(Converter.class); |
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 |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
24
diff
changeset
|
51 /** |
55
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
52 * Entrypoint for the application. |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
53 */ |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
54 public static void main(String[] args) { |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
55 try{ |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
56 String mxdfile = ""; |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
57 String mapfile = ""; |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
58 String maptemplate = ""; |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
59 int ndx = 0; |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
60 if (args.length > 0) { |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
61 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
|
62 mxdfile = args[1]; |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
63 ndx = 2; |
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 } |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
66 if (args.length >= ndx + 2) { |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
67 if (args[ndx].equals("-map")) { |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
68 mapfile = args[ndx+1]; |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
69 ndx += 2; |
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 } |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
72 if (args.length >= ndx + 2) { |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
73 if (args[ndx].equals("-template")) { |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
74 maptemplate = args[ndx+1]; |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
75 ndx += 2; |
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 |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
79 if(mxdfile.equals("")) { |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
80 try { |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
81 mxdfile = readProperty("mxd"); |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
82 } |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
83 catch(Exception e) { |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
84 e.printStackTrace (); |
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 } |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
87 if(mapfile.equals("")) { |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
88 try { |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
89 mapfile = readProperty("map"); |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
90 } |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
91 catch(Exception e) { |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
92 e.printStackTrace (); |
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 } |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
95 if(maptemplate.equals("")) { |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
96 try { |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
97 maptemplate = readProperty("map-template"); |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
98 } |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
99 catch(Exception e) { |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
100 e.printStackTrace (); |
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 |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
104 IReader reader = new MXDReader(); |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
105 reader.init(); |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
106 reader.setFilename(mxdfile); |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
107 reader.read(); |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
108 |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
109 IWriter writer = new MapScriptWriter(maptemplate, mapfile); |
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 } |
f0c02ff120d6
Read filenames from properties file or commandline arguments.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
113 catch(IOException e) { |
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 : |