1 |
package appl.data; |
2 |
|
3 |
import edu.bonn.xulu.appl.XuluRegistry; |
4 |
import edu.bonn.xulu.io.ImportFactory; |
5 |
|
6 |
/** |
7 |
* This is an implementation of a loader class which loads data with an |
8 |
* importer. It is for Late Loading. |
9 |
* |
10 |
* @author Dominik Appl |
11 |
* @see WritableGridLLProxy |
12 |
* @author Dominik Appl |
13 |
*/ |
14 |
public class ImportFactoryLoader implements DataLoader { |
15 |
|
16 |
private ImportFactory fac; |
17 |
|
18 |
private Object inputPara; |
19 |
|
20 |
private XuluRegistry reg; |
21 |
|
22 |
/** |
23 |
* not usable |
24 |
*/ |
25 |
private ImportFactoryLoader() { |
26 |
} |
27 |
|
28 |
/** |
29 |
* @param importFac |
30 |
* the import factory to be used for loading |
31 |
* @param inputPara |
32 |
* the input object (usually a file) |
33 |
* @param reg |
34 |
* the {@link XuluRegistry} |
35 |
*/ |
36 |
public ImportFactoryLoader(ImportFactory importFac, Object inputPara, |
37 |
XuluRegistry reg) { |
38 |
fac = importFac; |
39 |
this.inputPara = inputPara; |
40 |
this.reg = reg; |
41 |
} |
42 |
|
43 |
/* |
44 |
* (non-Javadoc) |
45 |
* |
46 |
* @see appl.data.DataLoader#load() |
47 |
*/ |
48 |
public Object load() throws LoadingException { |
49 |
try { |
50 |
return fac.importObject(inputPara, reg); |
51 |
} catch (Exception e) { |
52 |
throw new LoadingException( |
53 |
"Could not load Grid with Importfactory <" |
54 |
+ fac.getClass().getName() + ">" + " and " |
55 |
+ inputPara, inputPara); |
56 |
} |
57 |
} |
58 |
|
59 |
/* |
60 |
* (non-Javadoc) |
61 |
* |
62 |
* @see appl.data.DataLoader#getLoadInfo() |
63 |
*/ |
64 |
public String getLoadInfo() { |
65 |
return "ImportFactoryLoader|" + fac + "|" + inputPara; |
66 |
} |
67 |
|
68 |
} |