KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > jdo > spi > persistence > support > sqlstore > ejb > PersistenceManagerServiceImpl


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
26 /*
27  * PersistenceManagerServiceImpl.java
28  *
29  * Created on January 24, 2002
30  */

31
32 package com.sun.jdo.spi.persistence.support.sqlstore.ejb;
33
34 import com.sun.appserv.server.ServerLifecycleImpl;
35 import com.sun.jdo.spi.persistence.utility.logging.LogHelper;
36
37
38 /**
39  * This class extends the default implementation of the ServerLifecycle
40  * interface and allows to load Sun specific implementation of the
41  * TransactionHelper as a part of Sun - Server Lifecycle process.
42  * This class does not need to do any processing for the Server Lifecycle events
43  * other than load the necessary class.
44  */

45 public class PersistenceManagerServiceImpl extends ServerLifecycleImpl {
46
47     // Initialize the appserver loggers.
48
static {
49         LogHelper.registerLoggerFactory(new LoggerFactoryiAS());
50     }
51
52     // Reference and force the initialization of the Sun specific
53
// implementation of the TransactionHelper and the ContainerHelper.
54
private static final Class JavaDoc helper = forceInit(SunContainerHelper.class);
55
56     // Reference and force the initialization of the DeploymentEventListener
57
// implementation.
58
private static final Class JavaDoc listener =
59         forceInit("com.sun.jdo.spi.persistence.support.ejb.ejbc.DeploymentEventListenerImpl");
60
61     /**
62      * Forces the initialization of the class pertaining to the specified
63      * <tt>Class</tt> object. This method does nothing if the class is already
64      * initialized prior to invocation.
65      *
66      * @param klass the class for which to force initialization
67      * @return <tt>klass</tt>
68      */

69     private static <T> Class JavaDoc<T> forceInit(Class JavaDoc<T> klass) {
70         try {
71             Class.forName(klass.getName(), true, klass.getClassLoader());
72         } catch (ClassNotFoundException JavaDoc e) {
73             throw new AssertionError JavaDoc(e); // Can't happen
74
}
75         return klass;
76     }
77
78     private static <T> Class JavaDoc<T> forceInit(String JavaDoc klassName) {
79         Class JavaDoc klass;
80         try {
81             klass = Class.forName(klassName);
82         } catch (ClassNotFoundException JavaDoc e) {
83             throw new AssertionError JavaDoc(e); // Can't happen
84
}
85         return klass;
86     }
87
88 }
89
Popular Tags