|
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 |
|
21 import javax.persistence.EntityManagerFactory; |
|
22 |
|
23 /** |
|
24 * This interface describe the methods used to creates |
|
25 * EntityManagerFactory for a particular database type (e.g.: Derby). |
|
26 * |
|
27 */ |
|
28 public interface EntityManagerFactoryCreator { |
|
29 |
|
30 /** |
|
31 * This method will be called once in the lifecycle of the EntityManagerFactoryCreator |
|
32 * object. |
|
33 * This method is a kind of entry point to load a driver for example. |
|
34 * @throws MetadataException this exception is thrown in case of error. |
|
35 */ |
|
36 void initialize() throws MetadataException ; |
|
37 |
|
38 /** |
|
39 * Create a new EntityManagerFactory for a particular database. |
|
40 * @param database the database to create the EntityManagerFactory for. |
|
41 * @return a new EntityManagerFactory. |
|
42 * @throws MetadataException this exception is raised in case of error. (e.g database could not be created.) |
|
43 */ |
|
44 EntityManagerFactory create(File database) throws MetadataException; |
|
45 |
|
46 /** |
|
47 * This method is called to unload a database, this is called usually when |
|
48 * all created EntityManagerFactory are freed. |
|
49 * @param database the database to unload. |
|
50 * @throws MetadataException |
|
51 */ |
|
52 void unload(File database) throws MetadataException ; |
|
53 } |