KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > oracle > toplink > essentials > platform > server > NoServerPlatform


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
5  * in compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * glassfish/bootstrap/legal/CDDLv1.0.txt or
9  * https://glassfish.dev.java.net/public/CDDLv1.0.html.
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 in each file and include the License file at
15  * glassfish/bootstrap/legal/CDDLv1.0.txt. If applicable,
16  * add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your
18  * own identifying information: Portions Copyright [yyyy]
19  * [name of copyright owner]
20  */

21 // Copyright (c) 1998, 2006, Oracle. All rights reserved.
22
package oracle.toplink.essentials.platform.server;
23
24 import oracle.toplink.essentials.internal.sessions.DatabaseSessionImpl;
25 import oracle.toplink.essentials.internal.databaseaccess.Platform;
26
27 /**
28  *
29  * PUBLIC:
30  *
31  * This platform is used when TopLink is not within any server (Oc4j, WebLogic, ...)
32  * This is also the default platform for all newly created DatabaseSessions.
33  *
34  * This platform has:
35  *
36  * - No external transaction controller class
37  * - No runtime services (JMX/MBean)
38  * - No launching of container Threads
39  *
40  */

41 public final class NoServerPlatform extends ServerPlatformBase {
42
43     /**
44      * INTERNAL:
45      * Default Constructor: Initialize so that runtime services and JTA are disabled.
46      */

47     public NoServerPlatform(DatabaseSessionImpl newDatabaseSession) {
48         super(newDatabaseSession);
49         this.disableRuntimeServices();
50         ;
51         this.disableJTA();
52     }
53
54     /**
55      * PUBLIC: getServerNameAndVersion(): Answer null because this does not apply to NoServerPlatform.
56      *
57      * @return String serverNameAndVersion
58      */

59     public String JavaDoc getServerNameAndVersion() {
60         return null;
61     }
62
63     /**
64      * INTERNAL: getExternalTransactionControllerClass(): Answer null because this does not apply.
65      *
66      * @see #isJTAEnabled()
67      * @see #disableJTA()
68      * @see #initializeExternalTransactionController()
69      */

70     public Class JavaDoc getExternalTransactionControllerClass() {
71         return null;
72     }
73
74     /**
75      * INTERNAL: launchContainerThread(Thread thread): Do nothing because container Threads are not launchable
76      * in this platform
77      *
78      * @param Thread thread : the instance of Thread
79      * @return void
80      */

81     public void launchContainerThread(Thread JavaDoc thread) {
82     }
83
84     /**
85      * INTERNAL: getServerLog(): Return the ServerLog for this platform
86      *
87      * Return the default ServerLog in the base
88      *
89      * @return oracle.toplink.essentials.logging.SessionLog
90      */

91     public oracle.toplink.essentials.logging.SessionLog getServerLog() {
92         return getDatabaseSession().getSessionLog();
93     }
94
95     /**
96      * INTERNAL:
97      * When there is no server, the original connection will be returned
98      */

99     public java.sql.Connection JavaDoc unwrapOracleConnection(Platform platform, java.sql.Connection JavaDoc connection){
100         return connection;
101     }
102 }
103
Popular Tags