587
|
1 |
/*
|
|
2 |
* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of the License "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description:
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
package com.nokia.helium.metadata;
|
|
18 |
|
|
19 |
import java.io.File;
|
|
20 |
import java.util.List;
|
628
|
21 |
|
|
22 |
import com.nokia.helium.metadata.fmpp.ORMQueryModeModel;
|
|
23 |
|
587
|
24 |
import fmpp.Engine;
|
|
25 |
import fmpp.tdd.DataLoader;
|
|
26 |
|
|
27 |
|
|
28 |
/**
|
628
|
29 |
* Utility class to access the data from the database and used by FMPP templates.
|
587
|
30 |
*/
|
|
31 |
public class ORMFMPPLoader implements DataLoader {
|
|
32 |
//private ResultSet rs;
|
|
33 |
|
|
34 |
/**
|
628
|
35 |
* Return a object abstracting the access to a database.
|
587
|
36 |
* @see fmpp.tdd.DataLoader#load(fmpp.Engine, java.util.List)
|
|
37 |
*/
|
628
|
38 |
@SuppressWarnings("unchecked")
|
587
|
39 |
public Object load(Engine engine, List args) throws Exception {
|
|
40 |
//log.debug("args.size:" + args.size());
|
628
|
41 |
if (args.size() < 1) {
|
|
42 |
throw new MetadataException("The database path should be provided to load into FMPP.");
|
|
43 |
}
|
|
44 |
ORMQueryModeModel model = new ORMQueryModeModel(new File((String)args.get(0)));
|
587
|
45 |
engine.setAttribute(this.getClass().toString(), model);
|
|
46 |
return model;
|
|
47 |
}
|
|
48 |
} |