14 |
import dk.daoas.fulddaekning.BoundingBox.BoundingBoxException; |
import dk.daoas.fulddaekning.BoundingBox.BoundingBoxException; |
15 |
|
|
16 |
public class Lookup { |
public class Lookup { |
17 |
|
|
18 |
|
static final String CONFIG_FILENAME = "fulddaekning.properties"; |
19 |
|
|
20 |
static int max_workers; |
static int max_workers; |
21 |
static boolean verbose; |
static boolean verbose; |
22 |
|
|
23 |
|
static boolean rename_tables; |
24 |
|
static String distributor; |
25 |
|
|
26 |
static SafeProperties conf; |
static SafeProperties conf; |
27 |
static Logger logger = Logger.getLogger( Lookup.class.toString() ); |
static Logger logger = Logger.getLogger( Lookup.class.toString() ); |
28 |
|
|
161 |
|
|
162 |
public static void main(String[] args) throws Exception { |
public static void main(String[] args) throws Exception { |
163 |
|
|
164 |
File confFile = new File("fulddaekning.properties"); |
File confFile = new File( CONFIG_FILENAME ); |
165 |
if (! confFile.exists() ) { |
if (! confFile.exists() ) { |
166 |
logger.warning("Config file not found"); |
logger.warning("Config file not found: " + CONFIG_FILENAME); |
167 |
System.exit(1); |
System.exit(1); |
168 |
} |
} |
169 |
|
|
176 |
verbose = Boolean.parseBoolean( conf.getSafeProperty("VERBOSE") ); |
verbose = Boolean.parseBoolean( conf.getSafeProperty("VERBOSE") ); |
177 |
logger.info("Starting with VERBOSE:" + verbose); |
logger.info("Starting with VERBOSE:" + verbose); |
178 |
|
|
179 |
|
rename_tables = Boolean.parseBoolean( conf.getSafeProperty("RENAMETABLES") ); |
180 |
|
logger.info("Starting with RENAMETABLES:" + rename_tables); |
181 |
|
|
182 |
|
distributor = conf.getSafeProperty("DISTRIBUTOR"); |
183 |
|
distributor = distributor.toUpperCase(); |
184 |
|
Constants.init(distributor); |
185 |
|
|
186 |
|
|
187 |
Database db = new Database(conf); |
Database db = new Database(conf); |
188 |
|
|
189 |
db.resetResultTable(); |
|
190 |
|
|
191 |
|
|
192 |
|
|
197 |
logger.info("Finder postnumre"); |
logger.info("Finder postnumre"); |
198 |
List<Integer> postnumre = db.hentPostnumre(); |
List<Integer> postnumre = db.hentPostnumre(); |
199 |
|
|
200 |
|
// Først validerer vi BBox på alle postnummre, for at undgå fuldt stop midt i beregningen |
201 |
|
for(Integer postnr : postnumre) { // |
202 |
|
logger.info("Validerer BBox for " + postnr); |
203 |
|
BoundingBox bbox = db.getBoundingbox(postnr); |
204 |
|
bbox.validateBbox(); |
205 |
|
} |
206 |
|
|
207 |
|
|
208 |
|
//pre-check er ok - reset tmp tabel og start søgningen |
209 |
|
db.resetResultTable(); |
210 |
|
|
211 |
for(Integer postnr : postnumre) { |
for(Integer postnr : postnumre) { |
212 |
Lookup lookup = new Lookup(postnr, db); |
Lookup lookup = new Lookup(postnr, db); |
213 |
lookup.doLookup(); |
lookup.doLookup(); |
214 |
} |
} |
215 |
|
|
216 |
|
if (rename_tables) { |
217 |
|
db.renameResultTables(); |
218 |
|
} else { |
219 |
|
logger.info( "Rename tables is disabled !!!" ); |
220 |
|
} |
221 |
|
|
222 |
long now = System.currentTimeMillis(); |
long now = System.currentTimeMillis(); |
223 |
|
|
224 |
logger.info("Flest Ikke-dækkede, " + flestIkkeDaekkede); |
logger.info("Flest Ikke-dækkede, " + flestIkkeDaekkede); |