KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > oracle > toplink > essentials > sessions > Login


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, 2005, Oracle. All rights reserved.
22
package oracle.toplink.essentials.sessions;
23
24 import java.util.Properties JavaDoc;
25
26 import oracle.toplink.essentials.exceptions.DatabaseException;
27 import oracle.toplink.essentials.internal.databaseaccess.Accessor;
28 import oracle.toplink.essentials.internal.databaseaccess.DatabasePlatform;
29 import oracle.toplink.essentials.internal.databaseaccess.Platform;
30
31 /**
32  * <p>
33  * <b>Purpose</b>: Define the information required to connect to a TopLink session.
34  * <p>
35  * <b>Description</b>: This interface represents a generic concept of a login to be used
36  * when connecting to a data-store. It is independant of JDBC so that the TopLink
37  * session interface can be used for JCA, XML, non-relational or three-tiered frameworks.
38  * <p>
39  * @see DatabaseLogin
40  */

41 public interface Login {
42
43     /**
44      * PUBLIC:
45      * All logins must take a user name and password.
46      */

47     String JavaDoc getPassword();
48
49     /**
50      * PUBLIC:
51      * All logins must take a user name and password.
52      */

53     String JavaDoc getUserName();
54
55     /**
56      * PUBLIC:
57      * All logins must take a user name and password.
58      */

59     void setPassword(String JavaDoc password);
60
61     /**
62      * PUBLIC:
63      * All logins must take a user name and password.
64      */

65     void setUserName(String JavaDoc userName);
66
67     /**
68      * PUBLIC:
69      * Return whether TopLink uses some externally managed connection pooling.
70      */

71     boolean shouldUseExternalConnectionPooling();
72
73     /**
74      * PUBLIC:
75      * Return whether TopLink uses some externally managed transaction service such as JTS.
76      */

77     boolean shouldUseExternalTransactionController();
78
79     /**
80      * INTERNAL:
81      * Return the database platform specific information.
82      * This allows TopLink to configure certain advanced features for the database desired.
83      * The platform also allows configuration of sequence information.
84      * NOTE: this must only be used for relational specific usage and will not work for
85      * non-relational datasources.
86      */

87     DatabasePlatform getPlatform();
88
89     /**
90      * PUBLIC:
91      * Return the datasource platform specific information.
92      * This allows TopLink to configure certain advanced features for the datasource desired.
93      * The platform also allows configuration of sequence information.
94      */

95     Platform getDatasourcePlatform();
96
97     /**
98      * INTERNAL:
99      * Set the database platform specific information.
100      * This allows TopLink to configure certain advanced features for the database desired.
101      * The platform also allows configuration of sequence information.
102      */

103     void setPlatform(Platform platform);
104
105     /**
106      * PUBLIC:
107      * Set the database platform specific information.
108      * This allows TopLink to configure certain advanced features for the database desired.
109      * The platform also allows configuration of sequence information.
110      */

111     void setDatasourcePlatform(Platform platform);
112
113     /**
114      * INTERNAL:
115      * Connect to the datasource, and return the driver level connection object.
116      */

117     Object JavaDoc connectToDatasource(Accessor accessor) throws DatabaseException;
118
119     /**
120      * INTERNAL:
121      * Build the correct datasource Accessor for this login instance.
122      */

123     Accessor buildAccessor();
124
125     /**
126      * INTERNAL:
127      * Clone the login.
128      */

129     Object JavaDoc clone();
130
131     /**
132      * PUBLIC:
133      * Return the qualifier for the all of the tables.
134      */

135     public String JavaDoc getTableQualifier();
136
137     /**
138      * INTERNAL:
139      * Used for cache isolation.
140      */

141     public boolean shouldAllowConcurrentReadWrite();
142
143     /**
144      * INTERNAL:
145      * Used for Cache Isolation. Causes TopLink to lock at the class level on
146      * cache updates.
147      */

148     public boolean shouldSynchronizeWrites();
149     
150     /**
151      * INTERNAL:
152      * Used for Cache Isolation. Causes TopLink to lock at the object level on
153      * cache updates and cache access.
154      */

155     public boolean shouldSynchronizeObjectLevelReadWrite();
156     
157     /**
158      * INTERNAL:
159      * Used for Cache Isolation. Causes TopLink to lock at the object level on
160      * cache updates and cache access, based on database transaction.
161      */

162     public boolean shouldSynchronizeObjectLevelReadWriteDatabase();
163     
164     /**
165      * INTERNAL:
166      * Used for cache isolation.
167      */

168     public boolean shouldSynchronizedReadOnWrite();
169     
170     /**
171      * PUBLIC:
172      * The properties are additional, driver-specific, connection information
173      * to be passed to the driver.<p>
174      * NOTE: Do not set the password directly by getting the properties and
175      * setting the "password" property directly. Use the method DatabaseLogin.setPassword(String).
176      */

177     public Object JavaDoc getProperty(String JavaDoc name);
178     
179     /**
180      * PUBLIC:
181      * The properties are additional, driver-specific, connection information
182      * to be passed to the JDBC driver.
183      */

184     public void setProperties(Properties JavaDoc properties);
185
186     /**
187      * PUBLIC:
188      * Some JDBC drivers require additional, driver-specific, properties.
189      * Add the specified property to those to be passed to the JDBC driver.
190      */

191     public void setProperty(String JavaDoc propertyName, Object JavaDoc propertyValue);
192 }
193
Popular Tags