KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > server > PersistenceUnitLoader


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23
24
25 package com.sun.enterprise.server;
26
27 import com.sun.enterprise.deployment.Application;
28 import com.sun.enterprise.loader.InstrumentableClassLoader;
29
30 /**
31  * This is used by {@link AbstractLoader} to load persistence units embedded in
32  * an ear file. It recurssively loads all the persistence units.
33  *
34  * @author Sanjeeb.Sahoo@Sun.COM
35  */

36 public interface PersistenceUnitLoader {
37     /**
38      * This encapsulates information needed by {@link PersistenceUnitLoader}
39      * to load or unload persistence units.
40      */

41     interface ApplicationInfo {
42         /**
43          * @return {@link Application} whose persistence units will be
44          * loaded or unloaded.
45          */

46         Application getApplication();
47
48         /**
49          *
50          * @return a class loader that is used to load persistence entities
51          * bundled in this application.
52          */

53         InstrumentableClassLoader getClassLoader();
54
55         /**
56          * @return absolute path of the location where application is exploded.
57          */

58         String JavaDoc getApplicationLocation();
59
60     }
61
62     /**
63      * Load all the persistence units contained inside the application described
64      * by ApplicationInfo object. Loading involves calling the {@link
65      * javax.persistence.spi.PersistenceProvider} to create an {@link
66      * javax.persistence.EntityManagerFactory} and registering the {@link
67      * javax.persistence.EntityManagerFactory} at the appropriate level in
68      * {@link Application} descriptor object tree.
69      */

70     void load(ApplicationInfo appInfo);
71
72     /**
73      * Unload all the persistence units contained inside the application
74      * described by ApplicationInfo object. Unloading involves calling {@link
75      * javax.persistence.EntityManagerFactory#close()} for each {@link
76      * javax.persistence.EntityManagerFactory} in {@link Application} descriptor
77      * object tree.
78      */

79     void unload(ApplicationInfo appInfo);
80 }
81
Popular Tags