KickJava   Java API By Example, From Geeks To Geeks.

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


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.sessions;
23
24 import java.util.*;
25 import java.io.*;
26 import java.security.AccessController JavaDoc;
27 import java.security.PrivilegedActionException JavaDoc;
28 import java.text.MessageFormat JavaDoc;
29 import oracle.toplink.essentials.internal.databaseaccess.*;
30 import oracle.toplink.essentials.exceptions.*;
31 import oracle.toplink.essentials.queryframework.*;
32 import oracle.toplink.essentials.sequencing.Sequence;
33 import oracle.toplink.essentials.Version;
34 import oracle.toplink.essentials.internal.helper.*;
35 import oracle.toplink.essentials.internal.localization.*;
36 import oracle.toplink.essentials.internal.security.SecurableObjectHolder;
37 import oracle.toplink.essentials.internal.helper.ConversionManager;
38 import oracle.toplink.essentials.internal.security.PrivilegedAccessHelper;
39 import oracle.toplink.essentials.internal.security.PrivilegedNewInstanceFromClass;
40
41 /**
42  * <p>
43  * <b>Purpose</b>:
44  * Hold the configuration information necessary to connect to a datasource.
45  * <p>
46  * <b>Description</b>:
47  * This is an abstract class that defines the common datasource independent connection configuration.
48  * It is extended to support specific datasources such as JDBC, JCA, XML, etc.
49  */

