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