KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > jdo > api > persistence > support > PersistenceManagerFactory


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  * PersistenceManagerFactory.java
26  *
27  * Created on February 25, 2000
28  */

29  
30 package com.sun.jdo.api.persistence.support;
31
32 import java.io.PrintWriter JavaDoc;
33 import java.util.Properties JavaDoc;
34
35 /**
36  *
37  * @author Craig Russell
38  * @version 0.1
39  */

40
41 public interface PersistenceManagerFactory extends java.io.Serializable JavaDoc
42 {
43   /**
44    * Sets JDBC driver name
45    * @param driverName JDBC driver name
46    */

47   void setConnectionDriverName (String JavaDoc driverName);
48
49   /**
50    * Returns JDBC driver name
51    * @return driver name
52    */

53   String JavaDoc getConnectionDriverName ();
54    
55   /**
56    * Sets database user
57    * @param userName database user
58    */

59   void setConnectionUserName (String JavaDoc userName);
60
61   /**
62    * Returns database user name
63    * @return current database user name
64    */

65   String JavaDoc getConnectionUserName ();
66   
67   /**
68    * Sets database user password
69    * @param password database user password
70    */

71   void setConnectionPassword (String JavaDoc password);
72   
73   /**
74    * Sets maximum number of connections in the connection pool
75    * @param MaxPool maximum number of connections
76    */

77   void setConnectionMaxPool (int MaxPool);
78
79   /**
80    * Returns maximum number of connections in the connection pool
81    * @return connectionMaxPool
82    */

83   int getConnectionMaxPool ();
84   
85   /**
86    * Sets minimum number of connections in the connection pool
87    * @param MinPool minimum number of connections
88    */

89   void setConnectionMinPool (int MinPool);
90
91   /**
92    * Returns minimum number of connections in the connection pool
93    * @return connectionMinPool
94    */

95   int getConnectionMinPool ();
96   
97   
98   /**
99    * Sets maximum number of PersistenceManager instances in the pool
100    * @param MaxPool maximum number of instances
101    */

102   void setMaxPool (int MaxPool);
103
104   /**
105    * Returns maximum number of PersistenceManager instances in the pool
106    * @return maxPool
107    */

108   int getMaxPool ();
109   
110   /**
111    * Sets minimum number of PersistenceManager instances in the pool
112    * @param MinPool minimum number of PersistenceManager instances
113    */

114   void setMinPool (int MinPool);
115
116   /**
117    * Returns minimum number of PersistenceManager instances in the pool
118    * @return minPool
119    */

120   int getMinPool ();
121   
122   /**
123    * Sets the number of milliseconds to wait for an available connection
124    * from the connection pool before throwing an exception
125    * @param MsWait number in milliseconds
126    */

127   void setConnectionMsWait (int MsWait);
128
129   /**
130    * Returns the number of milliseconds to wait for an available connection
131    * from the connection pool before throwing an exception
132    * @return number in milliseconds
133    */

134   int getConnectionMsWait ();
135   
136   /**
137    * Sets the amount of time, in milliseconds, between the connection
138    * manager's attempts to get a pooled connection.
139    * @param MsInterval the interval between attempts to get a database
140    * connection, in milliseconds.
141    *
142    */

143   void setConnectionMsInterval (int MsInterval);
144
145   /**
146    * Returns the amount of time, in milliseconds, between the connection
147    * manager's attempts to get a pooled connection.
148    * @return the length of the interval between tries in milliseconds
149    */

150   int getConnectionMsInterval ();
151   
152   /**
153    * Sets the number of seconds to wait for a new connection to be
154    * established to the data source
155    * @param LoginTimeout wait time in seconds
156    */

157   void setConnectionLoginTimeout (int LoginTimeout);
158
159   /**
160    * Returns the number of seconds to wait for a new connection to be
161    * established to the data source
162    * @return wait time in seconds
163    */

164   int getConnectionLoginTimeout ();
165   
166   /**
167    * Sets JDBC connection URL
168    * @param URL connection URL
169    */

170   void setConnectionURL (String JavaDoc URL);
171
172   /**
173    * Returns connection URL
174    * @return connection URL
175    */

176   String JavaDoc getConnectionURL ();
177   
178   /**
179    * Sets Connection Factory as <a HREF="ConnectionFactory.html">ConnectionFactory</a>
180    * or javax.sql.DataSource
181    * @param cf as java.lang.Object
182    */

183   void setConnectionFactory (Object JavaDoc cf);
184
185   /**
186    * Returns Connection Factory object that can be one of
187    * <a HREF="ConnectionFactory.html">ConnectionFactory</a> or javax.sql.DataSource
188    * @return Connection Factory as java.lang.Object
189    */

190   Object JavaDoc getConnectionFactory ();
191   
192   /**
193    * Sets the LogWriter to which messages should be sent
194    * @param pw LogWriter
195    */

196   void setConnectionLogWriter(PrintWriter JavaDoc pw);
197
198   /**
199    * Returns the LogWriter to which messages should be sent
200    * @return LogWriter
201    */

202   PrintWriter JavaDoc getConnectionLogWriter ();
203   
204   /**
205    * Sets transaction isolation level for all connections of this PersistenceManagerFactory.
206    * All validation is done by java.sql.Connection itself, so e.g. while Oracle
207    * will not allow to set solation level to TRANSACTION_REPEATABLE_READ, this method
208    * does not have any explicit restrictions
209    *
210    * @param level - one of the java.sql.Connection.TRANSACTION_* isolation values
211    */

212   void setConnectionTransactionIsolation (int level);
213
214   /**
215    * Returns current transaction isolation level for connections of this PersistenceManagerFactory.
216    * @return the current transaction isolation mode value as java.sql.Connection.TRANSACTION_*
217    */

218   int getConnectionTransactionIsolation ();
219   
220   /**
221    * Sets ConnectionFactory name
222    * @param connectionFactoryName ConnectionFactory name
223    */

224   void setConnectionFactoryName (String JavaDoc connectionFactoryName);
225
226   /**
227    * Returns ConnectionFactory name
228    * @return ConnectionFactoryName
229    */

230   String JavaDoc getConnectionFactoryName ();
231
232   /**
233    * Sets Identifier. An Identifier is a string that user can use to identify
234    * the PersistenceManagerFacory in a given environment. Identifier can be
235    * particularly useful in an environment where multiple
236    * PersistenceManagerFacories are initialized in a system.
237    * @param identifier
238    */

239   void setIdentifier(String JavaDoc identifier);
240
241   /**
242    * Gets Identifier. An Identifier is a string that user can use to identify
243    * the PersistenceManagerFacory in a given environment. Identifier can be
244    * particularly useful in an environment where multiple
245    * PersistenceManagerFacories are initialized in a system.
246    * @return identifier
247    */

248   String JavaDoc getIdentifier();
249
250
251   /**
252    * Creates new <a HREF="PersistenceManager.html">PersistenceManager</a> without extra info
253    * @return the persistence manager
254    */

255   PersistenceManager getPersistenceManager ();
256   
257   /**
258    * Creates new <a HREF="PersistenceManager.html">PersistenceManager</a> with specific
259    * username and password. Used to call ConnectionFactory.getConnection(String, String)
260    * @param username datasource user
261    * @param password datasource user password
262    * @return the persistence manager
263    */

264   PersistenceManager getPersistenceManager (String JavaDoc username, String JavaDoc password);
265   
266   /**
267    * Sets the optimistic flag for all PersistenceManagers
268    * @param flag boolean optimistic flag
269    */

270   void setOptimistic (boolean flag);
271
272   /**
273    * Returns the boolean value of the optimistic flag for all PersistenceManagers
274    * @return boolean optimistic flag
275    */

276   boolean getOptimistic ();
277   
278   /**
279    * Sets flag that will not cause the eviction of persistent instances after transaction completion.
280    * @param flag boolean flag passed
281    */

282   void setRetainValues (boolean flag);
283
284   /**
285    * Returns the boolean value for the flag that will not cause the eviction of persistent
286    * instances after transaction completion.
287    * @return boolean setting for the flag
288    */

289   boolean getRetainValues ();
290   
291   /**
292    * Sets the flag that allows non-transactional instances to be managed in the cache.
293    * @param flag boolean flag passed
294    */

295   void setNontransactionalRead (boolean flag);
296
297   /**
298    * Returns the boolean value for the flag that allows non-transactional instances
299    * to be managed in the cache.
300    * @return boolean setting for the flag
301    */

302   boolean getNontransactionalRead ();
303   
304   /**
305    * Sets the flag that allows the user to request that queries be optimized to return
306    * approximate results by ignoring changed values in the cache.
307    * @param flag boolean flag passed
308    */

309   void setIgnoreCache (boolean flag);
310
311   /**
312    * Returns the boolean value for the flag that allows the user to request that queries
313    * be optimized to return approximate results by ignoring changed values in the cache.
314    * @return boolean setting for the flag
315    */

316   boolean getIgnoreCache ();
317   
318   /**
319    * Sets the number of seconds to wait for a query statement
320    * to execute in the datastore associated with this PersistenceManagerFactory.
321    * @param timeout new timout value in seconds; zero means unlimited
322    */

323   void setQueryTimeout (int timeout);
324
325   /**
326    * Gets the number of seconds to wait for a query statement
327    * to execute in the datastore associated with this PersistenceManagerFactory.
328    * @return timout value in seconds; zero means unlimited
329    */

330   int getQueryTimeout ();
331
332   /**
333    * Sets the number of seconds to wait for an update statement
334    * to execute in the datastore associated with this PersistenceManagerFactory.
335    * @param timeout new timout value in seconds; zero means unlimited
336    */

337   void setUpdateTimeout (int timeout);
338
339   /**
340    * Gets the number of seconds to wait for an update statement
341    * to execute in the datastore associated with this PersistenceManagerFactory.
342    * @return timout value in seconds; zero means unlimited
343    */

344   int getUpdateTimeout();
345
346
347   /**
348    * Returns non-operational properties to be available to the application via a Properties instance.
349    * @return Properties object
350    */

351   Properties JavaDoc getProperties ();
352
353   /**
354    * Returns the boolean value of the supersedeDeletedInstance flag
355    * for all PersistenceManagers. If set to true, deleted instances are
356    * allowed to be replaced with persistent-new instances with the equal
357    * Object Id.
358    * @return boolean supersedeDeletedInstance flag
359    */

360   boolean getSupersedeDeletedInstance ();
361    
362
363   /**
364    * Sets the supersedeDeletedInstance flag for all PersistenceManagers.
365    * @param flag boolean supersedeDeletedInstance flag
366    */

367   void setSupersedeDeletedInstance (boolean flag);
368
369   /**
370    * Returns the default value of the requireCopyObjectId flag
371    * for this PersistenceManagerFactory. If set to false, the PersistenceManager
372    * will not create a copy of an ObjectId for <code>PersistenceManager.getObjectId(Object pc)</code>
373    * and <code>PersistenceManager.getObjectById(Object oid)</code> requests.
374    *
375    * @see PersistenceManager#getObjectId(Object pc)
376    * @see PersistenceManager#getObjectById(Object oid)
377    * @return boolean requireCopyObjectId flag
378    */

379   boolean getRequireCopyObjectId();
380
381
382   /**
383    * Sets the default value of the requireCopyObjectId flag.
384    * If set to false, by default a PersistenceManager will not create a copy of
385    * an ObjectId for <code>PersistenceManager.getObjectId(Object pc)</code>
386    * and <code>PersistenceManager.getObjectById(Object oid)</code> requests.
387    *
388    * @see PersistenceManager#getObjectId(Object pc)
389    * @see PersistenceManager#getObjectById(Object oid)
390    * @param flag boolean requireCopyObjectId flag
391    */

392   void setRequireCopyObjectId (boolean flag);
393
394   /**
395    * Returns the boolean value of the requireTrackedSCO flag
396    * for this PersistenceManagerFactory. If set to false, by default the
397    * PersistenceManager will not create tracked SCO instances for
398    * new persistent instances at commit with retainValues set to true and while
399    * retrieving data from a datastore.
400    *
401    * @return boolean requireTrackedSCO flag
402    */

403   boolean getRequireTrackedSCO();
404
405   /**
406    * Sets the requireTrackedSCO flag for this PersistenceManagerFactory.
407    * If set to false, by default the PersistenceManager will not create tracked
408    * SCO instances for new persistent instances at commit with retainValues set to true
409    * and while retrieving data from a datastore.
410    *
411    * @param flag boolean requireTrackedSCO flag
412    */

413   void setRequireTrackedSCO (boolean flag);
414
415 }
416
417
Popular Tags