50 public abstract class DatasourceLogin implements oracle.toplink.essentials.sessions.Login, Serializable, Cloneable JavaDoc {
51
52     /** Version info */
53     private static final String JavaDoc versionStringTemplate = "{0} - {1} (Build {2})";
54     public static String JavaDoc versionString = null;
55
56     /** Connection properties (e.g. user, password, and driver-specific settings) */
57     protected Properties properties;
58
59     /** Implementation of platform-specific behaviors. */
60     protected Platform platform;
61
62     /** The encrypted String that holds the expiry key */
63     protected static String JavaDoc encryptedString = null;
64
65     /** The securable object holder and flag*/
66     private boolean isEncryptedPasswordSet;
67     private transient SecurableObjectHolder securableObjectHolder;
68
69     /** Provide a little flexibility for connecting to a database */
70     protected Connector connector;
71
72     /** True if we use an external connection pool such as WebLogic's JTS driver */
73     protected boolean usesExternalConnectionPooling;
74
75     /** True if we should use some external transaction service such as JTS. */
76     protected boolean usesExternalTransactionController;
77
78     /**
79      * By default concurrency is optimized and the cache is not locked during reads or writes,
80      * This allows for concurrent reading and writing and should never cause any problems. If the application
81      * uses no form of locking the last unit of work to merge changes will win, with no locking it is possible
82      * only under this senerio for two unit of works to merge changes different than the database although highly unlikely
83      * and if occured is the entire purpose of locking. This property allows for the isolation level of changes to the
84      * cache to be configured for sever situation and it is not suggest that this be changed.
85      */

86     protected int cacheTransactionIsolation = SYNCRONIZED_OBJECT_LEVEL_READ_WRITE_DATABASE;
87
88     /** Reads and unit of work merges can occur concurrently. */
89     public static final int CONCURRENT_READ_WRITE = 1;
90
91     /** Reads can occur concurrently but unit of work merges will be serialized. */
92     public static final int SYNCHRONIZED_WRITE = 2;
93
94     /** Reads and unit of work merges will be serialized. */
95     public static final int SYNCHRONIZED_READ_ON_WRITE = 3;
96     
97     /** Writes to the cache (merge, object build/refresh will be synchronized
98      * as will cache access (cloning) based on when access is required.
99      */

100     public static final int SYNCRONIZED_OBJECT_LEVEL_READ_WRITE = 4;
101
102     /** Writes to the cache (merge, object build/refresh will be synchronized
103      * as will cache access (cloning) based on database transaction.
104      */

105     public static final int SYNCRONIZED_OBJECT_LEVEL_READ_WRITE_DATABASE = 5;
106
107     /**
108      * PUBLIC:
109      * Create a new login.
110      */

111     public DatasourceLogin() {
112         this(new DatasourcePlatform());
113     }
114
115     /**
116      * ADVANCED:
117      * Create a new login for the given platform.
118      */

119     public DatasourceLogin(Platform databasePlatform) {
120         this.platform = databasePlatform;
121
122         this.dontUseExternalConnectionPooling();
123         this.dontUseExternalTransactionController();
124
125         this.properties = new Properties();
126         this.properties.put("user", "");
127         this.properties.put("password", "");
128         this.isEncryptedPasswordSet = false;
129         this.securableObjectHolder = new SecurableObjectHolder();
130     }
131
132     /**
133      * INTERNAL:
134      * Return the encryption securable holder.
135      * Lazy initialize to handle serialization.
136      */

137     protected SecurableObjectHolder getSecurableObjectHolder() {
138         if (securableObjectHolder == null) {
139             securableObjectHolder = new SecurableObjectHolder();
140             securableObjectHolder.getSecurableObject();
141         }
142         return securableObjectHolder;
143     }
144
145     /**
146      * INTERNAL:
147      * Clone the login.
148      * This also clones the platform as it is internal to the login.
149      */

150     public Object JavaDoc clone() {
151         DatasourceLogin clone = null;
152         try {
153             clone = (DatasourceLogin)super.clone();
154         } catch (Exception JavaDoc exception) {
155             // should not happen...do nothing
156
}
157         if (getConnector() != null) {
158             clone.setConnector((Connector)getConnector().clone());
159         }
160         clone.setDatasourcePlatform((Platform)getDatasourcePlatform().clone());
161         clone.setProperties((Properties)properties.clone());
162         return clone;
163     }
164
165     /**
166      * INTERNAL:
167      * Connect to the datasource, and return the driver level connection object.
168      */

169     public Object JavaDoc connectToDatasource(Accessor accessor) throws DatabaseException {
170         return getConnector().connect(prepareProperties(properties));
171     }
172
173     /**
174      * ADVANCED:
175      * By default concurrency is optimized and the cache is not locked more than required during reads or writes,
176      * This allows for virtual concurrent reading and writing and should never cause any problems. If the application
177      * uses no form of locking the last unit of work to merge changes will win, with no locking it is possible
178      * only under this senerio for two unit of works to merge changes different than the database although highly unlikely
179      * and if occured is the entire purpose of locking and locking is the suggested solution if this is a problem.
180      * This property allows for the isolation level of changes to the
181      * cache to be configured for sever situations and it is not suggest that this be changed.
182      * <p>Setting are:<ul>
183      * <li>ConcurrentReadWrite - default
184      * <li>SynchronizedWrite - only allow a single writer (i.e. unit of work merge) to the cache at once
185      * <li>SynchronizedReadOnWrite - do not allow reading or other unit of work merge ehile a unit of work is in merge
186      */

187     public int getCacheTransactionIsolation() {
188         return cacheTransactionIsolation;
189     }
190
191     /**
192      * ADVANCED:
193      * Return the connector that will instantiate the connection.
194      */

195     public Connector getConnector() {
196         return connector;
197     }
198
199     /**
200      * INTERNAL:
201      * Return the database platform specific information.
202      * This allows TopLink to configure certain advanced features for the database desired.
203      * NOTE: this must only be used for relational specific usage and will not work for
204      * non-relational datasources.
205      */

206     public DatabasePlatform getPlatform() {
207         try {
208             return (DatabasePlatform)getDatasourcePlatform();
209         } catch (ClassCastException JavaDoc wrongType) {
210             throw ValidationException.notSupportedForDatasource();
211         }
212     }
213
214     /**
215      * PUBLIC:
216      * Return the datasource platform specific information.
217      * This allows TopLink to configure certain advanced features for the datasource desired.
218      */

219     public Platform getDatasourcePlatform() {
220         return platform;
221     }
222
223     /**
224      * INTERNAL:
225      * The properties are additional, driver-specific, connection information
226      * to be passed to the driver.<p>
227      * NOTE: Do not set the password directly by getting the properties and
228      * setting the "password" property directly. Use the method DatabaseLogin.setPassword(String).
229      */

230     public Properties getProperties() {
231         return properties;
232     }
233
234     /**
235      * PUBLIC:
236      * The properties are additional, driver-specific, connection information
237      * to be passed to the driver.<p>
238      * NOTE: Do not set the password directly by getting the properties and
239      * setting the "password" property directly. Use the method DatabaseLogin.setPassword(String).
240      */

241     public Object JavaDoc getProperty(String JavaDoc name) {
242         return getProperties().get(name);
243     }
244
245     /**
246      * PUBLIC:
247      * Return the qualifier for the all of the tables referenced by TopLink.
248      * This can be the creator of the table or database name the table exists on.
249      * This is required by some databases such as Oracle and DB2.
250      * This should only be used if all of the tables have the same qualifier.
251      * It can also be set on each descriptor when the table name is specified.
252      */

253     public String JavaDoc getTableQualifier() {
254         return getDatasourcePlatform().getTableQualifier();
255     }
256
257     /**
258      * PUBLIC:
259      * The user name is the database login name.
260      * Some databases do not require a user name or the user is obtained from the OS,
261      * in this case the user name not be specified.
262      */

263     public String JavaDoc getUserName() {
264         return properties.getProperty("user");
265     }
266
267     /**
268      * PUBLIC:
269      * Return the TopLink version.
270      * @return version of TopLink
271      */

272     public static String JavaDoc getVersion() {
273         if (versionString == null) {
274             Object JavaDoc[] args = { Version.getProduct(), Version.getVersion(), Version.getBuildNumber() };
275             versionString = MessageFormat.format(versionStringTemplate, args);
276         }
277         return versionString;
278     }
279
280     /**
281      * SECURE:
282      * The password in the login properties is encrypted. Return a clone
283      * of the properties with the password decrypted.
284      */

285     private Properties prepareProperties(Properties properties) {
286         Properties result = (Properties)properties.clone();
287         String JavaDoc password = result.getProperty("password");
288         if (password != null) {
289             // Fix for bug # 2700529
290
// The securable object is initialized on first call of
291
// getSecurableObject. When setting an encrypted password
292
// we don't make this call since it is already encrypted, hence,
293
// we do not initialize the securable object on the holder.
294
//
295
// If neither setPassword or setEncryptedPassword is called
296
// (example, user sets properties via the setProperties method),
297
// when the user tries to connect they will get a null pointer
298
// exception. So if the holder does not hold
299
// a securable object or the setEncryptedPassword flag is not true,
300
// don't bother trying to decrypt.
301
if (getSecurableObjectHolder().hasSecurableObject() || isEncryptedPasswordSet) {
302                 result.put("password", getSecurableObjectHolder().getSecurableObject().decryptPassword(password));
303             }
304         }
305
306         return result;
307     }
308
309     /**
310      * PUBLIC:
311      * Some drivers don't like the "user" and "password" properties.
312      * They can be removed with this method.
313      */

314     public void removeProperty(String JavaDoc propertyName) {
315         properties.remove(propertyName);
316     }
317
318     /**
319      * ADVANCED:
320      * By default concurrency is optimized and the cache is not locked more than required during reads or writes,
321      * This allows for virtual concurrent reading and writing and should never cause any problems. If the application
322      * uses no form of locking the last unit of work to merge changes will win, with no locking it is possible
323      * only under this senerio for two unit of works to merge changes different than the database although highly unlikely
324      * and if occured is the entire purpose of locking and locking is the suggested solution if this is a problem.
325      * This property allows for the isolation level of changes to the
326      * cache to be configured for sever situations and it is not suggest that this be changed.
327      * <p>Setting are:<ul>
328      * <li>ConcurrentReadWrite - default
329      * <li>SynchronizedWrite - only allow a single writer (i.e. unit of work merge) to the cache at once
330      * <li>SynchronizedReadOnWrite - do not allow reading or other unit of work merge ehile a unit of work is in merge
331      */

332     public void setCacheTransactionIsolation(int cacheTransactionIsolation) {
333         this.cacheTransactionIsolation = cacheTransactionIsolation;
334     }
335
336     /**
337      * PUBLIC:
338      * Set the connector that will instantiate the connection.
339      * As an example, to use a JNDI-supplied <code>DataSource</code>, use code
340      * something like the following:
341      * <blockquote><code>
342      * session.getLogin().setConnector(new JNDIConnector(context, dataSourceName));<br>
343      * session.login();
344      * </code></blockquote>
345      * where the <code>context</code> is an instance of a <code>javax.naming.Context</code> and
346      * the <code>dataSourceName</code> refers to the name of the <code>DataSource</code>
347      * within the context.
348      */

349     public void setConnector(Connector connector) {
350         this.connector = connector;
351     }
352
353     /**
354      * PUBLIC:
355      * The default value to substitute for database NULLs can be configured
356      * on a per-class basis.
357      * Example: login.setDefaultNullValue(long.class, new Long(0))
358      */

359     public void setDefaultNullValue(Class JavaDoc type, Object JavaDoc value) {
360         getDatasourcePlatform().getConversionManager().setDefaultNullValue(type, value);
361     }
362
363     /**
364      * Set the password.
365      */

366     public void setPassword(String JavaDoc password) {
367         if (password != null) {
368             // first call to get will initialize the securable object
369
setProperty("password", getSecurableObjectHolder().getSecurableObject().encryptPassword(password));
370         } else {
371             // is null so remove the property
372
removeProperty("password");
373         }
374     }
375
376     /**
377      * Return the password. It will be encrypted.
378      */

379     public String JavaDoc getPassword() {
380         return properties.getProperty("password");
381     }
382
383     /**
384      * Set the encrypted password.
385      */

386     public void setEncryptedPassword(String JavaDoc password) {
387         // remember that we set an encrypted password
388
// flag will be needed in prepareProperties.
389
isEncryptedPasswordSet = true;
390
391         if (password != null) {
392             setProperty("password", password);
393         } else {// is null so remove the property
394
removeProperty("password");
395         }
396     }
397
398     /**
399      * Sets the encryption class name
400      */

401     public void setEncryptionClassName(String JavaDoc encryptionClassName) {
402         getSecurableObjectHolder().setEncryptionClassName(encryptionClassName);
403     }
404
405     /**
406      * INTERNAL:
407      * Set the database platform specific information.
408      * This allows TopLink to configure certain advanced features for the database desired.
409      */

410     public void setPlatform(Platform platform) {
411         setDatasourcePlatform(platform);
412     }
413
414     /**
415      * PUBLIC:
416      * Set the database platform specific information.
417      * This allows TopLink to configure certain advanced features for the database desired.
418      */

419     public void setDatasourcePlatform(Platform platform) {
420         this.platform = platform;
421     }
422
423     /**
424      * INTERNAL:
425      * Return the name of the database platform class.
426      */

427     public String JavaDoc getPlatformClassName() {
428         return getDatasourcePlatform().getClass().getName();
429     }
430
431     /**
432      * INTERNAL:
433      * Set the name of the Platform to be used.
434      * Creates a new instance of the specified Class.
435      */

436     public void setPlatformClassName(String JavaDoc platformClassName) throws ValidationException {
437         Class JavaDoc platformClass = null;
438         try {
439             //First try loading with the Login's class loader
440
platformClass = this.getClass().getClassLoader().loadClass(platformClassName);
441             Platform platform = null;
442             if (PrivilegedAccessHelper.shouldUsePrivilegedAccess()){
443                 try {
444                     platform = (Platform)AccessController.doPrivileged(new PrivilegedNewInstanceFromClass(platformClass));
445                 } catch (PrivilegedActionException JavaDoc exception) {
446                     throw exception.getException();
447                 }
448             } else {
449                 platform = (Platform)PrivilegedAccessHelper.newInstanceFromClass(platformClass);
450             }
451             usePlatform(platform);
452         } catch(Exception JavaDoc cne) {
453             //next try using ConversionManager
454
try {
455                 platformClass = ConversionManager.loadClass(platformClassName);
456                 Platform platform = null;
457                 if (PrivilegedAccessHelper.shouldUsePrivilegedAccess()){
458                     try {
459                         platform = (Platform)AccessController.doPrivileged(new PrivilegedNewInstanceFromClass(platformClass));
460                     } catch (PrivilegedActionException JavaDoc exception) {
461                         throw ValidationException.platformClassNotFound(exception.getException(), platformClassName);
462                     }
463                 } else {
464                     platform = (Platform)PrivilegedAccessHelper.newInstanceFromClass(platformClass);
465                 }
466                 usePlatform(platform);
467             } catch(Exception JavaDoc cne2) {
468                 //if still not found, throw exception
469
throw ValidationException.platformClassNotFound(cne2, platformClassName);
470             }
471         }
472     }
473
474     /**
475      * ADVANCED:
476      * Set the database platform to be custom platform.
477      */

478     public void usePlatform(Platform platform) {
479         if (getDatasourcePlatform() != null) {
480             getDatasourcePlatform().copyInto(platform);
481         }
482         setPlatform(platform);
483     }
484
485     /**
486      * PUBLIC:
487      * The properties are additional, driver-specific, connection information
488      * to be passed to the JDBC driver.
489      */

490     public void setProperties(Properties properties) {
491         this.properties = properties;
492     }
493
494     /**
495      * PUBLIC:
496      * Some JDBC drivers require additional, driver-specific, properties.
497      * Add the specified property to those to be passed to the JDBC driver.
498      */

499     public void setProperty(String JavaDoc propertyName, Object JavaDoc propertyValue) {
500         properties.put(propertyName, propertyValue);
501     }
502
503     /**
504      * PUBLIC:
505      * Set the default qualifier for all tables.
506      * This can be the creator of the table or database name the table exists on.
507      * This is required by some databases such as Oracle and DB2.
508      */

509     public void setTableQualifier(String JavaDoc qualifier) {
510         getDatasourcePlatform().setTableQualifier(qualifier);
511     }
512
513     /**
514      * PUBLIC:
515      * Override the default query for returning a timestamp from the server.
516      */

517     public void setTimestampQuery(ValueReadQuery timestampQuery) {
518         getDatasourcePlatform().setTimestampQuery(timestampQuery);
519     }
520
521     /**
522      * PUBLIC:
523      * The user name is the database login name.
524      * Some databases do not require a user name or the user is obtained from the OS,
525      * in this case this should not be specified.
526      */

527     public void setUserName(String JavaDoc name) {
528         if (name != null) {
529             setProperty("user", name);
530         }
531     }
532
533     /**
534      * PUBLIC:
535      * Return whether TopLink uses some external connection pooling service such as a JDBC 2.0 driver.
536      */

537     public void setUsesExternalConnectionPooling(boolean usesExternalConnectionPooling) {
538         this.usesExternalConnectionPooling = usesExternalConnectionPooling;
539     }
540
541     /**
542      * PUBLIC:
543      * Return whether TopLink uses some external transaction service such as JTS.
544      */

545     public void setUsesExternalTransactionController(boolean usesExternalTransactionController) {
546         this.usesExternalTransactionController = usesExternalTransactionController;
547     }
548
549     /**
550      * PUBLIC:
551      * Do not use external connection pooling. This is appropriate if using regular
552      * TopLink connection pooling and regular JDBC drivers.
553      *
554      * @see #useExternalConnectionPooling()
555      */

556     public void dontUseExternalConnectionPooling() {
557         setUsesExternalConnectionPooling(false);
558     }
559
560     /**
561      * PUBLIC:
562      * Let TopLink control transactions instead of some external transaction
563      * service such as JTS.
564      *
565      * @see #useExternalTransactionController()
566      */

567     public void dontUseExternalTransactionController() {
568         setUsesExternalTransactionController(false);
569     }
570
571     /**
572      * INTERNAL:
573      * Used for cache isolation.
574      */

575     public boolean shouldAllowConcurrentReadWrite() {
576         return getCacheTransactionIsolation() == CONCURRENT_READ_WRITE;
577     }
578
579     /**
580      * INTERNAL:
581      * Used for cache isolation.
582      */

583     public boolean shouldSynchronizedReadOnWrite() {
584         return getCacheTransactionIsolation() == SYNCHRONIZED_READ_ON_WRITE;
585     }
586
587     /**
588      * INTERNAL:
589      * Used for Cache Isolation. Causes TopLink to lock at the class level on
590      * cache updates.
591      */

592     public boolean shouldSynchronizeWrites() {
593         return getCacheTransactionIsolation() == SYNCHRONIZED_WRITE;
594     }
595     
596     /**
597      * INTERNAL:
598      * Used for Cache Isolation. Causes TopLink to lock at the object level on
599      * cache updates and cache access.
600      */

601     public boolean shouldSynchronizeObjectLevelReadWrite(){
602         return getCacheTransactionIsolation() == SYNCRONIZED_OBJECT_LEVEL_READ_WRITE;
603     }
604     
605     /**
606      * INTERNAL:
607      * Used for Cache Isolation. Causes TopLink to lock at the object level on
608      * cache updates and cache access, based on database transaction.
609      */

610     public boolean shouldSynchronizeObjectLevelReadWriteDatabase(){
611         return getCacheTransactionIsolation() == SYNCRONIZED_OBJECT_LEVEL_READ_WRITE_DATABASE;
612     }
613     
614     /**
615      * PUBLIC:
616      * Return whether TopLink uses some external connection pooling
617      * (e.g. WebLogic's JTS driver).
618      *
619      * @see #useExternalConnectionPooling()
620      * @see #dontUseExternalConnectionPooling()
621      */

622     public boolean shouldUseExternalConnectionPooling() {
623         return usesExternalConnectionPooling;
624     }
625
626     /**
627      * PUBLIC:
628      * Return whether TopLink uses some external transaction service such as JTS.
629      *
630      * @see #useExternalTransactionController()
631      * @see #dontUseExternalTransactionController()
632      */

633     public boolean shouldUseExternalTransactionController() {
634         return usesExternalTransactionController;
635     }
636
637     /**
638      * PUBLIC:
639      * Use external connection pooling.
640      *
641      * @see #dontUseExternalConnectionPooling()
642      * @see #shouldUseExternalConnectionPooling()
643      */

644     public void useExternalConnectionPooling() {
645         setUsesExternalConnectionPooling(true);
646     }
647
648     /**
649      * PUBLIC:
650      * Use an external transaction controller such as a JTS service
651      *
652      * @see #dontUseExternalTransactionController()
653      * @see #shouldUseExternalTransactionController()
654      */

655     public void useExternalTransactionController() {
656         setUsesExternalTransactionController(true);
657     }
658
659     /**
660      * PUBLIC:
661      * Print all of the connection information.
662      */

663     public String JavaDoc toString() {
664         StringWriter stringWriter = new StringWriter();
665         PrintWriter writer = new PrintWriter(stringWriter);
666         writer.write(Helper.getShortClassName(getClass()));
667         writer.println("(");
668         writer.println("\t" + ToStringLocalization.buildMessage("platform", (Object JavaDoc[])null) + "=> " + getDatasourcePlatform());
669         if (!shouldUseExternalConnectionPooling()) {
670             writer.println("\t" + ToStringLocalization.buildMessage("user_name", (Object JavaDoc[])null) + "=> \"" + getUserName() + "\"");
671         }
672         writer.print("\t");
673         getConnector().toString(writer);
674         writer.write(")");
675         return stringWriter.toString();
676     }
677
678     /**
679      * Get default sequence
680      */

681     public Sequence getDefaultSequence() {
682         return getDatasourcePlatform().getDefaultSequence();
683     }
684
685     /**
686      * Set default sequence
687      */

688     public void setDefaultSequence(Sequence sequence) {
689         getDatasourcePlatform().setDefaultSequence(sequence);
690     }
691
692     /**
693      * Add sequence corresponding to the name
694      */

695     public void addSequence(Sequence sequence) {
696         getDatasourcePlatform().addSequence(sequence);
697     }
698
699     /**
700      * Get sequence corresponding to the name
701      */

702     public Sequence getSequence(String JavaDoc seqName) {
703         return getDatasourcePlatform().getSequence(seqName);
704     }
705         
706     /**
707      * Returns a map of sequence names to Sequences (may be null).
708      */

709     public Map getSequences() {
710         return getDatasourcePlatform().getSequences();
711     }
712
713     /**
714      * Remove sequence corresponding to name.
715      * Doesn't remove default sequence.
716      */

717     public Sequence removeSequence(String JavaDoc seqName) {
718         return getDatasourcePlatform().removeSequence(seqName);
719     }
720
721     /**
722      * Remove all sequences but the default one.
723      */

724     public void removeAllSequences() {
725         getDatasourcePlatform().removeAllSequences();
726     }
727
728     /**
729      * INTERNAL:
730      * Used only for writing the login into XML or Java.
731      */

732     public Sequence getDefaultSequenceToWrite() {
733         return getDatasourcePlatform().getDefaultSequenceToWrite();
734     }
735
736     /**
737      * INTERNAL:
738      * Used only for writing the login into XML or Java.
739      */

740     public Map getSequencesToWrite() {
741         return getDatasourcePlatform().getSequencesToWrite();
742     }
743
744     /**
745      * INTERNAL:
746      * Used only for reading the login from XML.
747      */

748     public void setSequences(Map sequences) {
749         getDatasourcePlatform().setSequences(sequences);
750     }
751 }
752
Popular Tags