KickJava   Java API By Example, From Geeks To Geeks.

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


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  * PUBLIC:
29  *
30  * This is the interface describing the behaviour for ServerPlatformBase, and any other
31  * class that wants to provide behaviour for a server.
32  *
33  * This interface provides the behaviour for
34  *
35  * - Which external transaction controller to use
36  * - Whether or not to enable JTA (external transaction control)
37  * - How to register/unregister for runtime services (JMX/MBean)
38  * - Whether or not to enable runtime services
39  * - How to launch container Threads
40  *
41  * Any subclasses of ServerPlatformBase created by the user must implement this interface.
42  *
43  * public API:
44  *
45  * String getServerNameAndVersion()
46  *
47  * @see ServerPlatformBase
48  */

49 public interface ServerPlatform {
50
51     /**
52      * INTERNAL: getDatabaseSession(): Answer the instance of DatabaseSession the receiver is helping.
53      *
54      * @return DatabaseSession
55      */

56     public abstract DatabaseSessionImpl getDatabaseSession();
57
58     /**
59      * PUBLIC: getServerNameAndVersion(): Talk to the relevant server class library, and get the server name
60      * and version
61      *
62      * @return String serverNameAndVersion
63      */

64     public abstract String JavaDoc getServerNameAndVersion();
65
66     /**
67      * INTERNAL: getModuleName(): Answer the name of the module (jar name) that my session
68        * is associated with.
69        * Answer "unknown" if there is no module name available.
70      *
71      * @return String moduleName
72      */

73     public abstract String JavaDoc getModuleName();
74
75     /**
76      * INTERNAL: getExternalTransactionControllerClass(): Answer the class of external transaction controller to use
77      * For this server platform. This is read-only.
78      *
79      * If the subclasses of the ServerPlatformBase do not provide the Class desired, then
80      * a new subclass should be created to return the desired class.
81      *
82      * @return Class externalTransactionControllerClass
83      *
84      * @see oracle.toplink.essentials.transaction.JTATransactionController
85      * @see #isJTAEnabled()
86      * @see #disableJTA()
87      * @see #initializeExternalTransactionController()
88      */

89     public abstract Class JavaDoc getExternalTransactionControllerClass();
90
91     /**
92      * INTERNAL: setExternalTransactionControllerClass(Class newClass): Set the class of external
93      * transaction controller to use in the DatabaseSession.
94      * This is defined by the user via the sessions.xml.
95      *
96      * @see oracle.toplink.essentials.transaction.JTATransactionController
97      * @see #isJTAEnabled()
98      * @see #disableJTA()
99      * @see #initializeExternalTransactionController()
100      */

101     public void setExternalTransactionControllerClass(Class JavaDoc newClass);
102     
103     /**
104      * INTERNAL: initializeExternalTransactionController(): Populate the DatabaseSession's
105      * external transaction controller with an instance of my transaction controller class.
106      *
107      * To change the external transaction controller class, we recommend creating a subclass of
108        * ServerPlatformBase, and overriding getExternalTransactionControllerClass()
109        *
110        * @see ServerPlatformBase
111      *
112      * @return void
113      *
114      */

115     public abstract void initializeExternalTransactionController();
116
117     /**
118      * INTERNAL: isJTAEnabled(): Answer true if the DatabaseSession's external transaction controller class will
119      * be populated with my transaction controller class at runtime. If the transaction controller class is
120      * overridden in the DatabaseSession, my transaction controller class will be ignored.
121      *
122      * @return boolean isJTAEnabled
123      * @see #getExternalTransactionControllerClass()
124      * @see #disableJTA()
125      */

126     public abstract boolean isJTAEnabled();
127
128     /**
129      * INTERNAL: disableJTA(): Configure the receiver such that my external transaction controller class will
130      * be ignored, and will NOT be used to populate DatabaseSession's external transaction controller class
131      * at runtime.
132      *
133      * @return void
134      * @see #getExternalTransactionControllerClass()
135      * @see #isJTAEnabled()
136      */

137     public abstract void disableJTA();
138
139     /**
140      * INTERNAL: isRuntimeServicesEnabled(): Answer true if the JMX/MBean providing runtime services for
141      * the receiver's DatabaseSession will be deployed at runtime.
142      *
143      * @return boolean isRuntimeServicesEnabled
144      * @see #disableRuntimeServices()
145      */

146     public abstract boolean isRuntimeServicesEnabled();
147
148     /**
149      * INTERNAL: disableRuntimeServices(): Configure the receiver such that no JMX/MBean will be registered
150      * to provide runtime services for my DatabaseSession at runtime.
151      *
152      * @return void
153      * @see #isRuntimeServicesEnabled()
154      */

155     public abstract void disableRuntimeServices();
156
157     /**
158      * INTERNAL: registerMBean(): Create and deploy the JMX MBean to provide runtime services for my
159      * databaseSession.
160      *
161      * @return void
162      * @see #isRuntimeServicesEnabled()
163      * @see #disableRuntimeServices()
164      * @see #unregisterMBean()
165      */

166     public abstract void registerMBean();
167
168     /**
169      * INTERNAL: unregisterMBean(): Unregister the JMX MBean that was providing runtime services for my
170      * databaseSession.
171      *
172      * @return void
173      * @see #isRuntimeServicesEnabled()
174      * @see #disableRuntimeServices()
175      * @see #registerMBean()
176      */

177     public abstract void unregisterMBean();
178
179     /**
180      * INTERNAL: This method is used to unwrap the oracle connection wrapped by
181      * the application server. TopLink needs this unwrapped connection for certain
182      * Oracle Specific support. (ie TIMESTAMPTZ)
183      * This is added as a workaround for bug 4460996
184      */

185     public java.sql.Connection JavaDoc unwrapOracleConnection(Platform platform, java.sql.Connection JavaDoc connection);
186     
187     /**
188      * INTERNAL: launchContainerRunnable(Runnable runnable): Use the container library to
189      * start the provided Runnable.
190      *
191      * Default behaviour is to use Thread(runnable).start()
192      *
193      * @param Runnable runnable: the instance of runnable to be "started"
194      * @return void
195      */

196     public void launchContainerRunnable(Runnable JavaDoc runnable);
197
198     /**
199      * INTERNAL: getServerLog(): Return the ServerLog for this platform
200      *
201      * Return the default ServerLog in the base
202      *
203      * @return oracle.toplink.essentials.logging.SessionLog
204      */

205     public oracle.toplink.essentials.logging.SessionLog getServerLog();
206 }
207
Popular Tags