Mercurial > dive4elements > gnv-client
comparison gnv-artifacts/src/main/java/de/intevation/gnv/utils/MapfileGenerator.java @ 621:567216b56983
Added MapfileGenerator stub and MapfileGenerator calls after writing and removing shapefiles.
gnv-artifacts/trunk@692 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Wed, 17 Feb 2010 09:40:15 +0000 |
parents | |
children | 89aca25642d6 |
comparison
equal
deleted
inserted
replaced
620:f668c881f45a | 621:567216b56983 |
---|---|
1 package de.intevation.gnv.utils; | |
2 | |
3 import org.apache.log4j.Logger; | |
4 | |
5 | |
6 /** | |
7 * @author Ingo Weinzierl (ingo.weinzierl@intevation.de) | |
8 */ | |
9 public class MapfileGenerator | |
10 extends Thread | |
11 { | |
12 | |
13 public static final String MAPFILE_PATH = | |
14 "/artifact-database/map-generator/mapfile/@path"; | |
15 | |
16 protected static final long SLEEPTIME = 10 * 1000L; // 10 seconds | |
17 | |
18 private static Logger logger = Logger.getLogger(MapfileGenerator.class); | |
19 | |
20 private static MapfileGenerator instance; | |
21 | |
22 private boolean lock[]; | |
23 | |
24 | |
25 | |
26 private MapfileGenerator() { | |
27 lock = new boolean[1]; | |
28 } | |
29 | |
30 | |
31 public static void main(String[] args) { | |
32 // TODO Implement me | |
33 } | |
34 | |
35 | |
36 public static synchronized MapfileGenerator getInstance() { | |
37 if (instance == null) { | |
38 instance = new MapfileGenerator(); | |
39 instance.setDaemon(true); | |
40 instance.start(); | |
41 } | |
42 | |
43 return instance; | |
44 } | |
45 | |
46 | |
47 public void update() { | |
48 synchronized (lock) { | |
49 lock[0] = true; | |
50 lock.notify(); | |
51 } | |
52 } | |
53 | |
54 | |
55 public void run() { | |
56 try { | |
57 for (;;) { | |
58 synchronized (lock) { | |
59 while (!lock[0]) { | |
60 lock.wait(SLEEPTIME); | |
61 } | |
62 | |
63 lock[0] = false; | |
64 } | |
65 | |
66 logger.info("Update mapfile for MapServer."); | |
67 generate(); | |
68 } | |
69 } | |
70 catch (InterruptedException ie) { | |
71 } | |
72 } | |
73 | |
74 | |
75 private void generate() { | |
76 logger.debug("IMPLEMENT ME"); | |
77 } | |
78 } | |
79 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8: |