4 |
|
|
5 |
import javax.servlet.ServletContext; |
import javax.servlet.ServletContext; |
6 |
|
|
7 |
|
import dk.daoas.daoadresseservice.admin.ServiceConfig; |
8 |
|
import dk.daoas.daoadresseservice.db.DatabaseLayerImplementation; |
9 |
|
|
10 |
public class DataLoader { |
public class DataLoader { |
11 |
|
|
12 |
boolean isRunning = false; |
boolean isRunning = false; |
13 |
|
|
14 |
|
ServiceConfig config; |
15 |
|
|
16 |
ServletContext ctxt; |
ServletContext ctxt; |
17 |
public DataLoader(ServletContext ctxt) { |
public DataLoader(ServletContext ctxt,ServiceConfig conf) { |
18 |
this.ctxt = ctxt; |
this.ctxt = ctxt; |
19 |
|
|
20 |
|
config = conf; |
21 |
} |
} |
22 |
|
|
23 |
public void doLoad() { |
public void doLoad() { |
58 |
|
|
59 |
|
|
60 |
try { |
try { |
61 |
AdressSearch search = new AdressSearch(); |
AddressSearch search = new AddressSearch(new DatabaseLayerImplementation(), loader.config); |
62 |
search.buildSearchStructures(); |
search.buildSearchStructures(); |
63 |
|
|
64 |
AdressSearch oldSearch = (AdressSearch) loader.ctxt.getAttribute("search"); |
AddressSearch oldSearch = (AddressSearch) loader.ctxt.getAttribute("search"); |
65 |
loader.ctxt.setAttribute("search", search); |
loader.ctxt.setAttribute("search", search); |
66 |
|
|
67 |
if (oldSearch != null) { |
if (oldSearch != null) { |